Commit c99ac3e7 authored by Ajit Khaparde's avatar Ajit Khaparde Committed by David S. Miller

be2net: Initialize and cleanup sriov resources only if pci_enable_sriov has succeeded.

Signed-off-by: default avatarAjit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 658681f7
...@@ -2277,22 +2277,26 @@ static int be_setup(struct be_adapter *adapter) ...@@ -2277,22 +2277,26 @@ static int be_setup(struct be_adapter *adapter)
goto do_none; goto do_none;
if (be_physfn(adapter)) { if (be_physfn(adapter)) {
while (vf < num_vfs) { if (adapter->sriov_enabled) {
cap_flags = en_flags = BE_IF_FLAGS_UNTAGGED while (vf < num_vfs) {
| BE_IF_FLAGS_BROADCAST; cap_flags = en_flags = BE_IF_FLAGS_UNTAGGED |
status = be_cmd_if_create(adapter, cap_flags, en_flags, BE_IF_FLAGS_BROADCAST;
mac, true, status = be_cmd_if_create(adapter, cap_flags,
en_flags, mac, true,
&adapter->vf_cfg[vf].vf_if_handle, &adapter->vf_cfg[vf].vf_if_handle,
NULL, vf+1); NULL, vf+1);
if (status) { if (status) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Interface Create failed for VF %d\n", vf); "Interface Create failed for VF %d\n",
goto if_destroy; vf);
goto if_destroy;
}
adapter->vf_cfg[vf].vf_pmac_id =
BE_INVALID_PMAC_ID;
vf++;
} }
adapter->vf_cfg[vf].vf_pmac_id = BE_INVALID_PMAC_ID;
vf++;
} }
} else if (!be_physfn(adapter)) { } else {
status = be_cmd_mac_addr_query(adapter, mac, status = be_cmd_mac_addr_query(adapter, mac,
MAC_ADDRESS_TYPE_NETWORK, false, adapter->if_handle); MAC_ADDRESS_TYPE_NETWORK, false, adapter->if_handle);
if (!status) { if (!status) {
...@@ -2313,7 +2317,7 @@ static int be_setup(struct be_adapter *adapter) ...@@ -2313,7 +2317,7 @@ static int be_setup(struct be_adapter *adapter)
if (status != 0) if (status != 0)
goto rx_qs_destroy; goto rx_qs_destroy;
if (be_physfn(adapter)) { if (be_physfn(adapter) && adapter->sriov_enabled) {
status = be_vf_eth_addr_config(adapter); status = be_vf_eth_addr_config(adapter);
if (status) if (status)
goto mcc_q_destroy; goto mcc_q_destroy;
...@@ -2332,9 +2336,10 @@ static int be_setup(struct be_adapter *adapter) ...@@ -2332,9 +2336,10 @@ static int be_setup(struct be_adapter *adapter)
tx_qs_destroy: tx_qs_destroy:
be_tx_queues_destroy(adapter); be_tx_queues_destroy(adapter);
if_destroy: if_destroy:
for (vf = 0; vf < num_vfs; vf++) if (be_physfn(adapter) && adapter->sriov_enabled)
if (adapter->vf_cfg[vf].vf_if_handle) for (vf = 0; vf < num_vfs; vf++)
be_cmd_if_destroy(adapter, if (adapter->vf_cfg[vf].vf_if_handle)
be_cmd_if_destroy(adapter,
adapter->vf_cfg[vf].vf_if_handle, adapter->vf_cfg[vf].vf_if_handle,
vf + 1); vf + 1);
be_cmd_if_destroy(adapter, adapter->if_handle, 0); be_cmd_if_destroy(adapter, adapter->if_handle, 0);
...@@ -2344,7 +2349,7 @@ static int be_setup(struct be_adapter *adapter) ...@@ -2344,7 +2349,7 @@ static int be_setup(struct be_adapter *adapter)
static int be_clear(struct be_adapter *adapter) static int be_clear(struct be_adapter *adapter)
{ {
if (be_physfn(adapter)) if (be_physfn(adapter) && adapter->sriov_enabled)
be_vf_eth_addr_rem(adapter); be_vf_eth_addr_rem(adapter);
be_mcc_queues_destroy(adapter); be_mcc_queues_destroy(adapter);
......
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