diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2008-07-08 18:53:04 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-11 01:20:30 -0400 |
commit | 6d37ab282e246f3cb5b4b975ecc5e8303ba5da82 (patch) | |
tree | d3ba52c9c065a0f69e54130b4dea1ba6469b842a /drivers/net | |
parent | 2c21fc6e3a1150a1fa8c09b0f8ae0b796fb5039f (diff) |
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/Kconfig | 14 | ||||
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 47 |
2 files changed, 1 insertions, 60 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 9b98714889bf..21414177ee1e 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2430,20 +2430,6 @@ config IXGB | |||
2430 | To compile this driver as a module, choose M here. The module | 2430 | To compile this driver as a module, choose M here. The module |
2431 | will be called ixgb. | 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 | config S2IO | 2433 | config S2IO |
2448 | tristate "S2IO 10Gbe XFrame NIC" | 2434 | tristate "S2IO 10Gbe XFrame NIC" |
2449 | depends on PCI | 2435 | depends on PCI |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 3e857c022b66..526413482be2 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -31,12 +31,8 @@ | |||
31 | char ixgb_driver_name[] = "ixgb"; | 31 | char ixgb_driver_name[] = "ixgb"; |
32 | static char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver"; | 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 | #define DRIVERNAPI "-NAPI" | 34 | #define DRIVERNAPI "-NAPI" |
38 | #endif | 35 | #define DRV_VERSION "1.0.126" DRIVERNAPI |
39 | #define DRV_VERSION "1.0.126-k4"DRIVERNAPI | ||
40 | const char ixgb_driver_version[] = DRV_VERSION; | 36 | const char ixgb_driver_version[] = DRV_VERSION; |
41 | static const char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; | 37 | static const char ixgb_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
42 | 38 | ||
@@ -92,12 +88,8 @@ static int ixgb_set_mac(struct net_device *netdev, void *p); | |||
92 | static irqreturn_t ixgb_intr(int irq, void *data); | 88 | static irqreturn_t ixgb_intr(int irq, void *data); |
93 | static bool ixgb_clean_tx_irq(struct ixgb_adapter *adapter); | 89 | static bool ixgb_clean_tx_irq(struct ixgb_adapter *adapter); |
94 | 90 | ||
95 | #ifdef CONFIG_IXGB_NAPI | ||
96 | static int ixgb_clean(struct napi_struct *, int); | 91 | static int ixgb_clean(struct napi_struct *, int); |
97 | static bool ixgb_clean_rx_irq(struct ixgb_adapter *, int *, int); | 92 | static bool ixgb_clean_rx_irq(struct ixgb_adapter *, int *, int); |
98 | #else | ||
99 | static bool ixgb_clean_rx_irq(struct ixgb_adapter *); | ||
100 | #endif | ||
101 | static void ixgb_alloc_rx_buffers(struct ixgb_adapter *, int); | 93 | static void ixgb_alloc_rx_buffers(struct ixgb_adapter *, int); |
102 | 94 | ||
103 | static void ixgb_tx_timeout(struct net_device *dev); | 95 | static void ixgb_tx_timeout(struct net_device *dev); |
@@ -271,9 +263,7 @@ ixgb_up(struct ixgb_adapter *adapter) | |||
271 | 263 | ||
272 | clear_bit(__IXGB_DOWN, &adapter->flags); | 264 | clear_bit(__IXGB_DOWN, &adapter->flags); |
273 | 265 | ||
274 | #ifdef CONFIG_IXGB_NAPI | ||
275 | napi_enable(&adapter->napi); | 266 | napi_enable(&adapter->napi); |
276 | #endif | ||
277 | ixgb_irq_enable(adapter); | 267 | ixgb_irq_enable(adapter); |
278 | 268 | ||
279 | mod_timer(&adapter->watchdog_timer, jiffies); | 269 | mod_timer(&adapter->watchdog_timer, jiffies); |
@@ -289,9 +279,7 @@ ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog) | |||
289 | /* prevent the interrupt handler from restarting watchdog */ | 279 | /* prevent the interrupt handler from restarting watchdog */ |
290 | set_bit(__IXGB_DOWN, &adapter->flags); | 280 | set_bit(__IXGB_DOWN, &adapter->flags); |
291 | 281 | ||
292 | #ifdef CONFIG_IXGB_NAPI | ||
293 | napi_disable(&adapter->napi); | 282 | napi_disable(&adapter->napi); |
294 | #endif | ||
295 | /* waiting for NAPI to complete can re-enable interrupts */ | 283 | /* waiting for NAPI to complete can re-enable interrupts */ |
296 | ixgb_irq_disable(adapter); | 284 | ixgb_irq_disable(adapter); |
297 | free_irq(adapter->pdev->irq, netdev); | 285 | free_irq(adapter->pdev->irq, netdev); |
@@ -419,9 +407,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
419 | ixgb_set_ethtool_ops(netdev); | 407 | ixgb_set_ethtool_ops(netdev); |
420 | netdev->tx_timeout = &ixgb_tx_timeout; | 408 | netdev->tx_timeout = &ixgb_tx_timeout; |
421 | netdev->watchdog_timeo = 5 * HZ; | 409 | netdev->watchdog_timeo = 5 * HZ; |
422 | #ifdef CONFIG_IXGB_NAPI | ||
423 | netif_napi_add(netdev, &adapter->napi, ixgb_clean, 64); | 410 | netif_napi_add(netdev, &adapter->napi, ixgb_clean, 64); |
424 | #endif | ||
425 | netdev->vlan_rx_register = ixgb_vlan_rx_register; | 411 | netdev->vlan_rx_register = ixgb_vlan_rx_register; |
426 | netdev->vlan_rx_add_vid = ixgb_vlan_rx_add_vid; | 412 | netdev->vlan_rx_add_vid = ixgb_vlan_rx_add_vid; |
427 | netdev->vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid; | 413 | netdev->vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid; |
@@ -1709,9 +1695,6 @@ ixgb_intr(int irq, void *data) | |||
1709 | struct ixgb_adapter *adapter = netdev_priv(netdev); | 1695 | struct ixgb_adapter *adapter = netdev_priv(netdev); |
1710 | struct ixgb_hw *hw = &adapter->hw; | 1696 | struct ixgb_hw *hw = &adapter->hw; |
1711 | u32 icr = IXGB_READ_REG(hw, ICR); | 1697 | u32 icr = IXGB_READ_REG(hw, ICR); |
1712 | #ifndef CONFIG_IXGB_NAPI | ||
1713 | unsigned int i; | ||
1714 | #endif | ||
1715 | 1698 | ||
1716 | if (unlikely(!icr)) | 1699 | if (unlikely(!icr)) |
1717 | return IRQ_NONE; /* Not our interrupt */ | 1700 | return IRQ_NONE; /* Not our interrupt */ |
@@ -1720,7 +1703,6 @@ ixgb_intr(int irq, void *data) | |||
1720 | if (!test_bit(__IXGB_DOWN, &adapter->flags)) | 1703 | if (!test_bit(__IXGB_DOWN, &adapter->flags)) |
1721 | mod_timer(&adapter->watchdog_timer, jiffies); | 1704 | mod_timer(&adapter->watchdog_timer, jiffies); |
1722 | 1705 | ||
1723 | #ifdef CONFIG_IXGB_NAPI | ||
1724 | if (netif_rx_schedule_prep(netdev, &adapter->napi)) { | 1706 | if (netif_rx_schedule_prep(netdev, &adapter->napi)) { |
1725 | 1707 | ||
1726 | /* Disable interrupts and register for poll. The flush | 1708 | /* Disable interrupts and register for poll. The flush |
@@ -1730,20 +1712,9 @@ ixgb_intr(int irq, void *data) | |||
1730 | IXGB_WRITE_REG(&adapter->hw, IMC, ~0); | 1712 | IXGB_WRITE_REG(&adapter->hw, IMC, ~0); |
1731 | __netif_rx_schedule(netdev, &adapter->napi); | 1713 | __netif_rx_schedule(netdev, &adapter->napi); |
1732 | } | 1714 | } |
1733 | #else | ||
1734 | /* yes, that is actually a & and it is meant to make sure that | ||
1735 | * every pass through this for loop checks both receive and | ||
1736 | * transmit queues for completed descriptors, intended to | ||
1737 | * avoid starvation issues and assist tx/rx fairness. */ | ||
1738 | for (i = 0; i < IXGB_MAX_INTR; i++) | ||
1739 | if (!ixgb_clean_rx_irq(adapter) & | ||
1740 | !ixgb_clean_tx_irq(adapter)) | ||
1741 | break; | ||
1742 | #endif | ||
1743 | return IRQ_HANDLED; | 1715 | return IRQ_HANDLED; |
1744 | } | 1716 | } |
1745 | 1717 | ||
1746 | #ifdef CONFIG_IXGB_NAPI | ||
1747 | /** | 1718 | /** |
1748 | * ixgb_clean - NAPI Rx polling callback | 1719 | * ixgb_clean - NAPI Rx polling callback |
1749 | * @adapter: board private structure | 1720 | * @adapter: board private structure |
@@ -1768,7 +1739,6 @@ ixgb_clean(struct napi_struct *napi, int budget) | |||
1768 | 1739 | ||
1769 | return work_done; | 1740 | return work_done; |
1770 | } | 1741 | } |
1771 | #endif | ||
1772 | 1742 | ||
1773 | /** | 1743 | /** |
1774 | * ixgb_clean_tx_irq - Reclaim resources after transmit completes | 1744 | * ixgb_clean_tx_irq - Reclaim resources after transmit completes |
@@ -1901,11 +1871,7 @@ ixgb_rx_checksum(struct ixgb_adapter *adapter, | |||
1901 | **/ | 1871 | **/ |
1902 | 1872 | ||
1903 | static bool | 1873 | static bool |
1904 | #ifdef CONFIG_IXGB_NAPI | ||
1905 | ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do) | 1874 | ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do) |
1906 | #else | ||
1907 | ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | ||
1908 | #endif | ||
1909 | { | 1875 | { |
1910 | struct ixgb_desc_ring *rx_ring = &adapter->rx_ring; | 1876 | struct ixgb_desc_ring *rx_ring = &adapter->rx_ring; |
1911 | struct net_device *netdev = adapter->netdev; | 1877 | struct net_device *netdev = adapter->netdev; |
@@ -1925,12 +1891,10 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
1925 | struct sk_buff *skb; | 1891 | struct sk_buff *skb; |
1926 | u8 status; | 1892 | u8 status; |
1927 | 1893 | ||
1928 | #ifdef CONFIG_IXGB_NAPI | ||
1929 | if (*work_done >= work_to_do) | 1894 | if (*work_done >= work_to_do) |
1930 | break; | 1895 | break; |
1931 | 1896 | ||
1932 | (*work_done)++; | 1897 | (*work_done)++; |
1933 | #endif | ||
1934 | status = rx_desc->status; | 1898 | status = rx_desc->status; |
1935 | skb = buffer_info->skb; | 1899 | skb = buffer_info->skb; |
1936 | buffer_info->skb = NULL; | 1900 | buffer_info->skb = NULL; |
@@ -2005,21 +1969,12 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter) | |||
2005 | ixgb_rx_checksum(adapter, rx_desc, skb); | 1969 | ixgb_rx_checksum(adapter, rx_desc, skb); |
2006 | 1970 | ||
2007 | skb->protocol = eth_type_trans(skb, netdev); | 1971 | skb->protocol = eth_type_trans(skb, netdev); |
2008 | #ifdef CONFIG_IXGB_NAPI | ||
2009 | if (adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { | 1972 | if (adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { |
2010 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, | 1973 | vlan_hwaccel_receive_skb(skb, adapter->vlgrp, |
2011 | le16_to_cpu(rx_desc->special)); | 1974 | le16_to_cpu(rx_desc->special)); |
2012 | } else { | 1975 | } else { |
2013 | netif_receive_skb(skb); | 1976 | netif_receive_skb(skb); |
2014 | } | 1977 | } |
2015 | #else /* CONFIG_IXGB_NAPI */ | ||
2016 | if (adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) { | ||
2017 | vlan_hwaccel_rx(skb, adapter->vlgrp, | ||
2018 | le16_to_cpu(rx_desc->special)); | ||
2019 | } else { | ||
2020 | netif_rx(skb); | ||
2021 | } | ||
2022 | #endif /* CONFIG_IXGB_NAPI */ | ||
2023 | netdev->last_rx = jiffies; | 1978 | netdev->last_rx = jiffies; |
2024 | 1979 | ||
2025 | rxdesc_done: | 1980 | rxdesc_done: |