aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatthew Vick <matthew.vick@intel.com>2012-05-18 00:54:58 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-06-20 04:35:27 -0400
commit374a542dee0a10c5f81edc2af17a97b06805ecd9 (patch)
tree623580b3b0856a4fb44f17f4c79fbbfc1d7da65a /drivers
parentcb41145ee78585282af56a9203f391c0d84366b1 (diff)
igb: Streamline RSS queue and queue pairing assignment logic.
Rather than spread out the complexity of the RSS queue and queue pairing assignment logic, place it all in one location for simplicity and readability. Signed-off-by: Matthew Vick <matthew.vick@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h9
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c79
2 files changed, 55 insertions, 33 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index ae6d3f393a54..3ced7b546f7f 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -65,13 +65,10 @@ struct igb_adapter;
65#define MAX_Q_VECTORS 8 65#define MAX_Q_VECTORS 8
66 66
67/* Transmit and receive queues */ 67/* Transmit and receive queues */
68#define IGB_MAX_RX_QUEUES ((adapter->vfs_allocated_count ? 2 : \ 68#define IGB_MAX_RX_QUEUES 8
69 (hw->mac.type > e1000_82575 ? 8 : 4))) 69#define IGB_MAX_RX_QUEUES_82575 4
70#define IGB_MAX_RX_QUEUES_I210 4
71#define IGB_MAX_RX_QUEUES_I211 2 70#define IGB_MAX_RX_QUEUES_I211 2
72#define IGB_MAX_TX_QUEUES 16 71#define IGB_MAX_TX_QUEUES 8
73#define IGB_MAX_TX_QUEUES_I210 4
74#define IGB_MAX_TX_QUEUES_I211 2
75#define IGB_MAX_VF_MC_ENTRIES 30 72#define IGB_MAX_VF_MC_ENTRIES 30
76#define IGB_MAX_VF_FUNCTIONS 8 73#define IGB_MAX_VF_FUNCTIONS 8
77#define IGB_MAX_VFTA_ENTRIES 128 74#define IGB_MAX_VFTA_ENTRIES 128
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 64090549722d..a7c9c5d77e0b 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1048,11 +1048,6 @@ static int igb_set_interrupt_capability(struct igb_adapter *adapter)
1048 if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS)) 1048 if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS))
1049 numvecs += adapter->num_tx_queues; 1049 numvecs += adapter->num_tx_queues;
1050 1050
1051 /* i210 and i211 can only have 4 MSIX vectors for rx/tx queues. */
1052 if ((adapter->hw.mac.type == e1000_i210)
1053 || (adapter->hw.mac.type == e1000_i211))
1054 numvecs = 4;
1055
1056 /* store the number of vectors reserved for queues */ 1051 /* store the number of vectors reserved for queues */
1057 adapter->num_q_vectors = numvecs; 1052 adapter->num_q_vectors = numvecs;
1058 1053
@@ -2338,6 +2333,7 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
2338 struct e1000_hw *hw = &adapter->hw; 2333 struct e1000_hw *hw = &adapter->hw;
2339 struct net_device *netdev = adapter->netdev; 2334 struct net_device *netdev = adapter->netdev;
2340 struct pci_dev *pdev = adapter->pdev; 2335 struct pci_dev *pdev = adapter->pdev;
2336 u32 max_rss_queues;
2341 2337
2342 pci_read_config_word(pdev, PCI_COMMAND, &hw->bus.pci_cmd_word); 2338 pci_read_config_word(pdev, PCI_COMMAND, &hw->bus.pci_cmd_word);
2343 2339
@@ -2370,40 +2366,69 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
2370 } else 2366 } else
2371 adapter->vfs_allocated_count = max_vfs; 2367 adapter->vfs_allocated_count = max_vfs;
2372 break; 2368 break;
2373 case e1000_i210:
2374 case e1000_i211:
2375 adapter->vfs_allocated_count = 0;
2376 break;
2377 default: 2369 default:
2378 break; 2370 break;
2379 } 2371 }
2380#endif /* CONFIG_PCI_IOV */ 2372#endif /* CONFIG_PCI_IOV */
2373
2374 /* Determine the maximum number of RSS queues supported. */
2381 switch (hw->mac.type) { 2375 switch (hw->mac.type) {
2376 case e1000_i211:
2377 max_rss_queues = IGB_MAX_RX_QUEUES_I211;
2378 break;
2379 case e1000_82575:
2382 case e1000_i210: 2380 case e1000_i210:
2383 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I210, 2381 max_rss_queues = IGB_MAX_RX_QUEUES_82575;
2384 num_online_cpus()); 2382 break;
2383 case e1000_i350:
2384 /* I350 cannot do RSS and SR-IOV at the same time */
2385 if (!!adapter->vfs_allocated_count) {
2386 max_rss_queues = 1;
2387 break;
2388 }
2389 /* fall through */
2390 case e1000_82576:
2391 if (!!adapter->vfs_allocated_count) {
2392 max_rss_queues = 2;
2393 break;
2394 }
2395 /* fall through */
2396 case e1000_82580:
2397 default:
2398 max_rss_queues = IGB_MAX_RX_QUEUES;
2385 break; 2399 break;
2400 }
2401
2402 adapter->rss_queues = min_t(u32, max_rss_queues, num_online_cpus());
2403
2404 /* Determine if we need to pair queues. */
2405 switch (hw->mac.type) {
2406 case e1000_82575:
2386 case e1000_i211: 2407 case e1000_i211:
2387 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I211, 2408 /* Device supports enough interrupts without queue pairing. */
2388 num_online_cpus());
2389 break; 2409 break;
2410 case e1000_82576:
2411 /*
2412 * If VFs are going to be allocated with RSS queues then we
2413 * should pair the queues in order to conserve interrupts due
2414 * to limited supply.
2415 */
2416 if ((adapter->rss_queues > 1) &&
2417 (adapter->vfs_allocated_count > 6))
2418 adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
2419 /* fall through */
2420 case e1000_82580:
2421 case e1000_i350:
2422 case e1000_i210:
2390 default: 2423 default:
2391 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, 2424 /*
2392 num_online_cpus()); 2425 * If rss_queues > half of max_rss_queues, pair the queues in
2426 * order to conserve interrupts due to limited supply.
2427 */
2428 if (adapter->rss_queues > (max_rss_queues / 2))
2429 adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
2393 break; 2430 break;
2394 } 2431 }
2395 /* i350 cannot do RSS and SR-IOV at the same time */
2396 if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count)
2397 adapter->rss_queues = 1;
2398
2399 /*
2400 * if rss_queues > 4 or vfs are going to be allocated with rss_queues
2401 * then we should combine the queues into a queue pair in order to
2402 * conserve interrupts due to limited supply
2403 */
2404 if ((adapter->rss_queues > 4) ||
2405 ((adapter->rss_queues > 1) && (adapter->vfs_allocated_count > 6)))
2406 adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
2407 2432
2408 /* Setup and initialize a copy of the hw vlan table array */ 2433 /* Setup and initialize a copy of the hw vlan table array */
2409 adapter->shadow_vfta = kzalloc(sizeof(u32) * 2434 adapter->shadow_vfta = kzalloc(sizeof(u32) *