diff options
| author | Michael Brown | 2008-11-08 03:18:30 +0100 |
|---|---|---|
| committer | Michael Brown | 2008-11-08 06:30:30 +0100 |
| commit | 9a52ba0cfac0fffb39b5a4c148ec7641bcc38381 (patch) | |
| tree | 12059ca7f75d37d1b62ffa550798fa8233834590 /src/include | |
| parent | [phantom] Do not halt PEGs on driver shutdown (diff) | |
| download | ipxe-9a52ba0cfac0fffb39b5a4c148ec7641bcc38381.tar.gz ipxe-9a52ba0cfac0fffb39b5a4c148ec7641bcc38381.tar.xz ipxe-9a52ba0cfac0fffb39b5a4c148ec7641bcc38381.zip | |
[netdevice] Retain and report detailed error breakdowns
netdev_rx_err() and netdev_tx_complete_err() get passed the error
code, but currently use it only in debug messages.
Retain error numbers and frequencey counts for up to
NETDEV_MAX_UNIQUE_ERRORS (4) different errors for each of TX and RX.
This allows the "ifstat" command to report the reasons for TX/RX
errors in most cases, even in non-debug builds.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/gpxe/netdevice.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h index c4f4a7be5..7be5b8134 100644 --- a/src/include/gpxe/netdevice.h +++ b/src/include/gpxe/netdevice.h @@ -193,16 +193,25 @@ struct net_device_operations { void ( * irq ) ( struct net_device *netdev, int enable ); }; +/** Network device error */ +struct net_device_error { + /** Error status code */ + int rc; + /** Error count */ + unsigned int count; +}; + +/** Maximum number of unique errors that we will keep track of */ +#define NETDEV_MAX_UNIQUE_ERRORS 4 + /** Network device statistics */ struct net_device_stats { - /** Count of successfully completed transmissions */ - unsigned int tx_ok; - /** Count of transmission errors */ - unsigned int tx_err; - /** Count of successfully received packets */ - unsigned int rx_ok; - /** Count of reception errors */ - unsigned int rx_err; + /** Count of successful completions */ + unsigned int good; + /** Count of error completions */ + unsigned int bad; + /** Error breakdowns */ + struct net_device_error errors[NETDEV_MAX_UNIQUE_ERRORS]; }; /** @@ -250,8 +259,10 @@ struct net_device { struct list_head tx_queue; /** RX packet queue */ struct list_head rx_queue; - /** Device statistics */ - struct net_device_stats stats; + /** TX statistics */ + struct net_device_stats tx_stats; + /** RX statistics */ + struct net_device_stats rx_stats; /** Configuration settings applicable to this device */ struct simple_settings settings; |
