summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe
diff options
context:
space:
mode:
authorMichael Brown2007-07-05 18:18:27 +0200
committerMichael Brown2007-07-05 18:18:27 +0200
commit539ff45fd0e8a4d4a979c28d9e5be8526a0eccaf (patch)
treed334500a329bad55622321e0dc27ee70a9672614 /src/include/gpxe
parentUse partition type 0xeb ("EtherBoot"), to avoid any attempts to mount (diff)
downloadipxe-539ff45fd0e8a4d4a979c28d9e5be8526a0eccaf.tar.gz
ipxe-539ff45fd0e8a4d4a979c28d9e5be8526a0eccaf.tar.xz
ipxe-539ff45fd0e8a4d4a979c28d9e5be8526a0eccaf.zip
Allow recording of TX and RX errors to aid in end-user debugging.
Diffstat (limited to 'src/include/gpxe')
-rw-r--r--src/include/gpxe/netdevice.h43
1 files changed, 37 insertions, 6 deletions
diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h
index 0bc5311ca..d6b9a1be5 100644
--- a/src/include/gpxe/netdevice.h
+++ b/src/include/gpxe/netdevice.h
@@ -134,9 +134,13 @@ struct ll_protocol {
*/
struct net_device_stats {
/** Count of successfully completed transmissions */
- unsigned int tx_count;
+ unsigned int tx_ok;
+ /** Count of transmission errors */
+ unsigned int tx_err;
/** Count of successfully received packets */
- unsigned int rx_count;
+ unsigned int rx_ok;
+ /** Count of reception errors */
+ unsigned int rx_err;
};
/**
@@ -189,7 +193,8 @@ struct net_device {
* owned by the net device's TX queue, and the net device must
* eventually call netdev_tx_complete() to free the buffer.
* If this method returns failure, the I/O buffer is
- * immediately released.
+ * immediately released; the failure is interpreted as
+ * "failure to enqueue buffer".
*
* This method is guaranteed to be called only when the device
* is open.
@@ -289,10 +294,12 @@ netdev_put ( struct net_device *netdev ) {
}
extern int netdev_tx ( struct net_device *netdev, struct io_buffer *iobuf );
-extern void netdev_tx_complete ( struct net_device *netdev,
- struct io_buffer *iobuf );
-extern void netdev_tx_complete_next ( struct net_device *netdev );
+extern void netdev_tx_complete_err ( struct net_device *netdev,
+ struct io_buffer *iobuf, int rc );
+extern void netdev_tx_complete_next_err ( struct net_device *netdev, int rc );
extern void netdev_rx ( struct net_device *netdev, struct io_buffer *iobuf );
+extern void netdev_rx_err ( struct net_device *netdev,
+ struct io_buffer *iobuf, int rc );
extern int netdev_poll ( struct net_device *netdev, unsigned int rx_quota );
extern struct io_buffer * netdev_rx_dequeue ( struct net_device *netdev );
extern struct net_device * alloc_netdev ( size_t priv_size );
@@ -308,4 +315,28 @@ extern int net_tx ( struct io_buffer *iobuf, struct net_device *netdev,
extern int net_rx ( struct io_buffer *iobuf, struct net_device *netdev,
uint16_t net_proto, const void *ll_source );
+/**
+ * Complete network transmission
+ *
+ * @v netdev Network device
+ * @v iobuf I/O buffer
+ *
+ * The packet must currently be in the network device's TX queue.
+ */
+static inline void netdev_tx_complete ( struct net_device *netdev,
+ struct io_buffer *iobuf ) {
+ netdev_tx_complete_err ( netdev, iobuf, 0 );
+}
+
+/**
+ * Complete network transmission
+ *
+ * @v netdev Network device
+ *
+ * Completes the oldest outstanding packet in the TX queue.
+ */
+static inline void netdev_tx_complete_next ( struct net_device *netdev ) {
+ netdev_tx_complete_next_err ( netdev, 0 );
+}
+
#endif /* _GPXE_NETDEVICE_H */