net: usb: ax88179_178a: improve link status logs
Subsystems (5)
PATCH v2 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 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.
---
v2:
- Fix the nits
v1: https://lore.kernel.org/netdev/[email protected]/
drivers/net/usb/ax88179_178a.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/usb/ax88179_178a.c +6 -1
@@ -326,7 +326,9 @@ 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 +1544,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 +1582,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
Quoted 9 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 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_resetprocessing, and in order to avoid spurious as much as possible, only show the link loss when some link status change is detected.
Quoted 7 lines
Fixes e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")Signed-off-by Jose Ignacio Tornos Martinez <[email protected]>---
v2:
- Fix the nits
v1: https://lore.kernel.org/netdev/[email protected]/
Hi Jose,
Thanks for the updates.
This version looks good to me.
...
Paolo Abeni
maintainerQuoted 5 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 after this the link is set to up, the last new log that is appearing is incorrectly telling that the link is up.
Quoted 7 lines
In order to avoid errors, show link status logs after
link_resetprocessing, 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")Signed-off-by Jose Ignacio Tornos Martinez <[email protected]>
Please always include the target tree in the subj prefix - in this case it should have been 'net'.
Quoted 13 lines
---
v2:
- Fix the nits
v1: https://lore.kernel.org/netdev/[email protected]/drivers/net/usb/ax88179_178a.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/net/usb/ax88179_178a.c +0
-0
drivers/net/usb/ax88179_178a.c static void ax88179_status(struct usbnet *dev, struct urb *urb) · line 331
Quoted 7 lines
drivers/net/usb/ax88179_178a.c +3
-1@@ -326,7 +326,9 @@ 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);
Here ^^^^ link value is always 0, so you
should using a constant string.
Thanks,
Paolo
Hello Paolo,
Quoted 2 lines
Please always include the target tree in the subj prefix - in this case it should have been 'net'.
Ok, I forgot it.
Quoted 2 lines
Here ^^^^ link value is always 0, so you
should using a constant string.
Ok, better in that way.
I will send a next version of the patch.
Thanks
Best regards
José Ignacio