mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Birger Koblitz <mail@birger-koblitz.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 02/12] ax88179_178a: Add HW support for AX179A-based chips
Date: Fri, 24 Jul 2026 09:33:10 +0200	[thread overview]
Message-ID: <b09ee224-db0b-4f44-80fa-eb350e4baba2@birger-koblitz.de> (raw)
In-Reply-To: <713954ed-6d7f-4de2-9d2e-3d0af0f2db1c@lunn.ch>

On 7/16/26 17:42, Andrew Lunn wrote:
>> A comment on phylink and USB-Ethernet NICs, though. Grepping for phylink
>> in drivers/net/usb shows only 2 drivers that use phylink: asix_devices (the
>> antiquated one using the 772A-PHYs) and lan789xx, which is also rather old.
>> There are more than 30 drivers there, so that makes < 7% phylink usage vs 93% mii.
> 
> Most USB dongles are old. There might be new variant, but generally,
> that only means adding new VID:PID to a table and they work.
> 
> phylink becomes interesting is with speeds > 1G and enabling more
> features of the PHY, like EEE. Because mii is so old, it only supports
> speeds up to 1G. It also requires that PHY stick to the 802.3 C22
> registers, and don't really have an vendor registers. There is no
> concept of a PHY driver for mii, so there is nowhere to put per PHY
> code.
> 
> For a totally new USB-ethernet driver, i would strongly push back on
> mii and want to see phylink. For the existing drivers, there is little
> i can do, i don't have the hardware. Converting to phylink would
> however be a good project for a newbie, if they have the hardware, and
> what to really learn something, rather than all the AI driven
> theoretical bug fix patches we are getting at the moment.
> 
> You are in the space in between. It is not a fully new driver, but you
> are doing speeds > 1G. And you are looking at lots of features and
> need vendor registers, so per PHY code.
I will submit a new set of patches as v3, which will be based on using
phylink. I added the phy drivers to ax88796b.c, which already has the drivers
for the older chips such as the AX88772A, keeping the tradition that the
ASIX PHYs are called like the controllers they are included in (the ax88796b
like the 772A is actually an Ethernet controller according to the datasheet).

Using phylink makes the separation between MAC and PHY much cleaner, but
I have to say that it was not that easy to switch to phylink, as many things
no longer are done directly but rely on configuration magic that often fails,
for example when MMD devices are not correctly reported to be present by the PHY.
I have trouble to understand why an RTLN-lock needs to be held over many ms
to send the half a dozen configuration URBs to configure EEE, but maybe I am
just frustrated because I had to debug locking issues that froze my development
machine...

One thing I was not able to figure out is whether it is possible to make phylink
listen to callbacks when the link-change interrupt URBs arrive. The solution now
relies on phylink polling the controller for the link status, which prevents the
USB bus from going to sleep. This solution is also used by the other USB-Ethernet
drivers using phylink.

> 
> I have another idea to throw out there, and it might be a bad idea. I
> will let you think about it. Split the current driver into two. Make a
> library out of all the code handling packets. Leave the mii code in
> the actual driver. Then add a new driver, making use of the library
> for moving packets around, but using phylink for PHY management. You
> can add the new VID:PID to this new driver. This has the advantage of
> reducing the risk of regressing the old devices you don't have. Also,
> we can put out a request for test, see if anybody has the older
> hardware, and ask them to try testing with the VID:PID added to the
> new driver. We might be able to slowly migrate them to the phylink
> driver.
> 
I looked into that. ASIX changes the format of their RX and TX packets basically
with every major firmware release. The older 179 chips use 32 bit values in the
packet headers, the 179A use 64 bit, so those fixup routines cannot be re-used and
put into a library. What is being re-used is the framework of of how the
controllers are configured and react to events, so I would like to keep the code
together in the hope that the 179 hardware can also be convert like the rest of
to use phylink.

>> Looking into the Realtek PHY driver code, what is done there appears to duplicate
>> the code in r8152.
> 
> And other reason to use the Linux PHY driver, no code duplication. And
> there might be some freebies, like cable testing just works, it is
> possible to control the LEDs, etc.

Personally, I think it would be great to push these drivers to use phylink and also
use usbnet. But for that one needs to figure out how to make phylink also react
to USB-linkchange URBs and usbnet also needs support for multiple RX/TX queues.

Birger

  reply	other threads:[~2026-07-24  7:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 18:39 [PATCH net-next v2 00/12] ax88179_178a: Add support for AX88179A-based chips Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 01/12] ax88179_178a: Fix endianness of pause watermark register Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 02/12] ax88179_178a: Add HW support for AX179A-based chips Birger Koblitz
2026-07-14 22:58   ` Andrew Lunn
2026-07-16 14:54     ` Birger Koblitz
2026-07-16 15:42       ` Andrew Lunn
2026-07-24  7:33         ` Birger Koblitz [this message]
2026-07-08 18:39 ` [PATCH net-next v2 03/12] ax88179_178a: Add MMD accessor function for AX88179A Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 04/12] ax88179_178a: Add EEE HW configuration support " Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 05/12] ax88179_178a: Add support for 2500 link speed of AX88279 Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 06/12] ax88179_178a: EEE setup for AX88179A-based chips Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 07/12] ax88179_178a: Obtain speed and duplex from Interrupt URB Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 08/12] ax88179_178a: Add support for ethtool pause parameter configuration Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 09/12] ax88179_178a: Add VLAN offload support for AX88179A Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 10/12] ax88179_178a: Add ethtool get_drvinfo Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 11/12] ax88179_178a: Add support for AX88179A/772D/279 EEPROM access Birger Koblitz
2026-07-08 18:39 ` [PATCH net-next v2 12/12] ax88179_178a: Add AX179A/AX279 multicast configuration Birger Koblitz
2026-07-23 14:34 ` [PATCH net-next v2 00/12] ax88179_178a: Add support for AX88179A-based chips Jianhui Xu
2026-07-24  7:39   ` Birger Koblitz
2026-07-28 13:09     ` Yuan Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b09ee224-db0b-4f44-80fa-eb350e4baba2@birger-koblitz.de \
    --to=mail@birger-koblitz.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®