diff options
author | Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> | 2018-10-26 13:41:03 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-11-13 12:09:26 -0500 |
commit | 995c90f2de819b020bdb0758ea4d486b0851e11a (patch) | |
tree | 63737fbea90b96273348a9508d8d3ef81c3cc36f /drivers/net/ethernet/intel/ice/ice_common.c | |
parent | 10e03a22de45699b6208592b85437d87a4741b9b (diff) |
ice: Calculate guaranteed VSIs per function and use it
Currently we are setting the guar_num_vsi to equal to ICE_MAX_VSI
which is the device limit of 768. This is incorrect and could have
unintended consequences. To fix this use the valid_function's 8-bit
bitmap returned from discovering device capabilities to determine the
guar_num_vsi per function. guar_num_vsi value is then passed on to
pf->num_alloc_vsi.
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_common.c')
-rw-r--r-- | drivers/net/ethernet/intel/ice/ice_common.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index 554fd707a6d6..9de5a3aac77d 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c | |||
@@ -1387,6 +1387,27 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res) | |||
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | /** | 1389 | /** |
1390 | * ice_get_guar_num_vsi - determine number of guar VSI for a PF | ||
1391 | * @hw: pointer to the hw structure | ||
1392 | * | ||
1393 | * Determine the number of valid functions by going through the bitmap returned | ||
1394 | * from parsing capabilities and use this to calculate the number of VSI per PF. | ||
1395 | */ | ||
1396 | static u32 ice_get_guar_num_vsi(struct ice_hw *hw) | ||
1397 | { | ||
1398 | u8 funcs; | ||
1399 | |||
1400 | #define ICE_CAPS_VALID_FUNCS_M 0xFF | ||
1401 | funcs = hweight8(hw->dev_caps.common_cap.valid_functions & | ||
1402 | ICE_CAPS_VALID_FUNCS_M); | ||
1403 | |||
1404 | if (!funcs) | ||
1405 | return 0; | ||
1406 | |||
1407 | return ICE_MAX_VSI / funcs; | ||
1408 | } | ||
1409 | |||
1410 | /** | ||
1390 | * ice_parse_caps - parse function/device capabilities | 1411 | * ice_parse_caps - parse function/device capabilities |
1391 | * @hw: pointer to the hw struct | 1412 | * @hw: pointer to the hw struct |
1392 | * @buf: pointer to a buffer containing function/device capability records | 1413 | * @buf: pointer to a buffer containing function/device capability records |
@@ -1428,6 +1449,12 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count, | |||
1428 | u16 cap = le16_to_cpu(cap_resp->cap); | 1449 | u16 cap = le16_to_cpu(cap_resp->cap); |
1429 | 1450 | ||
1430 | switch (cap) { | 1451 | switch (cap) { |
1452 | case ICE_AQC_CAPS_VALID_FUNCTIONS: | ||
1453 | caps->valid_functions = number; | ||
1454 | ice_debug(hw, ICE_DBG_INIT, | ||
1455 | "HW caps: Valid Functions = %d\n", | ||
1456 | caps->valid_functions); | ||
1457 | break; | ||
1431 | case ICE_AQC_CAPS_SRIOV: | 1458 | case ICE_AQC_CAPS_SRIOV: |
1432 | caps->sr_iov_1_1 = (number == 1); | 1459 | caps->sr_iov_1_1 = (number == 1); |
1433 | ice_debug(hw, ICE_DBG_INIT, | 1460 | ice_debug(hw, ICE_DBG_INIT, |
@@ -1457,10 +1484,10 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count, | |||
1457 | "HW caps: Dev.VSI cnt = %d\n", | 1484 | "HW caps: Dev.VSI cnt = %d\n", |
1458 | dev_p->num_vsi_allocd_to_host); | 1485 | dev_p->num_vsi_allocd_to_host); |
1459 | } else if (func_p) { | 1486 | } else if (func_p) { |
1460 | func_p->guaranteed_num_vsi = number; | 1487 | func_p->guar_num_vsi = ice_get_guar_num_vsi(hw); |
1461 | ice_debug(hw, ICE_DBG_INIT, | 1488 | ice_debug(hw, ICE_DBG_INIT, |
1462 | "HW caps: Func.VSI cnt = %d\n", | 1489 | "HW caps: Func.VSI cnt = %d\n", |
1463 | func_p->guaranteed_num_vsi); | 1490 | number); |
1464 | } | 1491 | } |
1465 | break; | 1492 | break; |
1466 | case ICE_AQC_CAPS_RSS: | 1493 | case ICE_AQC_CAPS_RSS: |