Commit c2bba3df authored by Somnath Kotur's avatar Somnath Kotur Committed by David S. Miller

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: default avatarSomnath Kotur <somnath.kotur@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 04d3d624
...@@ -2390,7 +2390,7 @@ static uint be_num_rss_want(struct be_adapter *adapter) ...@@ -2390,7 +2390,7 @@ static uint be_num_rss_want(struct be_adapter *adapter)
return num; return num;
} }
static void be_msix_enable(struct be_adapter *adapter) static int be_msix_enable(struct be_adapter *adapter)
{ {
#define BE_MIN_MSIX_VECTORS 1 #define BE_MIN_MSIX_VECTORS 1
int i, status, num_vec, num_roce_vec = 0; int i, status, num_vec, num_roce_vec = 0;
...@@ -2415,13 +2415,17 @@ static void be_msix_enable(struct be_adapter *adapter) ...@@ -2415,13 +2415,17 @@ static void be_msix_enable(struct be_adapter *adapter)
goto done; goto done;
} else if (status >= BE_MIN_MSIX_VECTORS) { } else if (status >= BE_MIN_MSIX_VECTORS) {
num_vec = status; num_vec = status;
if (pci_enable_msix(adapter->pdev, adapter->msix_entries, status = pci_enable_msix(adapter->pdev, adapter->msix_entries,
num_vec) == 0) num_vec);
if (!status)
goto done; goto done;
} }
dev_warn(dev, "MSIx enable failed\n"); dev_warn(dev, "MSIx enable failed\n");
return; /* INTx is not supported in VFs, so fail probe if enable_msix fails */
if (!be_physfn(adapter))
return status;
return 0;
done: done:
if (be_roce_supported(adapter)) { if (be_roce_supported(adapter)) {
if (num_vec > num_roce_vec) { if (num_vec > num_roce_vec) {
...@@ -2435,7 +2439,7 @@ static void be_msix_enable(struct be_adapter *adapter) ...@@ -2435,7 +2439,7 @@ static void be_msix_enable(struct be_adapter *adapter)
} else } else
adapter->num_msix_vec = num_vec; adapter->num_msix_vec = num_vec;
dev_info(dev, "enabled %d MSI-x vector(s)\n", adapter->num_msix_vec); dev_info(dev, "enabled %d MSI-x vector(s)\n", adapter->num_msix_vec);
return; return 0;
} }
static inline int be_msix_vec_get(struct be_adapter *adapter, static inline int be_msix_vec_get(struct be_adapter *adapter,
...@@ -2646,7 +2650,9 @@ static int be_open(struct net_device *netdev) ...@@ -2646,7 +2650,9 @@ static int be_open(struct net_device *netdev)
if (status) if (status)
goto err; goto err;
be_irq_register(adapter); status = be_irq_register(adapter);
if (status)
goto err;
for_all_rx_queues(adapter, rxo, i) for_all_rx_queues(adapter, rxo, i)
be_cq_notify(adapter, rxo->cq.id, true, 0); be_cq_notify(adapter, rxo->cq.id, true, 0);
...@@ -3116,7 +3122,9 @@ static int be_setup(struct be_adapter *adapter) ...@@ -3116,7 +3122,9 @@ static int be_setup(struct be_adapter *adapter)
if (status) if (status)
goto err; goto err;
be_msix_enable(adapter); status = be_msix_enable(adapter);
if (status)
goto err;
status = be_evt_queues_create(adapter); status = be_evt_queues_create(adapter);
if (status) if (status)
......
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