Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2011 17:42:29 +0200
From:      Marius Strobl <marius@alchemy.franken.de>
To:        Naresh <gbal.naresh@gmail.com>
Cc:        freebsd-drivers@freebsd.org, yongari@freebsd.org
Subject:   Re: MAC and PHY loopback tests entrypoint for NIC controller
Message-ID:  <20110817174229.34215905@rfhrz076.fh-regensburg.de>
In-Reply-To: <1A69CCCE-AF58-465E-87F5-BE3AF0BBAB19@gmail.com>
References:  <1A69CCCE-AF58-465E-87F5-BE3AF0BBAB19@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 6 Aug 2011 23:39:38 +0530
Naresh <gbal.naresh@gmail.com> wrote:

> 
> Hi All,
> 
> I am writing a 10Gb Ethernet driver. We have a requirement to support
> Mac and PHY loopback test for the network controller. In Linux there
> is a ethtool entrypoint which calls this feature.
> 
> I wondering what will be the equivalent entry point in FreeBSD. I
> tried looking in to other drivers, but not lucky enough to find one.
> 
> It is much appreciated if some one could point me to MAC and PHY
> loopback test entry point in FreeBSD.
> 

I don't know what API Linux provides but I think the question is how to
activate loopback mode from userland. Somewhere in your driver you'll
add the supported media similar to the following:
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
If there you also add media variants with option IFM_LOOP f.e. like so:
ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_1000_T | IFM_LOOP, 0, NULL);
etc then from userland you can activate loopback mode via ifconfig(8)
like so:
ifconfig youdrv0 1000baseT mediaopt hw-loopback
and deactivate if via:
ifconfig youdrv0 1000baseT -mediaopt hw-loopback
Current versions of FreeBSD also take "loopback" or even just "loop" as
an alias for "hw-loopback".
The media change handler of your driver of course needs to check
whether the selected media has IFM_LOOP set and (de)activate loopback
mode in the hardware as appropriate.

Marius



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110817174229.34215905>