Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: stable@vger.kernel.org
Fixes: e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jose Ignacio Tornos Martinez and committed by
David S. Miller
058722ee 02ea3120

+5 -1
+5 -1
drivers/net/usb/ax88179_178a.c
··· 326 326 327 327 if (netif_carrier_ok(dev->net) != link) { 328 328 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"); 330 331 } 331 332 } 332 333 ··· 1543 1542 GMII_PHY_PHYSR, 2, &tmp16); 1544 1543 1545 1544 if (!(tmp16 & GMII_PHY_PHYSR_LINK)) { 1545 + netdev_info(dev->net, "ax88179 - Link status is: 0\n"); 1546 1546 return 0; 1547 1547 } else if (GMII_PHY_PHYSR_GIGA == (tmp16 & GMII_PHY_PHYSR_SMASK)) { 1548 1548 mode |= AX_MEDIUM_GIGAMODE | AX_MEDIUM_EN_125MHZ; ··· 1580 1578 ax179_data->eee_enabled = ax88179_chk_eee(dev); 1581 1579 1582 1580 netif_carrier_on(dev->net); 1581 + 1582 + netdev_info(dev->net, "ax88179 - Link status is: 1\n"); 1583 1583 1584 1584 return 0; 1585 1585 }