diff options
author | Somnath Kotur <somnath.kotur@emulex.com> | 2013-05-01 23:37:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-02 16:43:34 -0400 |
commit | c2bba3dfc16e625e73f986a21110cb784cddd30a (patch) | |
tree | 814b14a06137f9640db7d1798f06ec887d6c851c | |
parent | 04d3d6247fa39d4ee6488f1bd5314879ab9d5c9d (diff) |
be2net: Fix to fail probe if MSI-X enable fails for a VF
As per SPEC, INTx mode is not supported on VFs. So if enable_msix fails,
then just fail probe. Also bail out of be_open if irq_register fails.
Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index e6b5c4cd8c0c..6c52a60dcdb7 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -2390,7 +2390,7 @@ static uint be_num_rss_want(struct be_adapter *adapter) | |||
2390 | return num; | 2390 | return num; |
2391 | } | 2391 | } |
2392 | 2392 | ||
2393 | static void be_msix_enable(struct be_adapter *adapter) | 2393 | static int be_msix_enable(struct be_adapter *adapter) |
2394 | { | 2394 | { |
2395 | #define BE_MIN_MSIX_VECTORS 1 | 2395 | #define BE_MIN_MSIX_VECTORS 1 |
2396 | int i, status, num_vec, num_roce_vec = 0; | 2396 | int i, status, num_vec, num_roce_vec = 0; |
@@ -2415,13 +2415,17 @@ static void be_msix_enable(struct be_adapter *adapter) | |||
2415 | goto done; | 2415 | goto done; |
2416 | } else if (status >= BE_MIN_MSIX_VECTORS) { | 2416 | } else if (status >= BE_MIN_MSIX_VECTORS) { |
2417 | num_vec = status; | 2417 | num_vec = status; |
2418 | if (pci_enable_msix(adapter->pdev, adapter->msix_entries, | 2418 | status = pci_enable_msix(adapter->pdev, adapter->msix_entries, |
2419 | num_vec) == 0) | 2419 | num_vec); |
2420 | if (!status) | ||
2420 | goto done; | 2421 | goto done; |
2421 | } | 2422 | } |
2422 | 2423 | ||
2423 | dev_warn(dev, "MSIx enable failed\n"); | 2424 | dev_warn(dev, "MSIx enable failed\n"); |
2424 | return; | 2425 | /* INTx is not supported in VFs, so fail probe if enable_msix fails */ |
2426 | if (!be_physfn(adapter)) | ||
2427 | return status; | ||
2428 | return 0; | ||
2425 | done: | 2429 | done: |
2426 | if (be_roce_supported(adapter)) { | 2430 | if (be_roce_supported(adapter)) { |
2427 | if (num_vec > num_roce_vec) { | 2431 | if (num_vec > num_roce_vec) { |
@@ -2435,7 +2439,7 @@ done: | |||
2435 | } else | 2439 | } else |
2436 | adapter->num_msix_vec = num_vec; | 2440 | adapter->num_msix_vec = num_vec; |
2437 | dev_info(dev, "enabled %d MSI-x vector(s)\n", adapter->num_msix_vec); | 2441 | dev_info(dev, "enabled %d MSI-x vector(s)\n", adapter->num_msix_vec); |
2438 | return; | 2442 | return 0; |
2439 | } | 2443 | } |
2440 | 2444 | ||
2441 | static inline int be_msix_vec_get(struct be_adapter *adapter, | 2445 | static inline int be_msix_vec_get(struct be_adapter *adapter, |
@@ -2646,7 +2650,9 @@ static int be_open(struct net_device *netdev) | |||
2646 | if (status) | 2650 | if (status) |
2647 | goto err; | 2651 | goto err; |
2648 | 2652 | ||
2649 | be_irq_register(adapter); | 2653 | status = be_irq_register(adapter); |
2654 | if (status) | ||
2655 | goto err; | ||
2650 | 2656 | ||
2651 | for_all_rx_queues(adapter, rxo, i) | 2657 | for_all_rx_queues(adapter, rxo, i) |
2652 | be_cq_notify(adapter, rxo->cq.id, true, 0); | 2658 | be_cq_notify(adapter, rxo->cq.id, true, 0); |
@@ -3116,7 +3122,9 @@ static int be_setup(struct be_adapter *adapter) | |||
3116 | if (status) | 3122 | if (status) |
3117 | goto err; | 3123 | goto err; |
3118 | 3124 | ||
3119 | be_msix_enable(adapter); | 3125 | status = be_msix_enable(adapter); |
3126 | if (status) | ||
3127 | goto err; | ||
3120 | 3128 | ||
3121 | status = be_evt_queues_create(adapter); | 3129 | status = be_evt_queues_create(adapter); |
3122 | if (status) | 3130 | if (status) |