Driver/snull/snull_napi_interrupt()

Last-modified: 2007-09-12 (水) 17:45:36

378 :/*
379 : * A NAPI interrupt handler.

new API、ポーリングを基本とするインタフェース

380 : */
381 :static void snull_napi_interrupt(int irq, void *dev_id, struct pt_regs *regs)
382 :{
383 : int statusword;
384 : struct snull_priv *priv;
385 :
386 : /*
387 : * As usual, check the "device" pointer for shared handlers.
388 : * Then assign "struct device *dev"
389 : */
390 : struct net_device *dev = (struct net_device *)dev_id;
391 : /* ... and check with hw if it's really ours */
392 :
393 : /* paranoid */
394 : if (!dev)
395 : return;
396 :
397 : /* Lock the device */
398 : priv = netdev_priv(dev);
399 : spin_lock(&priv->lock);
400 :
401 : /* retrieve statusword: real netdevices use I/O instructions */
402 : statusword = priv->status;
403 : priv->status = 0;
404 : if (statusword & SNULL_RX_INTR) {

受信命令の割り込みならば

405 : snull_rx_ints(dev, 0); /* Disable further interrupts */
406 : netif_rx_schedule(dev);
407 : }
408 : if (statusword & SNULL_TX_INTR) {

送信命令の割り込みならば

409 : /* a transmission is over: free the skb */
410 : priv->stats.tx_packets++;
411 : priv->stats.tx_bytes += priv->tx_packetlen;
412 : dev_kfree_skb(priv->skb);
413 : }
414 :
415 : /* Unlock the device and we are done */
416 : spin_unlock(&priv->lock);
417 : return;
418 :}