NAPI re-insertion w/ changes]
Subsystems (2)
For review by the list... The other e100/e1000 changes are in the 2.5 nightly snapshot on kernel.org...
ChangeSet 1.1101.22.17, 2003/03/20 23:46:10-05:00, [email protected]
[E1000] NAPI re-insertion w/ changes
* Previous patch wiped NAPI support, adding it back here. But, with a twist: this one doesn't disable/enable interrupts each time we enter/leave polling. (It's EXPERIMENTAL).
# This patch includes the following deltas:
# ChangeSet 1.1101.22.16 -> 1.1101.22.17
# drivers/net/e1000/e1000_main.c 1.60 -> 1.61
#
e1000_main.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletion(-)
drivers/net/e1000/e1000_main.c +69 -1
@@ -155,8 +155,14 @@static inline void e1000_irq_disable (struct e1000_adapter *adapter);static inline void e1000_irq_enable (struct e1000_adapter *adapter);static void e1000_intr (int irq,void *data,struct pt_regs *regs); -static boolean_t e1000_clean_tx_irq (struct e1000_adapter *adapter); +#ifdef CONFIG_E1000_NAPI +static int e1000_clean (struct net_device *netdev,int *budget); +static boolean_t e1000_clean_rx_irq (struct e1000_adapter *adapter, +int *work_done,int work_to_do); +#else static boolean_t e1000_clean_rx_irq (struct e1000_adapter *adapter); +#endif +static boolean_t e1000_clean_tx_irq (struct e1000_adapter *adapter);static void e1000_alloc_rx_buffers (struct e1000_adapter *adapter);static int e1000_ioctl (struct net_device *netdev,struct ifreq *ifr,int cmd); static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
@@ -418,6 +424,10 @@ netdev->do_ioctl = &e1000_ioctl; netdev->tx_timeout = &e1000_tx_timeout; netdev->watchdog_timeo =5 *HZ ; +#ifdef CONFIG_E1000_NAPI + netdev->poll = &e1000_clean; + netdev->weight =64 ; +#endif netdev->vlan_rx_register = e1000_vlan_rx_register; netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid; netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid;
@@ -1977,7 +1987,9 @@struct net_device *netdev = data;struct e1000_adapter *adapter = netdev->priv;uint32_t icr =E1000_READ_REG (&adapter->hw,ICR ); +#ifndef CONFIG_E1000_NAPI int i; +#endif if (!icr)return ;/* Not our interrupt */
@@ -1987,12 +1999,46 @@mod_timer (&adapter->watchdog_timer, jiffies); } +#ifdef CONFIG_E1000_NAPI +/* Don't disable interrupts - rely on h/w interrupt +* moderation to keep interrupts low. netif_rx_schedule +* is NOP if already polling. */ +netif_rx_schedule (netdev); +#else for (i =0 ; i <E1000_MAX_INTR ; i++)if (!e1000_clean_rx_irq (adapter) && !e1000_clean_tx_irq (adapter))break ; +#endif +} +#ifdef CONFIG_E1000_NAPI +/** +* e1000_clean - NAPI Rx polling callback +* @adapter: board private structure +**/ + +static int +e1000_clean (struct net_device *netdev,int *budget) +{ +struct e1000_adapter *adapter = netdev->priv; +int work_to_do =min (*budget, netdev->quota); +int work_done =0 ; + +while (work_done < work_to_do) +if (!e1000_clean_rx_irq (adapter, &work_done, work_to_do) && + !e1000_clean_tx_irq (adapter)) +break ; + + *budget -= work_done; + netdev->quota -= work_done; + +if (work_done < work_to_do) +netif_rx_complete (netdev); + +return (work_done >= work_to_do); } +#endif /** * e1000_clean_tx_irq - Reclaim resources after transmit completes
@@ -2054,7 +2100,12 @@**/ static boolean_t +#ifdef CONFIG_E1000_NAPI +e1000_clean_rx_irq(struct e1000_adapter *adapter, int *work_done, + int work_to_do) +#else e1000_clean_rx_irq(struct e1000_adapter *adapter) +#endif {struct e1000_desc_ring *rx_ring = &adapter->rx_ring;struct net_device *netdev = adapter->netdev;
@@ -2071,6 +2122,13 @@while (rx_desc->status &E1000_RXD_STAT_DD ) { +#ifdef CONFIG_E1000_NAPI +if (*work_done >= work_to_do) +break ; + + (*work_done)++; +#endif + cleaned = TRUE; pci_unmap_single(pdev,
@@ -2133,12 +2191,22 @@e1000_rx_checksum (adapter, rx_desc, skb); skb->protocol =eth_type_trans (skb, netdev); +#ifdef CONFIG_E1000_NAPI +if (adapter->vlgrp && (rx_desc->status &E1000_RXD_STAT_VP )) { +vlan_hwaccel_receive_skb (skb, adapter->vlgrp, + (rx_desc->special &E1000_RXD_SPC_VLAN_MASK )); + }else { +netif_receive_skb (skb); + } +#else /* CONFIG_E1000_NAPI */ if (adapter->vlgrp && (rx_desc->status &E1000_RXD_STAT_VP )) {vlan_hwaccel_rx (skb, adapter->vlgrp, (rx_desc->special &E1000_RXD_SPC_VLAN_MASK )); }else {netif_rx (skb); } +#endif /* CONFIG_E1000_NAPI */ + netdev->last_rx = jiffies; rx_desc->status =0 ;
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
drivers/net/e1000/e1000_main.c line 2007
Quoted 8 lines · Jeff Garzik
For review by the list... The other e100/e1000 changes are in the 2.5
drivers/net/e1000/e1000_main.c +6
-0+#ifdef CONFIG_E1000_NAPI +/* Don't disable interrupts - rely on h/w interrupt +* moderation to keep interrupts low. netif_rx_schedule +* is NOP if already polling. */ +netif_rx_schedule (netdev); +#else
It's clean but I have some concerns...
I think this will add interrupts when resources are fully utilized. In other words a decrease in top performance. I say "think" because I have no numbers.
At GIGE rate we have ~1 k interrupts/sec using interrupt delay. (it depend of ring sizes etc). We are now seeing Linux boxes with ~10 GIGE interfaces. So any effects gets multiplied.
It makes the use zero latency RX complicated. We see Ethernet getting used for "new" applications as SCSI, filesystems etc. In current e1000 we just can set the desired interrupt delay and relax.
If/when PCI-X uses message signalled interrupts (MSI) we have this "un- necessary" load over PCI too with bus arbitrations etc.
IMO believe your old plan having e1000 irq disable and with mitigation as default feels better but testing is needed.
Cheers.
--ro