diff options
author | Michael Brown | 2007-07-03 01:15:53 +0200 |
---|---|---|
committer | Michael Brown | 2007-07-03 01:15:53 +0200 |
commit | 4968caab8288664d4fd21417f312f3c5a05df155 (patch) | |
tree | 6c5ecf09777ba61dc056e9253df17ea309885a7d /src/net/netdevice.c | |
parent | Ensure that pxe_netdev is set before starting up PXE NBP. (diff) | |
download | ipxe-4968caab8288664d4fd21417f312f3c5a05df155.tar.gz ipxe-4968caab8288664d4fd21417f312f3c5a05df155.tar.xz ipxe-4968caab8288664d4fd21417f312f3c5a05df155.zip |
Add trivial net device statistics (TX and RX packet count), reported
via UNDI API and also by ifstat command; may be useful for debugging.
Diffstat (limited to 'src/net/netdevice.c')
-rw-r--r-- | src/net/netdevice.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c index 294f0786..8a099107 100644 --- a/src/net/netdevice.c +++ b/src/net/netdevice.c @@ -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++; } /** |