diff options
Diffstat (limited to 'src/usr/ifmgmt.c')
-rw-r--r-- | src/usr/ifmgmt.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/usr/ifmgmt.c b/src/usr/ifmgmt.c index 9c88ab53..72d86137 100644 --- a/src/usr/ifmgmt.c +++ b/src/usr/ifmgmt.c @@ -59,6 +59,25 @@ void ifclose ( struct net_device *netdev ) { } /** + * Print network device error breakdown + * + * @v stats Network device statistics + * @v prefix Message prefix + */ +static void ifstat_errors ( struct net_device_stats *stats, + const char *prefix ) { + unsigned int i; + + for ( i = 0 ; i < ( sizeof ( stats->errors ) / + sizeof ( stats->errors[0] ) ) ; i++ ) { + if ( stats->errors[i].count ) + printf ( " [%s: %d x \"%s\"]\n", prefix, + stats->errors[i].count, + strerror ( stats->errors[i].rc ) ); + } +} + +/** * Print status of network device * * @v netdev Network device @@ -69,8 +88,10 @@ void ifstat ( struct net_device *netdev ) { netdev->name, netdev_hwaddr ( netdev ), netdev->dev->name, ( ( netdev->state & NETDEV_OPEN ) ? "open" : "closed" ), ( netdev_link_ok ( netdev ) ? "up" : "down" ), - netdev->stats.tx_ok, netdev->stats.tx_err, - netdev->stats.rx_ok, netdev->stats.rx_err ); + netdev->tx_stats.good, netdev->tx_stats.bad, + netdev->rx_stats.good, netdev->rx_stats.bad ); + ifstat_errors ( &netdev->tx_stats, "TXE" ); + ifstat_errors ( &netdev->rx_stats, "RXE" ); } /** |