Skip to content

Commit 058722e

Browse files
jtornosmdavem330
authored andcommitted
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 after 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 avoid 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. cc: [email protected] Fixes: e2ca90c ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver") Signed-off-by: Jose Ignacio Tornos Martinez <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 02ea312 commit 058722e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/usb/ax88179_178a.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ static void ax88179_status(struct usbnet *dev, struct urb *urb)
326326

327327
if (netif_carrier_ok(dev->net) != link) {
328328
usbnet_link_change(dev, link, 1);
329-
netdev_info(dev->net, "ax88179 - Link status is: %d\n", link);
329+
if (!link)
330+
netdev_info(dev->net, "ax88179 - Link status is: 0\n");
330331
}
331332
}
332333

@@ -1542,6 +1543,7 @@ static int ax88179_link_reset(struct usbnet *dev)
15421543
GMII_PHY_PHYSR, 2, &tmp16);
15431544

15441545
if (!(tmp16 & GMII_PHY_PHYSR_LINK)) {
1546+
netdev_info(dev->net, "ax88179 - Link status is: 0\n");
15451547
return 0;
15461548
} else if (GMII_PHY_PHYSR_GIGA == (tmp16 & GMII_PHY_PHYSR_SMASK)) {
15471549
mode |= AX_MEDIUM_GIGAMODE | AX_MEDIUM_EN_125MHZ;
@@ -1579,6 +1581,8 @@ static int ax88179_link_reset(struct usbnet *dev)
15791581

15801582
netif_carrier_on(dev->net);
15811583

1584+
netdev_info(dev->net, "ax88179 - Link status is: 1\n");
1585+
15821586
return 0;
15831587
}
15841588

0 commit comments

Comments
 (0)