From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
Bruce Allan <bruce.w.allan@intel.com>
Subject: [dpdk-dev] [PATCH 03/40] net/ice/base: avoid unnecessary single-member variable-length structs
Date: Mon, 7 Sep 2020 19:27:49 +0800 [thread overview]
Message-ID: <20200907112826.48493-4-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20200907112826.48493-1-qi.z.zhang@intel.com>
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>
---
drivers/net/ice/base/ice_adminq_cmd.h | 63 ++---------------------------
drivers/net/ice/base/ice_common.c | 4 +-
drivers/net/ice/base/ice_common.h | 2 +-
drivers/net/ice/base/ice_dcb.c | 4 +-
drivers/net/ice/base/ice_sched.c | 76 ++++++++++++++++-------------------
drivers/net/ice/base/ice_sched.h | 10 ++---
drivers/net/ice/base/ice_switch.c | 38 +++++++++---------
drivers/net/ice/base/ice_switch.h | 10 ++---
drivers/net/ice/ice_ethdev.c | 6 +--
9 files changed, 75 insertions(+), 138 deletions(-)
diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h
index e17369f5e..df41cce06 100644
--- a/drivers/net/ice/base/ice_adminq_cmd.h
+++ b/drivers/net/ice/base/ice_adminq_cmd.h
@@ -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 {
diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index ec8d46017..4be363047 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -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)
diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h
index 329d0b50f..1aea915ad 100644
--- a/drivers/net/ice/base/ice_common.h
+++ b/drivers/net/ice/base/ice_common.h
@@ -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);
diff --git a/drivers/net/ice/base/ice_dcb.c b/drivers/net/ice/base/ice_dcb.c
index b9643b5ce..01cee227e 100644
--- a/drivers/net/ice/base/ice_dcb.c
+++ b/drivers/net/ice/base/ice_dcb.c
@@ -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 */
diff --git a/drivers/net/ice/base/ice_sched.c b/drivers/net/ice/base/ice_sched.c
index 8ee4b708e..cf9a6a777 100644
--- a/drivers/net/ice/base/ice_sched.c
+++ b/drivers/net/ice/base/ice_sched.c
@@ -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)
diff --git a/drivers/net/ice/base/ice_sched.h b/drivers/net/ice/base/ice_sched.h
index 57bf4b59d..da2604c75 100644
--- a/drivers/net/ice/base/ice_sched.h
+++ b/drivers/net/ice/base/ice_sched.h
@@ -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 */
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index ebf405f7a..e0eebe3d5 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -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 @@ ice_remove_rule_internal(struct ice_hw *hw, struct ice_sw_recipe *recp_list,
* 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;
diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h
index 77c70d3b2..fe7b86f12 100644
--- a/drivers/net/ice/base/ice_switch.h
+++ b/drivers/net/ice/base/ice_switch.h
@@ -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
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 4a161ae8a..b0a7a6707 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2056,7 +2056,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;
@@ -2065,7 +2065,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;
@@ -2084,7 +2084,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:
--
2.13.6
next prev parent reply other threads:[~2020-09-07 11:25 UTC|newest]
Thread overview: 87+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-07 11:27 [dpdk-dev] [PATCH 00/40] ice base code update Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 01/40] net/ice/base: handle error gracefully in HW table calloc Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 02/40] net/ice/base: split caps discover into two functions Qi Zhang
2020-09-07 11:27 ` Qi Zhang [this message]
2020-09-07 11:27 ` [dpdk-dev] [PATCH 04/40] net/ice/base: fix issues around move nodes Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 05/40] net/ice/base: cleanup stack hog Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 06/40] net/ice/base: clean the code wrapping Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 07/40] net/ice/base: cleanup misleading comment Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 08/40] net/ice/base: silence static analysis warning Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 09/40] net/ice/base: replace single-element array used for C struct hack Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 10/40] net/ice/base: introduce and use bitmap set API Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 11/40] net/ice/base: introduce and use bitmap hamming weight API Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 12/40] net/ice/base: add function header Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 13/40] net/ice/base: introduce and use for each bit iterator Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 14/40] net/ice/base: correct abbreviations Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 15/40] net/ice/base: add AQ cmd 0X0A0A LLDP fltr control Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 16/40] net/ice/base: add support for GTP-U type switch rule Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 17/40] net/ice/base: join format strings to same line Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 18/40] net/ice/base: introduce Tx rate limiting on port level Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 19/40] net/ice/base: reduce profile to recip info get from firmware Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 20/40] net/ice/base: refactor DCB related variables Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 21/40] net/ice/base: support outer IP filter for GTPC Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 22/40] net/ice/base: support outer IP filter for GTPU without inner IP Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 23/40] net/ice/base: move a function Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 24/40] net/ice/base: clear advanced rules in reset preparation Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 25/40] net/ice/base: move a function Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 26/40] net/ice/base: add check for failed acts allocation Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 27/40] net/ice/base: remove repeated words Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 28/40] net/ice/base: remove function ACL count query Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 29/40] net/ice/base: preserve NVM capabilities in safe mode Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 30/40] net/ice/base: misc minor ACL changes Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 31/40] net/ice/base: adjust rate limit profile ids runtime database Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 32/40] net/ice/base: enable QinQ filter for switch advanced rule Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 33/40] net/ice/base: create flash info structure and separate NVM version Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 34/40] net/ice/base: remove unused parameter Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 35/40] net/ice/base: minor code clean Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 36/40] net/ice/base: cache NVM module bank information Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 37/40] net/ice/base: rename function Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 38/40] net/ice/base: remove unnecessary conditional Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 39/40] net/ice/base: rename ACL priority values Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 40/40] net/ice/base: preserve default aggr vsi information Qi Zhang
2020-09-09 7:16 ` [dpdk-dev] [PATCH 00/40] ice base code update Yang, Qiming
2020-09-10 3:26 ` Zhang, Qi Z
2020-09-11 11:07 ` Ferruh Yigit
2020-09-11 11:52 ` Zhang, Qi Z
2020-09-11 12:23 ` Ferruh Yigit
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 " Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 01/40] net/ice/base: handle error gracefully in HW table calloc Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 02/40] net/ice/base: split caps discover into two functions Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 03/40] net/ice/base: avoid unnecessary single-member variable-length structs Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 04/40] net/ice/base: fix issues around move nodes Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 05/40] net/ice/base: cleanup stack hog Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 06/40] net/ice/base: clean the code wrapping Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 07/40] net/ice/base: cleanup misleading comment Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 08/40] net/ice/base: silence static analysis warning Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 09/40] net/ice/base: replace single-element array used for C struct hack Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 10/40] net/ice/base: introduce and use bitmap set API Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 11/40] net/ice/base: introduce and use bitmap hamming weight API Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 12/40] net/ice/base: add function header Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 13/40] net/ice/base: introduce and use for each bit iterator Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 14/40] net/ice/base: correct abbreviations Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 15/40] net/ice/base: add AQ cmd 0X0A0A LLDP fltr control Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 16/40] net/ice/base: add support for GTP-U type switch rule Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 17/40] net/ice/base: join format strings to same line Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 18/40] net/ice/base: introduce Tx rate limiting on port level Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 19/40] net/ice/base: reduce profile to recip info get from firmware Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 20/40] net/ice/base: refactor DCB related variables Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 21/40] net/ice/base: support outer IP filter for GTPC Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 22/40] net/ice/base: support outer IP filter for GTPU without inner IP Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 23/40] net/ice/base: move a function Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 24/40] net/ice/base: clear advanced rules in reset preparation Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 25/40] net/ice/base: move a function Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 26/40] net/ice/base: add check for failed acts allocation Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 27/40] net/ice/base: remove repeated words Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 28/40] net/ice/base: remove function ACL count query Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 29/40] net/ice/base: preserve NVM capabilities in safe mode Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 30/40] net/ice/base: misc minor ACL changes Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 31/40] net/ice/base: adjust rate limit profile ids runtime database Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 32/40] net/ice/base: enable QinQ filter for switch advanced rule Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 33/40] net/ice/base: create flash info structure and separate NVM version Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 34/40] net/ice/base: remove unused parameter Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 35/40] net/ice/base: minor code clean Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 36/40] net/ice/base: cache NVM module bank information Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 37/40] net/ice/base: rename function Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 38/40] net/ice/base: remove unnecessary conditional Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 39/40] net/ice/base: rename ACL priority values Qi Zhang
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 40/40] net/ice/base: preserve default aggr vsi information Qi Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200907112826.48493-4-qi.z.zhang@intel.com \
--to=qi.z.zhang@intel.com \
--cc=bruce.w.allan@intel.com \
--cc=dev@dpdk.org \
--cc=qiming.yang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).