aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_common.c
diff options
context:
space:
mode:
authorBrett Creeley <brett.creeley@intel.com>2019-02-08 15:50:57 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2019-03-19 20:00:54 -0400
commit7a1f7111754020e6c1c8d83d79850444d9001cf3 (patch)
tree0b6a3aa03e3dcee389626c3bef52f4caad7cf173 /drivers/net/ethernet/intel/ice/ice_common.c
parent1c44e3bce12f3ae8bf2f3f7fb808d4e2e9ef98ca (diff)
ice: Get resources per function
ice_get_guar_num_vsi currently calculates the number of VSIs per PF. Rework this into a general function ice_get_num_per_func, that can calculate per PF allocations for not just VSIs but across multiple resource types. Signed-off-by: Brett Creeley <brett.creeley@intel.com> Reviewed-by: Bruce Allan <bruce.w.allan@intel.com> 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.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 2dc5c3249e12..d2e1e6f440b8 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1415,13 +1415,15 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res)
1415} 1415}
1416 1416
1417/** 1417/**
1418 * ice_get_guar_num_vsi - determine number of guar VSI for a PF 1418 * ice_get_num_per_func - determine number of resources per PF
1419 * @hw: pointer to the hw structure 1419 * @hw: pointer to the hw structure
1420 * @max: value to be evenly split between each PF
1420 * 1421 *
1421 * Determine the number of valid functions by going through the bitmap returned 1422 * Determine the number of valid functions by going through the bitmap returned
1422 * from parsing capabilities and use this to calculate the number of VSI per PF. 1423 * from parsing capabilities and use this to calculate the number of resources
1424 * per PF based on the max value passed in.
1423 */ 1425 */
1424static u32 ice_get_guar_num_vsi(struct ice_hw *hw) 1426static u32 ice_get_num_per_func(struct ice_hw *hw, u32 max)
1425{ 1427{
1426 u8 funcs; 1428 u8 funcs;
1427 1429
@@ -1432,7 +1434,7 @@ static u32 ice_get_guar_num_vsi(struct ice_hw *hw)
1432 if (!funcs) 1434 if (!funcs)
1433 return 0; 1435 return 0;
1434 1436
1435 return ICE_MAX_VSI / funcs; 1437 return max / funcs;
1436} 1438}
1437 1439
1438/** 1440/**
@@ -1512,7 +1514,8 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
1512 "HW caps: Dev.VSI cnt = %d\n", 1514 "HW caps: Dev.VSI cnt = %d\n",
1513 dev_p->num_vsi_allocd_to_host); 1515 dev_p->num_vsi_allocd_to_host);
1514 } else if (func_p) { 1516 } else if (func_p) {
1515 func_p->guar_num_vsi = ice_get_guar_num_vsi(hw); 1517 func_p->guar_num_vsi =
1518 ice_get_num_per_func(hw, ICE_MAX_VSI);
1516 ice_debug(hw, ICE_DBG_INIT, 1519 ice_debug(hw, ICE_DBG_INIT,
1517 "HW caps: Func.VSI cnt = %d\n", 1520 "HW caps: Func.VSI cnt = %d\n",
1518 number); 1521 number);