Driver/snull/snull_regular_interrupt()

Last-modified: 2007-09-12 (水) 17:46:55

330 :/*
331 : * The typical interrupt entry point
332 : */

NAPI interruptとの違いがいまいち分からない。

333 :static void snull_regular_interrupt(int irq, void *dev_id, struct pt_regs *regs)
334 :{
335 : int statusword;
336 : struct snull_priv *priv;
337 : struct snull_packet *pkt = NULL;
338 : /*
339 : * As usual, check the "device" pointer to be sure it is
340 : * really interrupting.
341 : * Then assign "struct device *dev"
342 : */
343 : struct net_device *dev = (struct net_device *)dev_id;
344 : /* ... and check with hw if it's really ours */
345 :
346 : /* paranoid */
347 : if (!dev)
348 : return;
349 :
350 : /* Lock the device */
351 : priv = netdev_priv(dev);
352 : spin_lock(&priv->lock);
353 :
354 : /* retrieve statusword: real netdevices use I/O instructions */
355 : statusword = priv->status;
356 : priv->status = 0;
357 : if (statusword & SNULL_RX_INTR) {
358 : /* send it to snull_rx for handling */
359 : pkt = priv->rx_queue;
360 : if (pkt) {
361 : priv->rx_queue = pkt->next;
362 : snull_rx(dev, pkt);
363 : }
364 : }
365 : if (statusword & SNULL_TX_INTR) {
366 : /* a transmission is over: free the skb */
367 : priv->stats.tx_packets++;
368 : priv->stats.tx_bytes += priv->tx_packetlen;
369 : dev_kfree_skb(priv->skb);
370 : }
371 :
372 : /* Unlock the device and we are done */
373 : spin_unlock(&priv->lock);
374 : if (pkt) snull_release_buffer(pkt); /* Do this outside the lock! */
375 : return;
376 :}