aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-11-12 13:37:19 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-13 23:46:50 -0500
commita99955fc067f57cf3b627d4c74bf7952a2d51029 (patch)
tree9c70e2a346be40b9d16b861c9f619e2cd6687948 /drivers/net
parent115f459a53b0c56a699a76b34b82507452eb3df5 (diff)
igb: when number of CPUs > 4 combine tx/rx queues to allow more queues
This patch makes it so that nics such as 82576 and newer can support more hardware queues when there are more than 4 cpus by combining a tx/rx queue pair onto one interrupt so that 8 queue pairs can be supported and thus allow for more queues. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/igb/igb.h9
-rw-r--r--drivers/net/igb/igb_main.c31
2 files changed, 27 insertions, 13 deletions
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index 3298f5a11dab..2bb95494377d 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -59,10 +59,10 @@ struct igb_adapter;
59#define MAX_Q_VECTORS 8 59#define MAX_Q_VECTORS 8
60 60
61/* Transmit and receive queues */ 61/* Transmit and receive queues */
62#define IGB_MAX_RX_QUEUES (adapter->vfs_allocated_count ? \ 62#define IGB_MAX_RX_QUEUES (adapter->vfs_allocated_count ? 2 : \
63 (adapter->vfs_allocated_count > 6 ? 1 : 2) : 4) 63 (hw->mac.type > e1000_82575 ? 8 : 4))
64#define IGB_MAX_TX_QUEUES IGB_MAX_RX_QUEUES 64#define IGB_ABS_MAX_TX_QUEUES 8
65#define IGB_ABS_MAX_TX_QUEUES 4 65#define IGB_MAX_TX_QUEUES IGB_MAX_RX_QUEUES
66 66
67#define IGB_MAX_VF_MC_ENTRIES 30 67#define IGB_MAX_VF_MC_ENTRIES 30
68#define IGB_MAX_VF_FUNCTIONS 8 68#define IGB_MAX_VF_FUNCTIONS 8
@@ -315,6 +315,7 @@ struct igb_adapter {
315 u16 rx_ring_count; 315 u16 rx_ring_count;
316 unsigned int vfs_allocated_count; 316 unsigned int vfs_allocated_count;
317 struct vf_data_storage *vf_data; 317 struct vf_data_storage *vf_data;
318 u32 rss_queues;
318}; 319};
319 320
320#define IGB_FLAG_HAS_MSI (1 << 0) 321#define IGB_FLAG_HAS_MSI (1 << 0)
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index d72d48476103..0235220a1d29 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -296,10 +296,10 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
296 * and continue consuming queues in the same sequence 296 * and continue consuming queues in the same sequence
297 */ 297 */
298 if (adapter->vfs_allocated_count) { 298 if (adapter->vfs_allocated_count) {
299 for (; i < adapter->num_rx_queues; i++) 299 for (; i < adapter->rss_queues; i++)
300 adapter->rx_ring[i].reg_idx = rbase_offset + 300 adapter->rx_ring[i].reg_idx = rbase_offset +
301 Q_IDX_82576(i); 301 Q_IDX_82576(i);
302 for (; j < adapter->num_tx_queues; j++) 302 for (; j < adapter->rss_queues; j++)
303 adapter->tx_ring[j].reg_idx = rbase_offset + 303 adapter->tx_ring[j].reg_idx = rbase_offset +
304 Q_IDX_82576(j); 304 Q_IDX_82576(j);
305 } 305 }
@@ -618,14 +618,15 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)
618 int numvecs, i; 618 int numvecs, i;
619 619
620 /* Number of supported queues. */ 620 /* Number of supported queues. */
621 adapter->num_rx_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus()); 621 adapter->num_rx_queues = adapter->rss_queues;
622 adapter->num_tx_queues = min_t(u32, IGB_MAX_TX_QUEUES, num_online_cpus()); 622 adapter->num_tx_queues = adapter->rss_queues;
623 623
624 /* start with one vector for every rx queue */ 624 /* start with one vector for every rx queue */
625 numvecs = adapter->num_rx_queues; 625 numvecs = adapter->num_rx_queues;
626 626
627 /* if tx handler is seperate add 1 for every tx queue */ 627 /* if tx handler is seperate add 1 for every tx queue */
628 numvecs += adapter->num_tx_queues; 628 if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS))
629 numvecs += adapter->num_tx_queues;
629 630
630 /* store the number of vectors reserved for queues */ 631 /* store the number of vectors reserved for queues */
631 adapter->num_q_vectors = numvecs; 632 adapter->num_q_vectors = numvecs;
@@ -666,6 +667,7 @@ msi_only:
666 } 667 }
667#endif 668#endif
668 adapter->vfs_allocated_count = 0; 669 adapter->vfs_allocated_count = 0;
670 adapter->rss_queues = 1;
669 adapter->flags |= IGB_FLAG_QUEUE_PAIRS; 671 adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
670 adapter->num_rx_queues = 1; 672 adapter->num_rx_queues = 1;
671 adapter->num_tx_queues = 1; 673 adapter->num_tx_queues = 1;
@@ -1824,6 +1826,17 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
1824 adapter->vfs_allocated_count = max_vfs; 1826 adapter->vfs_allocated_count = max_vfs;
1825 1827
1826#endif /* CONFIG_PCI_IOV */ 1828#endif /* CONFIG_PCI_IOV */
1829 adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus());
1830
1831 /*
1832 * if rss_queues > 4 or vfs are going to be allocated with rss_queues
1833 * then we should combine the queues into a queue pair in order to
1834 * conserve interrupts due to limited supply
1835 */
1836 if ((adapter->rss_queues > 4) ||
1837 ((adapter->rss_queues > 1) && (adapter->vfs_allocated_count > 6)))
1838 adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
1839
1827 /* This call may decrease the number of queues */ 1840 /* This call may decrease the number of queues */
1828 if (igb_init_interrupt_scheme(adapter)) { 1841 if (igb_init_interrupt_scheme(adapter)) {
1829 dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); 1842 dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
@@ -2015,7 +2028,7 @@ static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
2015 } 2028 }
2016 } 2029 }
2017 2030
2018 for (i = 0; i < IGB_MAX_TX_QUEUES; i++) { 2031 for (i = 0; i < IGB_ABS_MAX_TX_QUEUES; i++) {
2019 int r_idx = i % adapter->num_tx_queues; 2032 int r_idx = i % adapter->num_tx_queues;
2020 adapter->multi_tx_table[i] = &adapter->tx_ring[r_idx]; 2033 adapter->multi_tx_table[i] = &adapter->tx_ring[r_idx];
2021 } 2034 }
@@ -2199,7 +2212,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
2199 array_wr32(E1000_RSSRK(0), j, rsskey); 2212 array_wr32(E1000_RSSRK(0), j, rsskey);
2200 } 2213 }
2201 2214
2202 num_rx_queues = adapter->num_rx_queues; 2215 num_rx_queues = adapter->rss_queues;
2203 2216
2204 if (adapter->vfs_allocated_count) { 2217 if (adapter->vfs_allocated_count) {
2205 /* 82575 and 82576 supports 2 RSS queues for VMDq */ 2218 /* 82575 and 82576 supports 2 RSS queues for VMDq */
@@ -2255,7 +2268,7 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
2255 E1000_VT_CTL_DEFAULT_POOL_SHIFT; 2268 E1000_VT_CTL_DEFAULT_POOL_SHIFT;
2256 wr32(E1000_VT_CTL, vtctl); 2269 wr32(E1000_VT_CTL, vtctl);
2257 } 2270 }
2258 if (adapter->num_rx_queues > 1) 2271 if (adapter->rss_queues > 1)
2259 mrqc = E1000_MRQC_ENABLE_VMDQ_RSS_2Q; 2272 mrqc = E1000_MRQC_ENABLE_VMDQ_RSS_2Q;
2260 else 2273 else
2261 mrqc = E1000_MRQC_ENABLE_VMDQ; 2274 mrqc = E1000_MRQC_ENABLE_VMDQ;
@@ -2385,7 +2398,7 @@ static inline void igb_set_vmolr(struct igb_adapter *adapter, int vfn)
2385 /* clear all bits that might not be set */ 2398 /* clear all bits that might not be set */
2386 vmolr &= ~(E1000_VMOLR_BAM | E1000_VMOLR_RSSE); 2399 vmolr &= ~(E1000_VMOLR_BAM | E1000_VMOLR_RSSE);
2387 2400
2388 if (adapter->num_rx_queues > 1 && vfn == adapter->vfs_allocated_count) 2401 if (adapter->rss_queues > 1 && vfn == adapter->vfs_allocated_count)
2389 vmolr |= E1000_VMOLR_RSSE; /* enable RSS */ 2402 vmolr |= E1000_VMOLR_RSSE; /* enable RSS */
2390 /* 2403 /*
2391 * for VMDq only allow the VFs and pool 0 to accept broadcast and 2404 * for VMDq only allow the VFs and pool 0 to accept broadcast and