Add trivial net device statistics (TX and RX packet count), reported

via UNDI API and also by ifstat command; may be useful for debugging.
This commit is contained in:
Michael Brown
2007-07-03 00:15:53 +01:00
parent 071356d976
commit 4968caab82
4 changed files with 38 additions and 10 deletions

View File

@@ -61,7 +61,8 @@ void ifclose ( struct net_device *netdev ) {
* @v netdev Network device
*/
void ifstat ( struct net_device *netdev ) {
printf ( "%s: %s on %s (%s)\n",
printf ( "%s: %s on %s (%s) TX:%d RX:%d\n",
netdev->name, netdev_hwaddr ( netdev ), netdev->dev->name,
( ( netdev->state & NETDEV_OPEN ) ? "open" : "closed" ) );
( ( netdev->state & NETDEV_OPEN ) ? "open" : "closed" ),
netdev->stats.tx_count, netdev->stats.rx_count );
}