Browse Source

cxgb4: move the choice of interrupt type before net_device registration

We need to settle on the kind of interrupts we'll be using, a choice that
also impacts the number of queues, before registering and making visible
the net_devices.  Move the relevant code up a bit.

Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Dimitris Michailidis 15 years ago
parent
commit
f7cabcdd51
1 changed files with 7 additions and 6 deletions
  1. 7 6
      drivers/net/cxgb4/cxgb4_main.c

+ 7 - 6
drivers/net/cxgb4/cxgb4_main.c

@@ -3507,6 +3507,12 @@ static int __devinit init_one(struct pci_dev *pdev,
 		adapter->params.offload = 0;
 		adapter->params.offload = 0;
 	}
 	}
 
 
+	/* See what interrupts we'll be using */
+	if (msi > 1 && enable_msix(adapter) == 0)
+		adapter->flags |= USING_MSIX;
+	else if (msi > 0 && pci_enable_msi(pdev) == 0)
+		adapter->flags |= USING_MSI;
+
 	/*
 	/*
 	 * The card is now ready to go.  If any errors occur during device
 	 * The card is now ready to go.  If any errors occur during device
 	 * registration we do not fail the whole card but rather proceed only
 	 * registration we do not fail the whole card but rather proceed only
@@ -3542,12 +3548,6 @@ static int __devinit init_one(struct pci_dev *pdev,
 		setup_debugfs(adapter);
 		setup_debugfs(adapter);
 	}
 	}
 
 
-	/* See what interrupts we'll be using */
-	if (msi > 1 && enable_msix(adapter) == 0)
-		adapter->flags |= USING_MSIX;
-	else if (msi > 0 && pci_enable_msi(pdev) == 0)
-		adapter->flags |= USING_MSI;
-
 	if (is_offload(adapter))
 	if (is_offload(adapter))
 		attach_ulds(adapter);
 		attach_ulds(adapter);
 
 
@@ -3571,6 +3571,7 @@ sriov:
 			free_netdev(adapter->port[i]);
 			free_netdev(adapter->port[i]);
 	if (adapter->flags & FW_OK)
 	if (adapter->flags & FW_OK)
 		t4_fw_bye(adapter, 0);
 		t4_fw_bye(adapter, 0);
+	disable_msi(adapter);
  out_unmap_bar:
  out_unmap_bar:
 	iounmap(adapter->regs);
 	iounmap(adapter->regs);
  out_free_adapter:
  out_free_adapter: