+
+
+#ifdef CONFIG_R6040_NAPI
+static int r6040_poll(struct net_device *dev, int *budget)
+{
+ struct r6040_private *lp;
+ struct r6040_descriptor *descptr;
+ struct sk_buff *skb_ptr;
+ int ioaddr, status;
+ unsigned long flags;
+
+
+ ioaddr = dev->base_addr;
+ lp = (struct r6040_private *)dev->priv;
+ unsigned long rx_work = dev->quota ;
+ unsigned long rx ;
+
+
+#if 1
+ /* TX interrupt request */
+ if (NAPI_status & 0x10) {
+
+ descptr = lp->tx_remove_ptr;
+ while(lp->tx_free_desc < TX_DCNT) {
+ if (descptr->status & 0x8000) break; /* Not complte */
+ skb_ptr = descptr->skb_ptr;
+ pci_unmap_single(lp->pdev, descptr->buf, skb_ptr->len, PCI_DMA_TODEVICE);
+ dev_kfree_skb_irq(skb_ptr); /* Free buffer */
+ descptr->skb_ptr = 0;
+ descptr = descptr->vndescp; /* To next descriptor */
+ lp->tx_free_desc++;
+ }
+ lp->tx_remove_ptr = descptr;
+ if (lp->tx_free_desc) netif_wake_queue(dev);
+ }
+#endif
+#if 1
+ /* RX interrupt request */
+ if (NAPI_status & 0x01) {
+
+ descptr = lp->rx_remove_ptr;
+ while(lp->rx_free_desc) {
+ if (descptr->status & 0x8000) break; /* No Rx packet */
+ skb_ptr = descptr->skb_ptr;
+ descptr->skb_ptr = 0;
+ skb_ptr->dev = dev;
+ skb_put(skb_ptr, descptr->len - 4);
+ pci_unmap_single(lp->pdev, descptr->buf, MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+ skb_ptr->protocol = eth_type_trans(skb_ptr, dev);
+ netif_receive_skb(skb_ptr); /* Send to upper layer */
+ lp->stats.rx_packets++;
+ lp->stats.rx_bytes += descptr->len;
+ descptr = descptr->vndescp; /* To next descriptor */
+ lp->rx_free_desc--;
+ }
+ lp->rx_remove_ptr = descptr;
+
+ }
+ /* Allocate new RX buffer */
+ if (lp->rx_free_desc < RX_DCNT) rx_buf_alloc(lp,dev);
+
+ local_irq_disable();
+ netif_rx_complete(dev);
+ outw(R6040_INT_MASK,ioaddr + 0x40);
+ local_irq_enable();
+ return 0;
+#endif
+}
+#endif
+