Commit 374a542d authored by Matthew Vick's avatar Matthew Vick Committed by Jeff Kirsher

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: default avatarMatthew Vick <matthew.vick@intel.com>
Tested-by: default avatarJeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent cb41145e
......@@ -65,13 +65,10 @@ struct igb_adapter;
#define MAX_Q_VECTORS 8
/* Transmit and receive queues */
#define IGB_MAX_RX_QUEUES ((adapter->vfs_allocated_count ? 2 : \
(hw->mac.type > e1000_82575 ? 8 : 4)))
#define IGB_MAX_RX_QUEUES_I210 4
#define IGB_MAX_RX_QUEUES 8
#define IGB_MAX_RX_QUEUES_82575 4
#define IGB_MAX_RX_QUEUES_I211 2
#define IGB_MAX_TX_QUEUES 16
#define IGB_MAX_TX_QUEUES_I210 4
#define IGB_MAX_TX_QUEUES_I211 2
#define IGB_MAX_TX_QUEUES 8
#define IGB_MAX_VF_MC_ENTRIES 30
#define IGB_MAX_VF_FUNCTIONS 8
#define IGB_MAX_VFTA_ENTRIES 128
......
......@@ -1048,11 +1048,6 @@ static int igb_set_interrupt_capability(struct igb_adapter *adapter)
if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS))
numvecs += adapter->num_tx_queues;
/* i210 and i211 can only have 4 MSIX vectors for rx/tx queues. */
if ((adapter->hw.mac.type == e1000_i210)
|| (adapter->hw.mac.type == e1000_i211))
numvecs = 4;
/* store the number of vectors reserved for queues */
adapter->num_q_vectors = numvecs;
......@@ -2338,6 +2333,7 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
struct e1000_hw *hw = &adapter->hw;
struct net_device *netdev = adapter->netdev;
struct pci_dev *pdev = adapter->pdev;
u32 max_rss_queues;
pci_read_config_word(pdev, PCI_COMMAND, &hw->bus.pci_cmd_word);
......@@ -2370,40 +2366,69 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
} else
adapter->vfs_allocated_count = max_vfs;
break;
case e1000_i210:
case e1000_i211:
adapter->vfs_allocated_count = 0;
break;
default:
break;
}
#endif /* CONFIG_PCI_IOV */
/* Determine the maximum number of RSS queues supported. */
switch (hw->mac.type) {
case e1000_i211:
max_rss_queues = IGB_MAX_RX_QUEUES_I211;
break;
case e1000_82575:
case e1000_i210:
adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I210,
num_online_cpus());
max_rss_queues = IGB_MAX_RX_QUEUES_82575;
break;
case e1000_i350:
/* I350 cannot do RSS and SR-IOV at the same time */
if (!!adapter->vfs_allocated_count) {
max_rss_queues = 1;
break;
}
/* fall through */
case e1000_82576:
if (!!adapter->vfs_allocated_count) {
max_rss_queues = 2;
break;
}
/* fall through */
case e1000_82580:
default:
max_rss_queues = IGB_MAX_RX_QUEUES;
break;
}
adapter->rss_queues = min_t(u32, max_rss_queues, num_online_cpus());
/* Determine if we need to pair queues. */
switch (hw->mac.type) {
case e1000_82575:
case e1000_i211:
adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES_I211,
num_online_cpus());
/* Device supports enough interrupts without queue pairing. */
break;
case e1000_82576:
/*
* If VFs are going to be allocated with RSS queues then we
* should pair the queues in order to conserve interrupts due
* to limited supply.
*/
if ((adapter->rss_queues > 1) &&
(adapter->vfs_allocated_count > 6))
adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
/* fall through */
case e1000_82580:
case e1000_i350:
case e1000_i210:
default:
adapter->rss_queues = min_t(u32, IGB_MAX_RX_QUEUES,
num_online_cpus());
/*
* If rss_queues > half of max_rss_queues, pair the queues in
* order to conserve interrupts due to limited supply.
*/
if (adapter->rss_queues > (max_rss_queues / 2))
adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
break;
}
/* i350 cannot do RSS and SR-IOV at the same time */
if (hw->mac.type == e1000_i350 && adapter->vfs_allocated_count)
adapter->rss_queues = 1;
/*
* if rss_queues > 4 or vfs are going to be allocated with rss_queues
* then we should combine the queues into a queue pair in order to
* conserve interrupts due to limited supply
*/
if ((adapter->rss_queues > 4) ||
((adapter->rss_queues > 1) && (adapter->vfs_allocated_count > 6)))
adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
/* Setup and initialize a copy of the hw vlan table array */
adapter->shadow_vfta = kzalloc(sizeof(u32) *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment