summaryrefslogtreecommitdiffstats
path: root/src/usr/ifmgmt.c
diff options
context:
space:
mode:
authorMichael Brown2009-06-24 13:52:38 +0200
committerMichael Brown2009-06-24 14:04:36 +0200
commita310d00d37f8362b48913972927bfb78e7d7586d (patch)
tree8cd343a5de2c6ab1c3f4b825daba09f5a631d101 /src/usr/ifmgmt.c
parent[comboot] Implement INT 22h AX=000Bh (Get Serial Console Configuration) (diff)
downloadipxe-a310d00d37f8362b48913972927bfb78e7d7586d.tar.gz
ipxe-a310d00d37f8362b48913972927bfb78e7d7586d.tar.xz
ipxe-a310d00d37f8362b48913972927bfb78e7d7586d.zip
[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>
Diffstat (limited to 'src/usr/ifmgmt.c')
-rw-r--r--src/usr/ifmgmt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/usr/ifmgmt.c b/src/usr/ifmgmt.c
index 9c82503a..2c4b3d24 100644
--- a/src/usr/ifmgmt.c
+++ b/src/usr/ifmgmt.c
@@ -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" );
}