Skip to contentSkip to conversation

net: usb: ax88179_178a: improve link status logs

PATCH Superseded Jose Ignacio Tornos Martinez 2 participants 4 messages Jun 17, 2024 – Jun 18, 2024

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: usb: ax88179_178a: improve link status logs

Avoid spurious link status logs that may ultimately be wrong; for example, if the link is set to down with the cable plugged, then the cable is unplugged and afer this the link is set to up, the last new log that is appearing is incorrectly telling that the link is up.

In order to aovid errors, show link status logs after link_reset processing, and in order to avoid spurious as much as possible, only show the link loss when some link status change is detected.

Fixes e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
---
 drivers/net/usb/ax88179_178a.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/usb/ax88179_178a.c +5 -1
index c2fb736f78b2..60357796be99 100644
@@ -326,7 +326,8 @@ static void ax88179_status(struct usbnet *dev, struct urb *urb)
 
 	if (netif_carrier_ok(dev->net) != link) {
 		usbnet_link_change(dev, link, 1);
-		netdev_info(dev->net, "ax88179 - Link status is: %d\n", link);
+		if (!link)
+			netdev_info(dev->net, "ax88179 - Link status is: %d\n", link);
 	}
 }
 
@@ -1542,6 +1543,7 @@ static int ax88179_link_reset(struct usbnet *dev)
 			 GMII_PHY_PHYSR, 2, &tmp16);
 
 	if (!(tmp16 & GMII_PHY_PHYSR_LINK)) {
+		netdev_info(dev->net, "ax88179 - Link status is: 0\n");
 		return 0;
 	} else if (GMII_PHY_PHYSR_GIGA == (tmp16 & GMII_PHY_PHYSR_SMASK)) {
 		mode |= AX_MEDIUM_GIGAMODE | AX_MEDIUM_EN_125MHZ;
@@ -1579,6 +1581,8 @@ static int ax88179_link_reset(struct usbnet *dev)
 
 	netif_carrier_on(dev->net);
 
+	netdev_info(dev->net, "ax88179 - Link status is: 1\n");
+
 	return 0;
 }
 
Signature · 1 line
2.45.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Jose Ignacio Tornos Martinez

Avoid spurious link status logs that may ultimately be wrong; for example, if the link is set to down with the cable plugged, then the cable is unplugged and afer this the link is set to up, the last new log that is

nit: after

Quoted 3 lines

appearing is incorrectly telling that the link is up.

In order to aovid errors, show link status logs after link_reset

nit: avoid

Nits Flagged by checkpatch.pl --codespell

Quoted 6 lines

processing, and in order to avoid spurious as much as possible, only show the link loss when some link status change is detected.

Fixes e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")

The nits above notwithstanding, this looks good to me.

...

reviewer
#2 lore raw
In reply to Jose Ignacio Tornos Martinez
Quoted 21 lines · Jose Ignacio Tornos Martinez

Avoid spurious link status logs that may ultimately be wrong; for example, if the link is set to down with the cable plugged, then the cable is unplugged and afer this the link is set to up, the last new log that is appearing is incorrectly telling that the link is up.

In order to aovid errors, show link status logs after link_reset processing, and in order to avoid spurious as much as possible, only show the link loss when some link status change is detected.

Fixes e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
---
 drivers/net/usb/ax88179_178a.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/usb/ax88179_178a.c +0 -0
index c2fb736f78b2..60357796be99 100644

drivers/net/usb/ax88179_178a.c static void ax88179_status(struct usbnet *dev, struct urb *urb) · line 330

Quoted 6 lines
drivers/net/usb/ax88179_178a.c +2 -1
@@ -326,7 +326,8 @@ static void ax88179_status(struct usbnet *dev, struct urb *urb)
 
 	if (netif_carrier_ok(dev->net) != link) {
 		usbnet_link_change(dev, link, 1);
-		netdev_info(dev->net, "ax88179 - Link status is: %d\n", link);
+		if (!link)
+			netdev_info(dev->net, "ax88179 - Link status is: %d\n", link);

Sorry Jose,

one more nit I noticed after sending my previous email.

The line above looks like it could be wrapped to <= 80 columns wide, which is still preferred for Networking code.

Flagged by checkpatch.pl --max-line-length=80

Quoted 3 lines
drivers/net/usb/ax88179_178a.c +0 -0
 	}
 }
 

...