diff options
author | Jesse Brandeburg <jesse.brandeburg@intel.com> | 2008-08-26 07:27:21 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 10:03:34 -0400 |
commit | 96b0e0f63b03153f7f2915f584083b4191b1932d (patch) | |
tree | 0bf2414a865a047bab4cc7b310b3aff9d508b42a /drivers/net/ixgbe | |
parent | 22f32b7a5ad34f23eb18f0e089522f1652ae8abc (diff) |
ixgbe: update dca to new interface, fix CONFIG_DCA_MODULE
DCA related fixes
=================
- ixgbe was not compiling and using DCA correctly if dca was a module
- DCA interface changed with new kernel
- ixgbe was not correctly configured to indicate DCA hints to the
correct CPU.
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/ixgbe')
-rw-r--r-- | drivers/net/ixgbe/ixgbe.h | 35 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 50 |
2 files changed, 59 insertions, 26 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index 628f60cf2fb7..90b53830196c 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -37,7 +37,7 @@ | |||
37 | #include "ixgbe_type.h" | 37 | #include "ixgbe_type.h" |
38 | #include "ixgbe_common.h" | 38 | #include "ixgbe_common.h" |
39 | 39 | ||
40 | #ifdef CONFIG_DCA | 40 | #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE) |
41 | #include <linux/dca.h> | 41 | #include <linux/dca.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -150,7 +150,7 @@ struct ixgbe_ring { | |||
150 | * offset associated with this ring, which is different | 150 | * offset associated with this ring, which is different |
151 | * for DCE and RSS modes */ | 151 | * for DCE and RSS modes */ |
152 | 152 | ||
153 | #ifdef CONFIG_DCA | 153 | #if defined(CONFIG_DCA) || defined(CONFIG_DCA_MODULE) |
154 | /* cpu for tx queue */ | 154 | /* cpu for tx queue */ |
155 | int cpu; | 155 | int cpu; |
156 | #endif | 156 | #endif |
@@ -267,15 +267,28 @@ struct ixgbe_adapter { | |||
267 | * thus the additional *_CAPABLE flags. | 267 | * thus the additional *_CAPABLE flags. |
268 | */ | 268 | */ |
269 | u32 flags; | 269 | u32 flags; |
270 | #define IXGBE_FLAG_RX_CSUM_ENABLED (u32)(1 << 0) | 270 | #define IXGBE_FLAG_RX_CSUM_ENABLED (u32)(1) |
271 | #define IXGBE_FLAG_MSI_ENABLED (u32)(1 << 1) | 271 | #define IXGBE_FLAG_MSI_CAPABLE (u32)(1 << 1) |
272 | #define IXGBE_FLAG_MSIX_ENABLED (u32)(1 << 2) | 272 | #define IXGBE_FLAG_MSI_ENABLED (u32)(1 << 2) |
273 | #define IXGBE_FLAG_RX_PS_ENABLED (u32)(1 << 3) | 273 | #define IXGBE_FLAG_MSIX_CAPABLE (u32)(1 << 3) |
274 | #define IXGBE_FLAG_IN_NETPOLL (u32)(1 << 4) | 274 | #define IXGBE_FLAG_MSIX_ENABLED (u32)(1 << 4) |
275 | #define IXGBE_FLAG_IMIR_ENABLED (u32)(1 << 5) | 275 | #define IXGBE_FLAG_RX_1BUF_CAPABLE (u32)(1 << 6) |
276 | #define IXGBE_FLAG_RSS_ENABLED (u32)(1 << 6) | 276 | #define IXGBE_FLAG_RX_PS_CAPABLE (u32)(1 << 7) |
277 | #define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 7) | 277 | #define IXGBE_FLAG_RX_PS_ENABLED (u32)(1 << 8) |
278 | #define IXGBE_FLAG_DCA_ENABLED (u32)(1 << 8) | 278 | #define IXGBE_FLAG_IN_NETPOLL (u32)(1 << 9) |
279 | #define IXGBE_FLAG_DCA_ENABLED (u32)(1 << 10) | ||
280 | #define IXGBE_FLAG_DCA_CAPABLE (u32)(1 << 11) | ||
281 | #define IXGBE_FLAG_IMIR_ENABLED (u32)(1 << 12) | ||
282 | #define IXGBE_FLAG_MQ_CAPABLE (u32)(1 << 13) | ||
283 | #define IXGBE_FLAG_RSS_ENABLED (u32)(1 << 16) | ||
284 | #define IXGBE_FLAG_RSS_CAPABLE (u32)(1 << 17) | ||
285 | #define IXGBE_FLAG_VMDQ_CAPABLE (u32)(1 << 18) | ||
286 | #define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 19) | ||
287 | #define IXGBE_FLAG_NEED_LINK_UPDATE (u32)(1 << 22) | ||
288 | #define IXGBE_FLAG_IN_WATCHDOG_TASK (u32)(1 << 23) | ||
289 | |||
290 | /* default to trying for four seconds */ | ||
291 | #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ) | ||
279 | 292 | ||
280 | /* OS defined structs */ | 293 | /* OS defined structs */ |
281 | struct net_device *netdev; | 294 | struct net_device *netdev; |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index b6973ee905e3..f37e3eb12f7c 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -80,7 +80,7 @@ static struct pci_device_id ixgbe_pci_tbl[] = { | |||
80 | }; | 80 | }; |
81 | MODULE_DEVICE_TABLE(pci, ixgbe_pci_tbl); | 81 | MODULE_DEVICE_TABLE(pci, ixgbe_pci_tbl); |
82 | 82 | ||
83 | #ifdef CONFIG_DCA | 83 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
84 | static int ixgbe_notify_dca(struct notifier_block *, unsigned long event, | 84 | static int ixgbe_notify_dca(struct notifier_block *, unsigned long event, |
85 | void *p); | 85 | void *p); |
86 | static struct notifier_block dca_notifier = { | 86 | static struct notifier_block dca_notifier = { |
@@ -309,7 +309,7 @@ done_cleaning: | |||
309 | return (total_packets ? true : false); | 309 | return (total_packets ? true : false); |
310 | } | 310 | } |
311 | 311 | ||
312 | #ifdef CONFIG_DCA | 312 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
313 | static void ixgbe_update_rx_dca(struct ixgbe_adapter *adapter, | 313 | static void ixgbe_update_rx_dca(struct ixgbe_adapter *adapter, |
314 | struct ixgbe_ring *rx_ring) | 314 | struct ixgbe_ring *rx_ring) |
315 | { | 315 | { |
@@ -320,7 +320,7 @@ static void ixgbe_update_rx_dca(struct ixgbe_adapter *adapter, | |||
320 | if (rx_ring->cpu != cpu) { | 320 | if (rx_ring->cpu != cpu) { |
321 | rxctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_RXCTRL(q)); | 321 | rxctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_RXCTRL(q)); |
322 | rxctrl &= ~IXGBE_DCA_RXCTRL_CPUID_MASK; | 322 | rxctrl &= ~IXGBE_DCA_RXCTRL_CPUID_MASK; |
323 | rxctrl |= dca_get_tag(cpu); | 323 | rxctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); |
324 | rxctrl |= IXGBE_DCA_RXCTRL_DESC_DCA_EN; | 324 | rxctrl |= IXGBE_DCA_RXCTRL_DESC_DCA_EN; |
325 | rxctrl |= IXGBE_DCA_RXCTRL_HEAD_DCA_EN; | 325 | rxctrl |= IXGBE_DCA_RXCTRL_HEAD_DCA_EN; |
326 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_RXCTRL(q), rxctrl); | 326 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_RXCTRL(q), rxctrl); |
@@ -339,7 +339,7 @@ static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter, | |||
339 | if (tx_ring->cpu != cpu) { | 339 | if (tx_ring->cpu != cpu) { |
340 | txctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q)); | 340 | txctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q)); |
341 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; | 341 | txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; |
342 | txctrl |= dca_get_tag(cpu); | 342 | txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); |
343 | txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; | 343 | txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN; |
344 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q), txctrl); | 344 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q), txctrl); |
345 | tx_ring->cpu = cpu; | 345 | tx_ring->cpu = cpu; |
@@ -372,11 +372,14 @@ static int __ixgbe_notify_dca(struct device *dev, void *data) | |||
372 | 372 | ||
373 | switch (event) { | 373 | switch (event) { |
374 | case DCA_PROVIDER_ADD: | 374 | case DCA_PROVIDER_ADD: |
375 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; | 375 | /* if we're already enabled, don't do it again */ |
376 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) | ||
377 | break; | ||
376 | /* Always use CB2 mode, difference is masked | 378 | /* Always use CB2 mode, difference is masked |
377 | * in the CB driver. */ | 379 | * in the CB driver. */ |
378 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, 2); | 380 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, 2); |
379 | if (dca_add_requester(dev) == 0) { | 381 | if (dca_add_requester(dev) == 0) { |
382 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; | ||
380 | ixgbe_setup_dca(adapter); | 383 | ixgbe_setup_dca(adapter); |
381 | break; | 384 | break; |
382 | } | 385 | } |
@@ -393,7 +396,7 @@ static int __ixgbe_notify_dca(struct device *dev, void *data) | |||
393 | return 0; | 396 | return 0; |
394 | } | 397 | } |
395 | 398 | ||
396 | #endif /* CONFIG_DCA */ | 399 | #endif /* CONFIG_DCA or CONFIG_DCA_MODULE */ |
397 | /** | 400 | /** |
398 | * ixgbe_receive_skb - Send a completed packet up the stack | 401 | * ixgbe_receive_skb - Send a completed packet up the stack |
399 | * @adapter: board private structure | 402 | * @adapter: board private structure |
@@ -931,7 +934,7 @@ static irqreturn_t ixgbe_msix_clean_tx(int irq, void *data) | |||
931 | r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); | 934 | r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); |
932 | for (i = 0; i < q_vector->txr_count; i++) { | 935 | for (i = 0; i < q_vector->txr_count; i++) { |
933 | tx_ring = &(adapter->tx_ring[r_idx]); | 936 | tx_ring = &(adapter->tx_ring[r_idx]); |
934 | #ifdef CONFIG_DCA | 937 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
935 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) | 938 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) |
936 | ixgbe_update_tx_dca(adapter, tx_ring); | 939 | ixgbe_update_tx_dca(adapter, tx_ring); |
937 | #endif | 940 | #endif |
@@ -996,7 +999,7 @@ static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget) | |||
996 | 999 | ||
997 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); | 1000 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); |
998 | rx_ring = &(adapter->rx_ring[r_idx]); | 1001 | rx_ring = &(adapter->rx_ring[r_idx]); |
999 | #ifdef CONFIG_DCA | 1002 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
1000 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) | 1003 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) |
1001 | ixgbe_update_rx_dca(adapter, rx_ring); | 1004 | ixgbe_update_rx_dca(adapter, rx_ring); |
1002 | #endif | 1005 | #endif |
@@ -2054,11 +2057,28 @@ void ixgbe_down(struct ixgbe_adapter *adapter) | |||
2054 | netif_carrier_off(netdev); | 2057 | netif_carrier_off(netdev); |
2055 | netif_tx_stop_all_queues(netdev); | 2058 | netif_tx_stop_all_queues(netdev); |
2056 | 2059 | ||
2060 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) | ||
2061 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { | ||
2062 | adapter->flags &= ~IXGBE_FLAG_DCA_ENABLED; | ||
2063 | dca_remove_requester(&adapter->pdev->dev); | ||
2064 | } | ||
2065 | |||
2066 | #endif | ||
2057 | if (!pci_channel_offline(adapter->pdev)) | 2067 | if (!pci_channel_offline(adapter->pdev)) |
2058 | ixgbe_reset(adapter); | 2068 | ixgbe_reset(adapter); |
2059 | ixgbe_clean_all_tx_rings(adapter); | 2069 | ixgbe_clean_all_tx_rings(adapter); |
2060 | ixgbe_clean_all_rx_rings(adapter); | 2070 | ixgbe_clean_all_rx_rings(adapter); |
2061 | 2071 | ||
2072 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) | ||
2073 | /* since we reset the hardware DCA settings were cleared */ | ||
2074 | if (dca_add_requester(&adapter->pdev->dev) == 0) { | ||
2075 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; | ||
2076 | /* always use CB2 mode, difference is masked | ||
2077 | * in the CB driver */ | ||
2078 | IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_CTRL, 2); | ||
2079 | ixgbe_setup_dca(adapter); | ||
2080 | } | ||
2081 | #endif | ||
2062 | } | 2082 | } |
2063 | 2083 | ||
2064 | static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) | 2084 | static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) |
@@ -2113,7 +2133,7 @@ static int ixgbe_poll(struct napi_struct *napi, int budget) | |||
2113 | struct ixgbe_adapter *adapter = q_vector->adapter; | 2133 | struct ixgbe_adapter *adapter = q_vector->adapter; |
2114 | int tx_cleaned = 0, work_done = 0; | 2134 | int tx_cleaned = 0, work_done = 0; |
2115 | 2135 | ||
2116 | #ifdef CONFIG_DCA | 2136 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
2117 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { | 2137 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { |
2118 | ixgbe_update_tx_dca(adapter, adapter->tx_ring); | 2138 | ixgbe_update_tx_dca(adapter, adapter->tx_ring); |
2119 | ixgbe_update_rx_dca(adapter, adapter->rx_ring); | 2139 | ixgbe_update_rx_dca(adapter, adapter->rx_ring); |
@@ -3677,7 +3697,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
3677 | if (err) | 3697 | if (err) |
3678 | goto err_register; | 3698 | goto err_register; |
3679 | 3699 | ||
3680 | #ifdef CONFIG_DCA | 3700 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
3681 | if (dca_add_requester(&pdev->dev) == 0) { | 3701 | if (dca_add_requester(&pdev->dev) == 0) { |
3682 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; | 3702 | adapter->flags |= IXGBE_FLAG_DCA_ENABLED; |
3683 | /* always use CB2 mode, difference is masked | 3703 | /* always use CB2 mode, difference is masked |
@@ -3727,7 +3747,7 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
3727 | 3747 | ||
3728 | flush_scheduled_work(); | 3748 | flush_scheduled_work(); |
3729 | 3749 | ||
3730 | #ifdef CONFIG_DCA | 3750 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
3731 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { | 3751 | if (adapter->flags & IXGBE_FLAG_DCA_ENABLED) { |
3732 | adapter->flags &= ~IXGBE_FLAG_DCA_ENABLED; | 3752 | adapter->flags &= ~IXGBE_FLAG_DCA_ENABLED; |
3733 | dca_remove_requester(&pdev->dev); | 3753 | dca_remove_requester(&pdev->dev); |
@@ -3860,7 +3880,7 @@ static int __init ixgbe_init_module(void) | |||
3860 | 3880 | ||
3861 | printk(KERN_INFO "%s: %s\n", ixgbe_driver_name, ixgbe_copyright); | 3881 | printk(KERN_INFO "%s: %s\n", ixgbe_driver_name, ixgbe_copyright); |
3862 | 3882 | ||
3863 | #ifdef CONFIG_DCA | 3883 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
3864 | dca_register_notify(&dca_notifier); | 3884 | dca_register_notify(&dca_notifier); |
3865 | 3885 | ||
3866 | #endif | 3886 | #endif |
@@ -3877,13 +3897,13 @@ module_init(ixgbe_init_module); | |||
3877 | **/ | 3897 | **/ |
3878 | static void __exit ixgbe_exit_module(void) | 3898 | static void __exit ixgbe_exit_module(void) |
3879 | { | 3899 | { |
3880 | #ifdef CONFIG_DCA | 3900 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
3881 | dca_unregister_notify(&dca_notifier); | 3901 | dca_unregister_notify(&dca_notifier); |
3882 | #endif | 3902 | #endif |
3883 | pci_unregister_driver(&ixgbe_driver); | 3903 | pci_unregister_driver(&ixgbe_driver); |
3884 | } | 3904 | } |
3885 | 3905 | ||
3886 | #ifdef CONFIG_DCA | 3906 | #if defined(CONFIG_DCA) || defined (CONFIG_DCA_MODULE) |
3887 | static int ixgbe_notify_dca(struct notifier_block *nb, unsigned long event, | 3907 | static int ixgbe_notify_dca(struct notifier_block *nb, unsigned long event, |
3888 | void *p) | 3908 | void *p) |
3889 | { | 3909 | { |
@@ -3894,7 +3914,7 @@ static int ixgbe_notify_dca(struct notifier_block *nb, unsigned long event, | |||
3894 | 3914 | ||
3895 | return ret_val ? NOTIFY_BAD : NOTIFY_DONE; | 3915 | return ret_val ? NOTIFY_BAD : NOTIFY_DONE; |
3896 | } | 3916 | } |
3897 | #endif /* CONFIG_DCA */ | 3917 | #endif /* CONFIG_DCA or CONFIG_DCA_MODULE */ |
3898 | 3918 | ||
3899 | module_exit(ixgbe_exit_module); | 3919 | module_exit(ixgbe_exit_module); |
3900 | 3920 | ||