Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314530
b: refs/heads/master
c: 374a542
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Vick authored and Jeff Kirsher committed Jun 20, 2012
1 parent 4ad634b commit 06a0286
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cb41145ee78585282af56a9203f391c0d84366b1
refs/heads/master: 374a542dee0a10c5f81edc2af17a97b06805ecd9
9 changes: 3 additions & 6 deletions trunk/drivers/net/ethernet/intel/igb/igb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
79 changes: 52 additions & 27 deletions trunk/drivers/net/ethernet/intel/igb/igb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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) *
Expand Down

0 comments on commit 06a0286

Please sign in to comment.