Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ixgb: make NAPI the only option and the default

network maintainers suggest NAPI only drivers are the only way to go.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

Jesse Brandeburg and committed by
Jeff Garzik
6d37ab28 2c21fc6e

+1 -60
-14
drivers/net/Kconfig
··· 2430 2430 To compile this driver as a module, choose M here. The module 2431 2431 will be called ixgb. 2432 2432 2433 - config IXGB_NAPI 2434 - bool "Use Rx Polling (NAPI) (EXPERIMENTAL)" 2435 - depends on IXGB && EXPERIMENTAL 2436 - help 2437 - NAPI is a new driver API designed to reduce CPU and interrupt load 2438 - when the driver is receiving lots of packets from the card. It is 2439 - still somewhat experimental and thus not yet enabled by default. 2440 - 2441 - If your estimated Rx load is 10kpps or more, or if the card will be 2442 - deployed on potentially unfriendly networks (e.g. in a firewall), 2443 - then say Y here. 2444 - 2445 - If in doubt, say N. 2446 - 2447 2433 config S2IO 2448 2434 tristate "S2IO 10Gbe XFrame NIC" 2449 2435 depends on PCI
+1 -46
drivers/net/ixgb/ixgb_main.c
··· 31 31 char ixgb_driver_name[] = "ixgb"; 32 32 static char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver"; 33 33 34 - #ifndef CONFIG_IXGB_NAPI 35 - #define DRIVERNAPI 36 - #else 37 34 #define DRIVERNAPI "-NAPI" 38 - #endif 39 - #define DRV_VERSION "1.0.126-k4"DRIVERNAPI 35 + #define DRV_VERSION "1.0.126" DRIVERNAPI 40 36 const char ixgb_driver_version[] = DRV_VERSION; 41 37 static const char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; 42 38 ··· 88 92 static irqreturn_t ixgb_intr(int irq, void *data); 89 93 static bool ixgb_clean_tx_irq(struct ixgb_adapter *adapter); 90 94 91 - #ifdef CONFIG_IXGB_NAPI 92 95 static int ixgb_clean(struct napi_struct *, int); 93 96 static bool ixgb_clean_rx_irq(struct ixgb_adapter *, int *, int); 94 - #else 95 - static bool ixgb_clean_rx_irq(struct ixgb_adapter *); 96 - #endif 97 97 static void ixgb_alloc_rx_buffers(struct ixgb_adapter *, int); 98 98 99 99 static void ixgb_tx_timeout(struct net_device *dev); ··· 263 271 264 272 clear_bit(__IXGB_DOWN, &adapter->flags); 265 273 266 - #ifdef CONFIG_IXGB_NAPI 267 274 napi_enable(&adapter->napi); 268 - #endif 269 275 ixgb_irq_enable(adapter); 270 276 271 277 mod_timer(&adapter->watchdog_timer, jiffies); ··· 279 289 /* prevent the interrupt handler from restarting watchdog */ 280 290 set_bit(__IXGB_DOWN, &adapter->flags); 281 291 282 - #ifdef CONFIG_IXGB_NAPI 283 292 napi_disable(&adapter->napi); 284 - #endif 285 293 /* waiting for NAPI to complete can re-enable interrupts */ 286 294 ixgb_irq_disable(adapter); 287 295 free_irq(adapter->pdev->irq, netdev); ··· 407 419 ixgb_set_ethtool_ops(netdev); 408 420 netdev->tx_timeout = &ixgb_tx_timeout; 409 421 netdev->watchdog_timeo = 5 * HZ; 410 - #ifdef CONFIG_IXGB_NAPI 411 422 netif_napi_add(netdev, &adapter->napi, ixgb_clean, 64); 412 - #endif 413 423 netdev->vlan_rx_register = ixgb_vlan_rx_register; 414 424 netdev->vlan_rx_add_vid = ixgb_vlan_rx_add_vid; 415 425 netdev->vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid; ··· 1695 1709 struct ixgb_adapter *adapter = netdev_priv(netdev); 1696 1710 struct ixgb_hw *hw = &adapter->hw; 1697 1711 u32 icr = IXGB_READ_REG(hw, ICR); 1698 - #ifndef CONFIG_IXGB_NAPI 1699 - unsigned int i; 1700 - #endif 1701 1712 1702 1713 if (unlikely(!icr)) 1703 1714 return IRQ_NONE; /* Not our interrupt */ ··· 1703 1720 if (!test_bit(__IXGB_DOWN, &adapter->flags)) 1704 1721 mod_timer(&adapter->watchdog_timer, jiffies); 1705 1722 1706 - #ifdef CONFIG_IXGB_NAPI 1707 1723 if (netif_rx_schedule_prep(netdev, &adapter->napi)) { 1708 1724 1709 1725 /* Disable interrupts and register for poll. The flush ··· 1712 1730 IXGB_WRITE_REG(&adapter->hw, IMC, ~0); 1713 1731 __netif_rx_schedule(netdev, &adapter->napi); 1714 1732 } 1715 - #else 1716 - /* yes, that is actually a & and it is meant to make sure that 1717 - * every pass through this for loop checks both receive and 1718 - * transmit queues for completed descriptors, intended to 1719 - * avoid starvation issues and assist tx/rx fairness. */ 1720 - for (i = 0; i < IXGB_MAX_INTR; i++) 1721 - if (!ixgb_clean_rx_irq(adapter) & 1722 - !ixgb_clean_tx_irq(adapter)) 1723 - break; 1724 - #endif 1725 1733 return IRQ_HANDLED; 1726 1734 } 1727 1735 1728 - #ifdef CONFIG_IXGB_NAPI 1729 1736 /** 1730 1737 * ixgb_clean - NAPI Rx polling callback 1731 1738 * @adapter: board private structure ··· 1739 1768 1740 1769 return work_done; 1741 1770 } 1742 - #endif 1743 1771 1744 1772 /** 1745 1773 * ixgb_clean_tx_irq - Reclaim resources after transmit completes ··· 1871 1901 **/ 1872 1902 1873 1903 static bool 1874 - #ifdef CONFIG_IXGB_NAPI 1875 1904 ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do) 1876 - #else 1877 - ixgb_clean_rx_irq(struct ixgb_adapter *adapter) 1878 - #endif 1879 1905 { 1880 1906 struct ixgb_desc_ring *rx_ring = &adapter->rx_ring; 1881 1907 struct net_device *netdev = adapter->netdev; ··· 1891 1925 struct sk_buff *skb; 1892 1926 u8 status; 1893 1927 1894 - #ifdef CONFIG_IXGB_NAPI 1895 1928 if (*work_done >= work_to_do) 1896 1929 break; 1897 1930 1898 1931 (*work_done)++; 1899 - #endif 1900 1932 status = rx_desc->status; 1901 1933 skb = buffer_info->skb; 1902 1934 buffer_info->skb = NULL; ··· 1969 2005 ixgb_rx_checksum(adapter, rx_desc, skb); 1970 2006 1971 2007 skb->protocol = eth_type_trans(skb, netdev); 1972 - #ifdef CONFIG_IXGB_NAPI 1973 2008 if (adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { 1974 2009 vlan_hwaccel_receive_skb(skb, adapter->vlgrp, 1975 2010 le16_to_cpu(rx_desc->special)); 1976 2011 } else { 1977 2012 netif_receive_skb(skb); 1978 2013 } 1979 - #else /* CONFIG_IXGB_NAPI */ 1980 - if (adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { 1981 - vlan_hwaccel_rx(skb, adapter->vlgrp, 1982 - le16_to_cpu(rx_desc->special)); 1983 - } else { 1984 - netif_rx(skb); 1985 - } 1986 - #endif /* CONFIG_IXGB_NAPI */ 1987 2014 netdev->last_rx = jiffies; 1988 2015 1989 2016 rxdesc_done: