|
@@ -803,7 +803,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
|
|
|
msixbm = E1000_EICR_RX_QUEUE0 << rx_queue;
|
|
|
if (tx_queue > IGB_N0_QUEUE)
|
|
|
msixbm |= E1000_EICR_TX_QUEUE0 << tx_queue;
|
|
|
- if (!adapter->msix_entries && msix_vector == 0)
|
|
|
+ if (!(adapter->flags & IGB_FLAG_HAS_MSIX) && msix_vector == 0)
|
|
|
msixbm |= E1000_EIMS_OTHER;
|
|
|
array_wr32(E1000_MSIXBM(0), msix_vector, msixbm);
|
|
|
q_vector->eims_value = msixbm;
|
|
@@ -1028,13 +1028,10 @@ static void igb_reset_interrupt_capability(struct igb_adapter *adapter)
|
|
|
{
|
|
|
int v_idx = adapter->num_q_vectors;
|
|
|
|
|
|
- if (adapter->msix_entries) {
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX)
|
|
|
pci_disable_msix(adapter->pdev);
|
|
|
- kfree(adapter->msix_entries);
|
|
|
- adapter->msix_entries = NULL;
|
|
|
- } else if (adapter->flags & IGB_FLAG_HAS_MSI) {
|
|
|
+ else if (adapter->flags & IGB_FLAG_HAS_MSI)
|
|
|
pci_disable_msi(adapter->pdev);
|
|
|
- }
|
|
|
|
|
|
while (v_idx--)
|
|
|
igb_reset_q_vector(adapter, v_idx);
|
|
@@ -1090,6 +1087,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
|
|
|
|
|
|
if (!msix)
|
|
|
goto msi_only;
|
|
|
+ adapter->flags |= IGB_FLAG_HAS_MSIX;
|
|
|
|
|
|
/* Number of supported queues. */
|
|
|
adapter->num_rx_queues = adapter->rss_queues;
|
|
@@ -1110,12 +1108,6 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
|
|
|
|
|
|
/* add 1 vector for link status interrupts */
|
|
|
numvecs++;
|
|
|
- adapter->msix_entries = kcalloc(numvecs, sizeof(struct msix_entry),
|
|
|
- GFP_KERNEL);
|
|
|
-
|
|
|
- if (!adapter->msix_entries)
|
|
|
- goto msi_only;
|
|
|
-
|
|
|
for (i = 0; i < numvecs; i++)
|
|
|
adapter->msix_entries[i].entry = i;
|
|
|
|
|
@@ -1392,7 +1384,7 @@ static int igb_request_irq(struct igb_adapter *adapter)
|
|
|
struct pci_dev *pdev = adapter->pdev;
|
|
|
int err = 0;
|
|
|
|
|
|
- if (adapter->msix_entries) {
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX) {
|
|
|
err = igb_request_msix(adapter);
|
|
|
if (!err)
|
|
|
goto request_done;
|
|
@@ -1436,7 +1428,7 @@ request_done:
|
|
|
|
|
|
static void igb_free_irq(struct igb_adapter *adapter)
|
|
|
{
|
|
|
- if (adapter->msix_entries) {
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX) {
|
|
|
int vector = 0, i;
|
|
|
|
|
|
free_irq(adapter->msix_entries[vector++].vector, adapter);
|
|
@@ -1461,7 +1453,7 @@ static void igb_irq_disable(struct igb_adapter *adapter)
|
|
|
* mapped into these registers and so clearing the bits can cause
|
|
|
* issues on the VF drivers so we only need to clear what we set
|
|
|
*/
|
|
|
- if (adapter->msix_entries) {
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX) {
|
|
|
u32 regval = rd32(E1000_EIAM);
|
|
|
wr32(E1000_EIAM, regval & ~adapter->eims_enable_mask);
|
|
|
wr32(E1000_EIMC, adapter->eims_enable_mask);
|
|
@@ -1472,7 +1464,7 @@ static void igb_irq_disable(struct igb_adapter *adapter)
|
|
|
wr32(E1000_IAM, 0);
|
|
|
wr32(E1000_IMC, ~0);
|
|
|
wrfl();
|
|
|
- if (adapter->msix_entries) {
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX) {
|
|
|
int i;
|
|
|
for (i = 0; i < adapter->num_q_vectors; i++)
|
|
|
synchronize_irq(adapter->msix_entries[i].vector);
|
|
@@ -1489,7 +1481,7 @@ static void igb_irq_enable(struct igb_adapter *adapter)
|
|
|
{
|
|
|
struct e1000_hw *hw = &adapter->hw;
|
|
|
|
|
|
- if (adapter->msix_entries) {
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX) {
|
|
|
u32 ims = E1000_IMS_LSC | E1000_IMS_DOUTSYNC | E1000_IMS_DRSTA;
|
|
|
u32 regval = rd32(E1000_EIAC);
|
|
|
wr32(E1000_EIAC, regval | adapter->eims_enable_mask);
|
|
@@ -1712,7 +1704,7 @@ int igb_up(struct igb_adapter *adapter)
|
|
|
for (i = 0; i < adapter->num_q_vectors; i++)
|
|
|
napi_enable(&(adapter->q_vector[i]->napi));
|
|
|
|
|
|
- if (adapter->msix_entries)
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX)
|
|
|
igb_configure_msix(adapter);
|
|
|
else
|
|
|
igb_assign_vector(adapter->q_vector[0], 0);
|
|
@@ -2565,7 +2557,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
|
dev_info(&pdev->dev, "%s: PBA No: %s\n", netdev->name, part_str);
|
|
|
dev_info(&pdev->dev,
|
|
|
"Using %s interrupts. %d rx queue(s), %d tx queue(s)\n",
|
|
|
- adapter->msix_entries ? "MSI-X" :
|
|
|
+ (adapter->flags & IGB_FLAG_HAS_MSIX) ? "MSI-X" :
|
|
|
(adapter->flags & IGB_FLAG_HAS_MSI) ? "MSI" : "legacy",
|
|
|
adapter->num_rx_queues, adapter->num_tx_queues);
|
|
|
switch (hw->mac.type) {
|
|
@@ -2653,7 +2645,7 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
|
|
|
int err = 0;
|
|
|
int i;
|
|
|
|
|
|
- if (!adapter->msix_entries || num_vfs > 7) {
|
|
|
+ if (!(adapter->flags & IGB_FLAG_HAS_MSIX) || num_vfs > 7) {
|
|
|
err = -EPERM;
|
|
|
goto out;
|
|
|
}
|
|
@@ -4273,7 +4265,7 @@ static void igb_watchdog_task(struct work_struct *work)
|
|
|
}
|
|
|
|
|
|
/* Cause software interrupt to ensure Rx ring is cleaned */
|
|
|
- if (adapter->msix_entries) {
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX) {
|
|
|
u32 eics = 0;
|
|
|
for (i = 0; i < adapter->num_q_vectors; i++)
|
|
|
eics |= adapter->q_vector[i]->eims_value;
|
|
@@ -6194,7 +6186,7 @@ static void igb_ring_irq_enable(struct igb_q_vector *q_vector)
|
|
|
}
|
|
|
|
|
|
if (!test_bit(__IGB_DOWN, &adapter->state)) {
|
|
|
- if (adapter->msix_entries)
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX)
|
|
|
wr32(E1000_EIMS, q_vector->eims_value);
|
|
|
else
|
|
|
igb_irq_enable(adapter);
|
|
@@ -7561,7 +7553,7 @@ static void igb_netpoll(struct net_device *netdev)
|
|
|
|
|
|
for (i = 0; i < adapter->num_q_vectors; i++) {
|
|
|
q_vector = adapter->q_vector[i];
|
|
|
- if (adapter->msix_entries)
|
|
|
+ if (adapter->flags & IGB_FLAG_HAS_MSIX)
|
|
|
wr32(E1000_EIMC, q_vector->eims_value);
|
|
|
else
|
|
|
igb_irq_disable(adapter);
|