aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSathya Perla <sathya.perla@emulex.com>2014-08-01 08:17:30 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-02 18:59:17 -0400
commitd3d183126de8e100b003d09b64c6ec4b1c93abfc (patch)
tree7cb5eb55aeb76074a49c1fe22d8c1fd992593ec2 /drivers/net
parent7e32aa4d8cc075e5109170ae8c43be550cebb14a (diff)
be2net: ignore get/set profile FW cmd failures
Old versions of BE3 FW may not support cmds to re-provision (and hence optimize) resources/queues in SR-IOV config. Do not treat this FW cmd failure as fatal and fail the function initialization. Instead, just enable SR-IOV with the resources provided by the FW. Prior to the "create optimal number of queues on SR-IOV config" patch such failures were ignored. Fixes: bec84e6b2 ("create optimal number of queues on SR-IOV config") Reported-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Sathya Perla <sathya.perla@emulex.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c67
1 files changed, 37 insertions, 30 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 9c50814f1e95..da4d3863bd18 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3342,22 +3342,17 @@ static int be_get_sriov_config(struct be_adapter *adapter)
3342{ 3342{
3343 struct device *dev = &adapter->pdev->dev; 3343 struct device *dev = &adapter->pdev->dev;
3344 struct be_resources res = {0}; 3344 struct be_resources res = {0};
3345 int status, max_vfs, old_vfs; 3345 int max_vfs, old_vfs;
3346
3347 status = be_cmd_get_profile_config(adapter, &res, 0);
3348 if (status)
3349 return status;
3350
3351 adapter->pool_res = res;
3352 3346
3353 /* Some old versions of BE3 FW don't report max_vfs value */ 3347 /* Some old versions of BE3 FW don't report max_vfs value */
3348 be_cmd_get_profile_config(adapter, &res, 0);
3349
3354 if (BE3_chip(adapter) && !res.max_vfs) { 3350 if (BE3_chip(adapter) && !res.max_vfs) {
3355 max_vfs = pci_sriov_get_totalvfs(adapter->pdev); 3351 max_vfs = pci_sriov_get_totalvfs(adapter->pdev);
3356 res.max_vfs = max_vfs > 0 ? min(MAX_VFS, max_vfs) : 0; 3352 res.max_vfs = max_vfs > 0 ? min(MAX_VFS, max_vfs) : 0;
3357 } 3353 }
3358 3354
3359 adapter->pool_res.max_vfs = res.max_vfs; 3355 adapter->pool_res = res;
3360 pci_sriov_set_totalvfs(adapter->pdev, be_max_vfs(adapter));
3361 3356
3362 if (!be_max_vfs(adapter)) { 3357 if (!be_max_vfs(adapter)) {
3363 if (num_vfs) 3358 if (num_vfs)
@@ -3366,6 +3361,8 @@ static int be_get_sriov_config(struct be_adapter *adapter)
3366 return 0; 3361 return 0;
3367 } 3362 }
3368 3363
3364 pci_sriov_set_totalvfs(adapter->pdev, be_max_vfs(adapter));
3365
3369 /* validate num_vfs module param */ 3366 /* validate num_vfs module param */
3370 old_vfs = pci_num_vf(adapter->pdev); 3367 old_vfs = pci_num_vf(adapter->pdev);
3371 if (old_vfs) { 3368 if (old_vfs) {
@@ -3423,6 +3420,35 @@ static int be_get_resources(struct be_adapter *adapter)
3423 return 0; 3420 return 0;
3424} 3421}
3425 3422
3423static void be_sriov_config(struct be_adapter *adapter)
3424{
3425 struct device *dev = &adapter->pdev->dev;
3426 int status;
3427
3428 status = be_get_sriov_config(adapter);
3429 if (status) {
3430 dev_err(dev, "Failed to query SR-IOV configuration\n");
3431 dev_err(dev, "SR-IOV cannot be enabled\n");
3432 return;
3433 }
3434
3435 /* When the HW is in SRIOV capable configuration, the PF-pool
3436 * resources are equally distributed across the max-number of
3437 * VFs. The user may request only a subset of the max-vfs to be
3438 * enabled. Based on num_vfs, redistribute the resources across
3439 * num_vfs so that each VF will have access to more number of
3440 * resources. This facility is not available in BE3 FW.
3441 * Also, this is done by FW in Lancer chip.
3442 */
3443 if (be_max_vfs(adapter) && !pci_num_vf(adapter->pdev)) {
3444 status = be_cmd_set_sriov_config(adapter,
3445 adapter->pool_res,
3446 adapter->num_vfs);
3447 if (status)
3448 dev_err(dev, "Failed to optimize SR-IOV resources\n");
3449 }
3450}
3451
3426static int be_get_config(struct be_adapter *adapter) 3452static int be_get_config(struct be_adapter *adapter)
3427{ 3453{
3428 u16 profile_id; 3454 u16 profile_id;
@@ -3439,27 +3465,8 @@ static int be_get_config(struct be_adapter *adapter)
3439 "Using profile 0x%x\n", profile_id); 3465 "Using profile 0x%x\n", profile_id);
3440 } 3466 }
3441 3467
3442 if (!BE2_chip(adapter) && be_physfn(adapter)) { 3468 if (!BE2_chip(adapter) && be_physfn(adapter))
3443 status = be_get_sriov_config(adapter); 3469 be_sriov_config(adapter);
3444 if (status)
3445 return status;
3446
3447 /* When the HW is in SRIOV capable configuration, the PF-pool
3448 * resources are equally distributed across the max-number of
3449 * VFs. The user may request only a subset of the max-vfs to be
3450 * enabled. Based on num_vfs, redistribute the resources across
3451 * num_vfs so that each VF will have access to more number of
3452 * resources. This facility is not available in BE3 FW.
3453 * Also, this is done by FW in Lancer chip.
3454 */
3455 if (!pci_num_vf(adapter->pdev)) {
3456 status = be_cmd_set_sriov_config(adapter,
3457 adapter->pool_res,
3458 adapter->num_vfs);
3459 if (status)
3460 return status;
3461 }
3462 }
3463 3470
3464 status = be_get_resources(adapter); 3471 status = be_get_resources(adapter);
3465 if (status) 3472 if (status)