mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 13:49:36 +07:00
ice: Refactor a few Tx scheduler functions
The following functions were refactored to call a new common function, ice_aqc_send_sched_elem_cmd(): - ice_aq_add_sched_elems() - ice_aq_delete_sched_elems() - ice_aq_move_sched_elems() - ice_aq_query_sched_elems() - ice_aq_cfg_sched_elems() - ice_aq_suspend_sched_elems() - ice_aq_resume_sched_elems() Signed-off-by: Greg Priest <greg.priest@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>
This commit is contained in:
parent
3d50514717
commit
1f9c7840e8
@ -657,8 +657,13 @@ struct ice_aqc_get_topo {
|
||||
|
||||
/* Update TSE (indirect 0x0403)
|
||||
* Get TSE (indirect 0x0404)
|
||||
* Add TSE (indirect 0x0401)
|
||||
* Delete TSE (indirect 0x040F)
|
||||
* Move TSE (indirect 0x0408)
|
||||
* Suspend Nodes (indirect 0x0409)
|
||||
* Resume Nodes (indirect 0x040A)
|
||||
*/
|
||||
struct ice_aqc_get_cfg_elem {
|
||||
struct ice_aqc_sched_elem_cmd {
|
||||
__le16 num_elem_req; /* Used by commands */
|
||||
__le16 num_elem_resp; /* Used by responses */
|
||||
__le32 reserved;
|
||||
@ -674,18 +679,6 @@ struct ice_aqc_suspend_resume_elem {
|
||||
__le32 teid[1];
|
||||
};
|
||||
|
||||
/* Add TSE (indirect 0x0401)
|
||||
* Delete TSE (indirect 0x040F)
|
||||
* Move TSE (indirect 0x0408)
|
||||
*/
|
||||
struct ice_aqc_add_move_delete_elem {
|
||||
__le16 num_grps_req;
|
||||
__le16 num_grps_updated;
|
||||
__le32 reserved;
|
||||
__le32 addr_high;
|
||||
__le32 addr_low;
|
||||
};
|
||||
|
||||
struct ice_aqc_elem_info_bw {
|
||||
__le16 bw_profile_idx;
|
||||
__le16 bw_alloc;
|
||||
@ -1344,9 +1337,8 @@ struct ice_aq_desc {
|
||||
struct ice_aqc_get_sw_cfg get_sw_conf;
|
||||
struct ice_aqc_sw_rules sw_rules;
|
||||
struct ice_aqc_get_topo get_topo;
|
||||
struct ice_aqc_get_cfg_elem get_update_elem;
|
||||
struct ice_aqc_sched_elem_cmd sched_elem_cmd;
|
||||
struct ice_aqc_query_txsched_res query_sched_res;
|
||||
struct ice_aqc_add_move_delete_elem add_move_delete_elem;
|
||||
struct ice_aqc_nvm nvm;
|
||||
struct ice_aqc_pf_vf_msg virt;
|
||||
struct ice_aqc_get_set_rss_lut get_set_rss_lut;
|
||||
|
@ -84,6 +84,38 @@ ice_sched_find_node_by_teid(struct ice_sched_node *start_node, u32 teid)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aqc_send_sched_elem_cmd - send scheduling elements cmd
|
||||
* @hw: pointer to the hw struct
|
||||
* @cmd_opc: cmd opcode
|
||||
* @elems_req: number of elements to request
|
||||
* @buf: pointer to buffer
|
||||
* @buf_size: buffer size in bytes
|
||||
* @elems_resp: returns total number of elements response
|
||||
* @cd: pointer to command details structure or NULL
|
||||
*
|
||||
* This function sends a scheduling elements cmd (cmd_opc)
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aqc_send_sched_elem_cmd(struct ice_hw *hw, enum ice_adminq_opc cmd_opc,
|
||||
u16 elems_req, void *buf, u16 buf_size,
|
||||
u16 *elems_resp, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_sched_elem_cmd *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
|
||||
cmd = &desc.params.sched_elem_cmd;
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, cmd_opc);
|
||||
cmd->num_elem_req = cpu_to_le16(elems_req);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
status = ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
|
||||
if (!status && elems_resp)
|
||||
*elems_resp = le16_to_cpu(cmd->num_elem_resp);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_aq_query_sched_elems - query scheduler elements
|
||||
* @hw: pointer to the hw struct
|
||||
@ -100,19 +132,9 @@ ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_get_elem *buf, u16 buf_size,
|
||||
u16 *elems_ret, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_get_cfg_elem *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
|
||||
cmd = &desc.params.get_update_elem;
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_sched_elems);
|
||||
cmd->num_elem_req = cpu_to_le16(elems_req);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
status = ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
|
||||
if (!status && elems_ret)
|
||||
*elems_ret = le16_to_cpu(cmd->num_elem_resp);
|
||||
|
||||
return status;
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_get_sched_elems,
|
||||
elems_req, (void *)buf, buf_size,
|
||||
elems_ret, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -218,20 +240,9 @@ ice_aq_delete_sched_elems(struct ice_hw *hw, u16 grps_req,
|
||||
struct ice_aqc_delete_elem *buf, u16 buf_size,
|
||||
u16 *grps_del, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_add_move_delete_elem *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
|
||||
cmd = &desc.params.add_move_delete_elem;
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_delete_sched_elems);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
cmd->num_grps_req = cpu_to_le16(grps_req);
|
||||
|
||||
status = ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
|
||||
if (!status && grps_del)
|
||||
*grps_del = le16_to_cpu(cmd->num_grps_updated);
|
||||
|
||||
return status;
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_delete_sched_elems,
|
||||
grps_req, (void *)buf, buf_size,
|
||||
grps_del, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -442,52 +453,9 @@ ice_aq_add_sched_elems(struct ice_hw *hw, u16 grps_req,
|
||||
struct ice_aqc_add_elem *buf, u16 buf_size,
|
||||
u16 *grps_added, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_add_move_delete_elem *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
|
||||
cmd = &desc.params.add_move_delete_elem;
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_add_sched_elems);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
|
||||
cmd->num_grps_req = cpu_to_le16(grps_req);
|
||||
status = ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
|
||||
if (!status && grps_added)
|
||||
*grps_added = le16_to_cpu(cmd->num_grps_updated);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_suspend_resume_elems - suspend/resume scheduler elements
|
||||
* @hw: pointer to the hw struct
|
||||
* @elems_req: number of elements to suspend
|
||||
* @buf: pointer to buffer
|
||||
* @buf_size: buffer size in bytes
|
||||
* @elems_ret: returns total number of elements suspended
|
||||
* @cd: pointer to command details structure or NULL
|
||||
* @cmd_code: command code for suspend or resume
|
||||
*
|
||||
* suspend/resume scheduler elements
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_suspend_resume_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_suspend_resume_elem *buf, u16 buf_size,
|
||||
u16 *elems_ret, struct ice_sq_cd *cd,
|
||||
enum ice_adminq_opc cmd_code)
|
||||
{
|
||||
struct ice_aqc_get_cfg_elem *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
|
||||
cmd = &desc.params.get_update_elem;
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, cmd_code);
|
||||
cmd->num_elem_req = cpu_to_le16(elems_req);
|
||||
desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
|
||||
status = ice_aq_send_cmd(hw, &desc, buf, buf_size, cd);
|
||||
if (!status && elems_ret)
|
||||
*elems_ret = le16_to_cpu(cmd->num_elem_resp);
|
||||
return status;
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_add_sched_elems,
|
||||
grps_req, (void *)buf, buf_size,
|
||||
grps_added, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -506,8 +474,9 @@ ice_aq_suspend_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_suspend_resume_elem *buf,
|
||||
u16 buf_size, u16 *elems_ret, struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_suspend_resume_elems(hw, elems_req, buf, buf_size, elems_ret,
|
||||
cd, ice_aqc_opc_suspend_sched_elems);
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_suspend_sched_elems,
|
||||
elems_req, (void *)buf, buf_size,
|
||||
elems_ret, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -526,8 +495,9 @@ ice_aq_resume_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_suspend_resume_elem *buf,
|
||||
u16 buf_size, u16 *elems_ret, struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_suspend_resume_elems(hw, elems_req, buf, buf_size, elems_ret,
|
||||
cd, ice_aqc_opc_resume_sched_elems);
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_resume_sched_elems,
|
||||
elems_req, (void *)buf, buf_size,
|
||||
elems_ret, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user