aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@etherboot.org>2010-03-23 00:55:19 +0000
committerMichael Brown <mcb30@etherboot.org>2010-03-23 00:55:47 +0000
commit4a7648bd3d811c10f272608cf5a64ab5eb2cd728 (patch)
tree96783a9651fe3e56fc508452364156a86e81dd60
parent88e436376cbdedee73483a9b57203c60a34316ac (diff)
downloadipxe-4a7648bd3d811c10f272608cf5a64ab5eb2cd728.zip
ipxe-4a7648bd3d811c10f272608cf5a64ab5eb2cd728.tar.gz
ipxe-4a7648bd3d811c10f272608cf5a64ab5eb2cd728.tar.bz2
[netdevice] Record whether or not interrupts are currently enabled
Signed-off-by: Michael Brown <mcb30@etherboot.org>
-rw-r--r--src/include/gpxe/netdevice.h14
-rw-r--r--src/net/netdevice.c7
2 files changed, 21 insertions, 0 deletions
diff --git a/src/include/gpxe/netdevice.h b/src/include/gpxe/netdevice.h
index 4f469e6..97bf168 100644
--- a/src/include/gpxe/netdevice.h
+++ b/src/include/gpxe/netdevice.h
@@ -329,6 +329,9 @@ struct net_device {
/** Network device is open */
#define NETDEV_OPEN 0x0001
+/** Network device interrupts are enabled */
+#define NETDEV_IRQ_ENABLED 0x0002
+
/** Link-layer protocol table */
#define LL_PROTOCOLS __table ( struct ll_protocol, "ll_protocols" )
@@ -491,6 +494,17 @@ netdev_is_open ( struct net_device *netdev ) {
return ( netdev->state & NETDEV_OPEN );
}
+/**
+ * Check whether or not network device interrupts are currently enabled
+ *
+ * @v netdev Network device
+ * @v irq_enabled Network device interrupts are enabled
+ */
+static inline __attribute__ (( always_inline )) int
+netdev_irq_enabled ( struct net_device *netdev ) {
+ return ( netdev->state & NETDEV_IRQ_ENABLED );
+}
+
extern void netdev_link_down ( struct net_device *netdev );
extern int netdev_tx ( struct net_device *netdev, struct io_buffer *iobuf );
extern void netdev_tx_complete_err ( struct net_device *netdev,
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index 2e781d7..b91f98c 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -460,7 +460,14 @@ void unregister_netdev ( struct net_device *netdev ) {
* @v enable Interrupts should be enabled
*/
void netdev_irq ( struct net_device *netdev, int enable ) {
+
+ /* Enable or disable device interrupts */
netdev->op->irq ( netdev, enable );
+
+ /* Record interrupt enabled state */
+ netdev->state &= ~NETDEV_IRQ_ENABLED;
+ if ( enable )
+ netdev->state |= NETDEV_IRQ_ENABLED;
}
/**