Commit 52da2fb2 authored by Przemek Kitszel's avatar Przemek Kitszel Committed by Tony Nguyen

ice: drop two params from ice_aq_alloc_free_res()

Drop @num_entries and @cd params, latter of which was always NULL.

Number of entities to alloc is passed in internal buffer, the outer layer
(that @num_entries was assigned to) meaning is closer to "the number of
requests", which was =1 in all cases.
ice_free_hw_res() was always called with 1 as its @num arg.
Signed-off-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 1533b774
...@@ -2000,37 +2000,31 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res) ...@@ -2000,37 +2000,31 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res)
/** /**
* ice_aq_alloc_free_res - command to allocate/free resources * ice_aq_alloc_free_res - command to allocate/free resources
* @hw: pointer to the HW struct * @hw: pointer to the HW struct
* @num_entries: number of resource entries in buffer
* @buf: Indirect buffer to hold data parameters and response * @buf: Indirect buffer to hold data parameters and response
* @buf_size: size of buffer for indirect commands * @buf_size: size of buffer for indirect commands
* @opc: pass in the command opcode * @opc: pass in the command opcode
* @cd: pointer to command details structure or NULL
* *
* Helper function to allocate/free resources using the admin queue commands * Helper function to allocate/free resources using the admin queue commands
*/ */
int int ice_aq_alloc_free_res(struct ice_hw *hw,
ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries,
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size, struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
enum ice_adminq_opc opc, struct ice_sq_cd *cd) enum ice_adminq_opc opc)
{ {
struct ice_aqc_alloc_free_res_cmd *cmd; struct ice_aqc_alloc_free_res_cmd *cmd;
struct ice_aq_desc desc; struct ice_aq_desc desc;
cmd = &desc.params.sw_res_ctrl; cmd = &desc.params.sw_res_ctrl;
if (!buf) if (!buf || buf_size < flex_array_size(buf, elem, 1))
return -EINVAL;
if (buf_size < flex_array_size(buf, elem, num_entries))
return -EINVAL; return -EINVAL;
ice_fill_dflt_direct_cmd_desc(&desc, opc); ice_fill_dflt_direct_cmd_desc(&desc, opc);
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD); desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
cmd->num_entries = cpu_to_le16(num_entries); cmd->num_entries = cpu_to_le16(1);
return ice_aq_send_cmd(hw, &desc, buf, buf_size, cd); return ice_aq_send_cmd(hw, &desc, buf, buf_size, NULL);
} }
/** /**
...@@ -2060,8 +2054,7 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res) ...@@ -2060,8 +2054,7 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res)
if (btm) if (btm)
buf->res_type |= cpu_to_le16(ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM); buf->res_type |= cpu_to_le16(ICE_AQC_RES_TYPE_FLAG_SCAN_BOTTOM);
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_alloc_res);
ice_aqc_opc_alloc_res, NULL);
if (status) if (status)
goto ice_alloc_res_exit; goto ice_alloc_res_exit;
...@@ -2095,8 +2088,7 @@ int ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res) ...@@ -2095,8 +2088,7 @@ int ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res)
buf->res_type = cpu_to_le16(type); buf->res_type = cpu_to_le16(type);
memcpy(buf->elem, res, sizeof(*buf->elem) * num); memcpy(buf->elem, res, sizeof(*buf->elem) * num);
status = ice_aq_alloc_free_res(hw, num, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_free_res);
ice_aqc_opc_free_res, NULL);
if (status) if (status)
ice_debug(hw, ICE_DBG_SW, "CQ CMD Buffer:\n"); ice_debug(hw, ICE_DBG_SW, "CQ CMD Buffer:\n");
......
...@@ -38,10 +38,9 @@ int ...@@ -38,10 +38,9 @@ int
ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res); ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res);
int int
ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res); ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res);
int int ice_aq_alloc_free_res(struct ice_hw *hw,
ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries,
struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size, struct ice_aqc_alloc_free_res_elem *buf, u16 buf_size,
enum ice_adminq_opc opc, struct ice_sq_cd *cd); enum ice_adminq_opc opc);
bool ice_is_sbq_supported(struct ice_hw *hw); bool ice_is_sbq_supported(struct ice_hw *hw);
struct ice_ctl_q_info *ice_get_sbq(struct ice_hw *hw); struct ice_ctl_q_info *ice_get_sbq(struct ice_hw *hw);
int int
......
...@@ -983,9 +983,8 @@ ice_lag_set_swid(u16 primary_swid, struct ice_lag *local_lag, ...@@ -983,9 +983,8 @@ ice_lag_set_swid(u16 primary_swid, struct ice_lag *local_lag,
/* if unlinnking need to free the shared resource */ /* if unlinnking need to free the shared resource */
if (!link && local_lag->bond_swid) { if (!link && local_lag->bond_swid) {
buf->elem[0].e.sw_resp = cpu_to_le16(local_lag->bond_swid); buf->elem[0].e.sw_resp = cpu_to_le16(local_lag->bond_swid);
status = ice_aq_alloc_free_res(&local_lag->pf->hw, 1, buf, status = ice_aq_alloc_free_res(&local_lag->pf->hw, buf,
buf_len, ice_aqc_opc_free_res, buf_len, ice_aqc_opc_free_res);
NULL);
if (status) if (status)
dev_err(ice_pf_to_dev(local_lag->pf), "Error freeing SWID during LAG unlink\n"); dev_err(ice_pf_to_dev(local_lag->pf), "Error freeing SWID during LAG unlink\n");
local_lag->bond_swid = 0; local_lag->bond_swid = 0;
...@@ -1002,8 +1001,8 @@ ice_lag_set_swid(u16 primary_swid, struct ice_lag *local_lag, ...@@ -1002,8 +1001,8 @@ ice_lag_set_swid(u16 primary_swid, struct ice_lag *local_lag,
cpu_to_le16(local_lag->pf->hw.port_info->sw_id); cpu_to_le16(local_lag->pf->hw.port_info->sw_id);
} }
status = ice_aq_alloc_free_res(&local_lag->pf->hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(&local_lag->pf->hw, buf, buf_len,
ice_aqc_opc_alloc_res, NULL); ice_aqc_opc_alloc_res);
if (status) if (status)
dev_err(ice_pf_to_dev(local_lag->pf), "Error subscribing to SWID 0x%04X\n", dev_err(ice_pf_to_dev(local_lag->pf), "Error subscribing to SWID 0x%04X\n",
local_lag->bond_swid); local_lag->bond_swid);
......
...@@ -1847,7 +1847,7 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id, ...@@ -1847,7 +1847,7 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id,
if (opc == ice_aqc_opc_free_res) if (opc == ice_aqc_opc_free_res)
sw_buf->elem[0].e.sw_resp = cpu_to_le16(*vsi_list_id); sw_buf->elem[0].e.sw_resp = cpu_to_le16(*vsi_list_id);
status = ice_aq_alloc_free_res(hw, 1, sw_buf, buf_len, opc, NULL); status = ice_aq_alloc_free_res(hw, sw_buf, buf_len, opc);
if (status) if (status)
goto ice_aq_alloc_free_vsi_list_exit; goto ice_aq_alloc_free_vsi_list_exit;
...@@ -2101,8 +2101,8 @@ int ice_alloc_recipe(struct ice_hw *hw, u16 *rid) ...@@ -2101,8 +2101,8 @@ int ice_alloc_recipe(struct ice_hw *hw, u16 *rid)
sw_buf->res_type = cpu_to_le16((ICE_AQC_RES_TYPE_RECIPE << sw_buf->res_type = cpu_to_le16((ICE_AQC_RES_TYPE_RECIPE <<
ICE_AQC_RES_TYPE_S) | ICE_AQC_RES_TYPE_S) |
ICE_AQC_RES_TYPE_FLAG_SHARED); ICE_AQC_RES_TYPE_FLAG_SHARED);
status = ice_aq_alloc_free_res(hw, 1, sw_buf, buf_len, status = ice_aq_alloc_free_res(hw, sw_buf, buf_len,
ice_aqc_opc_alloc_res, NULL); ice_aqc_opc_alloc_res);
if (!status) if (!status)
*rid = le16_to_cpu(sw_buf->elem[0].e.sw_resp); *rid = le16_to_cpu(sw_buf->elem[0].e.sw_resp);
kfree(sw_buf); kfree(sw_buf);
...@@ -4448,8 +4448,7 @@ ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, ...@@ -4448,8 +4448,7 @@ ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,
buf->res_type = cpu_to_le16(((type << ICE_AQC_RES_TYPE_S) & buf->res_type = cpu_to_le16(((type << ICE_AQC_RES_TYPE_S) &
ICE_AQC_RES_TYPE_M) | alloc_shared); ICE_AQC_RES_TYPE_M) | alloc_shared);
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_alloc_res);
ice_aqc_opc_alloc_res, NULL);
if (status) if (status)
goto exit; goto exit;
...@@ -4487,8 +4486,7 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, ...@@ -4487,8 +4486,7 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,
ICE_AQC_RES_TYPE_M) | alloc_shared); ICE_AQC_RES_TYPE_M) | alloc_shared);
buf->elem[0].e.sw_resp = cpu_to_le16(counter_id); buf->elem[0].e.sw_resp = cpu_to_le16(counter_id);
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len, ice_aqc_opc_free_res);
ice_aqc_opc_free_res, NULL);
if (status) if (status)
ice_debug(hw, ICE_DBG_SW, "counter resource could not be freed\n"); ice_debug(hw, ICE_DBG_SW, "counter resource could not be freed\n");
...@@ -4530,8 +4528,8 @@ int ice_share_res(struct ice_hw *hw, u16 type, u8 shared, u16 res_id) ...@@ -4530,8 +4528,8 @@ int ice_share_res(struct ice_hw *hw, u16 type, u8 shared, u16 res_id)
~ICE_AQC_RES_TYPE_FLAG_SHARED); ~ICE_AQC_RES_TYPE_FLAG_SHARED);
buf->elem[0].e.sw_resp = cpu_to_le16(res_id); buf->elem[0].e.sw_resp = cpu_to_le16(res_id);
status = ice_aq_alloc_free_res(hw, 1, buf, buf_len, status = ice_aq_alloc_free_res(hw, buf, buf_len,
ice_aqc_opc_share_res, NULL); ice_aqc_opc_share_res);
if (status) if (status)
ice_debug(hw, ICE_DBG_SW, "Could not set resource type %u id %u to %s\n", ice_debug(hw, ICE_DBG_SW, "Could not set resource type %u id %u to %s\n",
type, res_id, shared ? "SHARED" : "DEDICATED"); type, res_id, shared ? "SHARED" : "DEDICATED");
......
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