diff -ruN ../r8101-1.007.00/src/r8101.h ./src/r8101.h --- ../r8101-1.007.00/src/r8101.h 2008-03-31 09:57:16.000000000 +0200 +++ ./src/r8101.h 2008-06-27 15:20:21.000000000 +0200 @@ -932,6 +932,7 @@ void __iomem *mmio_addr; /* memory map physical address */ struct pci_dev *pci_dev; /* Index of PCI device */ struct net_device *dev; + struct napi_struct napi; struct net_device_stats stats; /* statistics of net device */ spinlock_t lock; /* spin lock flag */ spinlock_t phy_lock; /* spin lock flag for PHY */ diff -ruN ../r8101-1.007.00/src/r8101_n.c ./src/r8101_n.c --- ../r8101-1.007.00/src/r8101_n.c 2008-03-31 09:53:47.000000000 +0200 +++ ./src/r8101_n.c 2008-06-27 15:20:21.000000000 +0200 @@ -176,7 +176,7 @@ static void rtl8101_tx_timeout(struct net_device *dev); static struct net_device_stats *rtl8101_get_stats(struct net_device *dev); static int rtl8101_rx_interrupt(struct net_device *, struct rtl8101_private *, - void __iomem *); + void __iomem *, u32 budget); static int rtl8101_change_mtu(struct net_device *dev, int new_mtu); static void rtl8101_down(struct net_device *dev); @@ -187,7 +187,7 @@ static void rtl8101_phy_power_down (struct net_device *dev); #ifdef CONFIG_R8101_NAPI -static int rtl8101_poll(struct net_device *dev, int *budget); +static int rtl8101_poll(struct napi_struct *napi, int budget); #endif static const u16 rtl8101_intr_mask = @@ -2241,7 +2241,9 @@ goto err_out; } - SET_MODULE_OWNER(dev); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) && defined(SET_MODULE_OWNER) + SET_MODULE_OWNER(dev); +#endif SET_NETDEV_DEV(dev, &pdev->dev); tp = netdev_priv(dev); tp->dev = dev; @@ -2640,8 +2642,9 @@ dev->do_ioctl = rtl8101_do_ioctl; #ifdef CONFIG_R8101_NAPI - dev->poll = rtl8101_poll; - dev->weight = R8101_NAPI_WEIGHT; + /*dev->poll = rtl8101_poll;*/ + /*dev->weight = R8101_NAPI_WEIGHT;*/ + netif_napi_add(dev, &tp->napi, rtl8101_poll, R8101_NAPI_WEIGHT); #endif #ifdef CONFIG_R8101_VLAN @@ -2772,6 +2775,8 @@ INIT_DELAYED_WORK(&tp->task, NULL); #endif + napi_enable(&tp->napi); + rtl8101_hw_start(dev); if (tp->esd_flag == 0) { @@ -2997,9 +3002,11 @@ goto out; #ifdef NAPI - netif_poll_enable(dev); + /*netif_poll_enable(dev); */ #endif - + + napi_enable(&tp->napi); + rtl8101_hw_start(dev); out: @@ -3214,14 +3221,17 @@ /* Wait for any pending NAPI task to complete */ #ifdef NAPI - netif_poll_disable(dev); + /*netif_poll_disable(dev);*/ #endif + napi_disable(&tp->napi); + rtl8101_irq_mask_and_ack(ioaddr); #ifdef NAPI - netif_poll_enable(dev); + /*netif_poll_enable(dev);*/ #endif + napi_enable(&tp->napi); } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) @@ -3277,7 +3287,7 @@ rtl8101_wait_for_quiescence(dev); - rtl8101_rx_interrupt(dev, tp, tp->mmio_addr); + rtl8101_rx_interrupt(dev, tp, tp->mmio_addr, ~(u32)0); rtl8101_tx_clear(tp); if (tp->dirty_rx == tp->cur_rx) { @@ -3672,7 +3682,8 @@ static int rtl8101_rx_interrupt(struct net_device *dev, struct rtl8101_private *tp, - void __iomem *ioaddr) + void __iomem *ioaddr, + u32 budget) { unsigned int cur_rx, rx_left; unsigned int delta, count = 0; @@ -3683,7 +3694,7 @@ cur_rx = tp->cur_rx; rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx; - rx_left = rtl8101_rx_quota(rx_left, (u32) dev->quota); + rx_left = rtl8101_rx_quota(rx_left, budget); if ((tp->RxDescArray == NULL) || (tp->Rx_skbuff == NULL)) { goto rx_out; @@ -3863,8 +3874,10 @@ RTL_W16(IntrMask, rtl8101_intr_mask & ~rtl8101_napi_event); tp->intr_mask = ~rtl8101_napi_event; - if (likely(netif_rx_schedule_prep(dev))) - __netif_rx_schedule(dev); +/* if (likely(netif_rx_schedule_prep(dev))) + __netif_rx_schedule(dev); */ + if (likely(netif_rx_schedule_prep(dev, &tp->napi))) + __netif_rx_schedule(dev, &tp->napi); else if (netif_msg_intr(tp)) { printk(KERN_INFO "%s: interrupt %04x taken in poll\n", dev->name, status); @@ -3873,7 +3886,7 @@ #else /* Rx interrupt */ if (status & (RxOK | RxDescUnavail | RxFIFOOver)) { - rtl8101_rx_interrupt(dev, tp, ioaddr); + rtl8101_rx_interrupt(dev, tp, ioaddr, ~(u32)0); } /* Tx interrupt */ if (status & (TxOK | TxErr)) @@ -3907,21 +3920,25 @@ } #ifdef CONFIG_R8101_NAPI -static int rtl8101_poll(struct net_device *dev, - int *budget) +static int rtl8101_poll(struct napi_struct *napi, + int budget) { - unsigned int work_done, work_to_do = min(*budget, dev->quota); +/* unsigned int work_done, work_to_do = min(*budget, dev->quota); struct rtl8101_private *tp = netdev_priv(dev); +*/ + struct rtl8101_private *tp = container_of(napi, struct rtl8101_private, napi); + struct net_device *dev = tp->dev; void __iomem *ioaddr = tp->mmio_addr; + int work_done; - work_done = rtl8101_rx_interrupt(dev, tp, ioaddr); + work_done = rtl8101_rx_interrupt(dev, tp, ioaddr, (u32) budget); rtl8101_tx_interrupt(dev, tp, ioaddr); - *budget -= work_done; +/* *budget -= work_done; dev->quota -= work_done; - - if (work_done < work_to_do) { - netif_rx_complete(dev); +*/ + if (work_done < budget) { + netif_rx_complete(dev, napi); tp->intr_mask = 0xffff; /* * 20040426: the barrier is not strictly required but the @@ -3933,7 +3950,7 @@ RTL_W16(IntrMask, rtl8101_intr_mask); } - return (work_done >= work_to_do); + return work_done; } #endif @@ -3970,8 +3987,9 @@ if (!poll_locked) { #ifdef NAPI - netif_poll_disable(dev); +/* netif_poll_disable(dev);*/ #endif + napi_disable(&tp->napi); poll_locked++; } @@ -4021,7 +4039,7 @@ free_irq(dev->irq, dev); #ifdef NAPI - netif_poll_enable(dev); +/* netif_poll_enable(dev);*/ #endif pci_free_consistent(pdev, R8101_RX_RING_BYTES, tp->RxDescArray,