net/ice/base: avoid single-member variable-length structs
There are a number of structures that consist of a one-element array as the only struct member. Some of those are unused (ice_aqc_add_get_recipe_data, ice_aqc_get_port_options_data, ice_aqc_dis_txq, etc.) so remove them. Others are used to index into a buffer/array consisting of a variable number of a different data or structure type. Those are unnecessary since we can use simple pointer arithmetic or index directly into the buffer to access individual elements of the buffer/array. Additional code cleanups were done near areas affected by this change. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> Acked-by: Qiming Yang <qiming.yang@intel.com>
This commit is contained in:
parent
897aef75dc
commit
39ecbb6be0
@ -224,13 +224,6 @@ struct ice_aqc_get_sw_cfg_resp_elem {
|
||||
#define ICE_AQC_GET_SW_CONF_RESP_IS_VF BIT(15)
|
||||
};
|
||||
|
||||
/* The response buffer is as follows. Note that the length of the
|
||||
* elements array varies with the length of the command response.
|
||||
*/
|
||||
struct ice_aqc_get_sw_cfg_resp {
|
||||
struct ice_aqc_get_sw_cfg_resp_elem elements[1];
|
||||
};
|
||||
|
||||
/* These resource type defines are used for all switch resource
|
||||
* commands where a resource type is required, such as:
|
||||
* Get Resource Allocation command (indirect 0x0204)
|
||||
@ -294,15 +287,6 @@ struct ice_aqc_get_res_resp_elem {
|
||||
__le16 total_free; /* Resources un-allocated/not reserved by any PF */
|
||||
};
|
||||
|
||||
/* Buffer for Get Resource command */
|
||||
struct ice_aqc_get_res_resp {
|
||||
/* Number of resource entries to be calculated using
|
||||
* datalen/sizeof(struct ice_aqc_cmd_resp)).
|
||||
* Value of 'datalen' gets updated as part of response.
|
||||
*/
|
||||
struct ice_aqc_get_res_resp_elem elem[1];
|
||||
};
|
||||
|
||||
/* Allocate Resources command (indirect 0x0208)
|
||||
* Free Resources command (indirect 0x0209)
|
||||
*/
|
||||
@ -350,10 +334,6 @@ struct ice_aqc_get_allocd_res_desc {
|
||||
__le32 addr_low;
|
||||
};
|
||||
|
||||
struct ice_aqc_get_allocd_res_desc_resp {
|
||||
struct ice_aqc_res_elem elem[1];
|
||||
};
|
||||
|
||||
/* Add VSI (indirect 0x0210)
|
||||
* Update VSI (indirect 0x0211)
|
||||
* Get VSI (indirect 0x0212)
|
||||
@ -729,13 +709,6 @@ struct ice_aqc_recipe_data_elem {
|
||||
u8 rsvd2[20];
|
||||
};
|
||||
|
||||
/* This struct contains a number of entries as per the
|
||||
* num_sub_recipes in the command
|
||||
*/
|
||||
struct ice_aqc_add_get_recipe_data {
|
||||
struct ice_aqc_recipe_data_elem recipe[1];
|
||||
};
|
||||
|
||||
/* Set/Get Recipes to Profile Association (direct 0x0291/0x0293) */
|
||||
struct ice_aqc_recipe_to_profile {
|
||||
__le16 profile_id;
|
||||
@ -757,7 +730,6 @@ struct ice_aqc_sw_rules {
|
||||
__le32 addr_low;
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
/* Add/Update/Get/Remove lookup Rx/Tx command/response entry
|
||||
* This structures describes the lookup rules and associated actions. "index"
|
||||
* is returned as part of a response to a successful Add command, and can be
|
||||
@ -842,7 +814,6 @@ struct ice_sw_rule_lkup_rx_tx {
|
||||
__le16 hdr_len;
|
||||
u8 hdr[1];
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
/* Add/Update/Remove large action command/response entry
|
||||
* "index" is returned as part of a response to a successful Add command, and
|
||||
@ -851,7 +822,6 @@ struct ice_sw_rule_lkup_rx_tx {
|
||||
struct ice_sw_rule_lg_act {
|
||||
__le16 index; /* Index in large action table */
|
||||
__le16 size;
|
||||
__le32 act[1]; /* array of size for actions */
|
||||
/* Max number of large actions */
|
||||
#define ICE_MAX_LG_ACT 4
|
||||
/* Bit 0:1 - Action type */
|
||||
@ -902,6 +872,7 @@ struct ice_sw_rule_lg_act {
|
||||
#define ICE_LG_ACT_STAT_COUNT 0x7
|
||||
#define ICE_LG_ACT_STAT_COUNT_S 3
|
||||
#define ICE_LG_ACT_STAT_COUNT_M (0x7F << ICE_LG_ACT_STAT_COUNT_S)
|
||||
__le32 act[1]; /* array of size for actions */
|
||||
};
|
||||
|
||||
/* Add/Update/Remove VSI list command/response entry
|
||||
@ -1009,14 +980,6 @@ struct ice_aqc_sched_elem_cmd {
|
||||
__le32 addr_low;
|
||||
};
|
||||
|
||||
/* This is the buffer for:
|
||||
* Suspend Nodes (indirect 0x0409)
|
||||
* Resume Nodes (indirect 0x040A)
|
||||
*/
|
||||
struct ice_aqc_suspend_resume_elem {
|
||||
__le32 teid[1];
|
||||
};
|
||||
|
||||
struct ice_aqc_txsched_move_grp_info_hdr {
|
||||
__le32 src_parent_teid;
|
||||
__le32 dest_parent_teid;
|
||||
@ -1082,14 +1045,6 @@ struct ice_aqc_add_elem {
|
||||
struct ice_aqc_txsched_elem_data generic[1];
|
||||
};
|
||||
|
||||
struct ice_aqc_conf_elem {
|
||||
struct ice_aqc_txsched_elem_data generic[1];
|
||||
};
|
||||
|
||||
struct ice_aqc_get_elem {
|
||||
struct ice_aqc_txsched_elem_data generic[1];
|
||||
};
|
||||
|
||||
struct ice_aqc_get_topo_elem {
|
||||
struct ice_aqc_txsched_topo_grp_info_hdr hdr;
|
||||
struct ice_aqc_txsched_elem_data
|
||||
@ -1161,10 +1116,6 @@ struct ice_aqc_rl_profile_elem {
|
||||
__le16 rl_encode;
|
||||
};
|
||||
|
||||
struct ice_aqc_rl_profile_generic_elem {
|
||||
struct ice_aqc_rl_profile_elem generic[1];
|
||||
};
|
||||
|
||||
/* Configure L2 Node CGD (indirect 0x0414)
|
||||
* This indirect command allows configuring a congestion domain for given L2
|
||||
* node TEIDs in the scheduler topology.
|
||||
@ -1182,10 +1133,6 @@ struct ice_aqc_cfg_l2_node_cgd_elem {
|
||||
u8 reserved[3];
|
||||
};
|
||||
|
||||
struct ice_aqc_cfg_l2_node_cgd_data {
|
||||
struct ice_aqc_cfg_l2_node_cgd_elem elem[1];
|
||||
};
|
||||
|
||||
/* Query Scheduler Resource Allocation (indirect 0x0412)
|
||||
* This indirect command retrieves the scheduler resources allocated by
|
||||
* EMP Firmware to the given PF.
|
||||
@ -2512,23 +2459,21 @@ struct ice_aqc_dis_txqs {
|
||||
* added before the start of the next group, to allow correct
|
||||
* alignment of the parent_teid field.
|
||||
*/
|
||||
#pragma pack(1)
|
||||
struct ice_aqc_dis_txq_item {
|
||||
__le32 parent_teid;
|
||||
u8 num_qs;
|
||||
u8 rsvd;
|
||||
/* The length of the q_id array varies according to num_qs */
|
||||
__le16 q_id[1];
|
||||
/* This only applies from F8 onward */
|
||||
#define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S 15
|
||||
#define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_LAN_Q \
|
||||
(0 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)
|
||||
#define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_RDMA_QSET \
|
||||
(1 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)
|
||||
__le16 q_id[1];
|
||||
};
|
||||
|
||||
struct ice_aqc_dis_txq {
|
||||
struct ice_aqc_dis_txq_item qgrps[1];
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
/* Tx LAN Queues Cleanup Event (0x0C31) */
|
||||
struct ice_aqc_txqs_cleanup {
|
||||
|
@ -4596,14 +4596,14 @@ ice_stat_update_repc(struct ice_hw *hw, u16 vsi_handle, bool prev_stat_loaded,
|
||||
*/
|
||||
enum ice_status
|
||||
ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
|
||||
struct ice_aqc_get_elem *buf)
|
||||
struct ice_aqc_txsched_elem_data *buf)
|
||||
{
|
||||
u16 buf_size, num_elem_ret = 0;
|
||||
enum ice_status status;
|
||||
|
||||
buf_size = sizeof(*buf);
|
||||
ice_memset(buf, 0, buf_size, ICE_NONDMA_MEM);
|
||||
buf->generic[0].node_teid = CPU_TO_LE32(node_teid);
|
||||
buf->node_teid = CPU_TO_LE32(node_teid);
|
||||
status = ice_aq_query_sched_elems(hw, 1, buf, buf_size, &num_elem_ret,
|
||||
NULL);
|
||||
if (status != ICE_SUCCESS || num_elem_ret != 1)
|
||||
|
@ -219,7 +219,7 @@ enum ice_fw_modes ice_get_fw_mode(struct ice_hw *hw);
|
||||
void ice_print_rollback_msg(struct ice_hw *hw);
|
||||
enum ice_status
|
||||
ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,
|
||||
struct ice_aqc_get_elem *buf);
|
||||
struct ice_aqc_txsched_elem_data *buf);
|
||||
enum ice_status
|
||||
ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd);
|
||||
|
@ -1328,7 +1328,7 @@ ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
|
||||
struct ice_aqc_port_ets_elem *buf)
|
||||
{
|
||||
struct ice_sched_node *node, *tc_node;
|
||||
struct ice_aqc_get_elem elem;
|
||||
struct ice_aqc_txsched_elem_data elem;
|
||||
enum ice_status status = ICE_SUCCESS;
|
||||
u32 teid1, teid2;
|
||||
u8 i, j;
|
||||
@ -1370,7 +1370,7 @@ ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
|
||||
/* new TC */
|
||||
status = ice_sched_query_elem(pi->hw, teid2, &elem);
|
||||
if (!status)
|
||||
status = ice_sched_add_node(pi, 1, &elem.generic[0]);
|
||||
status = ice_sched_add_node(pi, 1, &elem);
|
||||
if (status)
|
||||
break;
|
||||
/* update the TC number */
|
||||
|
@ -130,7 +130,7 @@ ice_aqc_send_sched_elem_cmd(struct ice_hw *hw, enum ice_adminq_opc cmd_opc,
|
||||
*/
|
||||
enum ice_status
|
||||
ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_get_elem *buf, u16 buf_size,
|
||||
struct ice_aqc_txsched_elem_data *buf, u16 buf_size,
|
||||
u16 *elems_ret, struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_get_sched_elems,
|
||||
@ -150,8 +150,8 @@ enum ice_status
|
||||
ice_sched_add_node(struct ice_port_info *pi, u8 layer,
|
||||
struct ice_aqc_txsched_elem_data *info)
|
||||
{
|
||||
struct ice_aqc_txsched_elem_data elem;
|
||||
struct ice_sched_node *parent;
|
||||
struct ice_aqc_get_elem elem;
|
||||
struct ice_sched_node *node;
|
||||
enum ice_status status;
|
||||
struct ice_hw *hw;
|
||||
@ -194,7 +194,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer,
|
||||
node->parent = parent;
|
||||
node->tx_sched_layer = layer;
|
||||
parent->children[parent->num_children++] = node;
|
||||
node->info = elem.generic[0];
|
||||
node->info = elem;
|
||||
return ICE_SUCCESS;
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ ice_aq_add_sched_elems(struct ice_hw *hw, u16 grps_req,
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_cfg_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_conf_elem *buf, u16 buf_size,
|
||||
struct ice_aqc_txsched_elem_data *buf, u16 buf_size,
|
||||
u16 *elems_cfgd, struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_cfg_sched_elems,
|
||||
@ -463,8 +463,7 @@ ice_aq_move_sched_elems(struct ice_hw *hw, u16 grps_req,
|
||||
* Suspend scheduling elements (0x0409)
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_suspend_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_suspend_resume_elem *buf,
|
||||
ice_aq_suspend_sched_elems(struct ice_hw *hw, u16 elems_req, __le32 *buf,
|
||||
u16 buf_size, u16 *elems_ret, struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_suspend_sched_elems,
|
||||
@ -484,8 +483,7 @@ ice_aq_suspend_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
* resume scheduling elements (0x040A)
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_resume_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_suspend_resume_elem *buf,
|
||||
ice_aq_resume_sched_elems(struct ice_hw *hw, u16 elems_req, __le32 *buf,
|
||||
u16 buf_size, u16 *elems_ret, struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_aqc_send_sched_elem_cmd(hw, ice_aqc_opc_resume_sched_elems,
|
||||
@ -526,18 +524,17 @@ static enum ice_status
|
||||
ice_sched_suspend_resume_elems(struct ice_hw *hw, u8 num_nodes, u32 *node_teids,
|
||||
bool suspend)
|
||||
{
|
||||
struct ice_aqc_suspend_resume_elem *buf;
|
||||
u16 i, buf_size, num_elem_ret = 0;
|
||||
enum ice_status status;
|
||||
__le32 *buf;
|
||||
|
||||
buf_size = sizeof(*buf) * num_nodes;
|
||||
buf = (struct ice_aqc_suspend_resume_elem *)
|
||||
ice_malloc(hw, buf_size);
|
||||
buf = (__le32 *)ice_malloc(hw, buf_size);
|
||||
if (!buf)
|
||||
return ICE_ERR_NO_MEMORY;
|
||||
|
||||
for (i = 0; i < num_nodes; i++)
|
||||
buf->teid[i] = CPU_TO_LE32(node_teids[i]);
|
||||
buf[i] = CPU_TO_LE32(node_teids[i]);
|
||||
|
||||
if (suspend)
|
||||
status = ice_aq_suspend_sched_elems(hw, num_nodes, buf,
|
||||
@ -610,7 +607,7 @@ ice_alloc_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 new_numqs)
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_rl_profile(struct ice_hw *hw, enum ice_adminq_opc opcode,
|
||||
u16 num_profiles, struct ice_aqc_rl_profile_generic_elem *buf,
|
||||
u16 num_profiles, struct ice_aqc_rl_profile_elem *buf,
|
||||
u16 buf_size, u16 *num_processed, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_rl_profile *cmd;
|
||||
@ -641,13 +638,11 @@ ice_aq_rl_profile(struct ice_hw *hw, enum ice_adminq_opc opcode,
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_add_rl_profile(struct ice_hw *hw, u16 num_profiles,
|
||||
struct ice_aqc_rl_profile_generic_elem *buf,
|
||||
u16 buf_size, u16 *num_profiles_added,
|
||||
struct ice_sq_cd *cd)
|
||||
struct ice_aqc_rl_profile_elem *buf, u16 buf_size,
|
||||
u16 *num_profiles_added, struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_aq_rl_profile(hw, ice_aqc_opc_add_rl_profiles,
|
||||
num_profiles, buf,
|
||||
buf_size, num_profiles_added, cd);
|
||||
return ice_aq_rl_profile(hw, ice_aqc_opc_add_rl_profiles, num_profiles,
|
||||
buf, buf_size, num_profiles_added, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -662,8 +657,8 @@ ice_aq_add_rl_profile(struct ice_hw *hw, u16 num_profiles,
|
||||
*/
|
||||
enum ice_status
|
||||
ice_aq_query_rl_profile(struct ice_hw *hw, u16 num_profiles,
|
||||
struct ice_aqc_rl_profile_generic_elem *buf,
|
||||
u16 buf_size, struct ice_sq_cd *cd)
|
||||
struct ice_aqc_rl_profile_elem *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_aq_rl_profile(hw, ice_aqc_opc_query_rl_profiles,
|
||||
num_profiles, buf, buf_size, NULL, cd);
|
||||
@ -682,13 +677,12 @@ ice_aq_query_rl_profile(struct ice_hw *hw, u16 num_profiles,
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_remove_rl_profile(struct ice_hw *hw, u16 num_profiles,
|
||||
struct ice_aqc_rl_profile_generic_elem *buf,
|
||||
u16 buf_size, u16 *num_profiles_removed,
|
||||
struct ice_sq_cd *cd)
|
||||
struct ice_aqc_rl_profile_elem *buf, u16 buf_size,
|
||||
u16 *num_profiles_removed, struct ice_sq_cd *cd)
|
||||
{
|
||||
return ice_aq_rl_profile(hw, ice_aqc_opc_remove_rl_profiles,
|
||||
num_profiles, buf,
|
||||
buf_size, num_profiles_removed, cd);
|
||||
num_profiles, buf, buf_size,
|
||||
num_profiles_removed, cd);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -704,7 +698,7 @@ static enum ice_status
|
||||
ice_sched_del_rl_profile(struct ice_hw *hw,
|
||||
struct ice_aqc_rl_profile_info *rl_info)
|
||||
{
|
||||
struct ice_aqc_rl_profile_generic_elem *buf;
|
||||
struct ice_aqc_rl_profile_elem *buf;
|
||||
u16 num_profiles_removed;
|
||||
enum ice_status status;
|
||||
u16 num_profiles = 1;
|
||||
@ -713,8 +707,7 @@ ice_sched_del_rl_profile(struct ice_hw *hw,
|
||||
return ICE_ERR_IN_USE;
|
||||
|
||||
/* Safe to remove profile ID */
|
||||
buf = (struct ice_aqc_rl_profile_generic_elem *)
|
||||
&rl_info->profile;
|
||||
buf = &rl_info->profile;
|
||||
status = ice_aq_remove_rl_profile(hw, num_profiles, buf, sizeof(*buf),
|
||||
&num_profiles_removed, NULL);
|
||||
if (status || num_profiles_removed != num_profiles)
|
||||
@ -860,7 +853,7 @@ void ice_sched_cleanup_all(struct ice_hw *hw)
|
||||
*/
|
||||
enum ice_status
|
||||
ice_aq_cfg_l2_node_cgd(struct ice_hw *hw, u16 num_l2_nodes,
|
||||
struct ice_aqc_cfg_l2_node_cgd_data *buf,
|
||||
struct ice_aqc_cfg_l2_node_cgd_elem *buf,
|
||||
u16 buf_size, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_cfg_l2_node_cgd *cmd;
|
||||
@ -1602,7 +1595,7 @@ ice_sched_get_agg_node(struct ice_port_info *pi, struct ice_sched_node *tc_node,
|
||||
*/
|
||||
static bool ice_sched_check_node(struct ice_hw *hw, struct ice_sched_node *node)
|
||||
{
|
||||
struct ice_aqc_get_elem buf;
|
||||
struct ice_aqc_txsched_elem_data buf;
|
||||
enum ice_status status;
|
||||
u32 node_teid;
|
||||
|
||||
@ -1611,7 +1604,7 @@ static bool ice_sched_check_node(struct ice_hw *hw, struct ice_sched_node *node)
|
||||
if (status != ICE_SUCCESS)
|
||||
return false;
|
||||
|
||||
if (memcmp(buf.generic, &node->info, sizeof(*buf.generic))) {
|
||||
if (memcmp(&buf, &node->info, sizeof(buf))) {
|
||||
ice_debug(hw, ICE_DBG_SCHED, "Node mismatch for teid=0x%x\n",
|
||||
node_teid);
|
||||
return false;
|
||||
@ -2140,7 +2133,7 @@ bool ice_sched_is_tree_balanced(struct ice_hw *hw, struct ice_sched_node *node)
|
||||
*/
|
||||
enum ice_status
|
||||
ice_aq_query_node_to_root(struct ice_hw *hw, u32 node_teid,
|
||||
struct ice_aqc_get_elem *buf, u16 buf_size,
|
||||
struct ice_aqc_txsched_elem_data *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_query_node_to_root *cmd;
|
||||
@ -2904,7 +2897,7 @@ static void ice_sched_rm_unused_rl_prof(struct ice_port_info *pi)
|
||||
* @node: pointer to node
|
||||
* @info: node info to update
|
||||
*
|
||||
* It updates the HW DB, and local SW DB of node. It updates the scheduling
|
||||
* Update the HW DB, and local SW DB of node. Update the scheduling
|
||||
* parameters of node from argument info data buffer (Info->data buf) and
|
||||
* returns success or error on config sched element failure. The caller
|
||||
* needs to hold scheduler lock.
|
||||
@ -2913,18 +2906,18 @@ static enum ice_status
|
||||
ice_sched_update_elem(struct ice_hw *hw, struct ice_sched_node *node,
|
||||
struct ice_aqc_txsched_elem_data *info)
|
||||
{
|
||||
struct ice_aqc_conf_elem buf;
|
||||
struct ice_aqc_txsched_elem_data buf;
|
||||
enum ice_status status;
|
||||
u16 elem_cfgd = 0;
|
||||
u16 num_elems = 1;
|
||||
|
||||
buf.generic[0] = *info;
|
||||
buf = *info;
|
||||
/* Parent TEID is reserved field in this aq call */
|
||||
buf.generic[0].parent_teid = 0;
|
||||
buf.parent_teid = 0;
|
||||
/* Element type is reserved field in this aq call */
|
||||
buf.generic[0].data.elem_type = 0;
|
||||
buf.data.elem_type = 0;
|
||||
/* Flags is reserved field in this aq call */
|
||||
buf.generic[0].data.flags = 0;
|
||||
buf.data.flags = 0;
|
||||
|
||||
/* Update HW DB */
|
||||
/* Configure element node */
|
||||
@ -3875,9 +3868,9 @@ static struct ice_aqc_rl_profile_info *
|
||||
ice_sched_add_rl_profile(struct ice_port_info *pi,
|
||||
enum ice_rl_type rl_type, u32 bw, u8 layer_num)
|
||||
{
|
||||
struct ice_aqc_rl_profile_generic_elem *buf;
|
||||
struct ice_aqc_rl_profile_info *rl_prof_elem;
|
||||
u16 profiles_added = 0, num_profiles = 1;
|
||||
struct ice_aqc_rl_profile_elem *buf;
|
||||
enum ice_status status;
|
||||
struct ice_hw *hw;
|
||||
u8 profile_type;
|
||||
@ -3926,8 +3919,7 @@ ice_sched_add_rl_profile(struct ice_port_info *pi,
|
||||
rl_prof_elem->profile.max_burst_size = CPU_TO_LE16(hw->max_burst_size);
|
||||
|
||||
/* Create new entry in HW DB */
|
||||
buf = (struct ice_aqc_rl_profile_generic_elem *)
|
||||
&rl_prof_elem->profile;
|
||||
buf = &rl_prof_elem->profile;
|
||||
status = ice_aq_add_rl_profile(hw, num_profiles, buf, sizeof(*buf),
|
||||
&profiles_added, NULL);
|
||||
if (status || profiles_added != num_profiles)
|
||||
|
@ -75,15 +75,15 @@ struct ice_sched_agg_info {
|
||||
/* FW AQ command calls */
|
||||
enum ice_status
|
||||
ice_aq_query_rl_profile(struct ice_hw *hw, u16 num_profiles,
|
||||
struct ice_aqc_rl_profile_generic_elem *buf,
|
||||
u16 buf_size, struct ice_sq_cd *cd);
|
||||
struct ice_aqc_rl_profile_elem *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
ice_aq_cfg_l2_node_cgd(struct ice_hw *hw, u16 num_nodes,
|
||||
struct ice_aqc_cfg_l2_node_cgd_data *buf, u16 buf_size,
|
||||
struct ice_aqc_cfg_l2_node_cgd_elem *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
ice_aq_query_sched_elems(struct ice_hw *hw, u16 elems_req,
|
||||
struct ice_aqc_get_elem *buf, u16 buf_size,
|
||||
struct ice_aqc_txsched_elem_data *buf, u16 buf_size,
|
||||
u16 *elems_ret, struct ice_sq_cd *cd);
|
||||
enum ice_status ice_sched_init_port(struct ice_port_info *pi);
|
||||
enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw);
|
||||
@ -117,7 +117,7 @@ ice_sched_get_vsi_node(struct ice_port_info *pi, struct ice_sched_node *tc_node,
|
||||
bool ice_sched_is_tree_balanced(struct ice_hw *hw, struct ice_sched_node *node);
|
||||
enum ice_status
|
||||
ice_aq_query_node_to_root(struct ice_hw *hw, u32 node_teid,
|
||||
struct ice_aqc_get_elem *buf, u16 buf_size,
|
||||
struct ice_aqc_txsched_elem_data *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd);
|
||||
|
||||
/* Tx scheduler rate limiter functions */
|
||||
|
@ -1421,7 +1421,7 @@ ice_init_def_sw_recp(struct ice_hw *hw, struct ice_sw_recipe **recp_list)
|
||||
* @num_elems: pointer to number of elements
|
||||
* @cd: pointer to command details structure or NULL
|
||||
*
|
||||
* Get switch configuration (0x0200) to be placed in 'buff'.
|
||||
* Get switch configuration (0x0200) to be placed in buf.
|
||||
* This admin command returns information such as initial VSI/port number
|
||||
* and switch ID it belongs to.
|
||||
*
|
||||
@ -1438,13 +1438,13 @@ ice_init_def_sw_recp(struct ice_hw *hw, struct ice_sw_recipe **recp_list)
|
||||
* parsing the response buffer.
|
||||
*/
|
||||
static enum ice_status
|
||||
ice_aq_get_sw_cfg(struct ice_hw *hw, struct ice_aqc_get_sw_cfg_resp *buf,
|
||||
ice_aq_get_sw_cfg(struct ice_hw *hw, struct ice_aqc_get_sw_cfg_resp_elem *buf,
|
||||
u16 buf_size, u16 *req_desc, u16 *num_elems,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_get_sw_cfg *cmd;
|
||||
enum ice_status status;
|
||||
struct ice_aq_desc desc;
|
||||
enum ice_status status;
|
||||
|
||||
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_sw_cfg);
|
||||
cmd = &desc.params.get_sw_conf;
|
||||
@ -2438,7 +2438,7 @@ ice_init_port_info(struct ice_port_info *pi, u16 vsi_port_num, u8 type,
|
||||
*/
|
||||
enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw)
|
||||
{
|
||||
struct ice_aqc_get_sw_cfg_resp *rbuf;
|
||||
struct ice_aqc_get_sw_cfg_resp_elem *rbuf;
|
||||
enum ice_status status;
|
||||
u8 num_total_ports;
|
||||
u16 req_desc = 0;
|
||||
@ -2448,7 +2448,7 @@ enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw)
|
||||
|
||||
num_total_ports = 1;
|
||||
|
||||
rbuf = (struct ice_aqc_get_sw_cfg_resp *)
|
||||
rbuf = (struct ice_aqc_get_sw_cfg_resp_elem *)
|
||||
ice_malloc(hw, ICE_SW_CFG_MAX_BUF_LEN);
|
||||
|
||||
if (!rbuf)
|
||||
@ -2460,19 +2460,19 @@ enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw)
|
||||
* writing a non-zero value in req_desc
|
||||
*/
|
||||
do {
|
||||
struct ice_aqc_get_sw_cfg_resp_elem *ele;
|
||||
|
||||
status = ice_aq_get_sw_cfg(hw, rbuf, ICE_SW_CFG_MAX_BUF_LEN,
|
||||
&req_desc, &num_elems, NULL);
|
||||
|
||||
if (status)
|
||||
break;
|
||||
|
||||
for (i = 0; i < num_elems; i++) {
|
||||
struct ice_aqc_get_sw_cfg_resp_elem *ele;
|
||||
for (i = 0, ele = rbuf; i < num_elems; i++, ele++) {
|
||||
u16 pf_vf_num, swid, vsi_port_num;
|
||||
bool is_vf = false;
|
||||
u8 res_type;
|
||||
|
||||
ele = rbuf[i].elements;
|
||||
vsi_port_num = LE16_TO_CPU(ele->vsi_port_num) &
|
||||
ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_M;
|
||||
|
||||
@ -3613,17 +3613,18 @@ exit:
|
||||
* ice_aq_get_res_alloc - get allocated resources
|
||||
* @hw: pointer to the HW struct
|
||||
* @num_entries: pointer to u16 to store the number of resource entries returned
|
||||
* @buf: pointer to user-supplied buffer
|
||||
* @buf_size: size of buff
|
||||
* @buf: pointer to buffer
|
||||
* @buf_size: size of buf
|
||||
* @cd: pointer to command details structure or NULL
|
||||
*
|
||||
* The user-supplied buffer must be large enough to store the resource
|
||||
* The caller-supplied buffer must be large enough to store the resource
|
||||
* information for all resource types. Each resource type is an
|
||||
* ice_aqc_get_res_resp_data_elem structure.
|
||||
* ice_aqc_get_res_resp_elem structure.
|
||||
*/
|
||||
enum ice_status
|
||||
ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, void *buf,
|
||||
u16 buf_size, struct ice_sq_cd *cd)
|
||||
ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries,
|
||||
struct ice_aqc_get_res_resp_elem *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_get_res_alloc *resp;
|
||||
enum ice_status status;
|
||||
@ -3650,8 +3651,8 @@ ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, void *buf,
|
||||
* ice_aq_get_res_descs - get allocated resource descriptors
|
||||
* @hw: pointer to the hardware structure
|
||||
* @num_entries: number of resource entries in buffer
|
||||
* @buf: Indirect buffer to hold data parameters and response
|
||||
* @buf_size: size of buffer for indirect commands
|
||||
* @buf: structure to hold response data buffer
|
||||
* @buf_size: size of buffer
|
||||
* @res_type: resource type
|
||||
* @res_shared: is resource shared
|
||||
* @desc_id: input - first desc ID to start; output - next desc ID
|
||||
@ -3659,9 +3660,8 @@ ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, void *buf,
|
||||
*/
|
||||
enum ice_status
|
||||
ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries,
|
||||
struct ice_aqc_get_allocd_res_desc_resp *buf,
|
||||
u16 buf_size, u16 res_type, bool res_shared, u16 *desc_id,
|
||||
struct ice_sq_cd *cd)
|
||||
struct ice_aqc_res_elem *buf, u16 buf_size, u16 res_type,
|
||||
bool res_shared, u16 *desc_id, struct ice_sq_cd *cd)
|
||||
{
|
||||
struct ice_aqc_get_allocd_res_desc *cmd;
|
||||
struct ice_aq_desc desc;
|
||||
|
@ -408,13 +408,13 @@ ice_alloc_sw(struct ice_hw *hw, bool ena_stats, bool shared_res, u16 *sw_id,
|
||||
enum ice_status
|
||||
ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id);
|
||||
enum ice_status
|
||||
ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries, void *buf,
|
||||
u16 buf_size, struct ice_sq_cd *cd);
|
||||
ice_aq_get_res_alloc(struct ice_hw *hw, u16 *num_entries,
|
||||
struct ice_aqc_get_res_resp_elem *buf, u16 buf_size,
|
||||
struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries,
|
||||
struct ice_aqc_get_allocd_res_desc_resp *buf,
|
||||
u16 buf_size, u16 res_type, bool res_shared, u16 *desc_id,
|
||||
struct ice_sq_cd *cd);
|
||||
struct ice_aqc_res_elem *buf, u16 buf_size, u16 res_type,
|
||||
bool res_shared, u16 *desc_id, struct ice_sq_cd *cd);
|
||||
enum ice_status
|
||||
ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *m_list);
|
||||
enum ice_status
|
||||
|
@ -2053,7 +2053,7 @@ ice_get_hw_res(struct ice_hw *hw, uint16_t res_type,
|
||||
uint16_t num, uint16_t desc_id,
|
||||
uint16_t *prof_buf, uint16_t *num_prof)
|
||||
{
|
||||
struct ice_aqc_get_allocd_res_desc_resp *resp_buf;
|
||||
struct ice_aqc_res_elem *resp_buf;
|
||||
int ret;
|
||||
uint16_t buf_len;
|
||||
bool res_shared = 1;
|
||||
@ -2062,7 +2062,7 @@ ice_get_hw_res(struct ice_hw *hw, uint16_t res_type,
|
||||
struct ice_aqc_get_allocd_res_desc *cmd =
|
||||
&aq_desc.params.get_res_desc;
|
||||
|
||||
buf_len = sizeof(resp_buf->elem) * num;
|
||||
buf_len = sizeof(*resp_buf) * num;
|
||||
resp_buf = ice_malloc(hw, buf_len);
|
||||
if (!resp_buf)
|
||||
return -ENOMEM;
|
||||
@ -2081,7 +2081,7 @@ ice_get_hw_res(struct ice_hw *hw, uint16_t res_type,
|
||||
else
|
||||
goto exit;
|
||||
|
||||
ice_memcpy(prof_buf, resp_buf->elem, sizeof(resp_buf->elem) *
|
||||
ice_memcpy(prof_buf, resp_buf, sizeof(*resp_buf) *
|
||||
(*num_prof), ICE_NONDMA_TO_NONDMA);
|
||||
|
||||
exit:
|
||||
|
Loading…
x
Reference in New Issue
Block a user