RFC further mii(4) changes

Ben Hutchings bhutchings at solarflare.com
Fri Apr 22 14:22:22 UTC 2011


On Fri, 2011-04-22 at 14:09 +0200, Marius Strobl wrote:
> On Fri, Apr 22, 2011 at 10:07:11AM +0000, Bjoern A. Zeeb wrote:
[...]
> > One thing I am still pondering is whether we would be able to reserve enough spares (wherever needed) to be able to eventually allow to query-through and gather a lot more information than we currently expose via ifconfig.  It would be really great to be able to ask for all the bits.  Not sure how linux for example handles that for mii-tool/ethtool or how those things work, but .. well you get it.
> > 
> 
> Providing functionality akin mii-tool/ethtool is also something I'd
> like to see. Unfortunately, I currently lack the time to work on that,
> maybe next year as a GSoC or some such, in case someone is willing to
> mentor this time :) However, I think when going a route similar to
> pci(4)/pciconf(8) (without repeating their mistakes) it should be
> possible to implement that without breaking the ABI.

mii-tool uses the MDIO ioctls, wherease ethtool uses the relatively
high-level ethtool API.  Note that mii-tool itself is unmaintained and
needs some unofficial patches to support even 1G PHYs.

The MDIO ioctls all use struct ifreq with an instance of struct
mii_ioctl_data in the ifr_ifru field.  See <linux/if.h> and
<linux/mii.h>.

SIOCGMIIPHY: Set the phy_id field to the address of the PHY that the net
device is using.  (It is not specified what to do if the device is not
using an MDIO-manageable PHY.)

SIOCGMIIREG: Read the register at the address specified by phy_id and
reg_num.  Set val_out to the register value.

SIOCSMIIREG: Write the register at the addres specified by phy_id and
reg_num, with the value from val_in.

For clause 45 MDIO (as used by 10G and some other PHYs), the phy_id for
SIOC{G,S}MIIREG (but not SIOCGMIIPHY) provides both PRT and DEV
addresses, as specified in <linux/mdio.h>.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.



More information about the freebsd-arch mailing list