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

@@ -95,8 +95,12 @@ void netdev_tx_complete ( struct net_device *netdev, struct io_buffer *iobuf ) {
assert ( iobuf->list.next != NULL );
assert ( iobuf->list.prev != NULL );
/* Dequeue and free I/O buffer */
list_del ( &iobuf->list );
free_iob ( iobuf );
/* Update statistics counter */
netdev->stats.tx_count++;
}
/**
@@ -140,7 +144,12 @@ static void netdev_tx_flush ( struct net_device *netdev ) {
void netdev_rx ( struct net_device *netdev, struct io_buffer *iobuf ) {
DBGC ( netdev, "NETDEV %p received %p (%p+%zx)\n",
netdev, iobuf, iobuf->data, iob_len ( iobuf ) );
/* Enqueue packet */
list_add_tail ( &iobuf->list, &netdev->rx_queue );
/* Update statistics counter */
netdev->stats.rx_count++;
}
/**