Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Apr 2011 15:10:14 +0100
From:      Ben Hutchings <bhutchings@solarflare.com>
To:        Marius Strobl <marius@alchemy.franken.de>
Cc:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>, net@freebsd.org, arch@freebsd.org
Subject:   Re: RFC further mii(4) changes
Message-ID:  <1303481415.4129.22.camel@localhost>
In-Reply-To: <20110422120909.GO38455@alchemy.franken.de>
References:  <20110421203304.GA91381@alchemy.franken.de> <B5ACC779-52E3-49E4-9138-97D739654247@lists.zabbadoz.net> <20110422120909.GO38455@alchemy.franken.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




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