aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@emulex.com>2011-02-11 08:35:02 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-12 00:14:44 -0500
commitc99ac3e7e47ffb9e504d9b08f608e9d7519a6b4f (patch)
tree50582c153ed8ddbba2f25084a37d5bca035cfe69 /drivers/net
parent658681f72589b95b7ab340b4f644783d263b5200 (diff)
be2net: Initialize and cleanup sriov resources only if pci_enable_sriov has succeeded.
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/benet/be_main.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index aab464dd3063..c8075c1779bb 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -2277,22 +2277,26 @@ static int be_setup(struct be_adapter *adapter)
2277 goto do_none; 2277 goto do_none;
2278 2278
2279 if (be_physfn(adapter)) { 2279 if (be_physfn(adapter)) {
2280 while (vf < num_vfs) { 2280 if (adapter->sriov_enabled) {
2281 cap_flags = en_flags = BE_IF_FLAGS_UNTAGGED 2281 while (vf < num_vfs) {
2282 | BE_IF_FLAGS_BROADCAST; 2282 cap_flags = en_flags = BE_IF_FLAGS_UNTAGGED |
2283 status = be_cmd_if_create(adapter, cap_flags, en_flags, 2283 BE_IF_FLAGS_BROADCAST;
2284 mac, true, 2284 status = be_cmd_if_create(adapter, cap_flags,
2285 en_flags, mac, true,
2285 &adapter->vf_cfg[vf].vf_if_handle, 2286 &adapter->vf_cfg[vf].vf_if_handle,
2286 NULL, vf+1); 2287 NULL, vf+1);
2287 if (status) { 2288 if (status) {
2288 dev_err(&adapter->pdev->dev, 2289 dev_err(&adapter->pdev->dev,
2289 "Interface Create failed for VF %d\n", vf); 2290 "Interface Create failed for VF %d\n",
2290 goto if_destroy; 2291 vf);
2292 goto if_destroy;
2293 }
2294 adapter->vf_cfg[vf].vf_pmac_id =
2295 BE_INVALID_PMAC_ID;
2296 vf++;
2291 } 2297 }
2292 adapter->vf_cfg[vf].vf_pmac_id = BE_INVALID_PMAC_ID;
2293 vf++;
2294 } 2298 }
2295 } else if (!be_physfn(adapter)) { 2299 } else {
2296 status = be_cmd_mac_addr_query(adapter, mac, 2300 status = be_cmd_mac_addr_query(adapter, mac,
2297 MAC_ADDRESS_TYPE_NETWORK, false, adapter->if_handle); 2301 MAC_ADDRESS_TYPE_NETWORK, false, adapter->if_handle);
2298 if (!status) { 2302 if (!status) {
@@ -2313,7 +2317,7 @@ static int be_setup(struct be_adapter *adapter)
2313 if (status != 0) 2317 if (status != 0)
2314 goto rx_qs_destroy; 2318 goto rx_qs_destroy;
2315 2319
2316 if (be_physfn(adapter)) { 2320 if (be_physfn(adapter) && adapter->sriov_enabled) {
2317 status = be_vf_eth_addr_config(adapter); 2321 status = be_vf_eth_addr_config(adapter);
2318 if (status) 2322 if (status)
2319 goto mcc_q_destroy; 2323 goto mcc_q_destroy;
@@ -2332,9 +2336,10 @@ rx_qs_destroy:
2332tx_qs_destroy: 2336tx_qs_destroy:
2333 be_tx_queues_destroy(adapter); 2337 be_tx_queues_destroy(adapter);
2334if_destroy: 2338if_destroy:
2335 for (vf = 0; vf < num_vfs; vf++) 2339 if (be_physfn(adapter) && adapter->sriov_enabled)
2336 if (adapter->vf_cfg[vf].vf_if_handle) 2340 for (vf = 0; vf < num_vfs; vf++)
2337 be_cmd_if_destroy(adapter, 2341 if (adapter->vf_cfg[vf].vf_if_handle)
2342 be_cmd_if_destroy(adapter,
2338 adapter->vf_cfg[vf].vf_if_handle, 2343 adapter->vf_cfg[vf].vf_if_handle,
2339 vf + 1); 2344 vf + 1);
2340 be_cmd_if_destroy(adapter, adapter->if_handle, 0); 2345 be_cmd_if_destroy(adapter, adapter->if_handle, 0);
@@ -2344,7 +2349,7 @@ do_none:
2344 2349
2345static int be_clear(struct be_adapter *adapter) 2350static int be_clear(struct be_adapter *adapter)
2346{ 2351{
2347 if (be_physfn(adapter)) 2352 if (be_physfn(adapter) && adapter->sriov_enabled)
2348 be_vf_eth_addr_rem(adapter); 2353 be_vf_eth_addr_rem(adapter);
2349 2354
2350 be_mcc_queues_destroy(adapter); 2355 be_mcc_queues_destroy(adapter);