summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/ipxe/netdevice.h14
-rw-r--r--src/net/netdevice.c4
2 files changed, 18 insertions, 0 deletions
diff --git a/src/include/ipxe/netdevice.h b/src/include/ipxe/netdevice.h
index a7852a810..ac7cec521 100644
--- a/src/include/ipxe/netdevice.h
+++ b/src/include/ipxe/netdevice.h
@@ -236,6 +236,9 @@ struct net_device_operations {
*
* @v netdev Network device
* @v enable Interrupts should be enabled
+ *
+ * This method may be NULL to indicate that interrupts are not
+ * supported.
*/
void ( * irq ) ( struct net_device *netdev, int enable );
};
@@ -516,6 +519,17 @@ netdev_is_open ( struct net_device *netdev ) {
}
/**
+ * Check whether or not network device supports interrupts
+ *
+ * @v netdev Network device
+ * @ret irq_supported Network device supports interrupts
+ */
+static inline __attribute__ (( always_inline )) int
+netdev_irq_supported ( struct net_device *netdev ) {
+ return ( netdev->op->irq != NULL );
+}
+
+/**
* Check whether or not network device interrupts are currently enabled
*
* @v netdev Network device
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index c7e907ad6..813823760 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -542,6 +542,10 @@ void unregister_netdev ( struct net_device *netdev ) {
*/
void netdev_irq ( struct net_device *netdev, int enable ) {
+ /* Do nothing if device does not support interrupts */
+ if ( ! netdev_irq_supported ( netdev ) )
+ return;
+
/* Enable or disable device interrupts */
netdev->op->irq ( netdev, enable );