*
* @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 );
};
return ( netdev->state & NETDEV_OPEN );
}
+/**
+ * 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
*
*/
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 );