Skip to contentSkip to conversation

USBNET: Fix ASIX USB Ethernet carrier problems.

PATCH In review Krzysztof Hałasa 2 participants 2 messages Nov 27, 2024 – Dec 3, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USBNET: Fix ASIX USB Ethernet carrier problems.

Hi,

ASIX AX88772B based USB 10/100 Ethernet adapter doesn't come up ("carrier off"), despite the built-in 100BASE-FX PHY positive link indication. The internal PHY is configured (using EEPROM) in fixed 100 Mbps full duplex mode.

The primary problem appears to be using carrier_netif_{on,off}() while, at the same time, delegating carrier management to phylink. Use only the latter and remove "manual control" in the asix driver.

drivers/net/usb/asix.h +0 -1
index 74162190bccc..8531b804021a 100644
@@ -224,7 +224,6 @@ int asix_write_rx_ctl(struct usbnet *dev, u16 mode, int in_pm);
 
 u16 asix_read_medium_status(struct usbnet *dev, int in_pm);
 int asix_write_medium_mode(struct usbnet *dev, u16 mode, int in_pm);
-void asix_adjust_link(struct net_device *netdev);
 
 int asix_write_gpio(struct usbnet *dev, u16 value, int sleep, int in_pm);
 
drivers/net/usb/asix_common.c +0 -22
index 72ffc89b477a..7fd763917ae2 100644
@@ -414,28 +414,6 @@ int asix_write_medium_mode(struct usbnet *dev, u16 mode, int in_pm)
 	return ret;
 }
 
-/* set MAC link settings according to information from phylib */
-void asix_adjust_link(struct net_device *netdev)
-{
-	struct phy_device *phydev = netdev->phydev;
-	struct usbnet *dev = netdev_priv(netdev);
-	u16 mode = 0;
-
-	if (phydev->link) {
-		mode = AX88772_MEDIUM_DEFAULT;
-
-		if (phydev->duplex == DUPLEX_HALF)
-			mode &= ~AX_MEDIUM_FD;
-
-		if (phydev->speed != SPEED_100)
-			mode &= ~AX_MEDIUM_PS;
-	}
-
-	asix_write_medium_mode(dev, mode, 0);
-	phy_print_status(phydev);
-	usbnet_link_change(dev, phydev->link, 0);
-}
-
 int asix_write_gpio(struct usbnet *dev, u16 value, int sleep, int in_pm)
 {
 	int ret;
drivers/net/usb/asix_devices.c +9 -40

138 lines not on this page · raw message

Signature · 5 lines
Krzysztof "Chris" Hałasa

Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa
maintainer
#1 lore raw
Quoted 2 lines · On Wed, 27 Nov 2024 09:45:30 +0100 Krzysztof Hałasa wrote:

To: netdev <[email protected]>
Cc: Oliver Neukum <[email protected]>, Andrew Lunn <[email protected]>, "David S. Miller" <[email protected]>, Eric Dumazet <[email protected]>, Jakub Kicinski <[email protected]>, Paolo Abeni <[email protected]>, [email protected], [email protected], Jose Ignacio Tornos Martinez <[email protected]>, Ming Lei <[email protected]>

Please add to the CC list some folks who worked on phylib and phylink support for this driver. They will be best reviewers.

Quoted 1 line

Subject: [PATCH] USBNET: Fix ASIX USB Ethernet carrier problems.

No need to spell out USBNET in all caps. I'd rename the subject to:
usbnet: asix: leave the carrier control to phylink

If we say it's a 'fix' we should really point at the commit which broke things with a Fixes: tag. If your device never worked it's better to act as if it was "support for a new device". Otherwise various semi- -automated backport bots will suck this change in, and given the general dependability of ASIX devices... seems risky..

Quoted 4 lines

Date: Wed, 27 Nov 2024 09:45:30 +0100
Sender: [email protected]

Hi,

No need to say "Hi" in the commit message :)

Signature · 1 line
pw-bot: cr