Subject: Re: [PATCHv2 1/3] usbnet: specify naming of usbnet_set/get_link_ksettings

From: Andrew Lunn <[email-masked]>
Date: Tue, 26 Jan 2021 14:34:45 +0100

On Tue, Jan 26, 2021 at 10:42:09AM +0100, Oliver Neukum wrote:
> Am Freitag, den 22.01.2021, 02:10 +0100 schrieb Andrew Lunn:
> > On Thu, Jan 21, 2021 at 01:57:29PM +0100, Oliver Neukum wrote:
> > > The old generic functions assume that the devices includes
> > > an MDIO interface. This is true only for genuine ethernet.
> > > Devices with a higher level of abstraction or based on different
> > > technologies do not have it. So in preparation for
> > > supporting that, we rename the old functions to something specific.
> > > 
> > > v2: adjusted to recent changes
> > 
> > Hi Oliver
> > 
> > It  looks like my comment:
> > 
> > https://www.spinics.net/lists/netdev/msg711869.html
> > 
> > was ignored. Do you not like the name mii?
> 
> Hi,
> 
> sorry for not replying earlier.
> 
> It was my understanding that on the hardware level of the
> networking devices we are using MII, but to control MII we
> use MDIO, don't we?
> So it seems to me that hardware could use MII but not
> MDIO, yet for this purpose we require MDIO. So could
> you please explain your reasoning about networking stuff?

Hi Oliver

To some extent, it is a terminology problem. First off, MII includes
the two MDIO pins. MDIO is a subset of MII.

However, the bigger issue is Linux has two different bits of code
which can be used to talk to the PHY. There is the old mii code,
driver/net/mii.c. This code assumes the PHY exactly follows 802.3
clause 22.

Then we have drivers/net/mdio, drivers/net/phy, phylib, and a
collection of PHYs drivers. The MDIO drivers implement the MDIO bus,
allowing transfers over the bus. And the PHY drivers then handle the
devices on this bus. These PHY drivers can handle nearly any quirk the
PHY might have which deviate from C22. It also allows drivers to use
C45, the alternative register set PHYs can use. And it allows for
added extras, like temperature sensors, cable diagnostics and
statistics, none of which is standardised.

The code you are changing makes use of the older mii code.  There are
however some USB devices which use phylib. By using the postfix _mii
for these ops, it makes it clear it is using the older mii code. In
the future, there might be _phylib versions of these ops. It is very
unlikely any USB device driver will directly use an MDIO bus drivers,
so _mdio does not really make sense, from the perspective of Linux
code.

    Andrew