[netdevice] Add mechanism for reporting detailed link status codes

Expand the NETDEV_LINK_UP bit into a link_rc status code field,
allowing specific reasons for link failure to be reported via
"ifstat".

Originally-authored-by: Joshua Oreman <oremanj@rwcr.net>
This commit is contained in:
Michael Brown
2009-06-24 12:52:38 +01:00
parent cb9700ef6f
commit a310d00d37
4 changed files with 48 additions and 8 deletions

View File

@@ -94,6 +94,10 @@ void ifstat ( struct net_device *netdev ) {
( netdev_link_ok ( netdev ) ? "up" : "down" ),
netdev->tx_stats.good, netdev->tx_stats.bad,
netdev->rx_stats.good, netdev->rx_stats.bad );
if ( ! netdev_link_ok ( netdev ) ) {
printf ( " [Link status: %s]\n",
strerror ( netdev->link_rc ) );
}
ifstat_errors ( &netdev->tx_stats, "TXE" );
ifstat_errors ( &netdev->rx_stats, "RXE" );
}