ice base code update
cover ice base code update
main changes:
1. Added support for outer IP filter for GTPC.
2. Added support for outer IP filter for GPTU control packet (no inner IP)
3. Added support for QinQ switch filter
4. code refactor and bug fixes
Qi Zhang (40):
net/ice/base: handle error gracefully in HW table calloc net/ice/base: split caps discover into two functions net/ice/base: avoid unnecessary single-member variable-length structs net/ice/base: fix issues around move nodes
net/ice/base: cleanup stack hog
net/ice/base: clean the code wrapping
net/ice/base: cleanup misleading comment
net/ice/base: silence static analysis warning net/ice/base: replace single-element array used for C struct hack net/ice/base: introduce and use bitmap set API net/ice/base: introduce and use bitmap hamming weight API net/ice/base: add function header
net/ice/base: introduce and use for each bit iterator net/ice/base: correct abbreviations
net/ice/base: add AQ cmd 0X0A0A LLDP fltr control net/ice/base: add support for GTP-U type switch rule net/ice/base: join format strings to same line net/ice/base: introduce Tx rate limiting on port level net/ice/base: reduce profile to recip info get from firmware net/ice/base: refactor DCB related variables
net/ice/base: support outer IP filter for GTPC net/ice/base: support outer IP filter for GTPU without inner IP net/ice/base: move a function
net/ice/base: clear advanced rules in reset preparation net/ice/base: move a function
net/ice/base: add check for failed acts allocation net/ice/base: remove repeated words
net/ice/base: remove function ACL count query net/ice/base: preserve NVM capabilities in safe mode net/ice/base: misc minor ACL changes
net/ice/base: adjust rate limit profile ids runtime database net/ice/base: enable QinQ filter for switch advanced rule net/ice/base: create flash info structure and separate NVM version net/ice/base: remove unused parameter
net/ice/base: minor code clean
net/ice/base: cache NVM module bank information net/ice/base: rename function
net/ice/base: remove unnecessary conditional
net/ice/base: rename ACL priority values
net/ice/base: preserve default aggr vsi information
drivers/net/ice/base/ice_acl.c | 40 +- drivers/net/ice/base/ice_acl.h | 22 +- drivers/net/ice/base/ice_acl_ctrl.c | 200 ++++---- drivers/net/ice/base/ice_adminq_cmd.h | 83 +--- drivers/net/ice/base/ice_bitops.h | 47 ++ drivers/net/ice/base/ice_common.c | 434 +++++++++--------- drivers/net/ice/base/ice_common.h | 6 +- drivers/net/ice/base/ice_controlq.c | 42 +- drivers/net/ice/base/ice_dcb.c | 44 +- drivers/net/ice/base/ice_dcb.h | 10 +- drivers/net/ice/base/ice_flex_pipe.c | 266 ++++++----- drivers/net/ice/base/ice_flex_type.h | 49 +- drivers/net/ice/base/ice_flow.c | 280 ++++++------ drivers/net/ice/base/ice_flow.h | 1 + drivers/net/ice/base/ice_nvm.c | 293 ++++++++---- drivers/net/ice/base/ice_protocol_type.h | 15 + drivers/net/ice/base/ice_sched.c | 213 +++++---- drivers/net/ice/base/ice_sched.h | 10 +- drivers/net/ice/base/ice_switch.c | 755 +++++++++++++++++++++++++------ drivers/net/ice/base/ice_switch.h | 60 ++- drivers/net/ice/base/ice_type.h | 77 +++- drivers/net/ice/ice_ethdev.c | 20 +- 22 files changed, 1803 insertions(+), 1164 deletions(-)
Signature · 1 line
2.13.6
PATCH 1/40 net/ice/base: handle error gracefully in HW table calloc
In the ice_init_hw_tbls API, if the ice_calloc for es->written fails, catch that error and bail out gracefully, instead of continuing with a NULL pointer.
--- drivers/net/ice/base/ice_flex_pipe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_flex_pipe.c +9 -1
@@ -3908,11 +3908,19 @@ enum ice_status ice_init_hw_tbls(struct ice_hw *hw) es->ref_count = (u16 *)ice_calloc (hw, es->count,sizeof (*es->ref_count)); +if (!es->ref_count) + goto err; + es->written = (u8 *)ice_calloc (hw, es->count,sizeof (*es->written)); + +if (!es->written) + goto err; + es->mask_ena = (u32 *)ice_calloc (hw, es->count,sizeof (*es->mask_ena)); -if (!es->ref_count) + +if (!es->mask_ena) goto err; }return ICE_SUCCESS ;
Signature · 1 line
2.13.6
PATCH 2/40 net/ice/base: split caps discover into two functions
In reply to Qi ZhangUsing the new ice_aq_list_caps and ice_parse_(dev|func)_caps functions, replace ice_discover_caps with two functions that each take a pointer to the dev_caps and func_caps structures respectively.
This makes the side effect of updating the hw->dev_caps and hw->func_caps obvious from reading the implementation of the function. Additionally, it opens the way for enabling reading of device capabilities outside of the initialization flow. By passing in a pointer, another caller will be able to read the capabilities without modifying the hw capabilities structures.
As there are no other callers, it is safe to now remove ice_aq_discover_caps and ice_parse_caps.
--- drivers/net/ice/base/ice_common.c | 94 ++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 55 deletions(-)
drivers/net/ice/base/ice_common.c +39 -55
@@ -87,7 +87,8 @@ enum ice_status ice_clear_pf_cfg(struct ice_hw *hw)* is returned in user specified buffer. Please interpret user specified * buffer as "manage_mac_read" response. * Response such as various MAC addresses are stored in HW struct (port.mac) -* ice_aq_discover_caps is expected to be called before this function is called. +* ice_discover_dev_caps is expected to be called before this function is +* called. */ static enum ice_status ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size,
@@ -2156,30 +2157,6 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p, }/** -* ice_parse_caps - parse function/device capabilities -* @hw: pointer to the HW struct -* @buf: pointer to a buffer containing function/device capability records -* @cap_count: number of capability records in the list -* @opc: type of capabilities list to parse -* -* Helper function to parse function(0x000a)/device(0x000b) capabilities list. -*/ -static void -ice_parse_caps (struct ice_hw *hw,void *buf,u32 cap_count, -enum ice_adminq_opc opc) -{ -if (!buf) -return ; - -if (opc == ice_aqc_opc_list_dev_caps) -ice_parse_dev_caps (hw, &hw->dev_caps, buf, cap_count); -else if (opc == ice_aqc_opc_list_func_caps) -ice_parse_func_caps (hw, &hw->func_caps, buf, cap_count); -else -ice_debug (hw,ICE_DBG_INIT ,"wrong opcode\n" ); -} - -/** * ice_aq_list_caps - query function/device capabilities * @hw: pointer to the HW struct * @buf: a buffer to hold the capabilities
@@ -2222,47 +2199,52 @@ ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count, }/** -* ice_aq_discover_caps - query function/device capabilities -* @hw: pointer to the HW struct -* @buf: a virtual buffer to hold the capabilities -* @buf_size: Size of the virtual buffer -* @cap_count: cap count needed if AQ err==ENOMEM -* @opc: capabilities type to discover - pass in the command opcode -* @cd: pointer to command details structure or NULL -* -* Get the function(0x000a)/device(0x000b) capabilities description from -* the firmware. +* ice_discover_dev_caps - Read and extract device capabilities +* @hw: pointer to the hardware structure +* @dev_caps: pointer to device capabilities structure * -* NOTE: this function has the side effect of updating the hw->dev_caps or -* hw->func_caps by way of calling ice_parse_caps. +* Read the device capabilities and extract them into the dev_caps structure +* for later use. */ static enum ice_status -ice_aq_discover_caps (struct ice_hw *hw,void *buf,u16 buf_size,u32 *cap_count, -enum ice_adminq_opc opc,struct ice_sq_cd *cd) +ice_discover_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_caps) { -u32 local_cap_count =0 ;enum ice_status status; +u32 cap_count =0 ; +void *cbuf; - status =ice_aq_list_caps (hw, buf, buf_size, &local_cap_count, - opc, cd); + cbuf =ice_malloc (hw,ICE_AQ_MAX_BUF_LEN ); +if (!cbuf) +return ICE_ERR_NO_MEMORY ; + +/* Although the driver doesn't know the number of capabilities the +* device will return, we can simply send a 4KB buffer, the maximum +* possible size that firmware can return. +*/ + cap_count =ICE_AQ_MAX_BUF_LEN /sizeof (struct ice_aqc_list_caps_elem ); + + status =ice_aq_list_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, + ice_aqc_opc_list_dev_caps,NULL );if (!status) -ice_parse_caps (hw, buf, local_cap_count, opc); -else if (hw->adminq.sq_last_status ==ICE_AQ_RC_ENOMEM ) - *cap_count = local_cap_count; +ice_parse_dev_caps (hw, dev_caps, cbuf, cap_count); +ice_free (hw, cbuf);return status; }/** -* ice_discover_caps - get info about the HW +* ice_discover_func_caps - Read and extract function capabilities * @hw: pointer to the hardware structure -* @opc: capabilities type to discover - pass in the command opcode +* @func_caps: pointer to function capabilities structure +* +* Read the function capabilities and extract them into the func_caps structure +* for later use. */ static enum ice_status -ice_discover_caps (struct ice_hw *hw,enum ice_adminq_opc opc) +ice_discover_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_caps) {enum ice_status status; -u32 cap_count; +u32 cap_count =0 ;void *cbuf; cbuf =ice_malloc (hw,ICE_AQ_MAX_BUF_LEN );
@@ -2275,8 +2257,10 @@ ice_discover_caps(struct ice_hw *hw, enum ice_adminq_opc opc)*/ cap_count =ICE_AQ_MAX_BUF_LEN /sizeof (struct ice_aqc_list_caps_elem ); - status =ice_aq_discover_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, - opc,NULL ); + status =ice_aq_list_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, + ice_aqc_opc_list_func_caps,NULL ); +if (!status) +ice_parse_func_caps (hw, func_caps, cbuf, cap_count);ice_free (hw, cbuf);return status;
@@ -2354,11 +2338,11 @@ enum ice_status ice_get_caps(struct ice_hw *hw) {enum ice_status status; - status =ice_discover_caps (hw, ice_aqc_opc_list_dev_caps); -if (!status) - status =ice_discover_caps (hw, ice_aqc_opc_list_func_caps); + status =ice_discover_dev_caps (hw, &hw->dev_caps); +if (status) +return status; -return status; +return ice_discover_func_caps (hw, &hw->func_caps); }/**
Signature · 1 line
2.13.6
PATCH 3/40 net/ice/base: avoid unnecessary single-member variable-length structs
In reply to Qi ZhangThere 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.
--- 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(-)
drivers/net/ice/base/ice_adminq_cmd.h +4 -59
@@ -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 {
drivers/net/ice/base/ice_common.c +2 -2
@@ -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 )
drivers/net/ice/base/ice_common.h +1 -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);
drivers/net/ice/base/ice_dcb.c +2 -2
@@ -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 */
drivers/net/ice/base/ice_sched.c +34 -42
223 lines not on this page · raw message
drivers/net/ice/base/ice_sched.h +5 -5
@@ -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 */
drivers/net/ice/base/ice_switch.c +19 -19
@@ -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;
drivers/net/ice/base/ice_switch.h +5 -5
@@ -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
drivers/net/ice/ice_ethdev.c +3 -3
@@ -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:
Signature · 1 line
2.13.6
PATCH 4/40 net/ice/base: fix issues around move nodes
In reply to Qi Zhang1. Fixed the max children check when moving the last(8th) children. This allows the parent node to hold 8 children instead of 7.
2. Check whether the VSI is already part of the given aggregator subtree before moving it.
--- drivers/net/ice/base/ice_sched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_sched.c +5 -1
@@ -2267,7 +2267,7 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent,return ICE_ERR_PARAM ;/* Does parent have enough space */ -if (parent->num_children + num_items >= +if (parent->num_children + num_items > hw->max_children[parent->tx_sched_layer])return ICE_ERR_AQ_FULL ;
@@ -2335,6 +2335,10 @@ ice_sched_move_vsi_to_agg(struct ice_port_info *pi, u16 vsi_handle, u32 agg_id,if (!vsi_node)return ICE_ERR_DOES_NOT_EXIST ; +/* Is this VSI already part of given aggregator? */ +if (ice_sched_find_node_in_subtree (pi->hw, agg_node, vsi_node)) +return ICE_SUCCESS ; + aggl =ice_sched_get_agg_layer (pi->hw); vsil =ice_sched_get_vsi_layer (pi->hw);
Signature · 1 line
2.13.6
PATCH 5/40 net/ice/base: cleanup stack hog
In reply to Qi ZhangIn ice_flow_add_prof_sync(), struct ice_flow_prof_params has recently grown in size hogging stack space when allocated there. Hogging stack space should be avoided. Change allocation to be on the heap when needed.
--- drivers/net/ice/base/ice_flow.c | 55 +++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-)
drivers/net/ice/base/ice_flow.c +31 -24
@@ -1815,52 +1815,57 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, struct ice_flow_action *acts, u8 acts_cnt, struct ice_flow_prof **prof) { - struct ice_flow_prof_params params; + struct ice_flow_prof_params *params;enum ice_status status;u8 i;if (!prof || (acts_cnt && !acts))return ICE_ERR_BAD_PTR ; -ice_memset (¶ms,0 ,sizeof (params),ICE_NONDMA_MEM ); - params.prof = (struct ice_flow_prof *) -ice_malloc (hw,sizeof (*params.prof)); -if (!params.prof) + params = (struct ice_flow_prof_params *)ice_malloc (hw,sizeof (*params)); +if (!params)return ICE_ERR_NO_MEMORY ; + params->prof = (struct ice_flow_prof *) +ice_malloc (hw,sizeof (*params->prof)); +if (!params->prof) { + status =ICE_ERR_NO_MEMORY ; + goto free_params; + } +/* initialize extraction sequence to all invalid (0xff) */ for (i =0 ; i <ICE_MAX_FV_WORDS ; i++) { - params.es[i].prot_id =ICE_PROT_INVALID ; - params.es[i].off =ICE_FV_OFFSET_INVAL ; + params->es[i].prot_id =ICE_PROT_INVALID ; + params->es[i].off =ICE_FV_OFFSET_INVAL ; } - params.blk = blk; - params.prof->id = prof_id; - params.prof->dir = dir; - params.prof->segs_cnt = segs_cnt; + params->blk = blk; + params->prof->id = prof_id; + params->prof->dir = dir; + params->prof->segs_cnt = segs_cnt;/* Make a copy of the segments that need to be persistent in the flow * profile instance */ for (i =0 ; i < segs_cnt; i++) -ice_memcpy (¶ms.prof->segs[i], &segs[i],sizeof (*segs), +ice_memcpy (¶ms->prof->segs[i], &segs[i],sizeof (*segs),ICE_NONDMA_TO_NONDMA );/* Make a copy of the actions that need to be persistent in the flow * profile instance. */ if (acts_cnt) { - params.prof->acts = (struct ice_flow_action *) + params->prof->acts = (struct ice_flow_action *)ice_memdup (hw, acts, acts_cnt *sizeof (*acts),ICE_NONDMA_TO_NONDMA ); -if (!params.prof->acts) { +if (!params->prof->acts) { status =ICE_ERR_NO_MEMORY ; goto out; } } - status =ice_flow_proc_segs (hw, ¶ms); + status =ice_flow_proc_segs (hw, params);if (status) {ice_debug (hw,ICE_DBG_FLOW ,"Error processing a flow's packet segments\n" );
@@ -1868,24 +1873,26 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, }/* Add a HW profile for this flow profile */ - status =ice_add_prof (hw, blk, prof_id, (u8 *)params.ptypes, - params.attr, params.attr_cnt, params.es, - params.mask); + status =ice_add_prof (hw, blk, prof_id, (u8 *)params->ptypes, + params->attr, params->attr_cnt, params->es, + params->mask);if (status) {ice_debug (hw,ICE_DBG_FLOW ,"Error adding a HW flow profile\n" ); goto out; } -INIT_LIST_HEAD (¶ms.prof->entries); -ice_init_lock (¶ms.prof->entries_lock); - *prof = params.prof; +INIT_LIST_HEAD (¶ms->prof->entries); +ice_init_lock (¶ms->prof->entries_lock); + *prof = params->prof; out:if (status) { -if (params.prof->acts) -ice_free (hw, params.prof->acts); -ice_free (hw, params.prof); +if (params->prof->acts) +ice_free (hw, params->prof->acts); +ice_free (hw, params->prof); } +free_params: +ice_free (hw, params);return status; }
Signature · 1 line
2.13.6
PATCH 6/40 net/ice/base: clean the code wrapping
In reply to Qi ZhangTo make the wrapping a little cleaner, move the variables only applicable to ICE_FC_AUTO into that case. Also move caching of the value to only occur on succcess.
--- drivers/net/ice/base/ice_common.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/net/ice/base/ice_common.c +21 -16
@@ -2754,36 +2754,39 @@ static enum ice_status ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fc_mode req_mode) { - struct ice_aqc_get_phy_caps_data *pcaps = NULL; struct ice_phy_cache_mode_data cache_data; -enum ice_status status =ICE_SUCCESS ;u8 pause_mask =0x0 ;if (!pi || !cfg)return ICE_ERR_BAD_PTR ; - pcaps = (struct ice_aqc_get_phy_caps_data *) -ice_malloc (pi->hw,sizeof (*pcaps)); -if (!pcaps) -return ICE_ERR_NO_MEMORY ; - -/* Cache user FC request */ - cache_data.data.curr_user_fc_req = req_mode; -ice_cache_phy_user_req (pi, cache_data,ICE_FC_MODE ); -switch (req_mode) {case ICE_FC_AUTO : + { +struct ice_aqc_get_phy_caps_data *pcaps; +enum ice_status status; + + pcaps = (struct ice_aqc_get_phy_caps_data *) +ice_malloc (pi->hw,sizeof (*pcaps)); +if (!pcaps) +return ICE_ERR_NO_MEMORY ; +/* Query the value of FC that both the NIC and attached media * can do. */ status =ice_aq_get_phy_caps (pi, false,ICE_AQC_REPORT_TOPO_CAP , pcaps,NULL ); -if (status) - goto out; +if (status) { +ice_free (pi->hw, pcaps); +return status; + } pause_mask |= pcaps->caps &ICE_AQC_PHY_EN_TX_LINK_PAUSE ; pause_mask |= pcaps->caps &ICE_AQC_PHY_EN_RX_LINK_PAUSE ; + +ice_free (pi->hw, pcaps);break ; + }case ICE_FC_FULL : pause_mask |=ICE_AQC_PHY_EN_TX_LINK_PAUSE ; pause_mask |=ICE_AQC_PHY_EN_RX_LINK_PAUSE ;
@@ -2805,9 +2808,11 @@ ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,/* set the new capabilities */ cfg->caps |= pause_mask; -out: -ice_free (pi->hw, pcaps); -return status; +/* Cache user FC request */ + cache_data.data.curr_user_fc_req = req_mode; +ice_cache_phy_user_req (pi, cache_data,ICE_FC_MODE ); + +return ICE_SUCCESS ; }/**
Signature · 1 line
2.13.6
PATCH 7/40 net/ice/base: cleanup misleading comment
In reply to Qi ZhangThe maximum Admin Queue buffer size and NVM shadow RAM sector size are both 4 Kilobytes. Some comments refer to those as 4Kb which can be confused with 4 Kilobits. Update the comments to use the commonly used KB symbol instead.
--- drivers/net/ice/base/ice_nvm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_nvm.c +4 -4
@@ -58,7 +58,7 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,* * Reads a portion of the NVM, as a flat memory space. This function correctly * breaks read requests across Shadow RAM sectors and ensures that no single -* read request exceeds the maximum 4Kb read for a single AdminQ command. +* read request exceeds the maximum 4KB read for a single AdminQ command. * * Returns a status code on failure. Note that the data pointer may be * partially updated if some reads succeed before a failure.
@@ -86,10 +86,10 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data, do { u32 read_size, sector_offset; - /* ice_aq_read_nvm cannot read more than 4Kb at a time. + /* ice_aq_read_nvm cannot read more than 4KB at a time. * Additionally, a read from the Shadow RAM may not cross over * a sector boundary. Conveniently, the sector size is also - * 4Kb. + * 4KB. */ sector_offset = offset % ICE_AQ_MAX_BUF_LEN; read_size = MIN_T(u32, ICE_AQ_MAX_BUF_LEN - sector_offset,
@@ -164,7 +164,7 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data)ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__); -/* ice_read_flat_nvm takes into account the 4Kb AdminQ and Shadow RAM +/* ice_read_flat_nvm takes into account the 4KB AdminQ and Shadow RAM * sector restrictions necessary when reading from the NVM. */ status =ice_read_flat_nvm (hw, offset *2 , &bytes, (u8 *)data, true);
Signature · 1 line
2.13.6
PATCH 8/40 net/ice/base: silence static analysis warning
In reply to Qi ZhangSparse warns about these casts to/from restricted types which are not actual problems; silence the warnings.
--- drivers/net/ice/base/ice_nvm.c | 2 +- drivers/net/ice/base/ice_switch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_nvm.c +1 -1
@@ -138,7 +138,7 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data)* boundary */ status =ice_read_flat_nvm (hw, offset *sizeof (u16), &bytes, - (u8 *)&data_local, true); + (_FORCE_ u8 *)&data_local, true);if (status)return status;
drivers/net/ice/base/ice_switch.c +1 -1
@@ -5774,7 +5774,7 @@ ice_fill_valid_words(struct ice_adv_lkup_elem *rule, lkup_exts->fv_words[word].prot_id = ice_prot_id_tbl[rule->type].protocol_id; lkup_exts->field_mask[word] = -BE16_TO_CPU (((__be16 *)&rule->m_u)[j]); + BE16_TO_CPU(((_FORCE_ __be16 *)&rule->m_u)[j]); word++; }
Signature · 1 line
2.13.6
PATCH 9/40 net/ice/base: replace single-element array used for C struct hack
In reply to Qi ZhangConvert the pre-C90-extension "C struct hack" method (using a single- element array at the end of a structure for implementing variable-length types) to the preferred use of C99 flexible array member.
--- drivers/net/ice/base/ice_adminq_cmd.h | 22 +++++----- drivers/net/ice/base/ice_common.c | 77 ++++++++++++++++++----------------- drivers/net/ice/base/ice_dcb.h | 10 +---- drivers/net/ice/base/ice_flex_pipe.c | 33 ++++++++++----- drivers/net/ice/base/ice_flex_type.h | 49 +++++++++------------- drivers/net/ice/base/ice_sched.c | 10 +++-- drivers/net/ice/base/ice_switch.c | 32 ++++++--------- drivers/net/ice/base/ice_switch.h | 24 ++++------- drivers/net/ice/base/ice_type.h | 7 ++++ 9 files changed, 129 insertions(+), 135 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +11 -11
@@ -312,7 +312,7 @@ struct ice_aqc_alloc_free_res_elem {#define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_M \ (0xF << ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S)__le16 num_elems; -struct ice_aqc_res_elem elem[1 ]; +struct ice_aqc_res_elem elem[STRUCT_HACK_VAR_LEN ]; };/* Get Allocated Resource Descriptors Command (indirect 0x020A) */
@@ -812,7 +812,7 @@ struct ice_sw_rule_lkup_rx_tx {* lookup-type */ __le16 hdr_len; -u8 hdr[1 ]; +u8 hdr[STRUCT_HACK_VAR_LEN ]; };/* Add/Update/Remove large action command/response entry
@@ -872,7 +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 */ +__le32 act[STRUCT_HACK_VAR_LEN ];/* array of size for actions */ };/* Add/Update/Remove VSI list command/response entry
@@ -882,7 +882,7 @@ struct ice_sw_rule_lg_act {struct ice_sw_rule_vsi_list {__le16 index;/* Index of VSI/Prune list */ __le16 number_vsi; -__le16 vsi[1 ];/* Array of number_vsi VSI numbers */ +__le16 vsi[STRUCT_HACK_VAR_LEN ];/* Array of number_vsi VSI numbers */ };#pragma pack(1)
@@ -989,7 +989,7 @@ struct ice_aqc_txsched_move_grp_info_hdr {struct ice_aqc_move_elem {struct ice_aqc_txsched_move_grp_info_hdr hdr; -__le32 teid[1 ]; +__le32 teid[STRUCT_HACK_VAR_LEN ]; };struct ice_aqc_elem_info_bw {
@@ -1042,7 +1042,7 @@ struct ice_aqc_txsched_topo_grp_info_hdr {struct ice_aqc_add_elem {struct ice_aqc_txsched_topo_grp_info_hdr hdr; -struct ice_aqc_txsched_elem_data generic[1 ]; +struct ice_aqc_txsched_elem_data generic[STRUCT_HACK_VAR_LEN ]; };struct ice_aqc_get_topo_elem {
@@ -1053,7 +1053,7 @@ struct ice_aqc_get_topo_elem {struct ice_aqc_delete_elem {struct ice_aqc_txsched_topo_grp_info_hdr hdr; -__le32 teid[1 ]; +__le32 teid[STRUCT_HACK_VAR_LEN ]; };/* Query Port ETS (indirect 0x040E)
@@ -2426,7 +2426,7 @@ struct ice_aqc_add_tx_qgrp {__le32 parent_teid;u8 num_txqs;u8 rsvd[3 ]; -struct ice_aqc_add_txqs_perq txqs[1 ]; +struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN ]; };/* Disable Tx LAN Queues (indirect 0x0C31) */
@@ -2470,7 +2470,7 @@ struct ice_aqc_dis_txq_item { (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 ]; +__le16 q_id[STRUCT_HACK_VAR_LEN ]; };#pragma pack()
@@ -2514,7 +2514,7 @@ struct ice_aqc_move_txqs_elem {struct ice_aqc_move_txqs_data {__le32 src_teid;__le32 dest_teid; -struct ice_aqc_move_txqs_elem txqs[1 ]; +struct ice_aqc_move_txqs_elem txqs[STRUCT_HACK_VAR_LEN ]; };/* Download Package (indirect 0x0C40) */
@@ -2567,7 +2567,7 @@ struct ice_aqc_get_pkg_info {/* Get Package Info List response buffer format (0x0C43) */ struct ice_aqc_get_pkg_info_resp {__le32 count; -struct ice_aqc_get_pkg_info pkg_info[1 ]; +struct ice_aqc_get_pkg_info pkg_info[STRUCT_HACK_VAR_LEN ]; };/* Driver Shared Parameters (direct, 0x0C90) */
drivers/net/ice/base/ice_common.c +40 -37
173 lines not on this page · raw message
drivers/net/ice/base/ice_dcb.h +2 -8
@@ -103,17 +103,11 @@#define ICE_IEEE_APP_TLV_LEN 11#pragma pack(1) -/* IEEE 802.1AB LLDP TLV structure */ -struct ice_lldp_generic_tlv { -__be16 typelen; -u8 tlvinfo[1 ]; -}; -/* IEEE 802.1AB LLDP Organization specific TLV */ struct ice_lldp_org_tlv {__be16 typelen;__be32 ouisubtype; -u8 tlvinfo[1 ]; +u8 tlvinfo[STRUCT_HACK_VAR_LEN ]; };#pragma pack()
@@ -136,7 +130,7 @@ struct ice_cee_feat_tlv {#define ICE_CEE_FEAT_TLV_WILLING_M 0x40#define ICE_CEE_FEAT_TLV_ERR_M 0x20u8 subtype; -u8 tlvinfo[1 ]; +u8 tlvinfo[STRUCT_HACK_VAR_LEN ]; };#pragma pack(1)
drivers/net/ice/base/ice_flex_pipe.c +22 -11
@@ -1138,7 +1138,7 @@ static enum ice_status ice_get_pkg_info(struct ice_hw *hw)ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__); - size =ice_struct_size (pkg_info, pkg_info,ICE_PKG_CNT -1 ); + size =ice_struct_size (pkg_info, pkg_info,ICE_PKG_CNT ); pkg_info = (struct ice_aqc_get_pkg_info_resp *)ice_malloc (hw, size);if (!pkg_info)return ICE_ERR_NO_MEMORY ;
@@ -1197,7 +1197,7 @@ static enum ice_status ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)u32 seg_count;u32 i; -if (len <sizeof (*pkg)) +if (len <ice_struct_size (pkg, seg_offset,1 ))return ICE_ERR_BUF_TOO_SHORT ; if (pkg->pkg_format_ver.major != ICE_PKG_FMT_VER_MAJ ||
@@ -1212,7 +1212,7 @@ static enum ice_status ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)return ICE_ERR_CFG ;/* make sure segment array fits in package length */ -if (len <ice_struct_size (pkg, seg_offset, seg_count -1 )) +if (len <ice_struct_size (pkg, seg_offset, seg_count))return ICE_ERR_BUF_TOO_SHORT ;/* all segments must fit within length */
@@ -1321,7 +1321,7 @@ ice_chk_pkg_compat(struct ice_hw *hw, struct ice_pkg_hdr *ospkg, }/* Check if FW is compatible with the OS package */ - size =ice_struct_size (pkg, pkg_info,ICE_PKG_CNT -1 ); + size =ice_struct_size (pkg, pkg_info,ICE_PKG_CNT ); pkg = (struct ice_aqc_get_pkg_info_resp *)ice_malloc (hw, size);if (!pkg)return ICE_ERR_NO_MEMORY ;
@@ -2049,14 +2049,14 @@ ice_create_tunnel(struct ice_hw *hw, enum ice_tunnel_type type, u16 port) sect_rx = (struct ice_boost_tcam_section *)ice_pkg_buf_alloc_section (bld,ICE_SID_RXPARSER_BOOST_TCAM , -sizeof (*sect_rx)); +ice_struct_size (sect_rx, tcam,1 ));if (!sect_rx) goto ice_create_tunnel_err; sect_rx->count =CPU_TO_LE16 (1 ); sect_tx = (struct ice_boost_tcam_section *)ice_pkg_buf_alloc_section (bld,ICE_SID_TXPARSER_BOOST_TCAM , -sizeof (*sect_tx)); +ice_struct_size (sect_tx, tcam,1 ));if (!sect_tx) goto ice_create_tunnel_err; sect_tx->count =CPU_TO_LE16 (1 );
@@ -2134,7 +2134,7 @@ enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all) }/* size of section - there is at least one entry */ - size =ice_struct_size (sect_rx, tcam, count -1 ); + size =ice_struct_size (sect_rx, tcam, count); bld =ice_pkg_buf_alloc (hw);if (!bld) {
@@ -4092,7 +4092,9 @@ ice_prof_bld_es(struct ice_hw *hw, enum ice_block blk, id =ice_sect_id (blk,ICE_VEC_TBL ); p = (struct ice_pkg_es *) -ice_pkg_buf_alloc_section (bld, id,sizeof (*p) + +ice_pkg_buf_alloc_section (bld, id, +ice_struct_size (p, es, +1 ) + vec_size -sizeof (p->es[0 ]));
@@ -4129,7 +4131,10 @@ ice_prof_bld_tcam(struct ice_hw *hw, enum ice_block blk, id =ice_sect_id (blk,ICE_PROF_TCAM ); p = (struct ice_prof_id_section *) -ice_pkg_buf_alloc_section (bld, id,sizeof (*p)); +ice_pkg_buf_alloc_section (bld, id, +ice_struct_size (p, + entry, +1 ));if (!p)return ICE_ERR_MAX_LIMIT ;
@@ -4166,7 +4171,10 @@ ice_prof_bld_xlt1(enum ice_block blk, struct ice_buf_build *bld, id =ice_sect_id (blk,ICE_XLT1 ); p = (struct ice_xlt1_section *) -ice_pkg_buf_alloc_section (bld, id,sizeof (*p)); +ice_pkg_buf_alloc_section (bld, id, +ice_struct_size (p, + value, +1 ));if (!p)return ICE_ERR_MAX_LIMIT ;
@@ -4201,7 +4209,10 @@ ice_prof_bld_xlt2(enum ice_block blk, struct ice_buf_build *bld,case ICE_VSIG_REM : id =ice_sect_id (blk,ICE_XLT2 ); p = (struct ice_xlt2_section *) -ice_pkg_buf_alloc_section (bld, id,sizeof (*p)); +ice_pkg_buf_alloc_section (bld, id, +ice_struct_size (p, + value, +1 ));if (!p)return ICE_ERR_MAX_LIMIT ;
drivers/net/ice/base/ice_flex_type.h +20 -29
135 lines not on this page · raw message
drivers/net/ice/base/ice_sched.c +6 -4
@@ -237,7 +237,7 @@ ice_sched_remove_elems(struct ice_hw *hw, struct ice_sched_node *parent,enum ice_status status;u16 buf_size; - buf_size =sizeof (*buf) +sizeof (u32) * (num_nodes -1 ); + buf_size =ice_struct_size (buf, teid, num_nodes); buf = (struct ice_aqc_delete_elem *)ice_malloc (hw, buf_size);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -892,7 +892,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,u16 buf_size;u32 teid; - buf_size =ice_struct_size (buf, generic, num_nodes -1 ); + buf_size =ice_struct_size (buf, generic, num_nodes); buf = (struct ice_aqc_add_elem *)ice_malloc (hw, buf_size);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -2260,6 +2260,7 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent,struct ice_sched_node *node;u16 i, grps_movd =0 ;struct ice_hw *hw; +u16 buf_len; hw = pi->hw;
@@ -2271,7 +2272,8 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent, hw->max_children[parent->tx_sched_layer])return ICE_ERR_AQ_FULL ; - buf = (struct ice_aqc_move_elem *)ice_malloc (hw,sizeof (*buf)); + buf_len =ice_struct_size (buf, teid,1 ); + buf = (struct ice_aqc_move_elem *)ice_malloc (hw, buf_len);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -2286,7 +2288,7 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent, buf->hdr.dest_parent_teid = parent->info.node_teid; buf->teid[0 ] = node->info.node_teid; buf->hdr.num_elems =CPU_TO_LE16 (1 ); - status =ice_aq_move_sched_elems (hw,1 , buf,sizeof (*buf), + status =ice_aq_move_sched_elems (hw,1 , buf, buf_len, &grps_movd,NULL );if (status && grps_movd !=1 ) { status =ICE_ERR_CFG ;
drivers/net/ice/base/ice_switch.c +13 -19
@@ -1478,9 +1478,8 @@ ice_alloc_sw(struct ice_hw *hw, bool ena_stats, bool shared_res, u16 *sw_id,enum ice_status status;u16 buf_len; - buf_len =sizeof (*sw_buf); - sw_buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (sw_buf, elem,1 ); + sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ;
@@ -1560,9 +1559,8 @@ enum ice_status ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id)enum ice_status status, ret_status;u16 buf_len; - buf_len =sizeof (*sw_buf); - sw_buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (sw_buf, elem,1 ); + sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ;
@@ -2103,9 +2101,8 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id,enum ice_status status;u16 buf_len; - buf_len =sizeof (*sw_buf); - sw_buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (sw_buf, elem,1 ); + sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ; sw_buf->num_elems =CPU_TO_LE16 (1 );
@@ -2387,7 +2384,7 @@ enum ice_status ice_alloc_recipe(struct ice_hw *hw, u16 *rid)enum ice_status status;u16 buf_len; - buf_len =sizeof (*sw_buf); + buf_len =ice_struct_size (sw_buf, elem,1 ); sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ;
@@ -5253,9 +5250,8 @@ ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,u16 buf_len;/* Allocate resource */ - buf_len =sizeof (*buf); - buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (buf, elem,1 ); + buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -5292,9 +5288,8 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,u16 buf_len;/* Free resource */ - buf_len =sizeof (*buf); - buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (buf, elem,1 ); + buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -5354,9 +5349,8 @@ ice_alloc_res_lg_act(struct ice_hw *hw, u16 *l_id, u16 num_acts)return ICE_ERR_PARAM ;/* Allocate resource for large action */ - buf_len =sizeof (*sw_buf); - sw_buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (sw_buf, elem,1 ); + sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ;
drivers/net/ice/base/ice_switch.h +8 -16
@@ -45,25 +45,17 @@#define DUMMY_ETH_HDR_LEN 16#define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE \ - (sizeof(struct ice_aqc_sw_rules_elem) - \ - FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \ - sizeof(struct ice_sw_rule_lkup_rx_tx) + DUMMY_ETH_HDR_LEN - 1) + (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr) + \ + (DUMMY_ETH_HDR_LEN * \ + sizeof(((struct ice_sw_rule_lkup_rx_tx *)0)->hdr[0])))#define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \ - (sizeof(struct ice_aqc_sw_rules_elem) - \ - FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \ - sizeof(struct ice_sw_rule_lkup_rx_tx) - 1) + (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr))#define ICE_SW_RULE_LG_ACT_SIZE (n) \ - (sizeof(struct ice_aqc_sw_rules_elem) - \ - FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \ - sizeof(struct ice_sw_rule_lg_act) - \ - FIELD_SIZEOF(struct ice_sw_rule_lg_act, act) + \ - ((n) * FIELD_SIZEOF(struct ice_sw_rule_lg_act, act))) + (offsetof(struct ice_aqc_sw_rules_elem, pdata.lg_act.act) + \ + ((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act[0])))#define ICE_SW_RULE_VSI_LIST_SIZE (n) \ - (sizeof(struct ice_aqc_sw_rules_elem) - \ - FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \ - sizeof(struct ice_sw_rule_vsi_list) - \ - FIELD_SIZEOF(struct ice_sw_rule_vsi_list, vsi) + \ - ((n) * FIELD_SIZEOF(struct ice_sw_rule_vsi_list, vsi))) + (offsetof(struct ice_aqc_sw_rules_elem, pdata.vsi_list.vsi) + \ + ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi[0])))/* Worst case buffer length for ice_aqc_opc_get_res_alloc */ #define ICE_MAX_RES_TYPES 0x80
drivers/net/ice/base/ice_type.h +7 -0
@@ -34,6 +34,13 @@#define IS_ASCII (_ch) ((_ch) < 0x80) +#define STRUCT_HACK_VAR_LEN +/** +* ice_struct_size - size of struct with C99 flexible array member +* @ptr: pointer to structure +* @field: flexible array member (last member of the structure) +* @num: number of elements of that flexible array member +*/ #define ice_struct_size (ptr, field, num) \ (sizeof(*(ptr)) + sizeof(*(ptr)->field) * (num))
Signature · 1 line
2.13.6
PATCH 10/40 net/ice/base: introduce and use bitmap set API
In reply to Qi ZhangIntroduce ice_bitmap_set() and use it instead of open-coding that functionality.
--- drivers/net/ice/base/ice_acl_ctrl.c | 4 +--- drivers/net/ice/base/ice_bitops.h | 19 +++++++++++++++++++ drivers/net/ice/base/ice_flex_pipe.c | 9 ++------- drivers/net/ice/base/ice_switch.c | 3 +-- 4 files changed, 23 insertions(+), 12 deletions(-)
drivers/net/ice/base/ice_acl_ctrl.c +1 -3
@@ -354,7 +354,6 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)/* call the AQ command to create the ACL table with these values */ status =ice_aq_alloc_acl_tbl (hw, &tbl_alloc,NULL ); -if (status) {if (LE16_TO_CPU (tbl_alloc.buf.resp_buf.alloc_id) <ICE_AQC_ALLOC_ID_LESS_THAN_4K )
@@ -415,8 +414,7 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params) (tbl->last_entry /ICE_ACL_ENTRY_ALLOC_UNIT );/* Indicate available entries in the table */ -for (i = first_e; i <= last_e; i++) -ice_set_bit (i, tbl->avail); +ice_bitmap_set (tbl->avail, first_e, last_e - first_e +1 );INIT_LIST_HEAD (&tbl->scens); out:
drivers/net/ice/base/ice_bitops.h +19 -0
@@ -376,6 +376,25 @@ static inline void ice_cp_bitmap(ice_bitmap_t *dst, ice_bitmap_t *src, u16 size) }/** +* ice_bitmap_set - set a number of bits in bitmap from a starting position +* @dst: bitmap destination +* @pos: first bit position to set +* @num_bits: number of bits to set +* +* This function sets bits in a bitmap from pos to (pos + num_bits) - 1. +* Note that this function assumes it is operating on a bitmap declared using +* ice_declare_bitmap. +*/ +static inline void +ice_bitmap_set (ice_bitmap_t *dst,u16 pos,u16 num_bits) +{ +u16 i; + +for (i = pos; i < num_bits; i++) +ice_set_bit (i, dst); +} + +/** * ice_cmp_bitmaps - compares two bitmaps. * @bmp1: the bitmap to compare * @bmp2: the bitmap to compare with bmp1
drivers/net/ice/base/ice_flex_pipe.c +2 -7
@@ -1580,18 +1580,13 @@ ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type req_profs,struct ice_seg *ice_seg;struct ice_fv *fv; -ice_memset (&state,0 ,sizeof (state),ICE_NONDMA_MEM ); -if (req_profs ==ICE_PROF_ALL ) { -u16 i; - -for (i =0 ; i <ICE_MAX_NUM_PROFILES ; i++) -ice_set_bit (i, bm); +ice_bitmap_set (bm,0 ,ICE_MAX_NUM_PROFILES );return ; } +ice_memset (&state,0 ,sizeof (state),ICE_NONDMA_MEM );ice_zero_bitmap (bm,ICE_MAX_NUM_PROFILES ); - ice_seg = hw->seg; do { enum ice_prof_type prof_type;
drivers/net/ice/base/ice_switch.c +1 -2
@@ -5940,8 +5940,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,ice_zero_bitmap (used_idx,ICE_MAX_FV_WORDS );ice_zero_bitmap (free_idx,ICE_MAX_FV_WORDS ); -for (count =0 ; count <ICE_MAX_FV_WORDS ; count++) -ice_set_bit (count, possible_idx); +ice_bitmap_set (possible_idx,0 ,ICE_MAX_FV_WORDS );/* For each profile we are going to associate the recipe with, add the * recipes that are associated with that profile. This will give us
Signature · 1 line
2.13.6
PATCH 11/40 net/ice/base: introduce and use bitmap hamming weight API
In reply to Qi ZhangIntroduce ice_bitmap_hweight() and use it instead of open-coding that functionality.
--- drivers/net/ice/base/ice_bitops.h | 23 +++++++++++++++++++++++ drivers/net/ice/base/ice_switch.c | 11 +---------- 2 files changed, 24 insertions(+), 10 deletions(-)
drivers/net/ice/base/ice_bitops.h +23 -0
@@ -395,6 +395,29 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits) }/** +* ice_bitmap_hweight - hamming weight of bitmap +* @bm: bitmap pointer +* @size: size of bitmap (in bits) +* +* This function determines the number of set bits in a bitmap. +* Note that this function assumes it is operating on a bitmap declared using +* ice_declare_bitmap. +*/ +static inline int +ice_bitmap_hweight (ice_bitmap_t *bm,u16 size) +{ +int count =0 ; +u16 bit =0 ; + +while (size > (bit =ice_find_next_bit (bm, size, bit))) { + count++; + bit++; + } + +return count; +} + +/** * ice_cmp_bitmaps - compares two bitmaps. * @bmp1: the bitmap to compare * @bmp2: the bitmap to compare with bmp1
drivers/net/ice/base/ice_switch.c +1 -10
@@ -5932,7 +5932,6 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,ice_declare_bitmap (possible_idx,ICE_MAX_FV_WORDS );ice_declare_bitmap (recipes,ICE_MAX_NUM_RECIPES );ice_declare_bitmap (used_idx,ICE_MAX_FV_WORDS ); -u16 count =0 ;u16 bit;ice_zero_bitmap (possible_idx,ICE_MAX_FV_WORDS );
@@ -5971,15 +5970,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,ice_xor_bitmap (free_idx, used_idx, possible_idx,ICE_MAX_FV_WORDS );/* return number of free indexes */ - count =0 ; - bit =0 ; -while (ICE_MAX_FV_WORDS > - (bit =ice_find_next_bit (free_idx,ICE_MAX_FV_WORDS , bit))) { - count++; - bit++; - } - -return count; +return (u16 )ice_bitmap_hweight (free_idx,ICE_MAX_FV_WORDS ); }/**
Signature · 1 line
2.13.6
PATCH 12/40 net/ice/base: add function header
In reply to Qi ZhangAdd a function header for ice_cfg_phy_fc()
--- drivers/net/ice/base/ice_common.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ice/base/ice_common.c +6 -0
@@ -2749,6 +2749,12 @@ enum ice_fec_mode ice_caps_to_fec_mode(u8 caps, u8 fec_options)return ICE_FEC_NONE ; } +/** +* ice_cfg_phy_fc - Configure PHY FC data based on FC mode +* @pi: port information structure +* @cfg: PHY configuration data to set FC mode +* @req_mode: FC mode to configure +*/ static enum ice_status ice_cfg_phy_fc (struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg,enum ice_fc_mode req_mode)
Signature · 1 line
2.13.6
PATCH 13/40 net/ice/base: introduce and use for each bit iterator
In reply to Qi ZhangA number of code flows iterate over a block of memory to do something for every bit set in that memory. Use existing bit operations in a new iterator macro to make those code flows cleaner.
--- drivers/net/ice/base/ice_acl_ctrl.c | 17 +++----- drivers/net/ice/base/ice_bitops.h | 5 +++ drivers/net/ice/base/ice_flex_pipe.c | 66 ++++++++++++++----------------- drivers/net/ice/base/ice_flow.c | 75 +++++++++++------------------------- drivers/net/ice/base/ice_switch.c | 59 ++++++++++++---------------- 5 files changed, 85 insertions(+), 137 deletions(-)
drivers/net/ice/base/ice_acl_ctrl.c +5 -12
@@ -1028,9 +1028,8 @@ ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen, entry_tcam =ICE_ACL_TBL_TCAM_IDX (scen->start); idx =ICE_ACL_TBL_TCAM_ENTRY_IDX (scen->start + entry_idx); - i =ice_find_first_bit (scen->act_mem_bitmap, -ICE_AQC_MAX_ACTION_MEMORIES ); -while (i <ICE_AQC_MAX_ACTION_MEMORIES ) { +ice_for_each_set_bit (i, scen->act_mem_bitmap, +ICE_AQC_MAX_ACTION_MEMORIES ) {struct ice_acl_act_mem *mem = &hw->acl_tbl->act_mems[i];if (actx_idx >= acts_cnt)
@@ -1057,9 +1056,6 @@ ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen, } actx_idx++; } - - i =ice_find_next_bit (scen->act_mem_bitmap, -ICE_AQC_MAX_ACTION_MEMORIES , i +1 ); }if (!status && actx_idx < acts_cnt)
@@ -1111,9 +1107,9 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx) }ice_memset (&act_buf,0 ,sizeof (act_buf),ICE_NONDMA_MEM ); - i =ice_find_first_bit (scen->act_mem_bitmap, -ICE_AQC_MAX_ACTION_MEMORIES ); -while (i <ICE_AQC_MAX_ACTION_MEMORIES ) { + +ice_for_each_set_bit (i, scen->act_mem_bitmap, +ICE_AQC_MAX_ACTION_MEMORIES ) {struct ice_acl_act_mem *mem = &hw->acl_tbl->act_mems[i]; if (mem->member_of_tcam >= entry_tcam &&
@@ -1126,9 +1122,6 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx)"program actpair failed.status: %d\n" , status); } - - i =ice_find_next_bit (scen->act_mem_bitmap, -ICE_AQC_MAX_ACTION_MEMORIES , i +1 ); }ice_acl_scen_free_entry_idx (scen, entry_idx);
drivers/net/ice/base/ice_bitops.h +5 -0
@@ -346,6 +346,11 @@ static inline u16 ice_find_first_bit(const ice_bitmap_t *bitmap, u16 size)return ice_find_next_bit (bitmap, size,0 ); } +#define ice_for_each_set_bit (_bitpos, _addr, _maxlen) \ + for ((_bitpos) = ice_find_first_bit((_addr), (_maxlen)); \ + (_bitpos) < (_maxlen); \ + (_bitpos) = ice_find_next_bit((_addr), (_maxlen), (_bitpos) + 1)) +/** * ice_is_any_bit_set - Return true of any bit in the bitmap is set * @bitmap: the bitmap to check
drivers/net/ice/base/ice_flex_pipe.c +29 -37
79 lines not on this page · raw message
drivers/net/ice/base/ice_flow.c +22 -53
133 lines not on this page · raw message
drivers/net/ice/base/ice_switch.c +24 -35
105 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH 14/40 net/ice/base: correct abbreviations
In reply to Qi ZhangCorrect abbreviations as identified by abbrevcheck
--- drivers/net/ice/base/ice_flex_pipe.c | 6 +++--- drivers/net/ice/base/ice_sched.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +3 -3
@@ -5228,7 +5228,7 @@ ice_prof_tcam_ena_dis(struct ice_hw *hw, enum ice_block blk, bool enable,/* for re-enabling, reallocate a TCAM */ /* for entries with empty attribute masks, allocate entry from -* the bottom of the tcam table; otherwise, allocate from the +* the bottom of the TCAM table; otherwise, allocate from the * top of the table in order to give it higher priority */ status = ice_alloc_tcam_ent(hw, blk, tcam->attr.mask == 0,
@@ -5439,7 +5439,7 @@ ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl,/* allocate the TCAM entry index */ /* for entries with empty attribute masks, allocate entry from -* the bottom of the tcam table; otherwise, allocate from the +* the bottom of the TCAM table; otherwise, allocate from the * top of the table in order to give it higher priority */ status = ice_alloc_tcam_ent(hw, blk, map->attr[i].mask == 0,
@@ -5872,7 +5872,7 @@ ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)if (last_profile) {/* If there are no profiles left for this VSIG, -* then simply remove the the VSIG. +* then simply remove the VSIG. */ status =ice_rem_vsig (hw, blk, vsig, &chg);if (status)
drivers/net/ice/base/ice_sched.c +8 -8
@@ -1435,14 +1435,14 @@ ice_sched_find_node_in_subtree(struct ice_hw *hw, struct ice_sched_node *base, }/** -* ice_sched_get_free_qgrp - Scan all Q group siblings and find a free node +* ice_sched_get_free_qgrp - Scan all queue group siblings and find a free node * @pi: port information structure * @vsi_node: software VSI handle -* @qgrp_node: first Q group node identified for scanning +* @qgrp_node: first queue group node identified for scanning * @owner: LAN or RDMA * -* This function retrieves a free LAN or RDMA Q group node by scanning -* qgrp_node and its siblings for the Q group with the fewest number +* This function retrieves a free LAN or RDMA queue group node by scanning +* qgrp_node and its siblings for the queue group with the fewest number * of queues currently assigned. */ static struct ice_sched_node *
@@ -1459,17 +1459,17 @@ ice_sched_get_free_qgrp(struct ice_port_info *pi,if (!min_children)return qgrp_node; min_qgrp = qgrp_node; -/* scan all Q groups until find a node which has less than the -* minimum number of children. This way all Q group nodes get +/* scan all queue groups until find a node which has less than the +* minimum number of children. This way all queue group nodes get * equal number of shares and active. The bandwidth will be equally -* distributed across all Qs. +* distributed across all queues. */ while (qgrp_node) {/* make sure the qgroup node is part of the VSI subtree */ if (ice_sched_find_node_in_subtree (pi->hw, vsi_node, qgrp_node))if (qgrp_node->num_children < min_children && qgrp_node->owner == owner) { -/* replace the new min Q group node */ +/* replace the new min queue group node */ min_qgrp = qgrp_node; min_children = min_qgrp->num_children;/* break if it has no children, */
Signature · 1 line
2.13.6
PATCH 15/40 net/ice/base: add AQ cmd 0X0A0A LLDP fltr control
In reply to Qi ZhangAs of NVM ver 1.7.1 there is a new AQ command to add and remove LLDP filters for Rx flow. This patch implements the support structure to implement this functionality.
--- drivers/net/ice/base/ice_common.c | 47 +++++++++++++++++++++++++++++++++++++++ drivers/net/ice/base/ice_common.h | 3 +++ drivers/net/ice/base/ice_type.h | 4 ++++ 3 files changed, 54 insertions(+)
drivers/net/ice/base/ice_common.c +47 -0
@@ -4799,3 +4799,50 @@ ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,return ice_aq_send_cmd (hw, &desc, buf, buf_size, cd); } + +/** +* ice_fw_supports_lldp_fltr - check NVM version supports lldp_fltr_ctrl +* @hw: pointer to HW struct +*/ +bool ice_fw_supports_lldp_fltr_ctrl (struct ice_hw *hw) +{ +if (hw->mac_type !=ICE_MAC_E810 ) +return false; + +if (hw->api_maj_ver ==ICE_FW_API_LLDP_FLTR_MAJ ) { +if (hw->api_min_ver >ICE_FW_API_LLDP_FLTR_MIN ) +return true; +if (hw->api_min_ver ==ICE_FW_API_LLDP_FLTR_MIN && + hw->api_patch >=ICE_FW_API_LLDP_FLTR_PATCH ) +return true; + }else if (hw->api_maj_ver >ICE_FW_API_LLDP_FLTR_MAJ ) { +return true; + } +return false; +} + +/** +* ice_lldp_fltr_add_remove - add or remove a LLDP Rx switch filter +* @hw: pointer to HW struct +* @vsi_num: absolute HW index for VSI +* @add: boolean for if adding or removing a filter +*/ +enum ice_status +ice_lldp_fltr_add_remove (struct ice_hw *hw,u16 vsi_num,bool add) +{ +struct ice_aqc_lldp_filter_ctrl *cmd; +struct ice_aq_desc desc; + + cmd = &desc.params.lldp_filter_ctrl; + +ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_lldp_filter_ctrl); + +if (add) + cmd->cmd_flags =ICE_AQC_LLDP_FILTER_ACTION_ADD ; +else + cmd->cmd_flags =ICE_AQC_LLDP_FILTER_ACTION_DELETE ; + + cmd->vsi_num =CPU_TO_LE16 (vsi_num); + +return ice_aq_send_cmd (hw, &desc,NULL ,0 ,NULL ); +}
drivers/net/ice/base/ice_common.h +3 -0
@@ -223,4 +223,7 @@ ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,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); +bool ice_fw_supports_lldp_fltr_ctrl (struct ice_hw *hw); +enum ice_status +ice_lldp_fltr_add_remove (struct ice_hw *hw,u16 vsi_num,bool add);#endif /* _ICE_COMMON_H_ */
drivers/net/ice/base/ice_type.h +4 -0
@@ -1122,4 +1122,8 @@ enum ice_sw_fwd_act_type {#define GLPCI_LBARCTRL_VF_PE_DB_SIZE_8KB 0x1#define GLPCI_LBARCTRL_VF_PE_DB_SIZE_64KB 0x2 +/* AQ API version for LLDP_FILTER_CONTROL */ +#define ICE_FW_API_LLDP_FLTR_MAJ 1 +#define ICE_FW_API_LLDP_FLTR_MIN 7 +#define ICE_FW_API_LLDP_FLTR_PATCH 1#endif /* _ICE_TYPE_H_ */
Signature · 1 line
2.13.6
PATCH 16/40 net/ice/base: add support for GTP-U type switch rule
In reply to Qi ZhangThis patch add support for GTP-U type of switch rule. It enable all GTP-U related ptype.
--- drivers/net/ice/base/ice_protocol_type.h | 7 + drivers/net/ice/base/ice_switch.c | 299 ++++++++++++++++++++++++++++++- drivers/net/ice/base/ice_switch.h | 26 ++- 3 files changed, 328 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +7 -0
@@ -51,6 +51,7 @@ enum ice_protocol_type {ICE_ESP ,ICE_AH ,ICE_NAT_T , +ICE_GTP_NO_PAY , ICE_PROTOCOL_LAST };
@@ -71,6 +72,12 @@ enum ice_sw_tunnel_type {ICE_SW_IPV6_TCP ,ICE_SW_IPV6_UDP ,ICE_SW_TUN_GTP , +ICE_SW_TUN_IPV4_GTPU_NO_PAY , +ICE_SW_TUN_IPV6_GTPU_NO_PAY , +ICE_SW_TUN_IPV4_GTPU_IPV4 , +ICE_SW_TUN_IPV4_GTPU_IPV6 , +ICE_SW_TUN_IPV6_GTPU_IPV4 , +ICE_SW_TUN_IPV6_GTPU_IPV6 ,ICE_SW_TUN_PPPOE ,ICE_SW_TUN_PPPOE_PAY , ICE_SW_TUN_PPPOE_IPV4,
drivers/net/ice/base/ice_switch.c +296 -3
361 lines not on this page · raw message
drivers/net/ice/base/ice_switch.h +25 -1
@@ -28,8 +28,32 @@#define ICE_PROFID_PPPOE_IPV6_UDP 39#define ICE_PROFID_PPPOE_IPV6_OTHER 40#define ICE_PROFID_IPV4_GTPC_TEID 41 +#define ICE_PROFID_IPV4_GTPU_TEID 43 +#define ICE_PROFID_IPV6_GTPU_TEID 46#define ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER 47 -#define ICE_PROFID_IPV6_GTPU_IPV6_OTHER 70 +#define ICE_PROFID_IPV4_GTPU_IPV4_OTHER 48 +#define ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP 49 +#define ICE_PROFID_IPV4_GTPU_IPV4_UDP 50 +#define ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP 51 +#define ICE_PROFID_IPV4_GTPU_IPV4_TCP 52 +#define ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER 53 +#define ICE_PROFID_IPV6_GTPU_IPV4_OTHER 54 +#define ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP 55 +#define ICE_PROFID_IPV6_GTPU_IPV4_UDP 56 +#define ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP 57 +#define ICE_PROFID_IPV6_GTPU_IPV4_TCP 58 +#define ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER 59 +#define ICE_PROFID_IPV4_GTPU_IPV6_OTHER 60 +#define ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP 61 +#define ICE_PROFID_IPV4_GTPU_IPV6_UDP 62 +#define ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP 63 +#define ICE_PROFID_IPV4_GTPU_IPV6_TCP 64 +#define ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER 65 +#define ICE_PROFID_IPV6_GTPU_IPV6_OTHER 66 +#define ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP 67 +#define ICE_PROFID_IPV6_GTPU_IPV6_UDP 68 +#define ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP 69 +#define ICE_PROFID_IPV6_GTPU_IPV6_TCP 70#define ICE_PROFID_IPV4_ESP 71#define ICE_PROFID_IPV6_ESP 72#define ICE_PROFID_IPV4_AH 73
Signature · 1 line
2.13.6
PATCH 17/40 net/ice/base: join format strings to same line
In reply to Qi ZhangWhen printing messages with ice_debug, align the printed string to the origin line of the message in order to ease debugging and tracking messages back to their source.
--- drivers/net/ice/base/ice_acl_ctrl.c | 30 ++++------ drivers/net/ice/base/ice_common.c | 103 ++++++++++++----------------------- drivers/net/ice/base/ice_controlq.c | 42 +++++--------- drivers/net/ice/base/ice_flex_pipe.c | 27 +++------ drivers/net/ice/base/ice_flow.c | 9 +-- drivers/net/ice/base/ice_nvm.c | 30 ++++------ drivers/net/ice/base/ice_sched.c | 24 +++----- drivers/net/ice/base/ice_switch.c | 39 +++++-------- 8 files changed, 102 insertions(+), 202 deletions(-)
drivers/net/ice/base/ice_acl_ctrl.c +10 -20
@@ -357,12 +357,10 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)if (status) {if (LE16_TO_CPU (tbl_alloc.buf.resp_buf.alloc_id) <ICE_AQC_ALLOC_ID_LESS_THAN_4K ) -ice_debug (hw,ICE_DBG_ACL , -"Alloc ACL table failed. Unavailable resource.\n" ); +ice_debug (hw,ICE_DBG_ACL ,"Alloc ACL table failed. Unavailable resource.\n" );else -ice_debug (hw,ICE_DBG_ACL , -"AQ allocation of ACL failed with error. status: %d\n" , - status); +ice_debug (hw,ICE_DBG_ACL ,"AQ allocation of ACL failed with error. status: %d\n" , + status);return status; }
@@ -402,8 +400,7 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)if (status) {ice_free (hw, tbl); hw->acl_tbl =NULL ; -ice_debug (hw,ICE_DBG_ACL , -"Initialization of TCAM entries failed. status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"Initialization of TCAM entries failed. status: %d\n" , status); goto out; }
@@ -830,8 +827,7 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries, status =ice_aq_alloc_acl_scen (hw, scen_id, &scen_buf,NULL );if (status) { -ice_debug (hw,ICE_DBG_ACL , -"AQ allocation of ACL scenario failed. status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"AQ allocation of ACL scenario failed. status: %d\n" , status);ice_free (hw, scen);return status;
@@ -898,10 +894,8 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw)/* call the AQ command to destroy the ACL table */ status =ice_aq_dealloc_acl_tbl (hw, hw->acl_tbl->id, &resp_buf,NULL ); -if (status) { -ice_debug (hw,ICE_DBG_ACL , -"AQ de-allocation of ACL failed. status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"AQ de-allocation of ACL failed. status: %d\n" , status);return status; }
@@ -977,8 +971,7 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen, status =ice_aq_program_acl_entry (hw, entry_tcam + offset, idx, &buf,NULL );if (status) { -ice_debug (hw,ICE_DBG_ACL , -"aq program acl entry failed status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"aq program acl entry failed status: %d\n" , status); goto out; }
@@ -1049,8 +1042,7 @@ ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen, status =ice_aq_program_actpair (hw, i, idx, &act_buf,NULL );if (status) { -ice_debug (hw,ICE_DBG_ACL , -"program actpair failed status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"program actpair failed status: %d\n" , status);break ; }
@@ -1101,8 +1093,7 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx) status =ice_aq_program_acl_entry (hw, entry_tcam + i, idx, &buf,NULL );if (status) -ice_debug (hw,ICE_DBG_ACL , -"AQ program ACL entry failed status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"AQ program ACL entry failed status: %d\n" , status); }
@@ -1118,8 +1109,7 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx) status =ice_aq_program_actpair (hw, i, idx, &act_buf,NULL );if (status) -ice_debug (hw,ICE_DBG_ACL , -"program actpair failed.status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"program actpair failed status: %d\n" , status); } }
drivers/net/ice/base/ice_common.c +35 -68
267 lines not on this page · raw message
drivers/net/ice/base/ice_controlq.c +14 -28
126 lines not on this page · raw message
drivers/net/ice/base/ice_flex_pipe.c +9 -18
@@ -712,8 +712,7 @@ ice_acquire_global_cfg_lock(struct ice_hw *hw, ICE_GLOBAL_CFG_LOCK_TIMEOUT);if (status ==ICE_ERR_AQ_NO_WORK ) -ice_debug (hw,ICE_DBG_PKG , -"Global config lock: No work to do\n" ); +ice_debug (hw,ICE_DBG_PKG ,"Global config lock: No work to do\n" );return status; }
@@ -920,8 +919,7 @@ ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count) last, &offset, &info, NULL);if (status) { -ice_debug (hw,ICE_DBG_PKG , -"Update pkg failed: err %d off %d inf %d\n" , +ice_debug (hw,ICE_DBG_PKG ,"Update pkg failed: err %d off %d inf %d\n" , status, offset, info);break ; }
@@ -999,8 +997,7 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count)/* Save AQ status from download package */ hw->pkg_dwnld_status = hw->adminq.sq_last_status;if (status) { -ice_debug (hw,ICE_DBG_PKG , -"Pkg download failed: err %d off %d inf %d\n" , +ice_debug (hw,ICE_DBG_PKG ,"Pkg download failed: err %d off %d inf %d\n" , status, offset, info);break ; }
@@ -1097,8 +1094,7 @@ ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) meta_seg->pkg_ver.update, meta_seg->pkg_ver.draft, meta_seg->pkg_name); }else { -ice_debug (hw,ICE_DBG_INIT , -"Did not find metadata segment in driver package\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Did not find metadata segment in driver package\n" );return ICE_ERR_CFG ; }
@@ -1115,8 +1111,7 @@ ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) seg_hdr->seg_format_ver.draft, seg_hdr->seg_id); }else { -ice_debug (hw,ICE_DBG_INIT , -"Did not find ice segment in driver package\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Did not find ice segment in driver package\n" );return ICE_ERR_CFG ; }
@@ -1339,8 +1334,7 @@ ice_chk_pkg_compat(struct ice_hw *hw, struct ice_pkg_hdr *ospkg, (*seg)->hdr.seg_format_ver.minor > pkg->pkg_info[i].ver.minor) { status =ICE_ERR_FW_DDP_MISMATCH ; -ice_debug (hw,ICE_DBG_INIT , -"OS package is not compatible with NVM.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"OS package is not compatible with NVM.\n" ); }/* done processing NVM package so break */ break ;
@@ -1408,8 +1402,7 @@ enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)ice_init_pkg_hints (hw, seg); status =ice_download_pkg (hw, seg);if (status ==ICE_ERR_AQ_NO_WORK ) { -ice_debug (hw,ICE_DBG_INIT , -"package previously loaded - no work.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"package previously loaded - no work.\n" ); status =ICE_SUCCESS ; }
@@ -4059,8 +4052,7 @@ ice_has_prof_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl)if (ent->profile_cookie == hdl)return true; -ice_debug (hw,ICE_DBG_INIT , -"Characteristic list for VSI group %d not found.\n" , +ice_debug (hw,ICE_DBG_INIT ,"Characteristic list for VSI group %d not found.\n" , vsig);return false; }
@@ -5372,8 +5364,7 @@ ice_adj_prof_priorities(struct ice_hw *hw, enum ice_block blk, u16 vsig,if (attr_used_cnt <ICE_MAX_PTG_ATTRS ) attr_used[attr_used_cnt++] = &t->tcam[i];else -ice_debug (hw,ICE_DBG_INIT , -"Warn: ICE_MAX_PTG_ATTRS exceeded\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Warn: ICE_MAX_PTG_ATTRS exceeded\n" ); } }
drivers/net/ice/base/ice_flow.c +3 -6
@@ -1856,8 +1856,7 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, status =ice_flow_proc_segs (hw, params);if (status) { -ice_debug (hw,ICE_DBG_FLOW , -"Error processing a flow's packet segments\n" ); +ice_debug (hw,ICE_DBG_FLOW ,"Error processing a flow's packet segments\n" ); goto out; }
@@ -2106,8 +2105,7 @@ ice_flow_assoc_prof(struct ice_hw *hw, enum ice_block blk,if (!status)ice_set_bit (vsi_handle, prof->vsis);else -ice_debug (hw,ICE_DBG_FLOW , -"HW profile add failed, %d\n" , +ice_debug (hw,ICE_DBG_FLOW ,"HW profile add failed, %d\n" , status); }
@@ -2138,8 +2136,7 @@ ice_flow_disassoc_prof(struct ice_hw *hw, enum ice_block blk,if (!status)ice_clear_bit (vsi_handle, prof->vsis);else -ice_debug (hw,ICE_DBG_FLOW , -"HW profile remove failed, %d\n" , +ice_debug (hw,ICE_DBG_FLOW ,"HW profile remove failed, %d\n" , status); }
drivers/net/ice/base/ice_nvm.c +10 -20
@@ -78,8 +78,7 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,/* Verify the length of the read if this is for the Shadow RAM */ if (read_shadow_ram && ((offset + inlen) > (hw->nvm.sr_words *2u ))) { -ice_debug (hw,ICE_DBG_NVM , -"NVM error: requested data is beyond Shadow RAM limit\n" ); +ice_debug (hw,ICE_DBG_NVM ,"NVM error: requested data is beyond Shadow RAM limit\n" );return ICE_ERR_PARAM ; }
@@ -340,16 +339,14 @@ ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size)*/ pba_size--;if (pba_num_size < (((u32 )pba_size *2 ) +1 )) { -ice_debug (hw,ICE_DBG_INIT , -"Buffer too small for PBA data.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Buffer too small for PBA data.\n" );return ICE_ERR_PARAM ; }for (i =0 ; i < pba_size; i++) { status =ice_read_sr_word (hw, (pba_tlv +2 +1 ) + i, &pba_word);if (status !=ICE_SUCCESS ) { -ice_debug (hw,ICE_DBG_INIT , -"Failed to read PBA Block word %d.\n" , i); +ice_debug (hw,ICE_DBG_INIT ,"Failed to read PBA Block word %d.\n" , i);return status; }
@@ -378,8 +375,7 @@ static enum ice_status ice_get_orom_ver_info(struct ice_hw *hw) status =ice_get_pfa_module_tlv (hw, &boot_cfg_tlv, &boot_cfg_tlv_len,ICE_SR_BOOT_CFG_PTR );if (status) { -ice_debug (hw,ICE_DBG_INIT , -"Failed to read Boot Configuration Block TLV.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Failed to read Boot Configuration Block TLV.\n" );return status; }
@@ -387,8 +383,7 @@ static enum ice_status ice_get_orom_ver_info(struct ice_hw *hw)* (Combo Image Version High and Combo Image Version Low) */ if (boot_cfg_tlv_len <2 ) { -ice_debug (hw,ICE_DBG_INIT , -"Invalid Boot Configuration Block TLV size.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Invalid Boot Configuration Block TLV size.\n" );return ICE_ERR_INVAL_SIZE ; }
@@ -444,14 +439,12 @@ static enum ice_status ice_discover_flash_size(struct ice_hw *hw) status =ice_read_flat_nvm (hw, offset, &len, &data, false);if (status ==ICE_ERR_AQ_ERROR && hw->adminq.sq_last_status ==ICE_AQ_RC_EINVAL ) { -ice_debug (hw,ICE_DBG_NVM , -"%s: New upper bound of %u bytes\n" , +ice_debug (hw,ICE_DBG_NVM ,"%s: New upper bound of %u bytes\n" , __func__, offset); status =ICE_SUCCESS ; max_size = offset; }else if (!status) { -ice_debug (hw,ICE_DBG_NVM , -"%s: New lower bound of %u bytes\n" , +ice_debug (hw,ICE_DBG_NVM ,"%s: New lower bound of %u bytes\n" , __func__, offset); min_size = offset; }else {
@@ -460,8 +453,7 @@ static enum ice_status ice_discover_flash_size(struct ice_hw *hw) } } -ice_debug (hw,ICE_DBG_NVM , -"Predicted flash size is %u bytes\n" , max_size); +ice_debug (hw,ICE_DBG_NVM ,"Predicted flash size is %u bytes\n" , max_size); hw->nvm.flash_size = max_size;
@@ -504,8 +496,7 @@ enum ice_status ice_init_nvm(struct ice_hw *hw) }else {/* Blank programming mode */ nvm->blank_nvm_mode = true; -ice_debug (hw,ICE_DBG_NVM , -"NVM init error: unsupported blank mode.\n" ); +ice_debug (hw,ICE_DBG_NVM ,"NVM init error: unsupported blank mode.\n" );return ICE_ERR_NVM_BLANK_MODE ; }
@@ -805,8 +796,7 @@ ice_nvm_access_write(struct ice_hw *hw, struct ice_nvm_access_cmd *cmd,break ; } -ice_debug (hw,ICE_DBG_NVM , -"NVM access: writing register %08x with value %08x\n" , +ice_debug (hw,ICE_DBG_NVM ,"NVM access: writing register %08x with value %08x\n" , cmd->offset, data->regval);/* Write the data field to the specified register */
drivers/net/ice/base/ice_sched.c +8 -16
@@ -165,8 +165,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer, parent =ice_sched_find_node_by_teid (pi->root,LE32_TO_CPU (info->parent_teid));if (!parent) { -ice_debug (hw,ICE_DBG_SCHED , -"Parent Node not found for parent_teid=0x%x\n" , +ice_debug (hw,ICE_DBG_SCHED ,"Parent Node not found for parent_teid=0x%x\n" ,LE32_TO_CPU (info->parent_teid));return ICE_ERR_PARAM ; }
@@ -742,8 +741,7 @@ static void ice_sched_clear_rl_prof(struct ice_port_info *pi) rl_prof_elem->prof_id_ref =0 ; status =ice_sched_del_rl_profile (hw, rl_prof_elem);if (status) { -ice_debug (hw,ICE_DBG_SCHED , -"Remove rl profile failed\n" ); +ice_debug (hw,ICE_DBG_SCHED ,"Remove rl profile failed\n" );/* On error, free mem required */ LIST_DEL (&rl_prof_elem->list_entry);ice_free (hw, rl_prof_elem);
@@ -930,8 +928,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,for (i =0 ; i < num_nodes; i++) { status =ice_sched_add_node (pi, layer, &buf->generic[i]);if (status !=ICE_SUCCESS ) { -ice_debug (hw,ICE_DBG_SCHED , -"add nodes in SW DB failed status =%d\n" , +ice_debug (hw,ICE_DBG_SCHED ,"add nodes in SW DB failed status =%d\n" , status);break ; }
@@ -939,8 +936,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node, teid =LE32_TO_CPU (buf->generic[i].node_teid); new_node =ice_sched_find_node_by_teid (parent, teid);if (!new_node) { -ice_debug (hw,ICE_DBG_SCHED , -"Node is missing for teid =%d\n" , teid); +ice_debug (hw,ICE_DBG_SCHED ,"Node is missing for teid =%d\n" , teid);break ; }
@@ -1297,8 +1293,7 @@ struct ice_sched_node *ice_sched_get_node(struct ice_port_info *pi, u32 teid)ice_release_lock (&pi->sched_lock);if (!node) -ice_debug (pi->hw,ICE_DBG_SCHED , -"Node not found for teid=0x%x\n" , teid); +ice_debug (pi->hw,ICE_DBG_SCHED ,"Node not found for teid=0x%x\n" , teid);return node; }
@@ -2048,8 +2043,7 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)continue ;if (ice_sched_is_leaf_node_present (vsi_node)) { -ice_debug (pi->hw,ICE_DBG_SCHED , -"VSI has leaf nodes in TC %d\n" , i); +ice_debug (pi->hw,ICE_DBG_SCHED ,"VSI has leaf nodes in TC %d\n" , i); status =ICE_ERR_IN_USE ; goto exit_sched_rm_vsi_cfg; }
@@ -2891,8 +2885,7 @@ static void ice_sched_rm_unused_rl_prof(struct ice_port_info *pi) &pi->rl_prof_list[ln], ice_aqc_rl_profile_info, list_entry) {if (!ice_sched_del_rl_profile (pi->hw, rl_prof_elem)) -ice_debug (pi->hw,ICE_DBG_SCHED , -"Removed rl profile\n" ); +ice_debug (hw,ICE_DBG_SCHED ,"Removed rl profile\n" ); } } }
@@ -4143,8 +4136,7 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type,/* Remove old profile ID from database */ status =ice_sched_del_rl_profile (pi->hw, rl_prof_elem);if (status && status !=ICE_ERR_IN_USE ) -ice_debug (pi->hw,ICE_DBG_SCHED , -"Remove rl profile failed\n" ); +ice_debug (pi->hw,ICE_DBG_SCHED ,"Remove rl profile failed\n" );break ; }if (status ==ICE_ERR_IN_USE )
drivers/net/ice/base/ice_switch.c +13 -26
@@ -1823,8 +1823,7 @@ enum ice_status ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id) status =ice_aq_alloc_free_res (hw,1 , counter_buf, buf_len, ice_aqc_opc_free_res,NULL );if (status) { -ice_debug (hw,ICE_DBG_SW , -"VEB counter resource could not be freed\n" ); +ice_debug (hw,ICE_DBG_SW ,"VEB counter resource could not be freed\n" ); ret_status = status; }
@@ -2218,8 +2217,7 @@ ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,return ICE_ERR_PARAM ;break ;default : -ice_debug (hw,ICE_DBG_SW , -"Error due to unsupported rule_type %u\n" , rule_type); +ice_debug (hw,ICE_DBG_SW ,"Error due to unsupported rule_type %u\n" , rule_type);return ICE_ERR_OUT_OF_RANGE ; }
@@ -2241,8 +2239,7 @@ ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,* than ICE_MAX_VSI, if not return with error. */ if (id >=ICE_MAX_VSI ) { -ice_debug (hw,ICE_DBG_SW , -"Error VSI index (%u) out-of-range\n" , +ice_debug (hw,ICE_DBG_SW ,"Error VSI index (%u) out-of-range\n" , id);ice_free (hw, mr_list);return ICE_ERR_OUT_OF_RANGE ;
@@ -2649,8 +2646,7 @@ ice_init_port_info(struct ice_port_info *pi, u16 vsi_port_num, u8 type, pi->dflt_rx_vsi_num =ICE_DFLT_VSI_INVAL ;break ;default : -ice_debug (pi->hw,ICE_DBG_SW , -"incorrect VSI/port type received\n" ); +ice_debug (pi->hw,ICE_DBG_SW ,"incorrect VSI/port type received\n" );break ; } }
@@ -2714,8 +2710,7 @@ enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw)case ICE_AQC_GET_SW_CONF_RESP_PHYS_PORT :case ICE_AQC_GET_SW_CONF_RESP_VIRT_PORT :if (j == num_total_ports) { -ice_debug (hw,ICE_DBG_SW , -"more ports than expected\n" ); +ice_debug (hw,ICE_DBG_SW ,"more ports than expected\n" ); status =ICE_ERR_CFG ; goto out; }
@@ -3709,8 +3704,7 @@ ice_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle, tmp_fltr_info.vsi_handle = rem_vsi_handle; status =ice_update_pkt_fwd_rule (hw, &tmp_fltr_info);if (status) { -ice_debug (hw,ICE_DBG_SW , -"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n" , +ice_debug (hw,ICE_DBG_SW ,"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n" , tmp_fltr_info.fwd_id.hw_vsi_id, status);return status; }
@@ -3726,8 +3720,7 @@ ice_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,/* Remove the VSI list since it is no longer used */ status =ice_remove_vsi_list_rule (hw, vsi_list_id, lkup_type);if (status) { -ice_debug (hw,ICE_DBG_SW , -"Failed to remove VSI list %d, error %d\n" , +ice_debug (hw,ICE_DBG_SW ,"Failed to remove VSI list %d, error %d\n" , vsi_list_id, status);return status; }
@@ -4188,8 +4181,7 @@ ice_add_vlan_internal(struct ice_hw *hw, struct ice_sw_recipe *recp_list,*/ if (v_list_itr->vsi_count >1 && v_list_itr->vsi_list_info->ref_cnt >1 ) { -ice_debug (hw,ICE_DBG_SW , -"Invalid configuration: Optimization to reuse VSI list with more than one VSI is not being done yet\n" ); +ice_debug (hw,ICE_DBG_SW ,"Invalid configuration: Optimization to reuse VSI list with more than one VSI is not being done yet\n" ); status =ICE_ERR_CFG ; goto exit; }
@@ -5403,8 +5395,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,ice_remove_eth_mac (hw, &remove_list_head);break ;case ICE_SW_LKUP_DFLT : -ice_debug (hw,ICE_DBG_SW , -"Remove filters for this lookup type hasn't been implemented yet\n" ); +ice_debug (hw,ICE_DBG_SW ,"Remove filters for this lookup type hasn't been implemented yet\n" );break ;case ICE_SW_LKUP_LAST :ice_debug (hw,ICE_DBG_SW ,"Unsupported lookup type\n" );
@@ -5526,8 +5517,7 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, status =ice_aq_alloc_free_res (hw,1 , buf, buf_len, ice_aqc_opc_free_res,NULL );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" );ice_free (hw, buf);return status;
@@ -6306,8 +6296,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,* that can be used. */ if (chain_idx >=ICE_MAX_FV_WORDS ) { -ice_debug (hw,ICE_DBG_SW , -"No chain index available\n" ); +ice_debug (hw,ICE_DBG_SW ,"No chain index available\n" ); status =ICE_ERR_MAX_LIMIT ; goto err_unroll; }
@@ -7948,8 +7937,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,*/ status =ice_update_pkt_fwd_rule (hw, &tmp_fltr);if (status) { -ice_debug (hw,ICE_DBG_SW , -"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n" , +ice_debug (hw,ICE_DBG_SW ,"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n" , tmp_fltr.fwd_id.hw_vsi_id, status);return status; }
@@ -7958,8 +7946,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,/* Remove the VSI list since it is no longer used */ status =ice_remove_vsi_list_rule (hw, vsi_list_id, lkup_type);if (status) { -ice_debug (hw,ICE_DBG_SW , -"Failed to remove VSI list %d, error %d\n" , +ice_debug (hw,ICE_DBG_SW ,"Failed to remove VSI list %d, error %d\n" , vsi_list_id, status);return status; }
Signature · 1 line
2.13.6
PATCH 18/40 net/ice/base: introduce Tx rate limiting on port level
In reply to Qi ZhangThe PSM Configuration has a Rate Limiter for each associated switch port based on its relative speed from the total BW of switch ports connected to LAN controller. The rate limiters will be dynamic get readjusted if switch port speeds are changed at the root node layer of the scheduler tree. Adding a function to directly modify the EIR of root node.
--- drivers/net/ice/base/ice_common.c | 5 +++++ drivers/net/ice/base/ice_common.h | 1 + drivers/net/ice/base/ice_sched.c | 20 ++++++++++++++++++++ drivers/net/ice/base/ice_type.h | 1 + 4 files changed, 27 insertions(+)
drivers/net/ice/base/ice_common.c +5 -0
@@ -4382,6 +4382,7 @@ static bool ice_is_main_vsi(struct ice_hw *hw, u16 vsi_handle)static enum ice_status ice_replay_pre_init (struct ice_hw *hw,struct ice_switch_info *sw) { +enum ice_status status;u8 i;/* Delete old entries from replay filter list head if there is any */
@@ -4395,6 +4396,10 @@ ice_replay_pre_init(struct ice_hw *hw, struct ice_switch_info *sw) &sw->recp_list[i].filt_replay_rules);ice_sched_replay_agg_vsi_preinit (hw); + status =ice_sched_replay_root_node_bw (hw->port_info); +if (status) +return status; +return ice_sched_replay_tc_node_bw (hw->port_info); }
drivers/net/ice/base/ice_common.h +1 -0
@@ -202,6 +202,7 @@ void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw);void ice_sched_replay_agg (struct ice_hw *hw);enum ice_status ice_sched_replay_tc_node_bw (struct ice_port_info *pi);enum ice_status ice_replay_vsi_agg (struct ice_hw *hw,u16 vsi_handle); +enum ice_status ice_sched_replay_root_node_bw (struct ice_port_info *pi);enum ice_status ice_sched_replay_q_bw (struct ice_port_info *pi,struct ice_q_ctx *q_ctx); struct ice_q_ctx *
drivers/net/ice/base/ice_sched.c +20 -0
@@ -5382,6 +5382,26 @@ void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw) }/** +* ice_sched_replay_root_node_bw - replay root node BW +* @pi: port information structure +* +* Replay root node BW settings. +*/ +enum ice_status ice_sched_replay_root_node_bw (struct ice_port_info *pi) +{ +enum ice_status status =ICE_SUCCESS ; + +if (!pi->hw) +return ICE_ERR_PARAM ; +ice_acquire_lock (&pi->sched_lock); + + status =ice_sched_replay_node_bw (pi->hw, pi->root, + &pi->root_node_bw_t_info); +ice_release_lock (&pi->sched_lock); +return status; +} + +/** * ice_sched_replay_tc_node_bw - replay TC node(s) BW * @pi: port information structure *
drivers/net/ice/base/ice_type.h +1 -0
@@ -776,6 +776,7 @@ struct ice_port_info { sib_head[ICE_MAX_TRAFFIC_CLASS ][ICE_AQC_TOPO_MAX_LEVEL_NUM ];/* List contain profile ID(s) and other params per layer */ struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM ]; +struct ice_bw_type_info root_node_bw_t_info;struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS ];struct ice_dcbx_cfg local_dcbx_cfg;/* Oper/Local Cfg */ /* DCBX info */
Signature · 1 line
2.13.6
PATCH 19/40 net/ice/base: reduce profile to recip info get from firmware
In reply to Qi ZhangOnly need to get profile_to_recip info from firmware for profiles used by switch, no need for other free profile in order that we can reduce the time consumed when download a switch rule.
--- drivers/net/ice/base/ice_flex_pipe.c | 115 +++++++++++++++++++++++++---------- drivers/net/ice/base/ice_switch.c | 2 +- drivers/net/ice/base/ice_type.h | 1 + 3 files changed, 85 insertions(+), 33 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +83 -32
@@ -1345,6 +1345,88 @@ ice_chk_pkg_compat(struct ice_hw *hw, struct ice_pkg_hdr *ospkg, }/** +* ice_sw_fv_handler +* @sect_type: section type +* @section: pointer to section +* @index: index of the field vector entry to be returned +* @offset: ptr to variable that receives the offset in the field vector table +* +* This is a callback function that can be passed to ice_pkg_enum_entry. +* This function treats the given section as of type ice_sw_fv_section and +* enumerates offset field. "offset" is an index into the field vector table. +*/ +static void * +ice_sw_fv_handler (u32 sect_type,void *section,u32 index,u32 *offset) +{ +struct ice_sw_fv_section *fv_section = + (struct ice_sw_fv_section *)section; + +if (!section || sect_type !=ICE_SID_FLD_VEC_SW ) +return NULL ; +if (index >=LE16_TO_CPU (fv_section->count)) +return NULL ; +if (offset) +/* "index" passed in to this function is relative to a given +* 4k block. To get to the true index into the field vector +* table need to add the relative index to the base_offset +* field of this section +*/ + *offset =LE16_TO_CPU (fv_section->base_offset) + index; +return fv_section->fv + index; +} + +/** +* ice_get_prof_index_max - get the max profile index for used profile +* @hw: pointer to the HW struct +* +* Calling this function will get the max profile index for used profile +* and store the index number in struct ice_switch_info *switch_info +* in hw for following use. +*/ +static int ice_get_prof_index_max (struct ice_hw *hw) +{ +u16 prof_index =0 , j, max_prof_index =0 ; +struct ice_pkg_enum state; +struct ice_seg *ice_seg; +bool flag = false; +struct ice_fv *fv; +u32 offset; + +ice_memset (&state,0 ,sizeof (state),ICE_NONDMA_MEM ); + +if (!hw->seg) +return ICE_ERR_PARAM ; + + ice_seg = hw->seg; + +do { + fv = (struct ice_fv *) +ice_pkg_enum_entry (ice_seg, &state,ICE_SID_FLD_VEC_SW , + &offset, ice_sw_fv_handler); +if (!fv) +break ; + ice_seg =NULL ; + +/* in the profile that not be used, the prot_id is set to 0xff +* and the off is set to 0x1ff for all the field vectors. +*/ +for (j =0 ; j < hw->blk[ICE_BLK_SW ].es.fvw; j++) +if (fv->ew[j].prot_id !=ICE_PROT_INVALID || + fv->ew[j].off !=ICE_FV_OFFSET_INVAL ) + flag = true; +if (flag && prof_index > max_prof_index) + max_prof_index = prof_index; + + prof_index++; + flag = false; + }while (fv); + + hw->switch_info->max_used_prof_index = max_prof_index; + +return ICE_SUCCESS ; +} + +/** * ice_init_pkg - initialize/download package * @hw: pointer to the hardware structure * @buf: pointer to the package buffer
@@ -1423,6 +1505,7 @@ enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)*/ ice_init_pkg_regs (hw);ice_fill_blk_tbls (hw); +ice_get_prof_index_max (hw); }else {ice_debug (hw,ICE_DBG_INIT ,"package load failed, %d\n" , status);
@@ -1500,38 +1583,6 @@ static struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw) }/** -* ice_sw_fv_handler -* @sect_type: section type -* @section: pointer to section -* @index: index of the field vector entry to be returned -* @offset: ptr to variable that receives the offset in the field vector table -* -* This is a callback function that can be passed to ice_pkg_enum_entry. -* This function treats the given section as of type ice_sw_fv_section and -* enumerates offset field. "offset" is an index into the field vector -* vector table. -*/ -static void * -ice_sw_fv_handler (u32 sect_type,void *section,u32 index,u32 *offset) -{ -struct ice_sw_fv_section *fv_section = - (struct ice_sw_fv_section *)section; - -if (!section || sect_type !=ICE_SID_FLD_VEC_SW ) -return NULL ; -if (index >=LE16_TO_CPU (fv_section->count)) -return NULL ; -if (offset) -/* "index" passed in to this function is relative to a given -* 4k block. To get to the true index into the field vector -* table need to add the relative index to the base_offset -* field of this section -*/ - *offset =LE16_TO_CPU (fv_section->base_offset) + index; -return fv_section->fv + index; -} - -/** * ice_get_sw_prof_type - determine switch profile type * @hw: pointer to the HW structure * @fv: pointer to the switch field vector
drivers/net/ice/base/ice_switch.c +1 -1
@@ -1591,7 +1591,7 @@ static void ice_get_recp_to_prof_map(struct ice_hw *hw)ice_declare_bitmap (r_bitmap,ICE_MAX_NUM_RECIPES );u16 i; -for (i =0 ; i <ICE_MAX_NUM_PROFILES ; i++) { +for (i =0 ; i < hw->switch_info->max_used_prof_index +1 ; i++) {u16 j;ice_zero_bitmap (profile_to_recipe[i],ICE_MAX_NUM_RECIPES );
drivers/net/ice/base/ice_type.h +1 -0
@@ -792,6 +792,7 @@ struct ice_switch_info {struct LIST_HEAD_TYPE vsi_list_map_head;struct ice_sw_recipe *recp_list;u16 prof_res_bm_init; +u16 max_used_prof_index;ice_declare_bitmap (prof_res_bm[ICE_MAX_NUM_PROFILES ],ICE_MAX_FV_WORDS ); };
Signature · 1 line
2.13.6
PATCH 20/40 net/ice/base: refactor DCB related variables
In reply to Qi ZhangIn this patch, the DCB related variables will be refactored out of the ice_port_info_struct. The goal is to make the ice_port_info struct cleaner.
--- drivers/net/ice/base/ice_dcb.c | 40 ++++++++++++++++++++-------------------- drivers/net/ice/base/ice_type.h | 16 +++++++++------- 2 files changed, 29 insertions(+), 27 deletions(-)
drivers/net/ice/base/ice_dcb.c +20 -20
@@ -850,9 +850,9 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode)return ICE_ERR_PARAM ;if (dcbx_mode ==ICE_DCBX_MODE_IEEE ) - dcbx_cfg = &pi->local_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg;else if (dcbx_mode ==ICE_DCBX_MODE_CEE ) - dcbx_cfg = &pi->desired_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.desired_dcbx_cfg;/* Get Local DCB Config in case of ICE_DCBX_MODE_IEEE * or get CEE DCB Desired Config in case of ICE_DCBX_MODE_CEE
@@ -863,7 +863,7 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode) goto out;/* Get Remote DCB Config */ - dcbx_cfg = &pi->remote_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg; ret =ice_aq_get_dcb_cfg (pi->hw,ICE_AQ_LLDP_MIB_REMOTE ,ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID , dcbx_cfg);/* Don't treat ENOENT as an error for Remote MIBs */
@@ -892,14 +892,14 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) ret =ice_aq_get_cee_dcb_cfg (pi->hw, &cee_cfg,NULL );if (ret ==ICE_SUCCESS ) {/* CEE mode */ - dcbx_cfg = &pi->local_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; dcbx_cfg->dcbx_mode =ICE_DCBX_MODE_CEE ; dcbx_cfg->tlv_status =LE32_TO_CPU (cee_cfg.tlv_status);ice_cee_to_dcb_cfg (&cee_cfg, dcbx_cfg); ret =ice_get_ieee_or_cee_dcb_cfg (pi,ICE_DCBX_MODE_CEE ); }else if (pi->hw->adminq.sq_last_status ==ICE_AQ_RC_ENOENT ) {/* CEE mode not enabled try querying IEEE data */ - dcbx_cfg = &pi->local_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; dcbx_cfg->dcbx_mode =ICE_DCBX_MODE_IEEE ; ret =ice_get_ieee_or_cee_dcb_cfg (pi,ICE_DCBX_MODE_IEEE ); }
@@ -916,26 +916,26 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi)*/ enum ice_status ice_init_dcb (struct ice_hw *hw,bool enable_mib_change) { -struct ice_port_info *pi = hw->port_info; +struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;enum ice_status ret =ICE_SUCCESS ;if (!hw->func_caps.common_cap.dcb)return ICE_ERR_NOT_SUPPORTED ; - pi->is_sw_lldp = true; + qos_cfg->is_sw_lldp = true;/* Get DCBX status */ - pi->dcbx_status =ice_get_dcbx_status (hw); + qos_cfg->dcbx_status =ice_get_dcbx_status (hw); -if (pi->dcbx_status ==ICE_DCBX_STATUS_DONE || - pi->dcbx_status ==ICE_DCBX_STATUS_IN_PROGRESS || - pi->dcbx_status ==ICE_DCBX_STATUS_NOT_STARTED ) { +if (qos_cfg->dcbx_status ==ICE_DCBX_STATUS_DONE || + qos_cfg->dcbx_status ==ICE_DCBX_STATUS_IN_PROGRESS || + qos_cfg->dcbx_status ==ICE_DCBX_STATUS_NOT_STARTED ) {/* Get current DCBX configuration */ - ret =ice_get_dcb_cfg (pi); + ret =ice_get_dcb_cfg (hw->port_info);if (ret)return ret; - pi->is_sw_lldp = false; - }else if (pi->dcbx_status ==ICE_DCBX_STATUS_DIS ) { + qos_cfg->is_sw_lldp = false; + }else if (qos_cfg->dcbx_status ==ICE_DCBX_STATUS_DIS ) {return ICE_ERR_NOT_READY ; }
@@ -943,7 +943,7 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)if (enable_mib_change) { ret =ice_aq_cfg_lldp_mib_change (hw, true,NULL );if (ret) - pi->is_sw_lldp = true; + qos_cfg->is_sw_lldp = true; }return ret;
@@ -958,21 +958,21 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)*/ enum ice_status ice_cfg_lldp_mib_change (struct ice_hw *hw,bool ena_mib) { -struct ice_port_info *pi = hw->port_info; +struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;enum ice_status ret;if (!hw->func_caps.common_cap.dcb)return ICE_ERR_NOT_SUPPORTED ;/* Get DCBX status */ - pi->dcbx_status =ice_get_dcbx_status (hw); + qos_cfg->dcbx_status =ice_get_dcbx_status (hw); -if (pi->dcbx_status ==ICE_DCBX_STATUS_DIS ) +if (qos_cfg->dcbx_status ==ICE_DCBX_STATUS_DIS )return ICE_ERR_NOT_READY ; ret =ice_aq_cfg_lldp_mib_change (hw, ena_mib,NULL );if (!ret) - pi->is_sw_lldp = !ena_mib; + qos_cfg->is_sw_lldp = !ena_mib;return ret; }
@@ -1269,7 +1269,7 @@ enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi) hw = pi->hw;/* update the HW local config */ - dcbcfg = &pi->local_dcbx_cfg; + dcbcfg = &pi->qos_cfg.local_dcbx_cfg;/* Allocate the LLDPDU */ lldpmib = (u8 *)ice_malloc (hw,ICE_LLDPDU_SIZE );if (!lldpmib)
drivers/net/ice/base/ice_type.h +9 -7
@@ -753,6 +753,14 @@ struct ice_dcbx_cfg {#define ICE_DCBX_APPS_NON_WILLING 0x1 }; +struct ice_qos_cfg { +struct ice_dcbx_cfg local_dcbx_cfg;/* Oper/Local Cfg */ +struct ice_dcbx_cfg desired_dcbx_cfg;/* CEE Desired Cfg */ +struct ice_dcbx_cfg remote_dcbx_cfg;/* Peer Cfg */ +u8 dcbx_status :3 ;/* see ICE_DCBX_STATUS_DIS */ +u8 is_sw_lldp :1 ; +}; +struct ice_port_info {struct ice_sched_node *root;/* Root Node per Port */ struct ice_hw *hw;/* back pointer to HW instance */
@@ -778,13 +786,7 @@ struct ice_port_info {struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM ];struct ice_bw_type_info root_node_bw_t_info;struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS ]; -struct ice_dcbx_cfg local_dcbx_cfg;/* Oper/Local Cfg */ -/* DCBX info */ -struct ice_dcbx_cfg remote_dcbx_cfg;/* Peer Cfg */ -struct ice_dcbx_cfg desired_dcbx_cfg;/* CEE Desired Cfg */ -/* LLDP/DCBX Status */ - u8 dcbx_status:3; /* see ICE_DCBX_STATUS_DIS */ - u8 is_sw_lldp:1; +struct ice_qos_cfg qos_cfg; u8 is_vf:1; };
Signature · 1 line
2.13.6
PATCH 21/40 net/ice/base: support outer IP filter for GTPC
In reply to Qi ZhangAdd ptype MAC_IPV4_GTPC_TEID and MAC_IPV4_GTPC into ice_ptypes_ipv4_ofos, ice_ptypes_ipv4_ofos_all and ice_ipv4_ofos_no_l4
Add ptype MAC_IPV6_GTPC_TEID and MAC_IPV6_GTPC into ice_ptypes_ipv6_ofos, ice_ptypes_ipv6_ofos_all and ice_ipv6_ofos_no_l4
So outer IP can be configured as input set for GTPC packet.
Also add MAC_IPV4_GTPC_TEID and MAC_IPV6_GTPC_TEID into ice_ptypes_gtpc, so when ICE_FLOW_SEG_HDR_GTPC is requested, it can take effect on all GTPC packets (with or without TEID).
--- drivers/net/ice/base/ice_flow.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_flow.c +7 -7
@@ -224,7 +224,7 @@ static const u32 ice_ptypes_macvlan_il[] = {static const u32 ice_ptypes_ipv4_ofos[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000FC000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x000FC000 ,0x000000A0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -238,7 +238,7 @@ static const u32 ice_ptypes_ipv4_ofos[] = {static const u32 ice_ptypes_ipv4_ofos_all[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000FC000 ,0x83E0F800 ,0x00000101 , +0x00000000 ,0x000FC000 ,0x83E0F8A0 ,0x00000101 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -264,7 +264,7 @@ static const u32 ice_ptypes_ipv4_il[] = {static const u32 ice_ptypes_ipv6_ofos[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , -0x00000000 ,0x03F00000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x03F00000 ,0x00000140 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -278,7 +278,7 @@ static const u32 ice_ptypes_ipv6_ofos[] = {static const u32 ice_ptypes_ipv6_ofos_all[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , -0x00080F00 ,0x03F00000 ,0x7C1F0000 ,0x00000206 , +0x00080F00 ,0x03F00000 ,0x7C1F0140 ,0x00000206 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -302,7 +302,7 @@ static const u32 ice_ptypes_ipv6_il[] = {static const u32 ice_ipv4_ofos_no_l4[] = {0x10C00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000cc000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x000cc000 ,0x000000A0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -326,7 +326,7 @@ static const u32 ice_ipv4_il_no_l4[] = {static const u32 ice_ipv6_ofos_no_l4[] = {0x00000000 ,0x00000000 ,0x43000000 ,0x10002000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x02300000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x02300000 ,0x00000140 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -448,7 +448,7 @@ static const u32 ice_ptypes_mac_il[] = {static const u32 ice_ptypes_gtpc[] = {0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000180 ,0x00000000 , +0x00000000 ,0x00000000 ,0x000001E0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
Signature · 1 line
2.13.6
PATCH 22/40 net/ice/base: support outer IP filter for GTPU without inner IP
In reply to Qi ZhangAdd ptype MAC_IPV4_GTPU intoice_ptypes_ipv4_ofos, ice_ptypes_ipv4_ofos_all and ice_ipv4_ofos_no_l4
Add ptype MAC_IPV6_GTPU intoice_ptypes_ipv6_ofos, ice_ptypes_ipv6_ofos_all and ice_ipv6_ofos_no_l4
Add ptype MAC_IPV4_GTPU and MAC_IPV6_GTPU into
the new ice_ptypes_gtpu_no_ip
So outer IP can be configured as input set for GTPU packet that without inner IP layer.
--- drivers/net/ice/base/ice_flow.c | 29 ++++++++++++++++++++++------- drivers/net/ice/base/ice_flow.h | 1 + 2 files changed, 23 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_flow.c +22 -7
@@ -224,7 +224,7 @@ static const u32 ice_ptypes_macvlan_il[] = {static const u32 ice_ptypes_ipv4_ofos[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000FC000 ,0x000000A0 ,0x00000000 , +0x00000000 ,0x000FC000 ,0x000002A0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -238,7 +238,7 @@ static const u32 ice_ptypes_ipv4_ofos[] = {static const u32 ice_ptypes_ipv4_ofos_all[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000FC000 ,0x83E0F8A0 ,0x00000101 , +0x00000000 ,0x000FC000 ,0x83E0FAA0 ,0x00000101 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -264,7 +264,7 @@ static const u32 ice_ptypes_ipv4_il[] = {static const u32 ice_ptypes_ipv6_ofos[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , -0x00000000 ,0x03F00000 ,0x00000140 ,0x00000000 , +0x00000000 ,0x03F00000 ,0x00000540 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -278,7 +278,7 @@ static const u32 ice_ptypes_ipv6_ofos[] = {static const u32 ice_ptypes_ipv6_ofos_all[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , -0x00080F00 ,0x03F00000 ,0x7C1F0140 ,0x00000206 , +0x00080F00 ,0x03F00000 ,0x7C1F0540 ,0x00000206 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -302,7 +302,7 @@ static const u32 ice_ptypes_ipv6_il[] = {static const u32 ice_ipv4_ofos_no_l4[] = {0x10C00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000cc000 ,0x000000A0 ,0x00000000 , +0x00000000 ,0x000cc000 ,0x000002A0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -326,7 +326,7 @@ static const u32 ice_ipv4_il_no_l4[] = {static const u32 ice_ipv6_ofos_no_l4[] = {0x00000000 ,0x00000000 ,0x43000000 ,0x10002000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x02300000 ,0x00000140 ,0x00000000 , +0x00000000 ,0x02300000 ,0x00000540 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -667,6 +667,17 @@ static const u32 ice_ptypes_mac_non_ip_ofos[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +static const u32 ice_ptypes_gtpu_no_ip[] = { +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000600 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +}; +/* Manage parameters and info. used during the creation of a flow profile */ struct ice_flow_prof_params {enum ice_block blk;
@@ -691,7 +702,7 @@ struct ice_flow_prof_params {ICE_FLOW_SEG_HDR_GTPC_TEID |ICE_FLOW_SEG_HDR_GTPU | \ICE_FLOW_SEG_HDR_PFCP_SESSION |ICE_FLOW_SEG_HDR_L2TPV3 | \ICE_FLOW_SEG_HDR_ESP |ICE_FLOW_SEG_HDR_AH | \ - ICE_FLOW_SEG_HDR_NAT_T_ESP) + ICE_FLOW_SEG_HDR_NAT_T_ESP | ICE_FLOW_SEG_HDR_GTPU_NON_IP) #define ICE_FLOW_SEG_HDRS_L2_MASK \ (ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_VLAN )
@@ -911,6 +922,10 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) src = (const ice_bitmap_t *)ice_ptypes_gtpc_tid;ice_and_bitmap (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_GTPU_NON_IP ) { + src = (const ice_bitmap_t *)ice_ptypes_gtpu_no_ip; +ice_and_bitmap (params->ptypes, params->ptypes, + src,ICE_FLOW_PTYPE_MAX ); }else if (hdrs &ICE_FLOW_SEG_HDR_GTPU_DWN ) { src = (const ice_bitmap_t *)ice_ptypes_gtpu; ice_and_bitmap(params->ptypes, params->ptypes,
drivers/net/ice/base/ice_flow.h +1 -0
@@ -178,6 +178,7 @@ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_AH =0x00200000 ,ICE_FLOW_SEG_HDR_NAT_T_ESP =0x00400000 ,ICE_FLOW_SEG_HDR_ETH_NON_IP =0x00800000 , +ICE_FLOW_SEG_HDR_GTPU_NON_IP =0x01000000 ,/* The following is an additive bit for ICE_FLOW_SEG_HDR_IPV4 and * ICE_FLOW_SEG_HDR_IPV6 which include the IPV4 other PTYPEs */
Signature · 1 line
2.13.6
PATCH 23/40 net/ice/base: move a function
In reply to Qi ZhangThe only caller of this function is within the file so mark it as static and move it up in the file to avoid a forward declaration.
--- drivers/net/ice/base/ice_acl.h | 1 - drivers/net/ice/base/ice_acl_ctrl.c | 93 ++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 49 deletions(-)
drivers/net/ice/base/ice_acl.h +0 -1
@@ -132,7 +132,6 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw);enum ice_status ice_acl_create_scen (struct ice_hw *hw,u16 match_width,u16 num_entries,u16 *scen_id); -enum ice_status ice_acl_destroy_scen (struct ice_hw *hw,u16 scen_id);enum ice_status ice_aq_alloc_acl_tbl (struct ice_hw *hw,struct ice_acl_alloc_tbl *tbl,struct ice_sq_cd *cd);
drivers/net/ice/base/ice_acl_ctrl.c +45 -48
102 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH 24/40 net/ice/base: clear advanced rules in reset preparation
In reply to Qi ZhangClear advanced rules from SW and HW before reset.
--- drivers/net/ice/base/ice_switch.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_switch.c +19 -11
@@ -8114,13 +8114,12 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,*/ enum ice_status ice_rem_adv_rule_for_vsi (struct ice_hw *hw,u16 vsi_handle) { -struct ice_adv_fltr_mgmt_list_entry *list_itr; +struct ice_adv_fltr_mgmt_list_entry *list_itr, *tmp_entry;struct ice_vsi_list_map_info *map_info;struct LIST_HEAD_TYPE *list_head;struct ice_adv_rule_info rinfo;struct ice_switch_info *sw;enum ice_status status; -u16 vsi_list_id =0 ;u8 rid; sw = hw->switch_info;
@@ -8129,22 +8128,31 @@ enum ice_status ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)continue ;if (!sw->recp_list[rid].adv_rule)continue ; + list_head = &sw->recp_list[rid].filt_rules; - map_info =NULL ; -LIST_FOR_EACH_ENTRY (list_itr, list_head, - ice_adv_fltr_mgmt_list_entry, list_entry) { - map_info =ice_find_vsi_list_entry (&sw->recp_list[rid], - vsi_handle, - &vsi_list_id); -if (!map_info) -continue ; +LIST_FOR_EACH_ENTRY_SAFE (list_itr, tmp_entry, list_head, + ice_adv_fltr_mgmt_list_entry, + list_entry) { rinfo = list_itr->rule_info; + +if (rinfo.sw_act.fltr_act ==ICE_FWD_TO_VSI_LIST ) { + map_info = list_itr->vsi_list_info; +if (!map_info) +continue ; + +if (!ice_is_bit_set (map_info->vsi_map, + vsi_handle)) +continue ; + }else if (rinfo.sw_act.vsi_handle != vsi_handle) { +continue ; + } + rinfo.sw_act.vsi_handle = vsi_handle; status =ice_rem_adv_rule (hw, list_itr->lkups, list_itr->lkups_cnt, &rinfo); +if (status)return status; - map_info =NULL ; } }return ICE_SUCCESS ;
Signature · 1 line
2.13.6
PATCH 25/40 net/ice/base: move a function
In reply to Qi ZhangMove ice_flow_get_hw_prof, this is not necessary for DPDK, just sync the code with other compile option which ice_flow_get_hw_prof is declared as a static function.
--- drivers/net/ice/base/ice_flow.c | 48 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/net/ice/base/ice_flow.c +24 -24
@@ -1642,6 +1642,30 @@ ice_dealloc_flow_entry(struct ice_hw *hw, struct ice_flow_entry *entry)ice_free (hw, entry); } +/** +* ice_flow_get_hw_prof - return the HW profile for a specific profile ID handle +* @hw: pointer to the HW struct +* @blk: classification stage +* @prof_id: the profile ID handle +* @hw_prof_id: pointer to variable to receive the HW profile ID +*/ +enum ice_status +ice_flow_get_hw_prof (struct ice_hw *hw,enum ice_block blk,u64 prof_id, +u8 *hw_prof_id) +{ +enum ice_status status =ICE_ERR_DOES_NOT_EXIST ; +struct ice_prof_map *map; + +ice_acquire_lock (&hw->blk[blk].es.prof_map_lock); + map =ice_search_prof_id (hw, blk, prof_id); +if (map) { + *hw_prof_id = map->prof_id; + status =ICE_SUCCESS ; + } +ice_release_lock (&hw->blk[blk].es.prof_map_lock); +return status; +} +#define ICE_ACL_INVALID_SCEN 0x3f/**
@@ -2233,30 +2257,6 @@ ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id) }/** -* ice_flow_get_hw_prof - return the HW profile for a specific profile ID handle -* @hw: pointer to the HW struct -* @blk: classification stage -* @prof_id: the profile ID handle -* @hw_prof_id: pointer to variable to receive the HW profile ID -*/ -enum ice_status -ice_flow_get_hw_prof (struct ice_hw *hw,enum ice_block blk,u64 prof_id, -u8 *hw_prof_id) -{ -enum ice_status status =ICE_ERR_DOES_NOT_EXIST ; -struct ice_prof_map *map; - -ice_acquire_lock (&hw->blk[blk].es.prof_map_lock); - map =ice_search_prof_id (hw, blk, prof_id); -if (map) { - *hw_prof_id = map->prof_id; - status =ICE_SUCCESS ; - } -ice_release_lock (&hw->blk[blk].es.prof_map_lock); -return status; -} - -/** * ice_flow_find_entry - look for a flow entry using its unique ID * @hw: pointer to the HW struct * @blk: classification stage
Signature · 1 line
2.13.6
PATCH 26/40 net/ice/base: add check for failed acts allocation
In reply to Qi ZhangThere is no check for failed allocation of 'acts'. Add a check and return if memory was not successfully allocated. Also, as all 'goto out' occur after this check there is no need to perform a check for 'acts' as we will have returned if it is not set.
--- drivers/net/ice/base/ice_flow.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_flow.c +8 -7
@@ -1712,8 +1712,8 @@ ice_flow_acl_is_prof_in_use(struct ice_hw *hw, struct ice_flow_prof *prof, buf->pf_scenario_num[6] == ICE_ACL_INVALID_SCEN && buf->pf_scenario_num[7] == ICE_ACL_INVALID_SCEN)return ICE_SUCCESS ; - else - return ICE_ERR_IN_USE; + +return ICE_ERR_IN_USE ; }/**
@@ -2861,7 +2861,6 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof,*/ exist =ice_flow_acl_find_scen_entry_cond (prof, e, &do_chg_action, &do_add_entry, &do_rem_entry); -if (do_rem_entry) { status =ice_flow_rem_entry_sync (hw,ICE_BLK_ACL , exist);if (status)
@@ -2869,8 +2868,11 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof, }/* Prepare the result action buffer */ - acts = (struct ice_acl_act_entry *)ice_calloc - (hw, e->entry_sz,sizeof (struct ice_acl_act_entry )); + acts = (struct ice_acl_act_entry *) +ice_calloc (hw, e->entry_sz,sizeof (struct ice_acl_act_entry )); +if (!acts) +return ICE_ERR_NO_MEMORY ; +for (i =0 ; i < e->acts_cnt; i++) ice_memcpy(&acts[i], &e->acts[i].data.acl_act, sizeof(struct ice_acl_act_entry),
@@ -2937,8 +2939,7 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof, *(entry) = exist; } out: -if (acts) -ice_free (hw, acts); +ice_free (hw, acts);return status; }
Signature · 1 line
2.13.6
PATCH 27/40 net/ice/base: remove repeated words
In reply to Qi ZhangA new test in checkpatch detects repeated words; cleanup all pre-existing occurrences of those now.
--- drivers/net/ice/base/ice_adminq_cmd.h | 2 +- drivers/net/ice/base/ice_common.c | 2 +- drivers/net/ice/base/ice_flow.c | 4 ++-- drivers/net/ice/base/ice_nvm.c | 2 +- drivers/net/ice/base/ice_switch.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +1 -1
@@ -2130,7 +2130,7 @@ struct ice_aqc_acl_update_query_scen {*/ struct ice_aqc_acl_scen {struct { -/* Byte [x] selection for the TCAM key. This value must be set +/* Byte [x] selection for the TCAM key. This value must be * set to 0x0 for unusued TCAM. * Only Bit 6..0 is used in each byte and MSB is reserved */
drivers/net/ice/base/ice_common.c +1 -1
@@ -2084,7 +2084,7 @@ ice_parse_fdir_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,* @cap_count: the number of capabilities * * Helper device to parse device (0x000B) capabilities list. For -* capabilities shared between device and device, this relies on +* capabilities shared between device and function, this relies on * ice_parse_common_caps. * * Loop through the list of provided capabilities and extract the relevant
drivers/net/ice/base/ice_flow.c +2 -2
@@ -1254,7 +1254,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,* ice_flow_xtract_raws - Create extract sequence entries for raw bytes * @hw: pointer to the HW struct * @params: information about the flow to be processed -* @seg: index of packet segment whose raw fields are to be be extracted +* @seg: index of packet segment whose raw fields are to be extracted */ static enum ice_status ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
@@ -3106,7 +3106,7 @@ enum ice_status ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk,* * This helper function stores information of a field being matched, including * the type of the field and the locations of the value to match, the mask, and -* and the upper-bound value in the start of the input buffer for a flow entry. +* the upper-bound value in the start of the input buffer for a flow entry. * This function should only be used for fixed-size data structures. * * This function also opportunistically determines the protocol headers to be
drivers/net/ice/base/ice_nvm.c +1 -1
@@ -629,7 +629,7 @@ ice_nvm_access_get_features(struct ice_nvm_access_cmd *cmd, {/* The provided data_size must be at least as large as our NVM * features structure. A larger size should not be treated as an -* error, to allow future extensions to to the features structure to +* error, to allow future extensions to the features structure to * work on older drivers. */ if (cmd->data_size <sizeof (struct ice_nvm_features ))
drivers/net/ice/base/ice_switch.c +2 -2
@@ -2367,7 +2367,7 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id,* @hw: pointer to the HW struct * @bcast_thresh: represents the upper threshold for broadcast storm control * @mcast_thresh: represents the upper threshold for multicast storm control -* @ctl_bitmask: storm control control knobs +* @ctl_bitmask: storm control knobs * * Sets the storm control configuration (0x0280) */
@@ -2394,7 +2394,7 @@ ice_aq_set_storm_ctrl(struct ice_hw *hw, u32 bcast_thresh, u32 mcast_thresh,* @hw: pointer to the HW struct * @bcast_thresh: represents the upper threshold for broadcast storm control * @mcast_thresh: represents the upper threshold for multicast storm control -* @ctl_bitmask: storm control control knobs +* @ctl_bitmask: storm control knobs * * Gets the storm control configuration (0x0281) */
Signature · 1 line
2.13.6
PATCH 28/40 net/ice/base: remove function ACL count query
In reply to Qi ZhangRemove debug function ice_aq_query_acl_cntrs.
--- drivers/net/ice/base/ice_acl.c | 36 ------------------------------------ drivers/net/ice/base/ice_acl.h | 3 --- 2 files changed, 39 deletions(-)
drivers/net/ice/base/ice_acl.c +0 -36
@@ -435,42 +435,6 @@ ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs, }/** -* ice_aq_query_acl_cntrs - query ACL counter -* @hw: pointer to the HW struct -* @bank: queries counter bank -* @index: queried counter index -* @cntr_val: pointer to counter or packet counter value -* @cd: pointer to command details structure or NULL -* -* Query ACL counter (direct 0x0C27) -*/ -enum ice_status -ice_aq_query_acl_cntrs (struct ice_hw *hw,u8 bank,u16 index,u64 *cntr_val, -struct ice_sq_cd *cd) -{ -struct ice_aqc_acl_query_counter *cmd; -struct ice_aq_desc desc; -enum ice_status status; - -if (!cntr_val) -return ICE_ERR_PARAM ; - -ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_query_acl_counter); - cmd = &desc.params.query_counter; - cmd->counter_index =CPU_TO_LE16 (index); - cmd->counter_bank = bank; - status =ice_aq_send_cmd (hw, &desc,NULL ,0 , cd); -if (!status) { -__le64 resp_val =0 ; - -ice_memcpy (&resp_val, cmd->ops.resp.val, -sizeof (cmd->ops.resp.val),ICE_NONDMA_TO_NONDMA ); - *cntr_val =LE64_TO_CPU (resp_val); - } -return status; -} - -/** * ice_prog_acl_prof_ranges - program ACL profile ranges * @hw: pointer to the HW struct * @prof_id: programmed or updated profile ID
drivers/net/ice/base/ice_acl.h +0 -3
@@ -172,9 +172,6 @@ enum ice_status ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs, struct ice_sq_cd *cd);enum ice_status -ice_aq_query_acl_cntrs (struct ice_hw *hw,u8 bank,u16 index,u64 *cntr_val, -struct ice_sq_cd *cd); -enum ice_status ice_prog_acl_prof_ranges (struct ice_hw *hw,u8 prof_id,struct ice_aqc_acl_profile_ranges *buf,struct ice_sq_cd *cd);
Signature · 1 line
2.13.6
PATCH 29/40 net/ice/base: preserve NVM capabilities in safe mode
In reply to Qi ZhangIf the driver initializes in safe mode, it will call ice_set_safe_mode_caps. This results in clearing the capabilities structures, in order to set them up for operating in safe mode, ensuring many features are disabled.
This has a side effect of also clearing the capability bits that relate to NVM update. The result is that the device driver will not indicate support for unified update, even if the firmware is capable.
Fix this by adding the relevant capability fields to the list of values we preserve. To simplify the code, use a common_cap structure instead of a handful of local variables. To reduce some duplication of the capability name, introduce a couple of macros used to restore the capabilities values from the cached copy.
--- drivers/net/ice/base/ice_common.c | 43 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-)
drivers/net/ice/base/ice_common.c +21 -22
@@ -2248,26 +2248,25 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) {struct ice_hw_func_caps *func_caps = &hw->func_caps;struct ice_hw_dev_caps *dev_caps = &hw->dev_caps; -u32 valid_func, rxq_first_id, txq_first_id; -u32 msix_vector_first_id, max_mtu; +struct ice_hw_common_caps cached_caps;u32 num_funcs;/* cache some func_caps values that should be restored after memset */ - valid_func = func_caps->common_cap.valid_functions; - txq_first_id = func_caps->common_cap.txq_first_id; - rxq_first_id = func_caps->common_cap.rxq_first_id; - msix_vector_first_id = func_caps->common_cap.msix_vector_first_id; - max_mtu = func_caps->common_cap.max_mtu; + cached_caps = func_caps->common_cap;/* unset func capabilities */ memset (func_caps,0 ,sizeof (*func_caps)); +#define ICE_RESTORE_FUNC_CAP (name) \ + func_caps->common_cap.name = cached_caps.name +/* restore cached values */ - func_caps->common_cap.valid_functions = valid_func; - func_caps->common_cap.txq_first_id = txq_first_id; - func_caps->common_cap.rxq_first_id = rxq_first_id; - func_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - func_caps->common_cap.max_mtu = max_mtu; +ICE_RESTORE_FUNC_CAP (valid_functions); +ICE_RESTORE_FUNC_CAP (txq_first_id); +ICE_RESTORE_FUNC_CAP (rxq_first_id); +ICE_RESTORE_FUNC_CAP (msix_vector_first_id); +ICE_RESTORE_FUNC_CAP (max_mtu); +ICE_RESTORE_FUNC_CAP (nvm_unified_update);/* one Tx and one Rx queue in safe mode */ func_caps->common_cap.num_rxq =1 ;
@@ -2278,22 +2277,22 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) func_caps->guar_num_vsi =1 ;/* cache some dev_caps values that should be restored after memset */ - valid_func = dev_caps->common_cap.valid_functions; - txq_first_id = dev_caps->common_cap.txq_first_id; - rxq_first_id = dev_caps->common_cap.rxq_first_id; - msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id; - max_mtu = dev_caps->common_cap.max_mtu; + cached_caps = dev_caps->common_cap; num_funcs = dev_caps->num_funcs;/* unset dev capabilities */ memset (dev_caps,0 ,sizeof (*dev_caps)); +#define ICE_RESTORE_DEV_CAP (name) \ + dev_caps->common_cap.name = cached_caps.name +/* restore cached values */ - dev_caps->common_cap.valid_functions = valid_func; - dev_caps->common_cap.txq_first_id = txq_first_id; - dev_caps->common_cap.rxq_first_id = rxq_first_id; - dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - dev_caps->common_cap.max_mtu = max_mtu; +ICE_RESTORE_DEV_CAP (valid_functions); +ICE_RESTORE_DEV_CAP (txq_first_id); +ICE_RESTORE_DEV_CAP (rxq_first_id); +ICE_RESTORE_DEV_CAP (msix_vector_first_id); +ICE_RESTORE_DEV_CAP (max_mtu); +ICE_RESTORE_DEV_CAP (nvm_unified_update); dev_caps->num_funcs = num_funcs;/* one Tx and one Rx queue per function in safe mode */
Signature · 1 line
2.13.6
PATCH 30/40 net/ice/base: misc minor ACL changes
In reply to Qi ZhangThis is a collection of minor ACL style changes including:
- When there is nothing to unroll, return a value directly.
- Return ICE_SUCCESS(0) in cases where an error was previously checked so ICE_SUCCESS is the only possible return.
- Remove unnecessary parentheses and newlines
- Move unroll of allocation to end of function and use goto on errors to free.
- Fix function header comment style
- Remove 'else' from an 'if else' condition where both conditions return a value to reduce indentation.
--- drivers/net/ice/base/ice_acl_ctrl.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/net/ice/base/ice_acl_ctrl.c +11 -13
@@ -149,10 +149,8 @@ static enum ice_status ice_acl_init_tbl(struct ice_hw *hw)u16 idx; tbl = hw->acl_tbl; -if (!tbl) { - status =ICE_ERR_CFG ; -return status; - } +if (!tbl) +return ICE_ERR_CFG ;ice_memset (&buf,0 ,sizeof (buf),ICE_NONDMA_MEM );ice_memset (&act_buf,0 ,sizeof (act_buf),ICE_NONDMA_MEM );
@@ -526,7 +524,7 @@ ice_acl_alloc_partition(struct ice_hw *hw, struct ice_acl_scen *req)break ; } - row = (dir >0 ) ? (row + width) : (row - width); + row = dir >0 ? row + width : row - width;if (row > hw->acl_tbl->last_tcam || row < hw->acl_tbl->first_tcam) {/* All rows have been checked. Increment 'off' that
@@ -668,8 +666,7 @@ static void ice_acl_assign_act_mem_for_scen(struct ice_acl_tbl *tbl, struct ice_acl_scen *scen, struct ice_aqc_acl_scen *scen_buf, - u8 current_tcam_idx, - u8 target_tcam_idx) + u8 current_tcam_idx, u8 target_tcam_idx) { u8 i;
@@ -761,10 +758,8 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries, scen->num_entry = num_entries; status =ice_acl_alloc_partition (hw, scen); -if (status) { -ice_free (hw, scen); -return status; - } +if (status) + goto out;ice_memset (&scen_buf,0 ,sizeof (scen_buf),ICE_NONDMA_MEM );
@@ -829,8 +824,7 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries,if (status) {ice_debug (hw,ICE_DBG_ACL ,"AQ allocation of ACL scenario failed. status: %d\n" , status); -ice_free (hw, scen); -return status; + goto out; } scen->id = *scen_id;
@@ -838,6 +832,10 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries,ice_acl_init_entry (scen);LIST_ADD (&scen->list_entry, &hw->acl_tbl->scens); +out: +if (status) +ice_free (hw, scen); +return status; }
Signature · 1 line
2.13.6
PATCH 31/40 net/ice/base: adjust rate limit profile ids runtime database
In reply to Qi ZhangMoving the runtime profile ids database/storage to the hw structure.
--- drivers/net/ice/base/ice_sched.c | 52 +++++++++++++++++++--------------------- drivers/net/ice/base/ice_type.h | 4 ++-- 2 files changed, 27 insertions(+), 29 deletions(-)
drivers/net/ice/base/ice_sched.c +25 -27
@@ -727,15 +727,15 @@ ice_sched_del_rl_profile(struct ice_hw *hw,static void ice_sched_clear_rl_prof (struct ice_port_info *pi) {u16 ln; +struct ice_hw *hw = pi->hw; -for (ln =0 ; ln < pi->hw->num_tx_sched_layers; ln++) { +for (ln =0 ; ln < hw->num_tx_sched_layers; ln++) {struct ice_aqc_rl_profile_info *rl_prof_elem;struct ice_aqc_rl_profile_info *rl_prof_tmp;LIST_FOR_EACH_ENTRY_SAFE (rl_prof_elem, rl_prof_tmp, - &pi->rl_prof_list[ln], + &hw->rl_prof_list[ln], ice_aqc_rl_profile_info, list_entry) { -struct ice_hw *hw = pi->hw;enum ice_status status; rl_prof_elem->prof_id_ref =0 ;
@@ -1260,7 +1260,7 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi) pi->port_state =ICE_SCHED_PORT_STATE_READY ;ice_init_lock (&pi->sched_lock);for (i =0 ; i <ICE_AQC_TOPO_MAX_LEVEL_NUM ; i++) -INIT_LIST_HEAD (&pi->rl_prof_list[i]); +INIT_LIST_HEAD (&hw->rl_prof_list[i]); err_init_port:if (status && pi->root) {
@@ -2868,23 +2868,23 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,/** * ice_sched_rm_unused_rl_prof - remove unused RL profile -* @pi: port information structure +* @hw: pointer to the hardware structure * * This function removes unused rate limit profiles from the HW and * SW DB. The caller needs to hold scheduler lock. */ -static void ice_sched_rm_unused_rl_prof (struct ice_port_info *pi) +static void ice_sched_rm_unused_rl_prof (struct ice_hw *hw) {u16 ln; -for (ln =0 ; ln < pi->hw->num_tx_sched_layers; ln++) { +for (ln =0 ; ln < hw->num_tx_sched_layers; ln++) {struct ice_aqc_rl_profile_info *rl_prof_elem;struct ice_aqc_rl_profile_info *rl_prof_tmp;LIST_FOR_EACH_ENTRY_SAFE (rl_prof_elem, rl_prof_tmp, - &pi->rl_prof_list[ln], + &hw->rl_prof_list[ln], ice_aqc_rl_profile_info, list_entry) { -if (!ice_sched_del_rl_profile (pi->hw, rl_prof_elem)) +if (!ice_sched_del_rl_profile (hw, rl_prof_elem))ice_debug (hw,ICE_DBG_SCHED ,"Removed rl profile\n" ); } }
@@ -3031,7 +3031,7 @@ enum ice_status ice_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id)ice_free (pi->hw, agg_info);/* Remove unused RL profile IDs from HW and SW DB */ -ice_sched_rm_unused_rl_prof (pi); +ice_sched_rm_unused_rl_prof (pi->hw); exit_ice_rm_agg_cfg:ice_release_lock (&pi->sched_lock);
@@ -3852,7 +3852,7 @@ ice_sched_bw_to_rl_profile(struct ice_hw *hw, u32 bw,/** * ice_sched_add_rl_profile - add RL profile -* @pi: port information structure +* @hw: pointer to the hardware structure * @rl_type: type of rate limit BW - min, max, or shared * @bw: bandwidth in Kbps - Kilo bits per sec * @layer_num: specifies in which layer to create profile
@@ -3864,14 +3864,13 @@ ice_sched_bw_to_rl_profile(struct ice_hw *hw, u32 bw,* The caller needs to hold the scheduler lock. */ 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) +ice_sched_add_rl_profile (struct ice_hw *hw,enum ice_rl_type rl_type, +u32 bw,u8 layer_num) {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;if (layer_num >=ICE_AQC_TOPO_MAX_LEVEL_NUM )
@@ -3890,10 +3889,9 @@ ice_sched_add_rl_profile(struct ice_port_info *pi,return NULL ; } -if (!pi) +if (!hw)return NULL ; - hw = pi->hw; -LIST_FOR_EACH_ENTRY (rl_prof_elem, &pi->rl_prof_list[layer_num], +LIST_FOR_EACH_ENTRY (rl_prof_elem, &hw->rl_prof_list[layer_num], ice_aqc_rl_profile_info, list_entry) if ((rl_prof_elem->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M) == profile_type && rl_prof_elem->bw == bw)
@@ -3926,7 +3924,7 @@ ice_sched_add_rl_profile(struct ice_port_info *pi,/* Good entry - add in the list */ rl_prof_elem->prof_id_ref =0 ; -LIST_ADD (&rl_prof_elem->list_entry, &pi->rl_prof_list[layer_num]); +LIST_ADD (&rl_prof_elem->list_entry, &hw->rl_prof_list[layer_num]);return rl_prof_elem; exit_add_rl_prof:
@@ -4105,7 +4103,7 @@ ice_sched_get_srl_node(struct ice_sched_node *node, u8 srl_layer)/** * ice_sched_rm_rl_profile - remove RL profile ID -* @pi: port information structure +* @hw: pointer to the hardware structure * @layer_num: layer number where profiles are saved * @profile_type: profile type like EIR, CIR, or SRL * @profile_id: profile ID to remove
@@ -4115,7 +4113,7 @@ ice_sched_get_srl_node(struct ice_sched_node *node, u8 srl_layer)* scheduler lock. */ static enum ice_status -ice_sched_rm_rl_profile (struct ice_port_info *pi,u8 layer_num,u8 profile_type, +ice_sched_rm_rl_profile (struct ice_hw *hw,u8 layer_num,u8 profile_type,u16 profile_id) {struct ice_aqc_rl_profile_info *rl_prof_elem;
@@ -4124,7 +4122,7 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type,if (layer_num >=ICE_AQC_TOPO_MAX_LEVEL_NUM )return ICE_ERR_PARAM ;/* Check the existing list for RL profile */ -LIST_FOR_EACH_ENTRY (rl_prof_elem, &pi->rl_prof_list[layer_num], +LIST_FOR_EACH_ENTRY (rl_prof_elem, &hw->rl_prof_list[layer_num], ice_aqc_rl_profile_info, list_entry) if ((rl_prof_elem->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M) == profile_type &&
@@ -4134,9 +4132,9 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type, rl_prof_elem->prof_id_ref--;/* Remove old profile ID from database */ - status =ice_sched_del_rl_profile (pi->hw, rl_prof_elem); + status =ice_sched_del_rl_profile (hw, rl_prof_elem);if (status && status !=ICE_ERR_IN_USE ) -ice_debug (pi->hw,ICE_DBG_SCHED ,"Remove rl profile failed\n" ); +ice_debug (hw,ICE_DBG_SCHED ,"Remove rl profile failed\n" );break ; }if (status ==ICE_ERR_IN_USE )
@@ -4196,7 +4194,7 @@ ice_sched_set_node_bw_dflt(struct ice_port_info *pi, old_id == ICE_SCHED_INVAL_PROF_ID)return ICE_SUCCESS ; -return ice_sched_rm_rl_profile (pi, layer_num, profile_type, old_id); +return ice_sched_rm_rl_profile (hw, layer_num, profile_type, old_id); }/**
@@ -4265,7 +4263,7 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node,struct ice_hw *hw = pi->hw;u16 old_id, rl_prof_id; - rl_prof_info =ice_sched_add_rl_profile (pi, rl_type, bw, layer_num); + rl_prof_info =ice_sched_add_rl_profile (hw, rl_type, bw, layer_num);if (!rl_prof_info)return status;
@@ -4287,7 +4285,7 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node, old_id == ICE_SCHED_INVAL_PROF_ID || old_id == rl_prof_id)return ICE_SUCCESS ; -return ice_sched_rm_rl_profile (pi, layer_num, +return ice_sched_rm_rl_profile (hw, layer_num, rl_prof_info->profile.flags &ICE_AQC_RL_PROFILE_TYPE_M , old_id); }
@@ -4316,7 +4314,7 @@ ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,return ICE_ERR_PARAM ; hw = pi->hw;/* Remove unused RL profile IDs from HW and SW DB */ -ice_sched_rm_unused_rl_prof (pi); +ice_sched_rm_unused_rl_prof (hw); layer_num =ice_sched_get_rl_prof_layer (pi, rl_type, node->tx_sched_layer);if (layer_num >= hw->num_tx_sched_layers)
drivers/net/ice/base/ice_type.h +2 -2
@@ -782,8 +782,6 @@ struct ice_port_info {struct ice_lock sched_lock;/* protect access to TXSched tree */ struct ice_sched_node * sib_head[ICE_MAX_TRAFFIC_CLASS ][ICE_AQC_TOPO_MAX_LEVEL_NUM ]; -/* List contain profile ID(s) and other params per layer */ -struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM ];struct ice_bw_type_info root_node_bw_t_info;struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS ];struct ice_qos_cfg qos_cfg;
@@ -834,6 +832,8 @@ struct ice_hw {u8 sw_entry_point_layer;u16 max_children[ICE_AQC_TOPO_MAX_LEVEL_NUM ];struct LIST_HEAD_TYPE agg_list;/* lists all aggregator */ +/* List contain profile ID(s) and other params per layer */ +struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM ];struct ice_vsi_ctx *vsi_ctx[ICE_MAX_VSI ];u8 evb_veb;/* true for VEB, false for VEPA */ u8 reset_ongoing;/* true if HW is in reset, false otherwise */
Signature · 1 line
2.13.6
PATCH 32/40 net/ice/base: enable QinQ filter for switch advanced rule
In reply to Qi ZhangEnable QinQ type filter for switch advanced rule, it support tunnel and non-tunnel packet use external and inner vlan id as input set for rules, it also support session id as input set for PPPoE rule with QinQ flag in packet.
--- drivers/net/ice/base/ice_protocol_type.h | 8 ++ drivers/net/ice/base/ice_switch.c | 236 +++++++++++++++++++++++++++++-- 2 files changed, 230 insertions(+), 14 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +8 -0
@@ -52,6 +52,7 @@ enum ice_protocol_type {ICE_AH ,ICE_NAT_T ,ICE_GTP_NO_PAY , +ICE_VLAN_EX , ICE_PROTOCOL_LAST };
@@ -102,6 +103,12 @@ enum ice_sw_tunnel_type {ICE_SW_TUN_PROFID_IPV4_PFCP_SESSION ,ICE_SW_TUN_PROFID_IPV6_PFCP_NODE ,ICE_SW_TUN_PROFID_IPV6_PFCP_SESSION , +ICE_SW_TUN_AND_NON_TUN_QINQ , +ICE_NON_TUN_QINQ , +ICE_SW_TUN_PPPOE_QINQ , +ICE_SW_TUN_PPPOE_PAY_QINQ , +ICE_SW_TUN_PPPOE_IPV4_QINQ , +ICE_SW_TUN_PPPOE_IPV6_QINQ ,ICE_ALL_TUNNELS /* All tunnel types including NVGRE */ };
@@ -160,6 +167,7 @@ enum ice_prot_id {#define ICE_MAC_OFOS_HW 1#define ICE_MAC_IL_HW 4#define ICE_ETYPE_OL_HW 9 +#define ICE_VLAN_OF_HW 16#define ICE_VLAN_OL_HW 17#define ICE_IPV4_OFOS_HW 32#define ICE_IPV4_IL_HW 33
drivers/net/ice/base/ice_switch.c +222 -14
370 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH 33/40 net/ice/base: create flash info structure and separate NVM version
In reply to Qi ZhangThe ice_nvm_info structure has become somewhat of a dumping ground for all of the fields related to flash version. It holds the NVM version and EETRACK id, the OptionROM info structure, the flash size, the ShadowRAM size, and more.
A future change is going to add the ability to read the NVM version and EETRACK ID from the inactive NVM bank. To make this simpler, it is useful to have these NVM version info fields extracted to their own structure.
Rename ice_nvm_info into ice_flash_info, and create a separate ice_nvm_info structure that will contain the eetrack and NVM map version. Move the netlist_ver structure into ice_flash_info and rename it ice_netlist_info for consistency.
Modify the static ice_get_orom_ver_info to take the option rom structure as a pointer. This makes it more obvious what portion of the hw struct is being modified. Do the same for ice_get_netlist_ver_info.
Introduce a new ice_get_nvm_ver_info function, which will be similar to ice_get_orom_ver_info and ice_get_netlist_ver_info, used to keep the NVM version extraction code co-located.
--- drivers/net/ice/base/ice_common.c | 7 +-- drivers/net/ice/base/ice_nvm.c | 108 +++++++++++++++++++------------------- drivers/net/ice/base/ice_type.h | 15 ++++-- drivers/net/ice/ice_ethdev.c | 14 ++--- 4 files changed, 75 insertions(+), 69 deletions(-)
drivers/net/ice/base/ice_common.c +4 -3
@@ -675,13 +675,14 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw)void ice_print_rollback_msg (struct ice_hw *hw) {char nvm_str[ICE_NVM_VER_LEN ] = {0 }; -struct ice_nvm_info *nvm = &hw->nvm;struct ice_orom_info *orom; +struct ice_nvm_info *nvm; - orom = &nvm->orom; + orom = &hw->flash.orom; + nvm = &hw->flash.nvm;SNPRINTF (nvm_str,sizeof (nvm_str),"%x.%02x 0x%x %d.%d.%d" , - nvm->major_ver, nvm->minor_ver, nvm->eetrack, orom->major, + nvm->major, nvm->minor, nvm->eetrack, orom->major, orom->build, orom->patch); ice_warn(hw, "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode\n",
drivers/net/ice/base/ice_nvm.c +54 -54
176 lines not on this page · raw message
drivers/net/ice/base/ice_type.h +10 -5
@@ -511,14 +511,19 @@ struct ice_orom_info {u16 build;/* Build version of OROM */ }; -/* NVM Information */ +/* NVM version information */ struct ice_nvm_info { +u32 eetrack; +u8 major; +u8 minor; +}; + +/* Flash Chip Information */ +struct ice_flash_info {struct ice_orom_info orom;/* Option ROM version info */ -u32 eetrack;/* NVM data version */ +struct ice_nvm_info nvm;/* NVM version information */ u16 sr_words;/* Shadow RAM size in words */ u32 flash_size;/* Size of available flash in bytes */ -u8 major_ver;/* major version of dev starter */ -u8 minor_ver;/* minor version of dev starter */ u8 blank_nvm_mode;/* is NVM empty (no FW present) */ };
@@ -838,7 +843,7 @@ struct ice_hw {u8 evb_veb;/* true for VEB, false for VEPA */ u8 reset_ongoing;/* true if HW is in reset, false otherwise */ struct ice_bus_info bus; -struct ice_nvm_info nvm; +struct ice_flash_info flash;struct ice_hw_dev_caps dev_caps;/* device capabilities */ struct ice_hw_func_caps func_caps;/* function capabilities */
drivers/net/ice/ice_ethdev.c +7 -7
@@ -4407,15 +4407,15 @@ ice_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)u16 build;int ret; - ver = hw->nvm.orom.major; - patch = hw->nvm.orom.patch; - build = hw->nvm.orom.build; + ver = hw->flash.orom.major; + patch = hw->flash.orom.patch; + build = hw->flash.orom.build; ret =snprintf (fw_version, fw_size,"%d.%d 0x%08x %d.%d.%d" , - hw->nvm.major_ver, - hw->nvm.minor_ver, - hw->nvm.eetrack, + hw->flash.nvm.major, + hw->flash.nvm.minor, + hw->flash.nvm.eetrack, ver, build, patch);/* add the size of '\0' */
@@ -4513,7 +4513,7 @@ ice_get_eeprom_length(struct rte_eth_dev *dev) {struct ice_hw *hw =ICE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -return hw->nvm.flash_size; +return hw->flash.flash_size; } static int
Signature · 1 line
2.13.6
PATCH 34/40 net/ice/base: remove unused parameter
In reply to Qi Zhangremove unused parameter of ice_parse_fdir_func_caps
--- drivers/net/ice/base/ice_common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_common.c +2 -4
@@ -1942,13 +1942,11 @@ ice_parse_vsi_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,* ice_parse_fdir_func_caps - Parse ICE_AQC_CAPS_FD function caps * @hw: pointer to the HW struct * @func_p: pointer to function capabilities structure -* @cap: pointer to the capability element to parse * * Extract function capabilities for ICE_AQC_CAPS_FD. */ static void -ice_parse_fdir_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_p, -struct ice_aqc_list_caps_elem *cap) +ice_parse_fdir_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_p) {u32 reg_val, val;
@@ -2006,7 +2004,7 @@ ice_parse_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,ice_parse_vsi_func_caps (hw, func_p, &cap_resp[i]);break ;case ICE_AQC_CAPS_FD : -ice_parse_fdir_func_caps (hw, func_p, &cap_resp[i]); +ice_parse_fdir_func_caps (hw, func_p);break ;default :/* Don't list common capabilities as unknown */
Signature · 1 line
2.13.6
PATCH 35/40 net/ice/base: minor code clean
In reply to Qi ZhangRemove unnecessary mac_type check, fix couple comment, and remove unnecessary empty line.
--- drivers/net/ice/base/ice_common.c | 7 +------ drivers/net/ice/base/ice_flow.c | 9 ++++----- 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_common.c +1 -6
@@ -782,8 +782,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw) ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL);ice_free (hw, pcaps);if (status) -ice_debug (hw,ICE_DBG_PHY ,"%s: Get PHY capabilities failed, continuing anyway\n" , - __func__); +ice_debug (hw,ICE_DBG_PHY ,"Get PHY capabilities failed, continuing anyway\n" );/* Initialize port_info struct with link information */ status =ice_aq_get_link_info (hw->port_info, false,NULL ,NULL );
@@ -4632,10 +4631,6 @@ enum ice_fw_modes ice_get_fw_mode(struct ice_hw *hw)*/ bool ice_fw_supports_link_override (struct ice_hw *hw) { -/* Currently, only supported for E810 devices */ -if (hw->mac_type !=ICE_MAC_E810 ) -return false; -if (hw->api_maj_ver ==ICE_FW_API_LINK_OVERRIDE_MAJ ) {if (hw->api_min_ver >ICE_FW_API_LINK_OVERRIDE_MIN )return true;
drivers/net/ice/base/ice_flow.c +4 -5
@@ -2818,7 +2818,7 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof,if (!entry || !(*entry) || !prof)return ICE_ERR_BAD_PTR ; - e = *(entry); + e = *entry; do_chg_rng_chk = false;if (e->range_buf) {
@@ -3236,8 +3236,7 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len, (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6)#define ICE_FLOW_RSS_SEG_HDR_L4_MASKS \ - (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | \ - ICE_FLOW_SEG_HDR_SCTP) + (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP)#define ICE_FLOW_RSS_SEG_HDR_VAL_MASKS \ (ICE_FLOW_RSS_SEG_HDR_L2_MASKS | \
@@ -3573,7 +3572,7 @@ ice_add_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,if (status) goto exit; -/* don't do RSS for GTPU outer */ +/* Don't do RSS for GTPU Outer */ if (segs_cnt ==ICE_RSS_OUTER_HEADERS && segs[segs_cnt -1 ].hdrs &ICE_FLOW_SEG_HDR_GTPU ) { status =ICE_SUCCESS ;
@@ -3696,7 +3695,6 @@ ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,ice_acquire_lock (&hw->rss_locks); status =ice_add_rss_cfg_sync (hw, vsi_handle, hashed_flds, addl_hdrs,ICE_RSS_OUTER_HEADERS , symm); -if (!status) status = ice_add_rss_cfg_sync(hw, vsi_handle, hashed_flds, addl_hdrs, ICE_RSS_INNER_HEADERS,
@@ -3736,6 +3734,7 @@ ice_rem_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,if (status) goto out; +/* Don't do RSS for GTPU Outer */ if (segs_cnt ==ICE_RSS_OUTER_HEADERS && segs[segs_cnt -1 ].hdrs &ICE_FLOW_SEG_HDR_GTPU ) { status =ICE_SUCCESS ;
Signature · 1 line
2.13.6
PATCH 36/40 net/ice/base: cache NVM module bank information
In reply to Qi ZhangThe ice flash contains two copies of each of the NVM, Option ROM, and Netlist modules. Each bank has a pointer word and a size word. In order to correctly read from the active flash bank, the driver must calculate the offset manually.
During NVM initialization, read the Shadow RAM control word and determine which bank is active for each NVM module. Additionally, cache the size and pointer values for use in calculating the correct offset.
--- drivers/net/ice/base/ice_nvm.c | 151 ++++++++++++++++++++++++++++++++++++++++ drivers/net/ice/base/ice_type.h | 29 ++++++++ 2 files changed, 180 insertions(+)
drivers/net/ice/base/ice_nvm.c +151 -0
@@ -503,6 +503,151 @@ static enum ice_status ice_discover_flash_size(struct ice_hw *hw) }/** +* ice_read_sr_pointer - Read the value of a Shadow RAM pointer word +* @hw: pointer to the HW structure +* @offset: the word offset of the Shadow RAM word to read +* @pointer: pointer value read from Shadow RAM +* +* Read the given Shadow RAM word, and convert it to a pointer value specified +* in bytes. This function assumes the specified offset is a valid pointer +* word. +* +* Each pointer word specifies whether it is stored in word size or 4KB +* sector size by using the highest bit. The reported pointer value will be in +* bytes, intended for flat NVM reads. +*/ +static enum ice_status +ice_read_sr_pointer (struct ice_hw *hw,u16 offset,u32 *pointer) +{ +enum ice_status status; +u16 value; + + status =ice_read_sr_word (hw, offset, &value); +if (status) +return status; + +/* Determine if the pointer is in 4KB or word units */ +if (value &ICE_SR_NVM_PTR_4KB_UNITS ) + *pointer = (value & ~ICE_SR_NVM_PTR_4KB_UNITS ) *4 *1024 ; +else + *pointer = value *2 ; + +return ICE_SUCCESS ; +} + +/** +* ice_read_sr_area_size - Read an area size from a Shadow RAM word +* @hw: pointer to the HW structure +* @offset: the word offset of the Shadow RAM to read +* @size: size value read from the Shadow RAM +* +* Read the given Shadow RAM word, and convert it to an area size value +* specified in bytes. This function assumes the specified offset is a valid +* area size word. +* +* Each area size word is specified in 4KB sector units. This function reports +* the size in bytes, intended for flat NVM reads. +*/ +static enum ice_status +ice_read_sr_area_size (struct ice_hw *hw,u16 offset,u32 *size) +{ +enum ice_status status; +u16 value; + + status =ice_read_sr_word (hw, offset, &value); +if (status) +return status; + +/* Area sizes are always specified in 4KB units */ + *size = value *4 *1024 ; + +return ICE_SUCCESS ; +} + +/** +* ice_determine_active_flash_banks - Discover active bank for each module +* @hw: pointer to the HW struct +* +* Read the Shadow RAM control word and determine which banks are active for +* the NVM, OROM, and Netlist modules. Also read and calculate the associated +* pointer and size. These values are then cached into the ice_flash_info +* structure for later use in order to calculate the correct offset to read +* from the active module. +*/ +static enum ice_status +ice_determine_active_flash_banks (struct ice_hw *hw) +{ +struct ice_bank_info *banks = &hw->flash.banks; +enum ice_status status; +u16 ctrl_word; + + status =ice_read_sr_word (hw,ICE_SR_NVM_CTRL_WORD , &ctrl_word); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read the Shadow RAM control word\n" ); +return status; + } + +/* Check that the control word indicates validity */ +if ((ctrl_word &ICE_SR_CTRL_WORD_1_M ) >>ICE_SR_CTRL_WORD_1_S !=ICE_SR_CTRL_WORD_VALID ) { +ice_debug (hw,ICE_DBG_NVM ,"Shadow RAM control word is invalid\n" ); +return ICE_ERR_CFG ; + } + +if (!(ctrl_word &ICE_SR_CTRL_WORD_NVM_BANK )) + banks->nvm_bank =ICE_1ST_FLASH_BANK ; +else + banks->nvm_bank =ICE_2ND_FLASH_BANK ; + +if (!(ctrl_word &ICE_SR_CTRL_WORD_OROM_BANK )) + banks->orom_bank =ICE_1ST_FLASH_BANK ; +else + banks->orom_bank =ICE_2ND_FLASH_BANK ; + +if (!(ctrl_word &ICE_SR_CTRL_WORD_NETLIST_BANK )) + banks->netlist_bank =ICE_1ST_FLASH_BANK ; +else + banks->netlist_bank =ICE_2ND_FLASH_BANK ; + + status =ice_read_sr_pointer (hw,ICE_SR_1ST_NVM_BANK_PTR , &banks->nvm_ptr); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read NVM bank pointer\n" ); +return status; + } + + status =ice_read_sr_area_size (hw,ICE_SR_NVM_BANK_SIZE , &banks->nvm_size); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read NVM bank area size\n" ); +return status; + } + + status =ice_read_sr_pointer (hw,ICE_SR_1ST_OROM_BANK_PTR , &banks->orom_ptr); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read OROM bank pointer\n" ); +return status; + } + + status =ice_read_sr_area_size (hw,ICE_SR_OROM_BANK_SIZE , &banks->orom_size); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read OROM bank area size\n" ); +return status; + } + + status =ice_read_sr_pointer (hw,ICE_SR_NETLIST_BANK_PTR , &banks->netlist_ptr); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read Netlist bank pointer\n" ); +return status; + } + + status =ice_read_sr_area_size (hw,ICE_SR_NETLIST_BANK_SIZE , &banks->netlist_size); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read Netlist bank area size\n" ); +return status; + } + +return ICE_SUCCESS ; +} + +/** * ice_init_nvm - initializes NVM setting * @hw: pointer to the HW struct *
@@ -544,6 +689,12 @@ enum ice_status ice_init_nvm(struct ice_hw *hw)return status; } + status =ice_determine_active_flash_banks (hw); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to determine active flash banks.\n" ); +return status; + } + status =ice_get_nvm_ver_info (hw, &flash->nvm);if (status) {ice_debug (hw,ICE_DBG_INIT ,"Failed to read NVM info.\n" );
drivers/net/ice/base/ice_type.h +29 -0
@@ -518,10 +518,33 @@ struct ice_nvm_info {u8 minor; }; +/* Enumeration of possible flash banks for the NVM, OROM, and Netlist modules +* of the flash image. +*/ +enum ice_flash_bank { +ICE_INVALID_FLASH_BANK , +ICE_1ST_FLASH_BANK , +ICE_2ND_FLASH_BANK , +}; + +/* information for accessing NVM, OROM, and Netlist flash banks */ +struct ice_bank_info { +u32 nvm_ptr;/* Pointer to 1st NVM bank */ +u32 nvm_size;/* Size of NVM bank */ +u32 orom_ptr;/* Pointer to 1st OROM bank */ +u32 orom_size;/* Size of OROM bank */ +u32 netlist_ptr;/* Pointer to 1st Netlist bank */ +u32 netlist_size;/* Size of Netlist bank */ +enum ice_flash_bank nvm_bank;/* Active NVM bank */ +enum ice_flash_bank orom_bank;/* Active OROM bank */ +enum ice_flash_bank netlist_bank;/* Active Netlist bank */ +}; +/* Flash Chip Information */ struct ice_flash_info {struct ice_orom_info orom;/* Option ROM version info */ struct ice_nvm_info nvm;/* NVM version information */ +struct ice_bank_info banks;/* Flash Bank information */ u16 sr_words;/* Shadow RAM size in words */ u32 flash_size;/* Size of available flash in bytes */ u8 blank_nvm_mode;/* is NVM empty (no FW present) */
@@ -1099,6 +1122,12 @@ enum ice_sw_fwd_act_type {#define ICE_SR_PCIE_ALT_SIZE_WORDS 512#define ICE_SR_CTRL_WORD_1_S 0x06#define ICE_SR_CTRL_WORD_1_M (0x03 << ICE_SR_CTRL_WORD_1_S) +#define ICE_SR_CTRL_WORD_VALID 0x1 +#define ICE_SR_CTRL_WORD_OROM_BANK BIT(3) +#define ICE_SR_CTRL_WORD_NETLIST_BANK BIT(4) +#define ICE_SR_CTRL_WORD_NVM_BANK BIT(5) + +#define ICE_SR_NVM_PTR_4KB_UNITS BIT(15)/* Shadow RAM related */ #define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800
Signature · 1 line
2.13.6
PATCH 37/40 net/ice/base: rename function
In reply to Qi Zhang'xtrct' or 'xtract' is currently used in the code to shorten 'extract'. Rename ice_prgm_acl_prof_extrt() to ice_prgm_acl_prof_xtrct() so we don't have another variation of a 'extract'.
--- drivers/net/ice/base/ice_acl.c | 4 ++-- drivers/net/ice/base/ice_acl.h | 2 +- drivers/net/ice/base/ice_flow.c | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/ice/base/ice_acl.c +2 -2
@@ -288,7 +288,7 @@ ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id, }/** -* ice_prgm_acl_prof_extrt - program ACL profile extraction sequence +* ice_prgm_acl_prof_xtrct - program ACL profile extraction sequence * @hw: pointer to the HW struct * @prof_id: profile ID * @buf: ptr to buffer
@@ -297,7 +297,7 @@ ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id,* Program ACL profile extraction (indirect 0x0C1D) */ enum ice_status -ice_prgm_acl_prof_extrt (struct ice_hw *hw,u8 prof_id, +ice_prgm_acl_prof_xtrct (struct ice_hw *hw,u8 prof_id,struct ice_aqc_acl_prof_generic_frmt *buf,struct ice_sq_cd *cd) {
drivers/net/ice/base/ice_acl.h +1 -1
@@ -158,7 +158,7 @@ ice_aq_query_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx, struct ice_aqc_actpair *buf, struct ice_sq_cd *cd);enum ice_status ice_aq_dealloc_acl_res (struct ice_hw *hw,struct ice_sq_cd *cd);enum ice_status -ice_prgm_acl_prof_extrt (struct ice_hw *hw,u8 prof_id, +ice_prgm_acl_prof_xtrct (struct ice_hw *hw,u8 prof_id,struct ice_aqc_acl_prof_generic_frmt *buf,struct ice_sq_cd *cd);enum ice_status
drivers/net/ice/base/ice_flow.c +2 -3
@@ -1780,7 +1780,7 @@ ice_flow_acl_disassoc_scen(struct ice_hw *hw, struct ice_flow_prof *prof)/* Clear scenario for this PF */ buf.pf_scenario_num[hw->pf_id] =ICE_ACL_INVALID_SCEN ; - status =ice_prgm_acl_prof_extrt (hw, prof_id, &buf,NULL ); + status =ice_prgm_acl_prof_xtrct (hw, prof_id, &buf,NULL );return status; }
@@ -2082,7 +2082,7 @@ ice_flow_acl_set_xtrct_seq(struct ice_hw *hw, struct ice_flow_prof *prof)/* Update the current PF */ buf.pf_scenario_num[hw->pf_id] = (u8 )prof->cfg.scen->id; - status =ice_prgm_acl_prof_extrt (hw, prof_id, &buf,NULL ); + status =ice_prgm_acl_prof_xtrct (hw, prof_id, &buf,NULL );return status; }
@@ -2510,7 +2510,6 @@ ice_flow_acl_frmt_entry(struct ice_hw *hw, struct ice_flow_prof *prof, e->acts = (struct ice_flow_action *)ice_memdup (hw, acts, acts_cnt *sizeof (*acts),ICE_NONDMA_TO_NONDMA ); -if (!e->acts) goto out;
Signature · 1 line
2.13.6
PATCH 38/40 net/ice/base: remove unnecessary conditional
In reply to Qi ZhangThese two conditional statements are unnecessary because the condition is always true based on existing code flow. Remove them to resolve potential errors from some static analysis tools.
--- drivers/net/ice/base/ice_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_flow.c +2 -2
@@ -1089,7 +1089,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,*/ if (fld ==ICE_FLOW_FIELD_IDX_IPV4_TTL ) sib =ICE_FLOW_FIELD_IDX_IPV4_PROT ; -else if (fld ==ICE_FLOW_FIELD_IDX_IPV4_PROT ) +else sib =ICE_FLOW_FIELD_IDX_IPV4_TTL ;/* If the sibling field is also included, that field's
@@ -1108,7 +1108,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,*/ if (fld ==ICE_FLOW_FIELD_IDX_IPV6_TTL ) sib =ICE_FLOW_FIELD_IDX_IPV6_PROT ; -else if (fld ==ICE_FLOW_FIELD_IDX_IPV6_PROT ) +else sib =ICE_FLOW_FIELD_IDX_IPV6_TTL ;/* If the sibling field is also included, that field's
Signature · 1 line
2.13.6
PATCH 39/40 net/ice/base: rename ACL priority values
In reply to Qi ZhangThe naming convention used to shorten 'priority' is 'prio'. Convert the ACL related entries that use 'prior' to 'prio'.
Also, as ICE_LOW, ICE_NORMAL,... are not very descriptive of what they represent. Add 'ACL_PRIO' to help convey their use.
--- drivers/net/ice/base/ice_acl.h | 16 ++++++++-------- drivers/net/ice/base/ice_acl_ctrl.c | 32 +++++++++++++++++--------------- drivers/net/ice/base/ice_flow.c | 25 ++++++++++++------------- 3 files changed, 37 insertions(+), 36 deletions(-)
drivers/net/ice/base/ice_acl.h +8 -8
@@ -47,11 +47,11 @@ struct ice_acl_tbl { };#define ICE_MAX_ACL_TCAM_ENTRY (ICE_AQC_ACL_TCAM_DEPTH * ICE_AQC_ACL_SLICES) -enum ice_acl_entry_prior { -ICE_LOW =0 , -ICE_NORMAL , -ICE_HIGH , -ICE_MAX_PRIOR +enum ice_acl_entry_prio { +ICE_ACL_PRIO_LOW =0 , +ICE_ACL_PRIO_NORMAL , +ICE_ACL_PRIO_HIGH , +ICE_ACL_MAX_PRIO };/* Scenario structure
@@ -74,8 +74,8 @@ struct ice_acl_scen {* be available in this scenario */ ice_declare_bitmap (entry_bitmap,ICE_MAX_ACL_TCAM_ENTRY ); -u16 first_idx[ICE_MAX_PRIOR ]; -u16 last_idx[ICE_MAX_PRIOR ]; +u16 first_idx[ICE_ACL_MAX_PRIO ]; +u16 last_idx[ICE_ACL_MAX_PRIO ];u16 id;u16 start;/* Number of entry from the start of the parent table */
@@ -192,7 +192,7 @@ ice_aq_query_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);enum ice_status ice_acl_add_entry (struct ice_hw *hw,struct ice_acl_scen *scen, -enum ice_acl_entry_prior prior,u8 *keys,u8 *inverts, +enum ice_acl_entry_prio prio,u8 *keys,u8 *inverts,struct ice_acl_act_entry *acts,u8 acts_cnt,u16 *entry_idx); enum ice_status ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,
drivers/net/ice/base/ice_acl_ctrl.c +17 -15
@@ -25,19 +25,21 @@ static void ice_acl_init_entry(struct ice_acl_scen *scen)* normal priority: start from the highest index, 50% of total entries * high priority: start from the lowest index, 25% of total entries */ - scen->first_idx[ICE_LOW ] = scen->num_entry -1 ; - scen->first_idx[ICE_NORMAL ] = scen->num_entry - scen->num_entry /4 -1 ; - scen->first_idx[ICE_HIGH ] =0 ; - - scen->last_idx[ICE_LOW ] = scen->num_entry - scen->num_entry /4 ; - scen->last_idx[ICE_NORMAL ] = scen->num_entry /4 ; - scen->last_idx[ICE_HIGH ] = scen->num_entry /4 -1 ; + scen->first_idx[ICE_ACL_PRIO_LOW ] = scen->num_entry -1 ; + scen->first_idx[ICE_ACL_PRIO_NORMAL ] = scen->num_entry - + scen->num_entry /4 -1 ; + scen->first_idx[ICE_ACL_PRIO_HIGH ] =0 ; + + scen->last_idx[ICE_ACL_PRIO_LOW ] = scen->num_entry - + scen->num_entry /4 ; + scen->last_idx[ICE_ACL_PRIO_NORMAL ] = scen->num_entry /4 ; + scen->last_idx[ICE_ACL_PRIO_HIGH ] = scen->num_entry /4 -1 ; }/** * ice_acl_scen_assign_entry_idx * @scen: pointer to the scenario struct -* @prior: the priority of the flow entry being allocated +* @prio: the priority of the flow entry being allocated * * To find the index of an available entry in scenario *
@@ -46,16 +48,16 @@ static void ice_acl_init_entry(struct ice_acl_scen *scen)*/ static u16 ice_acl_scen_assign_entry_idx (struct ice_acl_scen *scen, -enum ice_acl_entry_prior prior) +enum ice_acl_entry_prio prio) {u16 first_idx, last_idx, i;s8 step; -if (prior >=ICE_MAX_PRIOR ) +if (prio >=ICE_ACL_MAX_PRIO )return ICE_ACL_SCEN_ENTRY_INVAL ; - first_idx = scen->first_idx[prior]; - last_idx = scen->last_idx[prior]; + first_idx = scen->first_idx[prio]; + last_idx = scen->last_idx[prio]; step = first_idx <= last_idx ?1 :-1 ;for (i = first_idx; i != last_idx + step; i += step)
@@ -953,7 +955,7 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw)* ice_acl_add_entry - Add a flow entry to an ACL scenario * @hw: pointer to the HW struct * @scen: scenario to add the entry to -* @prior: priority level of the entry being added +* @prio: priority level of the entry being added * @keys: buffer of the value of the key to be programmed to the ACL entry * @inverts: buffer of the value of the key inverts to be programmed * @acts: pointer to a buffer containing formatted actions
@@ -967,7 +969,7 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw)*/ enum ice_status ice_acl_add_entry (struct ice_hw *hw,struct ice_acl_scen *scen, -enum ice_acl_entry_prior prior,u8 *keys,u8 *inverts, +enum ice_acl_entry_prio prio,u8 *keys,u8 *inverts,struct ice_acl_act_entry *acts,u8 acts_cnt,u16 *entry_idx) {u8 i, entry_tcam, num_cscd, offset;
@@ -978,7 +980,7 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,if (!scen)return ICE_ERR_DOES_NOT_EXIST ; - *entry_idx =ice_acl_scen_assign_entry_idx (scen, prior); + *entry_idx =ice_acl_scen_assign_entry_idx (scen, prio);if (*entry_idx >= scen->num_entry) { *entry_idx =0 ;return ICE_ERR_MAX_LIMIT ;
drivers/net/ice/base/ice_flow.c +12 -13
@@ -2715,30 +2715,30 @@ ice_flow_acl_find_scen_entry_cond(struct ice_flow_prof *prof, }/** -* ice_flow_acl_convert_to_acl_prior - Convert to ACL priority +* ice_flow_acl_convert_to_acl_prio - Convert to ACL priority * @p: flow priority */ -static enum ice_acl_entry_prior -ice_flow_acl_convert_to_acl_prior (enum ice_flow_priority p) +static enum ice_acl_entry_prio +ice_flow_acl_convert_to_acl_prio (enum ice_flow_priority p) { -enum ice_acl_entry_prior acl_prior; +enum ice_acl_entry_prio acl_prio;switch (p) {case ICE_FLOW_PRIO_LOW : - acl_prior =ICE_LOW ; + acl_prio =ICE_ACL_PRIO_LOW ;break ;case ICE_FLOW_PRIO_NORMAL : - acl_prior =ICE_NORMAL ; + acl_prio =ICE_ACL_PRIO_NORMAL ;break ;case ICE_FLOW_PRIO_HIGH : - acl_prior =ICE_HIGH ; + acl_prio =ICE_ACL_PRIO_HIGH ;break ;default : - acl_prior =ICE_NORMAL ; + acl_prio =ICE_ACL_PRIO_NORMAL ;break ; } -return acl_prior; +return acl_prio; }/**
@@ -2878,15 +2878,15 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof, ICE_NONDMA_TO_NONDMA);if (do_add_entry) { -enum ice_acl_entry_prior prior; +enum ice_acl_entry_prio prio;u8 *keys, *inverts;u16 entry_idx; keys = (u8 *)e->entry; inverts = keys + (e->entry_sz /2 ); - prior =ice_flow_acl_convert_to_acl_prior (e->priority); + prio =ice_flow_acl_convert_to_acl_prio (e->priority); - status =ice_acl_add_entry (hw, prof->cfg.scen, prior, keys, + status =ice_acl_add_entry (hw, prof->cfg.scen, prio, keys, inverts, acts, e->acts_cnt, &entry_idx);if (status)
@@ -2904,7 +2904,6 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof, exist->acts = (struct ice_flow_action *)ice_calloc (hw, exist->acts_cnt,sizeof (struct ice_flow_action )); -if (!exist->acts) { status =ICE_ERR_NO_MEMORY ; goto out;
Signature · 1 line
2.13.6
PATCH 40/40 net/ice/base: preserve default aggr vsi information
In reply to Qi ZhangAdded the change to keep the default aggregator VSI information.
--- drivers/net/ice/base/ice_sched.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/net/ice/base/ice_sched.c +1 -10
@@ -2852,16 +2852,7 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,if (status)break ; -if (agg_id !=ICE_DFLT_AGG_ID ) -ice_set_bit (tc, agg_vsi_info->tc_bitmap); -else -ice_clear_bit (tc, agg_vsi_info->tc_bitmap); - } -/* If VSI moved back to default aggregator, delete agg_vsi_info. */ -if (!ice_is_any_bit_set (agg_vsi_info->tc_bitmap, -ICE_MAX_TRAFFIC_CLASS )) { -LIST_DEL (&agg_vsi_info->list_entry); -ice_free (hw, agg_vsi_info); +ice_set_bit (tc, agg_vsi_info->tc_bitmap); }return status; }
Signature · 1 line
2.13.6
Quoted 81 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Monday, September 7, 2020 19:28
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 00/40] ice base code updatemain changes:
1. Added support for outer IP filter for GTPC.
2. Added support for outer IP filter for GPTU control packet (no inner IP) 3. Added support for QinQ switch filter 4. code refactor and bug fixesQi Zhang (40):
net/ice/base: handle error gracefully in HW table callocnet/ice/base: split caps discover into two functionsnet/ice/base: avoid unnecessary single-member variable-length structsnet/ice/base: fix issues around move nodes
net/ice/base: cleanup stack hog
net/ice/base: clean the code wrapping
net/ice/base: cleanup misleading comment
net/ice/base: silence static analysis warningnet/ice/base: replace single-element array used for C struct hacknet/ice/base: introduce and use bitmap set APInet/ice/base: introduce and use bitmap hamming weight APInet/ice/base: add function header
net/ice/base: introduce and use for each bit iteratornet/ice/base: correct abbreviations
net/ice/base: add AQ cmd0X0A0ALLDP fltr controlnet/ice/base: add support for GTP-U type switch rulenet/ice/base: join format strings to same linenet/ice/base: introduce Tx rate limiting on port levelnet/ice/base: reduce profile to recip info get from firmwarenet/ice/base: refactor DCB related variables
net/ice/base: support outer IP filter for GTPCnet/ice/base: support outer IP filter for GTPU without inner IPnet/ice/base: move a function
net/ice/base: clear advanced rules in reset preparationnet/ice/base: move a function
net/ice/base: add check for failed acts allocationnet/ice/base: remove repeated words
net/ice/base: remove function ACL count querynet/ice/base: preserve NVM capabilities in safe modenet/ice/base: misc minor ACL changes
net/ice/base: adjust rate limit profile ids runtime databasenet/ice/base: enable QinQ filter for switch advanced rulenet/ice/base: create flash info structure and separate NVM versionnet/ice/base: remove unused parameter
net/ice/base: minor code clean
net/ice/base: cache NVM module bank informationnet/ice/base: rename function
net/ice/base: remove unnecessary conditional
net/ice/base: rename ACL priority values
net/ice/base: preserve default aggr vsi informationdrivers/net/ice/base/ice_acl.c | 40 +- drivers/net/ice/base/ice_acl.h | 22 +- drivers/net/ice/base/ice_acl_ctrl.c | 200 ++++---- drivers/net/ice/base/ice_adminq_cmd.h | 83 +--- drivers/net/ice/base/ice_bitops.h | 47 ++ drivers/net/ice/base/ice_common.c | 434 +++++++++--------- drivers/net/ice/base/ice_common.h | 6 +- drivers/net/ice/base/ice_controlq.c | 42 +- drivers/net/ice/base/ice_dcb.c | 44 +- drivers/net/ice/base/ice_dcb.h | 10 +- drivers/net/ice/base/ice_flex_pipe.c | 266 ++++++----- drivers/net/ice/base/ice_flex_type.h | 49 +- drivers/net/ice/base/ice_flow.c | 280 ++++++------ drivers/net/ice/base/ice_flow.h | 1 + drivers/net/ice/base/ice_nvm.c | 293 ++++++++---- drivers/net/ice/base/ice_protocol_type.h | 15 + drivers/net/ice/base/ice_sched.c | 213 +++++---- drivers/net/ice/base/ice_sched.h | 10 +- drivers/net/ice/base/ice_switch.c | 755 +++++++++++++++++++++++++------ drivers/net/ice/base/ice_switch.h | 60 ++- drivers/net/ice/base/ice_type.h | 77 +++- drivers/net/ice/ice_ethdev.c | 20 +- 22 files changed, 1803 insertions(+), 1164 deletions(-)
Quoted 2 lines
--
2.13.6
Zhang, Qi Z
AppliedQuoted 90 lines
-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Wednesday, September 9, 2020 3:17 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH 00/40] ice base code updateQuoted 79 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Monday, September 7, 2020 19:28
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 00/40] ice base code updatemain changes:
1. Added support for outer IP filter for GTPC.
2. Added support for outer IP filter for GPTU control packet (no inner IP) 3. Added support for QinQ switch filter 4. code refactor and bug fixesQi Zhang (40):
net/ice/base: handle error gracefully in HW table callocnet/ice/base: split caps discover into two functionsnet/ice/base: avoid unnecessary single-member variable-length structsnet/ice/base: fix issues around move nodes
net/ice/base: cleanup stack hog
net/ice/base: clean the code wrapping
net/ice/base: cleanup misleading comment
net/ice/base: silence static analysis warningnet/ice/base: replace single-element array used for C struct hacknet/ice/base: introduce and use bitmap set APInet/ice/base: introduce and use bitmap hamming weight APInet/ice/base: add function header
net/ice/base: introduce and use for each bit iteratornet/ice/base: correct abbreviations
net/ice/base: add AQ cmd0X0A0ALLDP fltr controlnet/ice/base: add support for GTP-U type switch rulenet/ice/base: join format strings to same linenet/ice/base: introduce Tx rate limiting on port levelnet/ice/base: reduce profile to recip info get from firmwarenet/ice/base: refactor DCB related variables
net/ice/base: support outer IP filter for GTPCnet/ice/base: support outer IP filter for GTPU without inner IPnet/ice/base: move a function
net/ice/base: clear advanced rules in reset preparationnet/ice/base: move a function
net/ice/base: add check for failed acts allocationnet/ice/base: remove repeated words
net/ice/base: remove function ACL count querynet/ice/base: preserve NVM capabilities in safe modenet/ice/base: misc minor ACL changes
net/ice/base: adjust rate limit profile ids runtime databasenet/ice/base: enable QinQ filter for switch advanced rulenet/ice/base: create flash info structure and separate NVM versionnet/ice/base: remove unused parameter
net/ice/base: minor code clean
net/ice/base: cache NVM module bank informationnet/ice/base: rename function
net/ice/base: remove unnecessary conditional
net/ice/base: rename ACL priority values
net/ice/base: preserve default aggr vsi informationdrivers/net/ice/base/ice_acl.c | 40 +- drivers/net/ice/base/ice_acl.h | 22 +- drivers/net/ice/base/ice_acl_ctrl.c | 200 ++++---- drivers/net/ice/base/ice_adminq_cmd.h | 83 +--- drivers/net/ice/base/ice_bitops.h | 47 ++ drivers/net/ice/base/ice_common.c | 434 +++++++++--------- drivers/net/ice/base/ice_common.h | 6 +- drivers/net/ice/base/ice_controlq.c | 42 +- drivers/net/ice/base/ice_dcb.c | 44 +- drivers/net/ice/base/ice_dcb.h | 10 +- drivers/net/ice/base/ice_flex_pipe.c | 266 ++++++----- drivers/net/ice/base/ice_flex_type.h | 49 +- drivers/net/ice/base/ice_flow.c | 280 ++++++------ drivers/net/ice/base/ice_flow.h | 1 + drivers/net/ice/base/ice_nvm.c | 293 ++++++++---- drivers/net/ice/base/ice_protocol_type.h | 15 + drivers/net/ice/base/ice_sched.c | 213 +++++---- drivers/net/ice/base/ice_sched.h | 10 +- drivers/net/ice/base/ice_switch.c | 755 +++++++++++++++++++++++++------ drivers/net/ice/base/ice_switch.h | 60 ++- drivers/net/ice/base/ice_type.h | 77 +++- drivers/net/ice/ice_ethdev.c | 20 +- 22 files changed, 1803 insertions(+), 1164 deletions(-)
Quoted 5 lines
Quoted 2 lines
--
2.13.6Acked-by Qiming Yang <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi
Quoted 57 lines · Qi Z
Quoted 57 lines
-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Wednesday, September 9, 2020 3:17 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH 00/40] ice base code updateQuoted 46 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Monday, September 7, 2020 19:28
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 00/40] ice base code updatemain changes:
1. Added support for outer IP filter for GTPC.
2. Added support for outer IP filter for GPTU control packet (no inner IP) 3. Added support for QinQ switch filter 4. code refactor and bug fixesQi Zhang (40):
net/ice/base: handle error gracefully in HW table callocnet/ice/base: split caps discover into two functionsnet/ice/base: avoid unnecessary single-member variable-length structsnet/ice/base: fix issues around move nodes
net/ice/base: cleanup stack hog
net/ice/base: clean the code wrapping
net/ice/base: cleanup misleading comment
net/ice/base: silence static analysis warningnet/ice/base: replace single-element array used for C struct hacknet/ice/base: introduce and use bitmap set APInet/ice/base: introduce and use bitmap hamming weight APInet/ice/base: add function header
net/ice/base: introduce and use for each bit iteratornet/ice/base: correct abbreviations
net/ice/base: add AQ cmd0X0A0ALLDP fltr controlnet/ice/base: add support for GTP-U type switch rulenet/ice/base: join format strings to same linenet/ice/base: introduce Tx rate limiting on port levelnet/ice/base: reduce profile to recip info get from firmwarenet/ice/base: refactor DCB related variables
net/ice/base: support outer IP filter for GTPCnet/ice/base: support outer IP filter for GTPU without inner IPnet/ice/base: move a function
net/ice/base: clear advanced rules in reset preparationnet/ice/base: move a function
net/ice/base: add check for failed acts allocationnet/ice/base: remove repeated words
net/ice/base: remove function ACL count querynet/ice/base: preserve NVM capabilities in safe modenet/ice/base: misc minor ACL changes
net/ice/base: adjust rate limit profile ids runtime databasenet/ice/base: enable QinQ filter for switch advanced rulenet/ice/base: create flash info structure and separate NVM version
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
net/ice/base: remove unused parameternet/ice/base: minor code cleannet/ice/base: cache NVM module bank informationnet/ice/base: rename function
net/ice/base: remove unnecessary conditionalnet/ice/base: rename ACL priority valuesnet/ice/base: preserve default aggr vsi information
Hi Qi,
I am getting build error [1], can you please check.
[1]../drivers/net/ice/ice_rxtx.c: In function ‘ice_tx_queue_start’:../drivers/net/ice/ice_rxtx.c:486:15: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
486 | txq_elem.txqs[0].txq_id = rte_cpu_to_le_16(txq->reg_idx);
| ~~~~~~~~~~~~~^~~
In file included from ../drivers/net/ice/base/ice_controlq.h:8,
from ../drivers/net/ice/base/ice_type.h:52,
from ../drivers/net/ice/base/ice_common.h:8,
from ../drivers/net/ice/ice_ethdev.h:12,
from ../drivers/net/ice/ice_rxtx.h:8,
from ../drivers/net/ice/ice_rxtx.c:9:../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | struct ice_aqc_add_tx_qgrp txq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:498:54: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
498 | ice_set_ctx(hw, (uint8_t *)&tx_ctx, txq_elem.txqs[0].txq_ctx,
| ~~~~~~~~~~~~~~~~^~~~~~~~
In file included from ../drivers/net/ice/base/ice_controlq.h:8,
from ../drivers/net/ice/base/ice_type.h:52,
from ../drivers/net/ice/base/ice_common.h:8,
from ../drivers/net/ice/ice_ethdev.h:12,
from ../drivers/net/ice/ice_rxtx.h:8,
from ../drivers/net/ice/ice_rxtx.c:9:../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | struct ice_aqc_add_tx_qgrp txq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:514:29: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
514 | txq->q_teid = txq_elem.txqs[0].q_teid;
| ~~~~~~~~~~~~~^~~
In file included from ../drivers/net/ice/base/ice_controlq.h:8,
from ../drivers/net/ice/base/ice_type.h:52,
from ../drivers/net/ice/base/ice_common.h:8,
from ../drivers/net/ice/ice_ethdev.h:12,
from ../drivers/net/ice/ice_rxtx.h:8,
from ../drivers/net/ice/ice_rxtx.c:9:../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | struct ice_aqc_add_tx_qgrp txq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c: In function ‘ice_fdir_tx_queue_start’:../drivers/net/ice/ice_rxtx.c:658:15: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
658 | txq_elem.txqs[0].txq_id = rte_cpu_to_le_16(txq->reg_idx);
| ~~~~~~~~~~~~~^~~
In file included from ../drivers/net/ice/base/ice_controlq.h:8,
from ../drivers/net/ice/base/ice_type.h:52,
from ../drivers/net/ice/base/ice_common.h:8,
from ../drivers/net/ice/ice_ethdev.h:12,
from ../drivers/net/ice/ice_rxtx.h:8,
from ../drivers/net/ice/ice_rxtx.c:9:../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | struct ice_aqc_add_tx_qgrp txq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:670:54: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
670 | ice_set_ctx(hw, (uint8_t *)&tx_ctx, txq_elem.txqs[0].txq_ctx,
| ~~~~~~~~~~~~~~~~^~~~~~~~
In file included from ../drivers/net/ice/base/ice_controlq.h:8,
from ../drivers/net/ice/base/ice_type.h:52,
from ../drivers/net/ice/base/ice_common.h:8,
from ../drivers/net/ice/ice_ethdev.h:12,
from ../drivers/net/ice/ice_rxtx.h:8,
from ../drivers/net/ice/ice_rxtx.c:9:../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | struct ice_aqc_add_tx_qgrp txq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:686:29: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
686 | txq->q_teid = txq_elem.txqs[0].q_teid;
| ~~~~~~~~~~~~~^~~
In file included from ../drivers/net/ice/base/ice_controlq.h:8,
from ../drivers/net/ice/base/ice_type.h:52,
from ../drivers/net/ice/base/ice_common.h:8,
from ../drivers/net/ice/ice_ethdev.h:12,
from ../drivers/net/ice/ice_rxtx.h:8,
from ../drivers/net/ice/ice_rxtx.c:9:../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | struct ice_aqc_add_tx_qgrp txq_elem;
| ^~~~~~~~
cc1: all warnings being treated as errors
Quoted 183 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, September 11, 2020 7:08 PM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH 00/40] ice base code updateQuoted 57 lines · Qi Z
Quoted 57 lines
-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Wednesday, September 9, 2020 3:17 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH 00/40] ice base code updateQuoted 46 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Monday, September 7, 2020 19:28
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 00/40] ice base code updatemain changes:
1. Added support for outer IP filter for GTPC.
2. Added support for outer IP filter for GPTU control packet (no inner IP) 3. Added support for QinQ switch filter 4. code refactor and bug fixesQi Zhang (40):
net/ice/base: handle error gracefully in HW table callocnet/ice/base: split caps discover into two functionsnet/ice/base: avoid unnecessary single-member variable-length structsnet/ice/base: fix issues around move nodes
net/ice/base: cleanup stack hog
net/ice/base: clean the code wrapping
net/ice/base: cleanup misleading comment
net/ice/base: silence static analysis warningnet/ice/base: replace single-element array used for C struct hacknet/ice/base: introduce and use bitmap set APInet/ice/base: introduce and use bitmap hamming weight APInet/ice/base: add function header
net/ice/base: introduce and use for each bit iteratornet/ice/base: correct abbreviations
net/ice/base: add AQ cmd0X0A0ALLDP fltr controlnet/ice/base: add support for GTP-U type switch rulenet/ice/base: join format strings to same linenet/ice/base: introduce Tx rate limiting on port levelnet/ice/base: reduce profile to recip info get from firmwarenet/ice/base: refactor DCB related variables
net/ice/base: support outer IP filter for GTPCnet/ice/base: support outer IP filter for GTPU without inner IPnet/ice/base: move a function
net/ice/base: clear advanced rules in reset preparationnet/ice/base: move a function
net/ice/base: add check for failed acts allocationnet/ice/base: remove repeated words
net/ice/base: remove function ACL count querynet/ice/base: preserve NVM capabilities in safe modenet/ice/base: misc minor ACL changes
net/ice/base: adjust rate limit profile ids runtime databasenet/ice/base: enable QinQ filter for switch advanced rulenet/ice/base: create flash info structure and separate NVM versionQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
net/ice/base: remove unused parameternet/ice/base: minor code cleannet/ice/base: cache NVM module bank informationnet/ice/base: rename function
net/ice/base: remove unnecessary conditionalnet/ice/base: rename ACL priority valuesnet/ice/base: preserve default aggr vsi informationHi Qi,
I am getting build error [1], can you please check.
[1]
../drivers/net/ice/ice_rxtx.c: In function ‘ice_tx_queue_start’:../drivers/net/ice/ice_rxtx.c:486:15: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]486 | txq_elem.txqs[0].txq_id = rte_cpu_to_le_16(txq->reg_idx); | ~~~~~~~~~~~~~^~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:498:54: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
498 | ice_set_ctx(hw, (uint8_t*)&tx_ctx, txq_elem.txqs[0].txq_ctx,| ~~~~~~~~~~~~~~~~^~~~~~~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:514:29: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]514 | txq->q_teid = txq_elem.txqs[0].q_teid; | ~~~~~~~~~~~~~^~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c: In function ‘ice_fdir_tx_queue_start’:../drivers/net/ice/ice_rxtx.c:658:15: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]658 | txq_elem.txqs[0].txq_id = rte_cpu_to_le_16(txq->reg_idx); | ~~~~~~~~~~~~~^~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:670:54: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
670 | ice_set_ctx(hw, (uint8_t*)&tx_ctx, txq_elem.txqs[0].txq_ctx,| ~~~~~~~~~~~~~~~~^~~~~~~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:686:29: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]686 | txq->q_teid = txq_elem.txqs[0].q_teid; | ~~~~~~~~~~~~~^~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
Quoted 8 lines
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~
cc1: all warnings being treated as errors
Seems this issue is only reported by a new version GCC, and it does help to detect a invalid memory access issue. The bug has been fixed in dpdk-next-net-intel on below commit
commit 978dddfae32764dd6ba81d615399fbc0452ecfb3
Author: Qi Zhang <[email protected]> Date: Wed Aug 26 14:57:07 2020 +0800
net/ice/base: replace single-element array used for C struct hack
Convert the pre-C90-extension "C struct hack" method (using a single- element array at the end of a structure for implementing variable-length types) to the preferred use of C99 flexible array member.
Thanks
Qi
Quoted 196 lines · Qi Z
Quoted 183 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, September 11, 2020 7:08 PM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH 00/40] ice base code updateQuoted 57 lines · Qi Z
Quoted 57 lines
-----Original Message-----
From: Yang, Qiming <[email protected]>
Sent: Wednesday, September 9, 2020 3:17 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]
Subject: RE: [PATCH 00/40] ice base code updateQuoted 46 lines
-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Monday, September 7, 2020 19:28
To: Yang, Qiming <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>
Subject: [PATCH 00/40] ice base code updatemain changes:
1. Added support for outer IP filter for GTPC.
2. Added support for outer IP filter for GPTU control packet (no inner IP) 3. Added support for QinQ switch filter 4. code refactor and bug fixesQi Zhang (40):
net/ice/base: handle error gracefully in HW table callocnet/ice/base: split caps discover into two functionsnet/ice/base: avoid unnecessary single-member variable-length structsnet/ice/base: fix issues around move nodes
net/ice/base: cleanup stack hog
net/ice/base: clean the code wrapping
net/ice/base: cleanup misleading comment
net/ice/base: silence static analysis warningnet/ice/base: replace single-element array used for C struct hacknet/ice/base: introduce and use bitmap set APInet/ice/base: introduce and use bitmap hamming weight APInet/ice/base: add function header
net/ice/base: introduce and use for each bit iteratornet/ice/base: correct abbreviations
net/ice/base: add AQ cmd0X0A0ALLDP fltr controlnet/ice/base: add support for GTP-U type switch rulenet/ice/base: join format strings to same linenet/ice/base: introduce Tx rate limiting on port levelnet/ice/base: reduce profile to recip info get from firmwarenet/ice/base: refactor DCB related variables
net/ice/base: support outer IP filter for GTPCnet/ice/base: support outer IP filter for GTPU without inner IPnet/ice/base: move a function
net/ice/base: clear advanced rules in reset preparationnet/ice/base: move a function
net/ice/base: add check for failed acts allocationnet/ice/base: remove repeated words
net/ice/base: remove function ACL count querynet/ice/base: preserve NVM capabilities in safe modenet/ice/base: misc minor ACL changes
net/ice/base: adjust rate limit profile ids runtime databasenet/ice/base: enable QinQ filter for switch advanced rulenet/ice/base: create flash info structure and separate NVM versionQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
net/ice/base: remove unused parameternet/ice/base: minor code cleannet/ice/base: cache NVM module bank informationnet/ice/base: rename function
net/ice/base: remove unnecessary conditionalnet/ice/base: rename ACL priority valuesnet/ice/base: preserve default aggr vsi informationHi Qi,
I am getting build error [1], can you please check.
[1]
../drivers/net/ice/ice_rxtx.c: In function ‘ice_tx_queue_start’:../drivers/net/ice/ice_rxtx.c:486:15: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]486 | txq_elem.txqs[0].txq_id = rte_cpu_to_le_16(txq->reg_idx); | ~~~~~~~~~~~~~^~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:498:54: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
498 | ice_set_ctx(hw, (uint8_t*)&tx_ctx, txq_elem.txqs[0].txq_ctx,| ~~~~~~~~~~~~~~~~^~~~~~~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:514:29: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]514 | txq->q_teid = txq_elem.txqs[0].q_teid; | ~~~~~~~~~~~~~^~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:462:29: note: defined here ‘txq_elem’
462 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c: In function ‘ice_fdir_tx_queue_start’:../drivers/net/ice/ice_rxtx.c:658:15: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]658 | txq_elem.txqs[0].txq_id = rte_cpu_to_le_16(txq->reg_idx); | ~~~~~~~~~~~~~^~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:670:54: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]
670 | ice_set_ctx(hw, (uint8_t*)&tx_ctx, txq_elem.txqs[0].txq_ctx,| ~~~~~~~~~~~~~~~~^~~~~~~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~../drivers/net/ice/ice_rxtx.c:686:29: error: array subscript 0 is outside array bounds of ‘struct ice_aqc_add_txqs_perq[]’ [-Werror=array-bounds]686 | txq->q_teid = txq_elem.txqs[0].q_teid; | ~~~~~~~~~~~~~^~~ In file included from ../drivers/net/ice/base/ice_controlq.h:8, from ../drivers/net/ice/base/ice_type.h:52, from ../drivers/net/ice/base/ice_common.h:8, from ../drivers/net/ice/ice_ethdev.h:12, from ../drivers/net/ice/ice_rxtx.h:8, from ../drivers/net/ice/ice_rxtx.c:9:Quoted 8 lines
../drivers/net/ice/base/ice_adminq_cmd.h:2429:31: note: while referencing ‘txqs’
2429 | structice_aqc_add_txqs_perqtxqs[STRUCT_HACK_VAR_LEN];
| ^~~~../drivers/net/ice/ice_rxtx.c:640:29: note: defined here ‘txq_elem’
640 | structice_aqc_add_tx_qgrptxq_elem;
| ^~~~~~~~
cc1: all warnings being treated as errorsSeems this issue is only reported by a new version GCC, and it does help to detect a invalid memory access issue. The bug has been fixed in dpdk-next-net-intel on below commit
commit
978dddfae32764dd6ba81d615399fbc0452ecfb3
Quoted 9 lines
Author: Qi Zhang <[email protected]> Date: Wed Aug 26 14:57:07 2020 +0800
net/ice/base: replace single-element array used for C struct hackConvert the pre-C90-extension "C struct hack" method (using a single- element array at the end of a structure for implementing variable-length types) to the preferred use of C99 flexible array member.
Hi Qi,
Can you please send the fixed patchset as a new version to mail list first?
Also there are build errors on the patch by patch build, can you address them too in next version?
Thanks,
ferruh
v2 cover ice base code update
In reply to Qi Zhangmain changes:
1. Added support for outer IP filter for GTPC.
2. Added support for outer IP filter for GPTU control packet (no inner IP)
3. Added support for QinQ switch filter
4. code refactor and bug fixes
v2:
- fix a gcc10 build error.
- fix a patch by patch build error.
Qi Zhang (40):
net/ice/base: handle error gracefully in HW table calloc net/ice/base: split caps discover into two functions net/ice/base: avoid unnecessary single-member variable-length structs net/ice/base: fix issues around move nodes
net/ice/base: cleanup stack hog
net/ice/base: clean the code wrapping
net/ice/base: cleanup misleading comment
net/ice/base: silence static analysis warning net/ice/base: replace single-element array used for C struct hack net/ice/base: introduce and use bitmap set API net/ice/base: introduce and use bitmap hamming weight API net/ice/base: add function header
net/ice/base: introduce and use for each bit iterator net/ice/base: correct abbreviations
net/ice/base: add AQ cmd 0X0A0A LLDP fltr control net/ice/base: add support for GTP-U type switch rule net/ice/base: join format strings to same line net/ice/base: introduce Tx rate limiting on port level net/ice/base: reduce profile to recip info get from firmware net/ice/base: refactor DCB related variables
net/ice/base: support outer IP filter for GTPC net/ice/base: support outer IP filter for GTPU without inner IP net/ice/base: move a function
net/ice/base: clear advanced rules in reset preparation net/ice/base: move a function
net/ice/base: add check for failed acts allocation net/ice/base: remove repeated words
net/ice/base: remove function ACL count query net/ice/base: preserve NVM capabilities in safe mode net/ice/base: misc minor ACL changes
net/ice/base: adjust rate limit profile ids runtime database net/ice/base: enable QinQ filter for switch advanced rule net/ice/base: create flash info structure and separate NVM version net/ice/base: remove unused parameter
net/ice/base: minor code clean
net/ice/base: cache NVM module bank information net/ice/base: rename function
net/ice/base: remove unnecessary conditional
net/ice/base: rename ACL priority values
net/ice/base: preserve default aggr vsi information
drivers/net/ice/base/ice_acl.c | 40 +- drivers/net/ice/base/ice_acl.h | 22 +- drivers/net/ice/base/ice_acl_ctrl.c | 200 ++++---- drivers/net/ice/base/ice_adminq_cmd.h | 83 +--- drivers/net/ice/base/ice_bitops.h | 47 ++ drivers/net/ice/base/ice_common.c | 434 +++++++++--------- drivers/net/ice/base/ice_common.h | 6 +- drivers/net/ice/base/ice_controlq.c | 42 +- drivers/net/ice/base/ice_dcb.c | 44 +- drivers/net/ice/base/ice_dcb.h | 10 +- drivers/net/ice/base/ice_flex_pipe.c | 266 ++++++----- drivers/net/ice/base/ice_flex_type.h | 49 +- drivers/net/ice/base/ice_flow.c | 280 ++++++------ drivers/net/ice/base/ice_flow.h | 1 + drivers/net/ice/base/ice_nvm.c | 293 ++++++++---- drivers/net/ice/base/ice_protocol_type.h | 15 + drivers/net/ice/base/ice_sched.c | 213 +++++---- drivers/net/ice/base/ice_sched.h | 10 +- drivers/net/ice/base/ice_switch.c | 755 +++++++++++++++++++++++++------ drivers/net/ice/base/ice_switch.h | 60 ++- drivers/net/ice/base/ice_type.h | 77 +++- drivers/net/ice/ice_ethdev.c | 20 +- drivers/net/ice/ice_rxtx.c | 43 +- 23 files changed, 1832 insertions(+), 1178 deletions(-)
Signature · 1 line
2.13.6
PATCH v2 1/40 net/ice/base: handle error gracefully in HW table calloc
In the ice_init_hw_tbls API, if the ice_calloc for es->written fails, catch that error and bail out gracefully, instead of continuing with a NULL pointer.
--- drivers/net/ice/base/ice_flex_pipe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_flex_pipe.c +9 -1
@@ -3908,11 +3908,19 @@ enum ice_status ice_init_hw_tbls(struct ice_hw *hw) es->ref_count = (u16 *)ice_calloc (hw, es->count,sizeof (*es->ref_count)); +if (!es->ref_count) + goto err; + es->written = (u8 *)ice_calloc (hw, es->count,sizeof (*es->written)); + +if (!es->written) + goto err; + es->mask_ena = (u32 *)ice_calloc (hw, es->count,sizeof (*es->mask_ena)); -if (!es->ref_count) + +if (!es->mask_ena) goto err; }return ICE_SUCCESS ;
Signature · 1 line
2.13.6
PATCH v2 2/40 net/ice/base: split caps discover into two functions
In reply to Qi ZhangUsing the new ice_aq_list_caps and ice_parse_(dev|func)_caps functions, replace ice_discover_caps with two functions that each take a pointer to the dev_caps and func_caps structures respectively.
This makes the side effect of updating the hw->dev_caps and hw->func_caps obvious from reading the implementation of the function. Additionally, it opens the way for enabling reading of device capabilities outside of the initialization flow. By passing in a pointer, another caller will be able to read the capabilities without modifying the hw capabilities structures.
As there are no other callers, it is safe to now remove ice_aq_discover_caps and ice_parse_caps.
--- drivers/net/ice/base/ice_common.c | 94 ++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 55 deletions(-)
drivers/net/ice/base/ice_common.c +39 -55
@@ -87,7 +87,8 @@ enum ice_status ice_clear_pf_cfg(struct ice_hw *hw)* is returned in user specified buffer. Please interpret user specified * buffer as "manage_mac_read" response. * Response such as various MAC addresses are stored in HW struct (port.mac) -* ice_aq_discover_caps is expected to be called before this function is called. +* ice_discover_dev_caps is expected to be called before this function is +* called. */ static enum ice_status ice_aq_manage_mac_read(struct ice_hw *hw, void *buf, u16 buf_size,
@@ -2156,30 +2157,6 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p, }/** -* ice_parse_caps - parse function/device capabilities -* @hw: pointer to the HW struct -* @buf: pointer to a buffer containing function/device capability records -* @cap_count: number of capability records in the list -* @opc: type of capabilities list to parse -* -* Helper function to parse function(0x000a)/device(0x000b) capabilities list. -*/ -static void -ice_parse_caps (struct ice_hw *hw,void *buf,u32 cap_count, -enum ice_adminq_opc opc) -{ -if (!buf) -return ; - -if (opc == ice_aqc_opc_list_dev_caps) -ice_parse_dev_caps (hw, &hw->dev_caps, buf, cap_count); -else if (opc == ice_aqc_opc_list_func_caps) -ice_parse_func_caps (hw, &hw->func_caps, buf, cap_count); -else -ice_debug (hw,ICE_DBG_INIT ,"wrong opcode\n" ); -} - -/** * ice_aq_list_caps - query function/device capabilities * @hw: pointer to the HW struct * @buf: a buffer to hold the capabilities
@@ -2222,47 +2199,52 @@ ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count, }/** -* ice_aq_discover_caps - query function/device capabilities -* @hw: pointer to the HW struct -* @buf: a virtual buffer to hold the capabilities -* @buf_size: Size of the virtual buffer -* @cap_count: cap count needed if AQ err==ENOMEM -* @opc: capabilities type to discover - pass in the command opcode -* @cd: pointer to command details structure or NULL -* -* Get the function(0x000a)/device(0x000b) capabilities description from -* the firmware. +* ice_discover_dev_caps - Read and extract device capabilities +* @hw: pointer to the hardware structure +* @dev_caps: pointer to device capabilities structure * -* NOTE: this function has the side effect of updating the hw->dev_caps or -* hw->func_caps by way of calling ice_parse_caps. +* Read the device capabilities and extract them into the dev_caps structure +* for later use. */ static enum ice_status -ice_aq_discover_caps (struct ice_hw *hw,void *buf,u16 buf_size,u32 *cap_count, -enum ice_adminq_opc opc,struct ice_sq_cd *cd) +ice_discover_dev_caps (struct ice_hw *hw,struct ice_hw_dev_caps *dev_caps) { -u32 local_cap_count =0 ;enum ice_status status; +u32 cap_count =0 ; +void *cbuf; - status =ice_aq_list_caps (hw, buf, buf_size, &local_cap_count, - opc, cd); + cbuf =ice_malloc (hw,ICE_AQ_MAX_BUF_LEN ); +if (!cbuf) +return ICE_ERR_NO_MEMORY ; + +/* Although the driver doesn't know the number of capabilities the +* device will return, we can simply send a 4KB buffer, the maximum +* possible size that firmware can return. +*/ + cap_count =ICE_AQ_MAX_BUF_LEN /sizeof (struct ice_aqc_list_caps_elem ); + + status =ice_aq_list_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, + ice_aqc_opc_list_dev_caps,NULL );if (!status) -ice_parse_caps (hw, buf, local_cap_count, opc); -else if (hw->adminq.sq_last_status ==ICE_AQ_RC_ENOMEM ) - *cap_count = local_cap_count; +ice_parse_dev_caps (hw, dev_caps, cbuf, cap_count); +ice_free (hw, cbuf);return status; }/** -* ice_discover_caps - get info about the HW +* ice_discover_func_caps - Read and extract function capabilities * @hw: pointer to the hardware structure -* @opc: capabilities type to discover - pass in the command opcode +* @func_caps: pointer to function capabilities structure +* +* Read the function capabilities and extract them into the func_caps structure +* for later use. */ static enum ice_status -ice_discover_caps (struct ice_hw *hw,enum ice_adminq_opc opc) +ice_discover_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_caps) {enum ice_status status; -u32 cap_count; +u32 cap_count =0 ;void *cbuf; cbuf =ice_malloc (hw,ICE_AQ_MAX_BUF_LEN );
@@ -2275,8 +2257,10 @@ ice_discover_caps(struct ice_hw *hw, enum ice_adminq_opc opc)*/ cap_count =ICE_AQ_MAX_BUF_LEN /sizeof (struct ice_aqc_list_caps_elem ); - status =ice_aq_discover_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, - opc,NULL ); + status =ice_aq_list_caps (hw, cbuf,ICE_AQ_MAX_BUF_LEN , &cap_count, + ice_aqc_opc_list_func_caps,NULL ); +if (!status) +ice_parse_func_caps (hw, func_caps, cbuf, cap_count);ice_free (hw, cbuf);return status;
@@ -2354,11 +2338,11 @@ enum ice_status ice_get_caps(struct ice_hw *hw) {enum ice_status status; - status =ice_discover_caps (hw, ice_aqc_opc_list_dev_caps); -if (!status) - status =ice_discover_caps (hw, ice_aqc_opc_list_func_caps); + status =ice_discover_dev_caps (hw, &hw->dev_caps); +if (status) +return status; -return status; +return ice_discover_func_caps (hw, &hw->func_caps); }/**
Signature · 1 line
2.13.6
PATCH v2 3/40 net/ice/base: avoid unnecessary single-member variable-length structs
In reply to Qi ZhangThere 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.
--- 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(-)
drivers/net/ice/base/ice_adminq_cmd.h +4 -59
@@ -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 {
drivers/net/ice/base/ice_common.c +2 -2
@@ -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 )
drivers/net/ice/base/ice_common.h +1 -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);
drivers/net/ice/base/ice_dcb.c +2 -2
@@ -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 */
drivers/net/ice/base/ice_sched.c +34 -42
223 lines not on this page · raw message
drivers/net/ice/base/ice_sched.h +5 -5
@@ -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 */
drivers/net/ice/base/ice_switch.c +19 -19
@@ -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;
drivers/net/ice/base/ice_switch.h +5 -5
@@ -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
drivers/net/ice/ice_ethdev.c +3 -3
@@ -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:
Signature · 1 line
2.13.6
PATCH v2 4/40 net/ice/base: fix issues around move nodes
In reply to Qi Zhang1. Fixed the max children check when moving the last(8th) children. This allows the parent node to hold 8 children instead of 7.
2. Check whether the VSI is already part of the given aggregator subtree before moving it.
--- drivers/net/ice/base/ice_sched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_sched.c +5 -1
@@ -2267,7 +2267,7 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent,return ICE_ERR_PARAM ;/* Does parent have enough space */ -if (parent->num_children + num_items >= +if (parent->num_children + num_items > hw->max_children[parent->tx_sched_layer])return ICE_ERR_AQ_FULL ;
@@ -2335,6 +2335,10 @@ ice_sched_move_vsi_to_agg(struct ice_port_info *pi, u16 vsi_handle, u32 agg_id,if (!vsi_node)return ICE_ERR_DOES_NOT_EXIST ; +/* Is this VSI already part of given aggregator? */ +if (ice_sched_find_node_in_subtree (pi->hw, agg_node, vsi_node)) +return ICE_SUCCESS ; + aggl =ice_sched_get_agg_layer (pi->hw); vsil =ice_sched_get_vsi_layer (pi->hw);
Signature · 1 line
2.13.6
PATCH v2 5/40 net/ice/base: cleanup stack hog
In reply to Qi ZhangIn ice_flow_add_prof_sync(), struct ice_flow_prof_params has recently grown in size hogging stack space when allocated there. Hogging stack space should be avoided. Change allocation to be on the heap when needed.
--- drivers/net/ice/base/ice_flow.c | 55 +++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 24 deletions(-)
drivers/net/ice/base/ice_flow.c +31 -24
@@ -1815,52 +1815,57 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, struct ice_flow_action *acts, u8 acts_cnt, struct ice_flow_prof **prof) { - struct ice_flow_prof_params params; + struct ice_flow_prof_params *params;enum ice_status status;u8 i;if (!prof || (acts_cnt && !acts))return ICE_ERR_BAD_PTR ; -ice_memset (¶ms,0 ,sizeof (params),ICE_NONDMA_MEM ); - params.prof = (struct ice_flow_prof *) -ice_malloc (hw,sizeof (*params.prof)); -if (!params.prof) + params = (struct ice_flow_prof_params *)ice_malloc (hw,sizeof (*params)); +if (!params)return ICE_ERR_NO_MEMORY ; + params->prof = (struct ice_flow_prof *) +ice_malloc (hw,sizeof (*params->prof)); +if (!params->prof) { + status =ICE_ERR_NO_MEMORY ; + goto free_params; + } +/* initialize extraction sequence to all invalid (0xff) */ for (i =0 ; i <ICE_MAX_FV_WORDS ; i++) { - params.es[i].prot_id =ICE_PROT_INVALID ; - params.es[i].off =ICE_FV_OFFSET_INVAL ; + params->es[i].prot_id =ICE_PROT_INVALID ; + params->es[i].off =ICE_FV_OFFSET_INVAL ; } - params.blk = blk; - params.prof->id = prof_id; - params.prof->dir = dir; - params.prof->segs_cnt = segs_cnt; + params->blk = blk; + params->prof->id = prof_id; + params->prof->dir = dir; + params->prof->segs_cnt = segs_cnt;/* Make a copy of the segments that need to be persistent in the flow * profile instance */ for (i =0 ; i < segs_cnt; i++) -ice_memcpy (¶ms.prof->segs[i], &segs[i],sizeof (*segs), +ice_memcpy (¶ms->prof->segs[i], &segs[i],sizeof (*segs),ICE_NONDMA_TO_NONDMA );/* Make a copy of the actions that need to be persistent in the flow * profile instance. */ if (acts_cnt) { - params.prof->acts = (struct ice_flow_action *) + params->prof->acts = (struct ice_flow_action *)ice_memdup (hw, acts, acts_cnt *sizeof (*acts),ICE_NONDMA_TO_NONDMA ); -if (!params.prof->acts) { +if (!params->prof->acts) { status =ICE_ERR_NO_MEMORY ; goto out; } } - status =ice_flow_proc_segs (hw, ¶ms); + status =ice_flow_proc_segs (hw, params);if (status) {ice_debug (hw,ICE_DBG_FLOW ,"Error processing a flow's packet segments\n" );
@@ -1868,24 +1873,26 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, }/* Add a HW profile for this flow profile */ - status =ice_add_prof (hw, blk, prof_id, (u8 *)params.ptypes, - params.attr, params.attr_cnt, params.es, - params.mask); + status =ice_add_prof (hw, blk, prof_id, (u8 *)params->ptypes, + params->attr, params->attr_cnt, params->es, + params->mask);if (status) {ice_debug (hw,ICE_DBG_FLOW ,"Error adding a HW flow profile\n" ); goto out; } -INIT_LIST_HEAD (¶ms.prof->entries); -ice_init_lock (¶ms.prof->entries_lock); - *prof = params.prof; +INIT_LIST_HEAD (¶ms->prof->entries); +ice_init_lock (¶ms->prof->entries_lock); + *prof = params->prof; out:if (status) { -if (params.prof->acts) -ice_free (hw, params.prof->acts); -ice_free (hw, params.prof); +if (params->prof->acts) +ice_free (hw, params->prof->acts); +ice_free (hw, params->prof); } +free_params: +ice_free (hw, params);return status; }
Signature · 1 line
2.13.6
PATCH v2 6/40 net/ice/base: clean the code wrapping
In reply to Qi ZhangTo make the wrapping a little cleaner, move the variables only applicable to ICE_FC_AUTO into that case. Also move caching of the value to only occur on success.
--- drivers/net/ice/base/ice_common.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/net/ice/base/ice_common.c +21 -16
@@ -2754,36 +2754,39 @@ static enum ice_status ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, enum ice_fc_mode req_mode) { - struct ice_aqc_get_phy_caps_data *pcaps = NULL; struct ice_phy_cache_mode_data cache_data; -enum ice_status status =ICE_SUCCESS ;u8 pause_mask =0x0 ;if (!pi || !cfg)return ICE_ERR_BAD_PTR ; - pcaps = (struct ice_aqc_get_phy_caps_data *) -ice_malloc (pi->hw,sizeof (*pcaps)); -if (!pcaps) -return ICE_ERR_NO_MEMORY ; - -/* Cache user FC request */ - cache_data.data.curr_user_fc_req = req_mode; -ice_cache_phy_user_req (pi, cache_data,ICE_FC_MODE ); -switch (req_mode) {case ICE_FC_AUTO : + { +struct ice_aqc_get_phy_caps_data *pcaps; +enum ice_status status; + + pcaps = (struct ice_aqc_get_phy_caps_data *) +ice_malloc (pi->hw,sizeof (*pcaps)); +if (!pcaps) +return ICE_ERR_NO_MEMORY ; +/* Query the value of FC that both the NIC and attached media * can do. */ status =ice_aq_get_phy_caps (pi, false,ICE_AQC_REPORT_TOPO_CAP , pcaps,NULL ); -if (status) - goto out; +if (status) { +ice_free (pi->hw, pcaps); +return status; + } pause_mask |= pcaps->caps &ICE_AQC_PHY_EN_TX_LINK_PAUSE ; pause_mask |= pcaps->caps &ICE_AQC_PHY_EN_RX_LINK_PAUSE ; + +ice_free (pi->hw, pcaps);break ; + }case ICE_FC_FULL : pause_mask |=ICE_AQC_PHY_EN_TX_LINK_PAUSE ; pause_mask |=ICE_AQC_PHY_EN_RX_LINK_PAUSE ;
@@ -2805,9 +2808,11 @@ ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,/* set the new capabilities */ cfg->caps |= pause_mask; -out: -ice_free (pi->hw, pcaps); -return status; +/* Cache user FC request */ + cache_data.data.curr_user_fc_req = req_mode; +ice_cache_phy_user_req (pi, cache_data,ICE_FC_MODE ); + +return ICE_SUCCESS ; }/**
Signature · 1 line
2.13.6
PATCH v2 7/40 net/ice/base: cleanup misleading comment
In reply to Qi ZhangThe maximum Admin Queue buffer size and NVM shadow RAM sector size are both 4 Kilobytes. Some comments refer to those as 4Kb which can be confused with 4 Kilobits. Update the comments to use the commonly used KB symbol instead.
--- drivers/net/ice/base/ice_nvm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_nvm.c +4 -4
@@ -58,7 +58,7 @@ ice_aq_read_nvm(struct ice_hw *hw, u16 module_typeid, u32 offset, u16 length,* * Reads a portion of the NVM, as a flat memory space. This function correctly * breaks read requests across Shadow RAM sectors and ensures that no single -* read request exceeds the maximum 4Kb read for a single AdminQ command. +* read request exceeds the maximum 4KB read for a single AdminQ command. * * Returns a status code on failure. Note that the data pointer may be * partially updated if some reads succeed before a failure.
@@ -86,10 +86,10 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data, do { u32 read_size, sector_offset; - /* ice_aq_read_nvm cannot read more than 4Kb at a time. + /* ice_aq_read_nvm cannot read more than 4KB at a time. * Additionally, a read from the Shadow RAM may not cross over * a sector boundary. Conveniently, the sector size is also - * 4Kb. + * 4KB. */ sector_offset = offset % ICE_AQ_MAX_BUF_LEN; read_size = MIN_T(u32, ICE_AQ_MAX_BUF_LEN - sector_offset,
@@ -164,7 +164,7 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data)ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__); -/* ice_read_flat_nvm takes into account the 4Kb AdminQ and Shadow RAM +/* ice_read_flat_nvm takes into account the 4KB AdminQ and Shadow RAM * sector restrictions necessary when reading from the NVM. */ status =ice_read_flat_nvm (hw, offset *2 , &bytes, (u8 *)data, true);
Signature · 1 line
2.13.6
PATCH v2 8/40 net/ice/base: silence static analysis warning
In reply to Qi ZhangSparse warns about these casts to/from restricted types which are not actual problems; silence the warnings.
--- drivers/net/ice/base/ice_nvm.c | 2 +- drivers/net/ice/base/ice_switch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_nvm.c +1 -1
@@ -138,7 +138,7 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data)* boundary */ status =ice_read_flat_nvm (hw, offset *sizeof (u16), &bytes, - (u8 *)&data_local, true); + (_FORCE_ u8 *)&data_local, true);if (status)return status;
drivers/net/ice/base/ice_switch.c +1 -1
@@ -5774,7 +5774,7 @@ ice_fill_valid_words(struct ice_adv_lkup_elem *rule, lkup_exts->fv_words[word].prot_id = ice_prot_id_tbl[rule->type].protocol_id; lkup_exts->field_mask[word] = -BE16_TO_CPU (((__be16 *)&rule->m_u)[j]); + BE16_TO_CPU(((_FORCE_ __be16 *)&rule->m_u)[j]); word++; }
Signature · 1 line
2.13.6
PATCH v2 9/40 net/ice/base: replace single-element array used for C struct hack
In reply to Qi ZhangConvert the pre-C90-extension "C struct hack" method (using a single- element array at the end of a structure for implementing variable-length types) to the preferred use of C99 flexible array member.
--- drivers/net/ice/base/ice_adminq_cmd.h | 22 +++++----- drivers/net/ice/base/ice_common.c | 77 ++++++++++++++++++----------------- drivers/net/ice/base/ice_dcb.h | 10 +---- drivers/net/ice/base/ice_flex_pipe.c | 33 ++++++++++----- drivers/net/ice/base/ice_flex_type.h | 49 +++++++++------------- drivers/net/ice/base/ice_sched.c | 10 +++-- drivers/net/ice/base/ice_switch.c | 32 ++++++--------- drivers/net/ice/base/ice_switch.h | 24 ++++------- drivers/net/ice/base/ice_type.h | 7 ++++ drivers/net/ice/ice_rxtx.c | 43 ++++++++++++------- 10 files changed, 158 insertions(+), 149 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +11 -11
@@ -312,7 +312,7 @@ struct ice_aqc_alloc_free_res_elem {#define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_M \ (0xF << ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S)__le16 num_elems; -struct ice_aqc_res_elem elem[1 ]; +struct ice_aqc_res_elem elem[STRUCT_HACK_VAR_LEN ]; };/* Get Allocated Resource Descriptors Command (indirect 0x020A) */
@@ -812,7 +812,7 @@ struct ice_sw_rule_lkup_rx_tx {* lookup-type */ __le16 hdr_len; -u8 hdr[1 ]; +u8 hdr[STRUCT_HACK_VAR_LEN ]; };/* Add/Update/Remove large action command/response entry
@@ -872,7 +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 */ +__le32 act[STRUCT_HACK_VAR_LEN ];/* array of size for actions */ };/* Add/Update/Remove VSI list command/response entry
@@ -882,7 +882,7 @@ struct ice_sw_rule_lg_act {struct ice_sw_rule_vsi_list {__le16 index;/* Index of VSI/Prune list */ __le16 number_vsi; -__le16 vsi[1 ];/* Array of number_vsi VSI numbers */ +__le16 vsi[STRUCT_HACK_VAR_LEN ];/* Array of number_vsi VSI numbers */ };#pragma pack(1)
@@ -989,7 +989,7 @@ struct ice_aqc_txsched_move_grp_info_hdr {struct ice_aqc_move_elem {struct ice_aqc_txsched_move_grp_info_hdr hdr; -__le32 teid[1 ]; +__le32 teid[STRUCT_HACK_VAR_LEN ]; };struct ice_aqc_elem_info_bw {
@@ -1042,7 +1042,7 @@ struct ice_aqc_txsched_topo_grp_info_hdr {struct ice_aqc_add_elem {struct ice_aqc_txsched_topo_grp_info_hdr hdr; -struct ice_aqc_txsched_elem_data generic[1 ]; +struct ice_aqc_txsched_elem_data generic[STRUCT_HACK_VAR_LEN ]; };struct ice_aqc_get_topo_elem {
@@ -1053,7 +1053,7 @@ struct ice_aqc_get_topo_elem {struct ice_aqc_delete_elem {struct ice_aqc_txsched_topo_grp_info_hdr hdr; -__le32 teid[1 ]; +__le32 teid[STRUCT_HACK_VAR_LEN ]; };/* Query Port ETS (indirect 0x040E)
@@ -2426,7 +2426,7 @@ struct ice_aqc_add_tx_qgrp {__le32 parent_teid;u8 num_txqs;u8 rsvd[3 ]; -struct ice_aqc_add_txqs_perq txqs[1 ]; +struct ice_aqc_add_txqs_perq txqs[STRUCT_HACK_VAR_LEN ]; };/* Disable Tx LAN Queues (indirect 0x0C31) */
@@ -2470,7 +2470,7 @@ struct ice_aqc_dis_txq_item { (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 ]; +__le16 q_id[STRUCT_HACK_VAR_LEN ]; };#pragma pack()
@@ -2514,7 +2514,7 @@ struct ice_aqc_move_txqs_elem {struct ice_aqc_move_txqs_data {__le32 src_teid;__le32 dest_teid; -struct ice_aqc_move_txqs_elem txqs[1 ]; +struct ice_aqc_move_txqs_elem txqs[STRUCT_HACK_VAR_LEN ]; };/* Download Package (indirect 0x0C40) */
@@ -2567,7 +2567,7 @@ struct ice_aqc_get_pkg_info {/* Get Package Info List response buffer format (0x0C43) */ struct ice_aqc_get_pkg_info_resp {__le32 count; -struct ice_aqc_get_pkg_info pkg_info[1 ]; +struct ice_aqc_get_pkg_info pkg_info[STRUCT_HACK_VAR_LEN ]; };/* Driver Shared Parameters (direct, 0x0C90) */
drivers/net/ice/base/ice_common.c +40 -37
173 lines not on this page · raw message
drivers/net/ice/base/ice_dcb.h +2 -8
@@ -103,17 +103,11 @@#define ICE_IEEE_APP_TLV_LEN 11#pragma pack(1) -/* IEEE 802.1AB LLDP TLV structure */ -struct ice_lldp_generic_tlv { -__be16 typelen; -u8 tlvinfo[1 ]; -}; -/* IEEE 802.1AB LLDP Organization specific TLV */ struct ice_lldp_org_tlv {__be16 typelen;__be32 ouisubtype; -u8 tlvinfo[1 ]; +u8 tlvinfo[STRUCT_HACK_VAR_LEN ]; };#pragma pack()
@@ -136,7 +130,7 @@ struct ice_cee_feat_tlv {#define ICE_CEE_FEAT_TLV_WILLING_M 0x40#define ICE_CEE_FEAT_TLV_ERR_M 0x20u8 subtype; -u8 tlvinfo[1 ]; +u8 tlvinfo[STRUCT_HACK_VAR_LEN ]; };#pragma pack(1)
drivers/net/ice/base/ice_flex_pipe.c +22 -11
@@ -1138,7 +1138,7 @@ static enum ice_status ice_get_pkg_info(struct ice_hw *hw)ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__); - size =ice_struct_size (pkg_info, pkg_info,ICE_PKG_CNT -1 ); + size =ice_struct_size (pkg_info, pkg_info,ICE_PKG_CNT ); pkg_info = (struct ice_aqc_get_pkg_info_resp *)ice_malloc (hw, size);if (!pkg_info)return ICE_ERR_NO_MEMORY ;
@@ -1197,7 +1197,7 @@ static enum ice_status ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)u32 seg_count;u32 i; -if (len <sizeof (*pkg)) +if (len <ice_struct_size (pkg, seg_offset,1 ))return ICE_ERR_BUF_TOO_SHORT ; if (pkg->pkg_format_ver.major != ICE_PKG_FMT_VER_MAJ ||
@@ -1212,7 +1212,7 @@ static enum ice_status ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)return ICE_ERR_CFG ;/* make sure segment array fits in package length */ -if (len <ice_struct_size (pkg, seg_offset, seg_count -1 )) +if (len <ice_struct_size (pkg, seg_offset, seg_count))return ICE_ERR_BUF_TOO_SHORT ;/* all segments must fit within length */
@@ -1321,7 +1321,7 @@ ice_chk_pkg_compat(struct ice_hw *hw, struct ice_pkg_hdr *ospkg, }/* Check if FW is compatible with the OS package */ - size =ice_struct_size (pkg, pkg_info,ICE_PKG_CNT -1 ); + size =ice_struct_size (pkg, pkg_info,ICE_PKG_CNT ); pkg = (struct ice_aqc_get_pkg_info_resp *)ice_malloc (hw, size);if (!pkg)return ICE_ERR_NO_MEMORY ;
@@ -2049,14 +2049,14 @@ ice_create_tunnel(struct ice_hw *hw, enum ice_tunnel_type type, u16 port) sect_rx = (struct ice_boost_tcam_section *)ice_pkg_buf_alloc_section (bld,ICE_SID_RXPARSER_BOOST_TCAM , -sizeof (*sect_rx)); +ice_struct_size (sect_rx, tcam,1 ));if (!sect_rx) goto ice_create_tunnel_err; sect_rx->count =CPU_TO_LE16 (1 ); sect_tx = (struct ice_boost_tcam_section *)ice_pkg_buf_alloc_section (bld,ICE_SID_TXPARSER_BOOST_TCAM , -sizeof (*sect_tx)); +ice_struct_size (sect_tx, tcam,1 ));if (!sect_tx) goto ice_create_tunnel_err; sect_tx->count =CPU_TO_LE16 (1 );
@@ -2134,7 +2134,7 @@ enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all) }/* size of section - there is at least one entry */ - size =ice_struct_size (sect_rx, tcam, count -1 ); + size =ice_struct_size (sect_rx, tcam, count); bld =ice_pkg_buf_alloc (hw);if (!bld) {
@@ -4092,7 +4092,9 @@ ice_prof_bld_es(struct ice_hw *hw, enum ice_block blk, id =ice_sect_id (blk,ICE_VEC_TBL ); p = (struct ice_pkg_es *) -ice_pkg_buf_alloc_section (bld, id,sizeof (*p) + +ice_pkg_buf_alloc_section (bld, id, +ice_struct_size (p, es, +1 ) + vec_size -sizeof (p->es[0 ]));
@@ -4129,7 +4131,10 @@ ice_prof_bld_tcam(struct ice_hw *hw, enum ice_block blk, id =ice_sect_id (blk,ICE_PROF_TCAM ); p = (struct ice_prof_id_section *) -ice_pkg_buf_alloc_section (bld, id,sizeof (*p)); +ice_pkg_buf_alloc_section (bld, id, +ice_struct_size (p, + entry, +1 ));if (!p)return ICE_ERR_MAX_LIMIT ;
@@ -4166,7 +4171,10 @@ ice_prof_bld_xlt1(enum ice_block blk, struct ice_buf_build *bld, id =ice_sect_id (blk,ICE_XLT1 ); p = (struct ice_xlt1_section *) -ice_pkg_buf_alloc_section (bld, id,sizeof (*p)); +ice_pkg_buf_alloc_section (bld, id, +ice_struct_size (p, + value, +1 ));if (!p)return ICE_ERR_MAX_LIMIT ;
@@ -4201,7 +4209,10 @@ ice_prof_bld_xlt2(enum ice_block blk, struct ice_buf_build *bld,case ICE_VSIG_REM : id =ice_sect_id (blk,ICE_XLT2 ); p = (struct ice_xlt2_section *) -ice_pkg_buf_alloc_section (bld, id,sizeof (*p)); +ice_pkg_buf_alloc_section (bld, id, +ice_struct_size (p, + value, +1 ));if (!p)return ICE_ERR_MAX_LIMIT ;
drivers/net/ice/base/ice_flex_type.h +20 -29
135 lines not on this page · raw message
drivers/net/ice/base/ice_sched.c +6 -4
@@ -237,7 +237,7 @@ ice_sched_remove_elems(struct ice_hw *hw, struct ice_sched_node *parent,enum ice_status status;u16 buf_size; - buf_size =sizeof (*buf) +sizeof (u32) * (num_nodes -1 ); + buf_size =ice_struct_size (buf, teid, num_nodes); buf = (struct ice_aqc_delete_elem *)ice_malloc (hw, buf_size);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -892,7 +892,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,u16 buf_size;u32 teid; - buf_size =ice_struct_size (buf, generic, num_nodes -1 ); + buf_size =ice_struct_size (buf, generic, num_nodes); buf = (struct ice_aqc_add_elem *)ice_malloc (hw, buf_size);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -2260,6 +2260,7 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent,struct ice_sched_node *node;u16 i, grps_movd =0 ;struct ice_hw *hw; +u16 buf_len; hw = pi->hw;
@@ -2271,7 +2272,8 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent, hw->max_children[parent->tx_sched_layer])return ICE_ERR_AQ_FULL ; - buf = (struct ice_aqc_move_elem *)ice_malloc (hw,sizeof (*buf)); + buf_len =ice_struct_size (buf, teid,1 ); + buf = (struct ice_aqc_move_elem *)ice_malloc (hw, buf_len);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -2286,7 +2288,7 @@ ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent, buf->hdr.dest_parent_teid = parent->info.node_teid; buf->teid[0 ] = node->info.node_teid; buf->hdr.num_elems =CPU_TO_LE16 (1 ); - status =ice_aq_move_sched_elems (hw,1 , buf,sizeof (*buf), + status =ice_aq_move_sched_elems (hw,1 , buf, buf_len, &grps_movd,NULL );if (status && grps_movd !=1 ) { status =ICE_ERR_CFG ;
drivers/net/ice/base/ice_switch.c +13 -19
@@ -1478,9 +1478,8 @@ ice_alloc_sw(struct ice_hw *hw, bool ena_stats, bool shared_res, u16 *sw_id,enum ice_status status;u16 buf_len; - buf_len =sizeof (*sw_buf); - sw_buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (sw_buf, elem,1 ); + sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ;
@@ -1560,9 +1559,8 @@ enum ice_status ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id)enum ice_status status, ret_status;u16 buf_len; - buf_len =sizeof (*sw_buf); - sw_buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (sw_buf, elem,1 ); + sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ;
@@ -2103,9 +2101,8 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id,enum ice_status status;u16 buf_len; - buf_len =sizeof (*sw_buf); - sw_buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (sw_buf, elem,1 ); + sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ; sw_buf->num_elems =CPU_TO_LE16 (1 );
@@ -2387,7 +2384,7 @@ enum ice_status ice_alloc_recipe(struct ice_hw *hw, u16 *rid)enum ice_status status;u16 buf_len; - buf_len =sizeof (*sw_buf); + buf_len =ice_struct_size (sw_buf, elem,1 ); sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ;
@@ -5253,9 +5250,8 @@ ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,u16 buf_len;/* Allocate resource */ - buf_len =sizeof (*buf); - buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (buf, elem,1 ); + buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -5292,9 +5288,8 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,u16 buf_len;/* Free resource */ - buf_len =sizeof (*buf); - buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (buf, elem,1 ); + buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!buf)return ICE_ERR_NO_MEMORY ;
@@ -5354,9 +5349,8 @@ ice_alloc_res_lg_act(struct ice_hw *hw, u16 *l_id, u16 num_acts)return ICE_ERR_PARAM ;/* Allocate resource for large action */ - buf_len =sizeof (*sw_buf); - sw_buf = (struct ice_aqc_alloc_free_res_elem *) -ice_malloc (hw, buf_len); + buf_len =ice_struct_size (sw_buf, elem,1 ); + sw_buf = (struct ice_aqc_alloc_free_res_elem *)ice_malloc (hw, buf_len);if (!sw_buf)return ICE_ERR_NO_MEMORY ;
drivers/net/ice/base/ice_switch.h +8 -16
@@ -45,25 +45,17 @@#define DUMMY_ETH_HDR_LEN 16#define ICE_SW_RULE_RX_TX_ETH_HDR_SIZE \ - (sizeof(struct ice_aqc_sw_rules_elem) - \ - FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \ - sizeof(struct ice_sw_rule_lkup_rx_tx) + DUMMY_ETH_HDR_LEN - 1) + (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr) + \ + (DUMMY_ETH_HDR_LEN * \ + sizeof(((struct ice_sw_rule_lkup_rx_tx *)0)->hdr[0])))#define ICE_SW_RULE_RX_TX_NO_HDR_SIZE \ - (sizeof(struct ice_aqc_sw_rules_elem) - \ - FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \ - sizeof(struct ice_sw_rule_lkup_rx_tx) - 1) + (offsetof(struct ice_aqc_sw_rules_elem, pdata.lkup_tx_rx.hdr))#define ICE_SW_RULE_LG_ACT_SIZE (n) \ - (sizeof(struct ice_aqc_sw_rules_elem) - \ - FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \ - sizeof(struct ice_sw_rule_lg_act) - \ - FIELD_SIZEOF(struct ice_sw_rule_lg_act, act) + \ - ((n) * FIELD_SIZEOF(struct ice_sw_rule_lg_act, act))) + (offsetof(struct ice_aqc_sw_rules_elem, pdata.lg_act.act) + \ + ((n) * sizeof(((struct ice_sw_rule_lg_act *)0)->act[0])))#define ICE_SW_RULE_VSI_LIST_SIZE (n) \ - (sizeof(struct ice_aqc_sw_rules_elem) - \ - FIELD_SIZEOF(struct ice_aqc_sw_rules_elem, pdata) + \ - sizeof(struct ice_sw_rule_vsi_list) - \ - FIELD_SIZEOF(struct ice_sw_rule_vsi_list, vsi) + \ - ((n) * FIELD_SIZEOF(struct ice_sw_rule_vsi_list, vsi))) + (offsetof(struct ice_aqc_sw_rules_elem, pdata.vsi_list.vsi) + \ + ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi[0])))/* Worst case buffer length for ice_aqc_opc_get_res_alloc */ #define ICE_MAX_RES_TYPES 0x80
drivers/net/ice/base/ice_type.h +7 -0
@@ -34,6 +34,13 @@#define IS_ASCII (_ch) ((_ch) < 0x80) +#define STRUCT_HACK_VAR_LEN +/** +* ice_struct_size - size of struct with C99 flexible array member +* @ptr: pointer to structure +* @field: flexible array member (last member of the structure) +* @num: number of elements of that flexible array member +*/ #define ice_struct_size (ptr, field, num) \ (sizeof(*(ptr)) + sizeof(*(ptr)->field) * (num))
drivers/net/ice/ice_rxtx.c +29 -14
114 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH v2 10/40 net/ice/base: introduce and use bitmap set API
In reply to Qi ZhangIntroduce ice_bitmap_set() and use it instead of open-coding that functionality.
--- drivers/net/ice/base/ice_acl_ctrl.c | 4 +--- drivers/net/ice/base/ice_bitops.h | 19 +++++++++++++++++++ drivers/net/ice/base/ice_flex_pipe.c | 9 ++------- drivers/net/ice/base/ice_switch.c | 3 +-- 4 files changed, 23 insertions(+), 12 deletions(-)
drivers/net/ice/base/ice_acl_ctrl.c +1 -3
@@ -354,7 +354,6 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)/* call the AQ command to create the ACL table with these values */ status =ice_aq_alloc_acl_tbl (hw, &tbl_alloc,NULL ); -if (status) {if (LE16_TO_CPU (tbl_alloc.buf.resp_buf.alloc_id) <ICE_AQC_ALLOC_ID_LESS_THAN_4K )
@@ -415,8 +414,7 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params) (tbl->last_entry /ICE_ACL_ENTRY_ALLOC_UNIT );/* Indicate available entries in the table */ -for (i = first_e; i <= last_e; i++) -ice_set_bit (i, tbl->avail); +ice_bitmap_set (tbl->avail, first_e, last_e - first_e +1 );INIT_LIST_HEAD (&tbl->scens); out:
drivers/net/ice/base/ice_bitops.h +19 -0
@@ -376,6 +376,25 @@ static inline void ice_cp_bitmap(ice_bitmap_t *dst, ice_bitmap_t *src, u16 size) }/** +* ice_bitmap_set - set a number of bits in bitmap from a starting position +* @dst: bitmap destination +* @pos: first bit position to set +* @num_bits: number of bits to set +* +* This function sets bits in a bitmap from pos to (pos + num_bits) - 1. +* Note that this function assumes it is operating on a bitmap declared using +* ice_declare_bitmap. +*/ +static inline void +ice_bitmap_set (ice_bitmap_t *dst,u16 pos,u16 num_bits) +{ +u16 i; + +for (i = pos; i < num_bits; i++) +ice_set_bit (i, dst); +} + +/** * ice_cmp_bitmaps - compares two bitmaps. * @bmp1: the bitmap to compare * @bmp2: the bitmap to compare with bmp1
drivers/net/ice/base/ice_flex_pipe.c +2 -7
@@ -1580,18 +1580,13 @@ ice_get_sw_fv_bitmap(struct ice_hw *hw, enum ice_prof_type req_profs,struct ice_seg *ice_seg;struct ice_fv *fv; -ice_memset (&state,0 ,sizeof (state),ICE_NONDMA_MEM ); -if (req_profs ==ICE_PROF_ALL ) { -u16 i; - -for (i =0 ; i <ICE_MAX_NUM_PROFILES ; i++) -ice_set_bit (i, bm); +ice_bitmap_set (bm,0 ,ICE_MAX_NUM_PROFILES );return ; } +ice_memset (&state,0 ,sizeof (state),ICE_NONDMA_MEM );ice_zero_bitmap (bm,ICE_MAX_NUM_PROFILES ); - ice_seg = hw->seg; do { enum ice_prof_type prof_type;
drivers/net/ice/base/ice_switch.c +1 -2
@@ -5940,8 +5940,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,ice_zero_bitmap (used_idx,ICE_MAX_FV_WORDS );ice_zero_bitmap (free_idx,ICE_MAX_FV_WORDS ); -for (count =0 ; count <ICE_MAX_FV_WORDS ; count++) -ice_set_bit (count, possible_idx); +ice_bitmap_set (possible_idx,0 ,ICE_MAX_FV_WORDS );/* For each profile we are going to associate the recipe with, add the * recipes that are associated with that profile. This will give us
Signature · 1 line
2.13.6
PATCH v2 11/40 net/ice/base: introduce and use bitmap hamming weight API
In reply to Qi ZhangIntroduce ice_bitmap_hweight() and use it instead of open-coding that functionality.
--- drivers/net/ice/base/ice_bitops.h | 23 +++++++++++++++++++++++ drivers/net/ice/base/ice_switch.c | 11 +---------- 2 files changed, 24 insertions(+), 10 deletions(-)
drivers/net/ice/base/ice_bitops.h +23 -0
@@ -395,6 +395,29 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits) }/** +* ice_bitmap_hweight - hamming weight of bitmap +* @bm: bitmap pointer +* @size: size of bitmap (in bits) +* +* This function determines the number of set bits in a bitmap. +* Note that this function assumes it is operating on a bitmap declared using +* ice_declare_bitmap. +*/ +static inline int +ice_bitmap_hweight (ice_bitmap_t *bm,u16 size) +{ +int count =0 ; +u16 bit =0 ; + +while (size > (bit =ice_find_next_bit (bm, size, bit))) { + count++; + bit++; + } + +return count; +} + +/** * ice_cmp_bitmaps - compares two bitmaps. * @bmp1: the bitmap to compare * @bmp2: the bitmap to compare with bmp1
drivers/net/ice/base/ice_switch.c +1 -10
@@ -5932,7 +5932,6 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,ice_declare_bitmap (possible_idx,ICE_MAX_FV_WORDS );ice_declare_bitmap (recipes,ICE_MAX_NUM_RECIPES );ice_declare_bitmap (used_idx,ICE_MAX_FV_WORDS ); -u16 count =0 ;u16 bit;ice_zero_bitmap (possible_idx,ICE_MAX_FV_WORDS );
@@ -5971,15 +5970,7 @@ ice_find_free_recp_res_idx(struct ice_hw *hw, const ice_bitmap_t *profiles,ice_xor_bitmap (free_idx, used_idx, possible_idx,ICE_MAX_FV_WORDS );/* return number of free indexes */ - count =0 ; - bit =0 ; -while (ICE_MAX_FV_WORDS > - (bit =ice_find_next_bit (free_idx,ICE_MAX_FV_WORDS , bit))) { - count++; - bit++; - } - -return count; +return (u16 )ice_bitmap_hweight (free_idx,ICE_MAX_FV_WORDS ); }/**
Signature · 1 line
2.13.6
PATCH v2 12/40 net/ice/base: add function header
In reply to Qi ZhangAdd a function header for ice_cfg_phy_fc()
--- drivers/net/ice/base/ice_common.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ice/base/ice_common.c +6 -0
@@ -2749,6 +2749,12 @@ enum ice_fec_mode ice_caps_to_fec_mode(u8 caps, u8 fec_options)return ICE_FEC_NONE ; } +/** +* ice_cfg_phy_fc - Configure PHY FC data based on FC mode +* @pi: port information structure +* @cfg: PHY configuration data to set FC mode +* @req_mode: FC mode to configure +*/ static enum ice_status ice_cfg_phy_fc (struct ice_port_info *pi,struct ice_aqc_set_phy_cfg_data *cfg,enum ice_fc_mode req_mode)
Signature · 1 line
2.13.6
PATCH v2 13/40 net/ice/base: introduce and use for each bit iterator
In reply to Qi ZhangA number of code flows iterate over a block of memory to do something for every bit set in that memory. Use existing bit operations in a new iterator macro to make those code flows cleaner.
--- drivers/net/ice/base/ice_acl_ctrl.c | 17 +++----- drivers/net/ice/base/ice_bitops.h | 5 +++ drivers/net/ice/base/ice_flex_pipe.c | 66 ++++++++++++++----------------- drivers/net/ice/base/ice_flow.c | 75 +++++++++++------------------------- drivers/net/ice/base/ice_switch.c | 59 ++++++++++++---------------- 5 files changed, 85 insertions(+), 137 deletions(-)
drivers/net/ice/base/ice_acl_ctrl.c +5 -12
@@ -1028,9 +1028,8 @@ ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen, entry_tcam =ICE_ACL_TBL_TCAM_IDX (scen->start); idx =ICE_ACL_TBL_TCAM_ENTRY_IDX (scen->start + entry_idx); - i =ice_find_first_bit (scen->act_mem_bitmap, -ICE_AQC_MAX_ACTION_MEMORIES ); -while (i <ICE_AQC_MAX_ACTION_MEMORIES ) { +ice_for_each_set_bit (i, scen->act_mem_bitmap, +ICE_AQC_MAX_ACTION_MEMORIES ) {struct ice_acl_act_mem *mem = &hw->acl_tbl->act_mems[i];if (actx_idx >= acts_cnt)
@@ -1057,9 +1056,6 @@ ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen, } actx_idx++; } - - i =ice_find_next_bit (scen->act_mem_bitmap, -ICE_AQC_MAX_ACTION_MEMORIES , i +1 ); }if (!status && actx_idx < acts_cnt)
@@ -1111,9 +1107,9 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx) }ice_memset (&act_buf,0 ,sizeof (act_buf),ICE_NONDMA_MEM ); - i =ice_find_first_bit (scen->act_mem_bitmap, -ICE_AQC_MAX_ACTION_MEMORIES ); -while (i <ICE_AQC_MAX_ACTION_MEMORIES ) { + +ice_for_each_set_bit (i, scen->act_mem_bitmap, +ICE_AQC_MAX_ACTION_MEMORIES ) {struct ice_acl_act_mem *mem = &hw->acl_tbl->act_mems[i]; if (mem->member_of_tcam >= entry_tcam &&
@@ -1126,9 +1122,6 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx)"program actpair failed.status: %d\n" , status); } - - i =ice_find_next_bit (scen->act_mem_bitmap, -ICE_AQC_MAX_ACTION_MEMORIES , i +1 ); }ice_acl_scen_free_entry_idx (scen, entry_idx);
drivers/net/ice/base/ice_bitops.h +5 -0
@@ -346,6 +346,11 @@ static inline u16 ice_find_first_bit(const ice_bitmap_t *bitmap, u16 size)return ice_find_next_bit (bitmap, size,0 ); } +#define ice_for_each_set_bit (_bitpos, _addr, _maxlen) \ + for ((_bitpos) = ice_find_first_bit((_addr), (_maxlen)); \ + (_bitpos) < (_maxlen); \ + (_bitpos) = ice_find_next_bit((_addr), (_maxlen), (_bitpos) + 1)) +/** * ice_is_any_bit_set - Return true of any bit in the bitmap is set * @bitmap: the bitmap to check
drivers/net/ice/base/ice_flex_pipe.c +29 -37
79 lines not on this page · raw message
drivers/net/ice/base/ice_flow.c +22 -53
133 lines not on this page · raw message
drivers/net/ice/base/ice_switch.c +24 -35
105 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH v2 14/40 net/ice/base: correct abbreviations
In reply to Qi ZhangCorrect abbreviations as identified by abbrevcheck
--- drivers/net/ice/base/ice_flex_pipe.c | 6 +++--- drivers/net/ice/base/ice_sched.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +3 -3
@@ -5228,7 +5228,7 @@ ice_prof_tcam_ena_dis(struct ice_hw *hw, enum ice_block blk, bool enable,/* for re-enabling, reallocate a TCAM */ /* for entries with empty attribute masks, allocate entry from -* the bottom of the tcam table; otherwise, allocate from the +* the bottom of the TCAM table; otherwise, allocate from the * top of the table in order to give it higher priority */ status = ice_alloc_tcam_ent(hw, blk, tcam->attr.mask == 0,
@@ -5439,7 +5439,7 @@ ice_add_prof_id_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl,/* allocate the TCAM entry index */ /* for entries with empty attribute masks, allocate entry from -* the bottom of the tcam table; otherwise, allocate from the +* the bottom of the TCAM table; otherwise, allocate from the * top of the table in order to give it higher priority */ status = ice_alloc_tcam_ent(hw, blk, map->attr[i].mask == 0,
@@ -5872,7 +5872,7 @@ ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)if (last_profile) {/* If there are no profiles left for this VSIG, -* then simply remove the the VSIG. +* then simply remove the VSIG. */ status =ice_rem_vsig (hw, blk, vsig, &chg);if (status)
drivers/net/ice/base/ice_sched.c +8 -8
@@ -1435,14 +1435,14 @@ ice_sched_find_node_in_subtree(struct ice_hw *hw, struct ice_sched_node *base, }/** -* ice_sched_get_free_qgrp - Scan all Q group siblings and find a free node +* ice_sched_get_free_qgrp - Scan all queue group siblings and find a free node * @pi: port information structure * @vsi_node: software VSI handle -* @qgrp_node: first Q group node identified for scanning +* @qgrp_node: first queue group node identified for scanning * @owner: LAN or RDMA * -* This function retrieves a free LAN or RDMA Q group node by scanning -* qgrp_node and its siblings for the Q group with the fewest number +* This function retrieves a free LAN or RDMA queue group node by scanning +* qgrp_node and its siblings for the queue group with the fewest number * of queues currently assigned. */ static struct ice_sched_node *
@@ -1459,17 +1459,17 @@ ice_sched_get_free_qgrp(struct ice_port_info *pi,if (!min_children)return qgrp_node; min_qgrp = qgrp_node; -/* scan all Q groups until find a node which has less than the -* minimum number of children. This way all Q group nodes get +/* scan all queue groups until find a node which has less than the +* minimum number of children. This way all queue group nodes get * equal number of shares and active. The bandwidth will be equally -* distributed across all Qs. +* distributed across all queues. */ while (qgrp_node) {/* make sure the qgroup node is part of the VSI subtree */ if (ice_sched_find_node_in_subtree (pi->hw, vsi_node, qgrp_node))if (qgrp_node->num_children < min_children && qgrp_node->owner == owner) { -/* replace the new min Q group node */ +/* replace the new min queue group node */ min_qgrp = qgrp_node; min_children = min_qgrp->num_children;/* break if it has no children, */
Signature · 1 line
2.13.6
PATCH v2 15/40 net/ice/base: add AQ cmd 0X0A0A LLDP fltr control
In reply to Qi ZhangAs of NVM ver 1.7.1 there is a new AQ command to add and remove LLDP filters for Rx flow. This patch implements the support structure to implement this functionality.
--- drivers/net/ice/base/ice_common.c | 47 +++++++++++++++++++++++++++++++++++++++ drivers/net/ice/base/ice_common.h | 3 +++ drivers/net/ice/base/ice_type.h | 4 ++++ 3 files changed, 54 insertions(+)
drivers/net/ice/base/ice_common.c +47 -0
@@ -4799,3 +4799,50 @@ ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size,return ice_aq_send_cmd (hw, &desc, buf, buf_size, cd); } + +/** +* ice_fw_supports_lldp_fltr - check NVM version supports lldp_fltr_ctrl +* @hw: pointer to HW struct +*/ +bool ice_fw_supports_lldp_fltr_ctrl (struct ice_hw *hw) +{ +if (hw->mac_type !=ICE_MAC_E810 ) +return false; + +if (hw->api_maj_ver ==ICE_FW_API_LLDP_FLTR_MAJ ) { +if (hw->api_min_ver >ICE_FW_API_LLDP_FLTR_MIN ) +return true; +if (hw->api_min_ver ==ICE_FW_API_LLDP_FLTR_MIN && + hw->api_patch >=ICE_FW_API_LLDP_FLTR_PATCH ) +return true; + }else if (hw->api_maj_ver >ICE_FW_API_LLDP_FLTR_MAJ ) { +return true; + } +return false; +} + +/** +* ice_lldp_fltr_add_remove - add or remove a LLDP Rx switch filter +* @hw: pointer to HW struct +* @vsi_num: absolute HW index for VSI +* @add: boolean for if adding or removing a filter +*/ +enum ice_status +ice_lldp_fltr_add_remove (struct ice_hw *hw,u16 vsi_num,bool add) +{ +struct ice_aqc_lldp_filter_ctrl *cmd; +struct ice_aq_desc desc; + + cmd = &desc.params.lldp_filter_ctrl; + +ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_lldp_filter_ctrl); + +if (add) + cmd->cmd_flags =ICE_AQC_LLDP_FILTER_ACTION_ADD ; +else + cmd->cmd_flags =ICE_AQC_LLDP_FILTER_ACTION_DELETE ; + + cmd->vsi_num =CPU_TO_LE16 (vsi_num); + +return ice_aq_send_cmd (hw, &desc,NULL ,0 ,NULL ); +}
drivers/net/ice/base/ice_common.h +3 -0
@@ -223,4 +223,7 @@ ice_sched_query_elem(struct ice_hw *hw, u32 node_teid,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); +bool ice_fw_supports_lldp_fltr_ctrl (struct ice_hw *hw); +enum ice_status +ice_lldp_fltr_add_remove (struct ice_hw *hw,u16 vsi_num,bool add);#endif /* _ICE_COMMON_H_ */
drivers/net/ice/base/ice_type.h +4 -0
@@ -1122,4 +1122,8 @@ enum ice_sw_fwd_act_type {#define GLPCI_LBARCTRL_VF_PE_DB_SIZE_8KB 0x1#define GLPCI_LBARCTRL_VF_PE_DB_SIZE_64KB 0x2 +/* AQ API version for LLDP_FILTER_CONTROL */ +#define ICE_FW_API_LLDP_FLTR_MAJ 1 +#define ICE_FW_API_LLDP_FLTR_MIN 7 +#define ICE_FW_API_LLDP_FLTR_PATCH 1#endif /* _ICE_TYPE_H_ */
Signature · 1 line
2.13.6
PATCH v2 16/40 net/ice/base: add support for GTP-U type switch rule
In reply to Qi ZhangThis patch add support for GTP-U type of switch rule. It enable all GTP-U related ptype.
--- drivers/net/ice/base/ice_protocol_type.h | 7 + drivers/net/ice/base/ice_switch.c | 299 ++++++++++++++++++++++++++++++- drivers/net/ice/base/ice_switch.h | 26 ++- 3 files changed, 328 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +7 -0
@@ -51,6 +51,7 @@ enum ice_protocol_type {ICE_ESP ,ICE_AH ,ICE_NAT_T , +ICE_GTP_NO_PAY , ICE_PROTOCOL_LAST };
@@ -71,6 +72,12 @@ enum ice_sw_tunnel_type {ICE_SW_IPV6_TCP ,ICE_SW_IPV6_UDP ,ICE_SW_TUN_GTP , +ICE_SW_TUN_IPV4_GTPU_NO_PAY , +ICE_SW_TUN_IPV6_GTPU_NO_PAY , +ICE_SW_TUN_IPV4_GTPU_IPV4 , +ICE_SW_TUN_IPV4_GTPU_IPV6 , +ICE_SW_TUN_IPV6_GTPU_IPV4 , +ICE_SW_TUN_IPV6_GTPU_IPV6 ,ICE_SW_TUN_PPPOE ,ICE_SW_TUN_PPPOE_PAY , ICE_SW_TUN_PPPOE_IPV4,
drivers/net/ice/base/ice_switch.c +296 -3
361 lines not on this page · raw message
drivers/net/ice/base/ice_switch.h +25 -1
@@ -28,8 +28,32 @@#define ICE_PROFID_PPPOE_IPV6_UDP 39#define ICE_PROFID_PPPOE_IPV6_OTHER 40#define ICE_PROFID_IPV4_GTPC_TEID 41 +#define ICE_PROFID_IPV4_GTPU_TEID 43 +#define ICE_PROFID_IPV6_GTPU_TEID 46#define ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER 47 -#define ICE_PROFID_IPV6_GTPU_IPV6_OTHER 70 +#define ICE_PROFID_IPV4_GTPU_IPV4_OTHER 48 +#define ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP 49 +#define ICE_PROFID_IPV4_GTPU_IPV4_UDP 50 +#define ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP 51 +#define ICE_PROFID_IPV4_GTPU_IPV4_TCP 52 +#define ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER 53 +#define ICE_PROFID_IPV6_GTPU_IPV4_OTHER 54 +#define ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP 55 +#define ICE_PROFID_IPV6_GTPU_IPV4_UDP 56 +#define ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP 57 +#define ICE_PROFID_IPV6_GTPU_IPV4_TCP 58 +#define ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER 59 +#define ICE_PROFID_IPV4_GTPU_IPV6_OTHER 60 +#define ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP 61 +#define ICE_PROFID_IPV4_GTPU_IPV6_UDP 62 +#define ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP 63 +#define ICE_PROFID_IPV4_GTPU_IPV6_TCP 64 +#define ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER 65 +#define ICE_PROFID_IPV6_GTPU_IPV6_OTHER 66 +#define ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP 67 +#define ICE_PROFID_IPV6_GTPU_IPV6_UDP 68 +#define ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP 69 +#define ICE_PROFID_IPV6_GTPU_IPV6_TCP 70#define ICE_PROFID_IPV4_ESP 71#define ICE_PROFID_IPV6_ESP 72#define ICE_PROFID_IPV4_AH 73
Signature · 1 line
2.13.6
PATCH v2 17/40 net/ice/base: join format strings to same line
In reply to Qi ZhangWhen printing messages with ice_debug, align the printed string to the origin line of the message in order to ease debugging and tracking messages back to their source.
--- drivers/net/ice/base/ice_acl_ctrl.c | 30 ++++------ drivers/net/ice/base/ice_common.c | 103 ++++++++++++----------------------- drivers/net/ice/base/ice_controlq.c | 42 +++++--------- drivers/net/ice/base/ice_flex_pipe.c | 27 +++------ drivers/net/ice/base/ice_flow.c | 9 +-- drivers/net/ice/base/ice_nvm.c | 30 ++++------ drivers/net/ice/base/ice_sched.c | 24 +++----- drivers/net/ice/base/ice_switch.c | 39 +++++-------- 8 files changed, 102 insertions(+), 202 deletions(-)
drivers/net/ice/base/ice_acl_ctrl.c +10 -20
@@ -357,12 +357,10 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)if (status) {if (LE16_TO_CPU (tbl_alloc.buf.resp_buf.alloc_id) <ICE_AQC_ALLOC_ID_LESS_THAN_4K ) -ice_debug (hw,ICE_DBG_ACL , -"Alloc ACL table failed. Unavailable resource.\n" ); +ice_debug (hw,ICE_DBG_ACL ,"Alloc ACL table failed. Unavailable resource.\n" );else -ice_debug (hw,ICE_DBG_ACL , -"AQ allocation of ACL failed with error. status: %d\n" , - status); +ice_debug (hw,ICE_DBG_ACL ,"AQ allocation of ACL failed with error. status: %d\n" , + status);return status; }
@@ -402,8 +400,7 @@ ice_acl_create_tbl(struct ice_hw *hw, struct ice_acl_tbl_params *params)if (status) {ice_free (hw, tbl); hw->acl_tbl =NULL ; -ice_debug (hw,ICE_DBG_ACL , -"Initialization of TCAM entries failed. status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"Initialization of TCAM entries failed. status: %d\n" , status); goto out; }
@@ -830,8 +827,7 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries, status =ice_aq_alloc_acl_scen (hw, scen_id, &scen_buf,NULL );if (status) { -ice_debug (hw,ICE_DBG_ACL , -"AQ allocation of ACL scenario failed. status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"AQ allocation of ACL scenario failed. status: %d\n" , status);ice_free (hw, scen);return status;
@@ -898,10 +894,8 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw)/* call the AQ command to destroy the ACL table */ status =ice_aq_dealloc_acl_tbl (hw, hw->acl_tbl->id, &resp_buf,NULL ); -if (status) { -ice_debug (hw,ICE_DBG_ACL , -"AQ de-allocation of ACL failed. status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"AQ de-allocation of ACL failed. status: %d\n" , status);return status; }
@@ -977,8 +971,7 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen, status =ice_aq_program_acl_entry (hw, entry_tcam + offset, idx, &buf,NULL );if (status) { -ice_debug (hw,ICE_DBG_ACL , -"aq program acl entry failed status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"aq program acl entry failed status: %d\n" , status); goto out; }
@@ -1049,8 +1042,7 @@ ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen, status =ice_aq_program_actpair (hw, i, idx, &act_buf,NULL );if (status) { -ice_debug (hw,ICE_DBG_ACL , -"program actpair failed status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"program actpair failed status: %d\n" , status);break ; }
@@ -1101,8 +1093,7 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx) status =ice_aq_program_acl_entry (hw, entry_tcam + i, idx, &buf,NULL );if (status) -ice_debug (hw,ICE_DBG_ACL , -"AQ program ACL entry failed status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"AQ program ACL entry failed status: %d\n" , status); }
@@ -1118,8 +1109,7 @@ ice_acl_rem_entry(struct ice_hw *hw, struct ice_acl_scen *scen, u16 entry_idx) status =ice_aq_program_actpair (hw, i, idx, &act_buf,NULL );if (status) -ice_debug (hw,ICE_DBG_ACL , -"program actpair failed.status: %d\n" , +ice_debug (hw,ICE_DBG_ACL ,"program actpair failed status: %d\n" , status); } }
drivers/net/ice/base/ice_common.c +35 -68
267 lines not on this page · raw message
drivers/net/ice/base/ice_controlq.c +14 -28
126 lines not on this page · raw message
drivers/net/ice/base/ice_flex_pipe.c +9 -18
@@ -712,8 +712,7 @@ ice_acquire_global_cfg_lock(struct ice_hw *hw, ICE_GLOBAL_CFG_LOCK_TIMEOUT);if (status ==ICE_ERR_AQ_NO_WORK ) -ice_debug (hw,ICE_DBG_PKG , -"Global config lock: No work to do\n" ); +ice_debug (hw,ICE_DBG_PKG ,"Global config lock: No work to do\n" );return status; }
@@ -920,8 +919,7 @@ ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count) last, &offset, &info, NULL);if (status) { -ice_debug (hw,ICE_DBG_PKG , -"Update pkg failed: err %d off %d inf %d\n" , +ice_debug (hw,ICE_DBG_PKG ,"Update pkg failed: err %d off %d inf %d\n" , status, offset, info);break ; }
@@ -999,8 +997,7 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count)/* Save AQ status from download package */ hw->pkg_dwnld_status = hw->adminq.sq_last_status;if (status) { -ice_debug (hw,ICE_DBG_PKG , -"Pkg download failed: err %d off %d inf %d\n" , +ice_debug (hw,ICE_DBG_PKG ,"Pkg download failed: err %d off %d inf %d\n" , status, offset, info);break ; }
@@ -1097,8 +1094,7 @@ ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) meta_seg->pkg_ver.update, meta_seg->pkg_ver.draft, meta_seg->pkg_name); }else { -ice_debug (hw,ICE_DBG_INIT , -"Did not find metadata segment in driver package\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Did not find metadata segment in driver package\n" );return ICE_ERR_CFG ; }
@@ -1115,8 +1111,7 @@ ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) seg_hdr->seg_format_ver.draft, seg_hdr->seg_id); }else { -ice_debug (hw,ICE_DBG_INIT , -"Did not find ice segment in driver package\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Did not find ice segment in driver package\n" );return ICE_ERR_CFG ; }
@@ -1339,8 +1334,7 @@ ice_chk_pkg_compat(struct ice_hw *hw, struct ice_pkg_hdr *ospkg, (*seg)->hdr.seg_format_ver.minor > pkg->pkg_info[i].ver.minor) { status =ICE_ERR_FW_DDP_MISMATCH ; -ice_debug (hw,ICE_DBG_INIT , -"OS package is not compatible with NVM.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"OS package is not compatible with NVM.\n" ); }/* done processing NVM package so break */ break ;
@@ -1408,8 +1402,7 @@ enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)ice_init_pkg_hints (hw, seg); status =ice_download_pkg (hw, seg);if (status ==ICE_ERR_AQ_NO_WORK ) { -ice_debug (hw,ICE_DBG_INIT , -"package previously loaded - no work.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"package previously loaded - no work.\n" ); status =ICE_SUCCESS ; }
@@ -4059,8 +4052,7 @@ ice_has_prof_vsig(struct ice_hw *hw, enum ice_block blk, u16 vsig, u64 hdl)if (ent->profile_cookie == hdl)return true; -ice_debug (hw,ICE_DBG_INIT , -"Characteristic list for VSI group %d not found.\n" , +ice_debug (hw,ICE_DBG_INIT ,"Characteristic list for VSI group %d not found.\n" , vsig);return false; }
@@ -5372,8 +5364,7 @@ ice_adj_prof_priorities(struct ice_hw *hw, enum ice_block blk, u16 vsig,if (attr_used_cnt <ICE_MAX_PTG_ATTRS ) attr_used[attr_used_cnt++] = &t->tcam[i];else -ice_debug (hw,ICE_DBG_INIT , -"Warn: ICE_MAX_PTG_ATTRS exceeded\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Warn: ICE_MAX_PTG_ATTRS exceeded\n" ); } }
drivers/net/ice/base/ice_flow.c +3 -6
@@ -1856,8 +1856,7 @@ ice_flow_add_prof_sync(struct ice_hw *hw, enum ice_block blk, status =ice_flow_proc_segs (hw, params);if (status) { -ice_debug (hw,ICE_DBG_FLOW , -"Error processing a flow's packet segments\n" ); +ice_debug (hw,ICE_DBG_FLOW ,"Error processing a flow's packet segments\n" ); goto out; }
@@ -2106,8 +2105,7 @@ ice_flow_assoc_prof(struct ice_hw *hw, enum ice_block blk,if (!status)ice_set_bit (vsi_handle, prof->vsis);else -ice_debug (hw,ICE_DBG_FLOW , -"HW profile add failed, %d\n" , +ice_debug (hw,ICE_DBG_FLOW ,"HW profile add failed, %d\n" , status); }
@@ -2138,8 +2136,7 @@ ice_flow_disassoc_prof(struct ice_hw *hw, enum ice_block blk,if (!status)ice_clear_bit (vsi_handle, prof->vsis);else -ice_debug (hw,ICE_DBG_FLOW , -"HW profile remove failed, %d\n" , +ice_debug (hw,ICE_DBG_FLOW ,"HW profile remove failed, %d\n" , status); }
drivers/net/ice/base/ice_nvm.c +10 -20
@@ -78,8 +78,7 @@ ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,/* Verify the length of the read if this is for the Shadow RAM */ if (read_shadow_ram && ((offset + inlen) > (hw->nvm.sr_words *2u ))) { -ice_debug (hw,ICE_DBG_NVM , -"NVM error: requested data is beyond Shadow RAM limit\n" ); +ice_debug (hw,ICE_DBG_NVM ,"NVM error: requested data is beyond Shadow RAM limit\n" );return ICE_ERR_PARAM ; }
@@ -340,16 +339,14 @@ ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size)*/ pba_size--;if (pba_num_size < (((u32 )pba_size *2 ) +1 )) { -ice_debug (hw,ICE_DBG_INIT , -"Buffer too small for PBA data.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Buffer too small for PBA data.\n" );return ICE_ERR_PARAM ; }for (i =0 ; i < pba_size; i++) { status =ice_read_sr_word (hw, (pba_tlv +2 +1 ) + i, &pba_word);if (status !=ICE_SUCCESS ) { -ice_debug (hw,ICE_DBG_INIT , -"Failed to read PBA Block word %d.\n" , i); +ice_debug (hw,ICE_DBG_INIT ,"Failed to read PBA Block word %d.\n" , i);return status; }
@@ -378,8 +375,7 @@ static enum ice_status ice_get_orom_ver_info(struct ice_hw *hw) status =ice_get_pfa_module_tlv (hw, &boot_cfg_tlv, &boot_cfg_tlv_len,ICE_SR_BOOT_CFG_PTR );if (status) { -ice_debug (hw,ICE_DBG_INIT , -"Failed to read Boot Configuration Block TLV.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Failed to read Boot Configuration Block TLV.\n" );return status; }
@@ -387,8 +383,7 @@ static enum ice_status ice_get_orom_ver_info(struct ice_hw *hw)* (Combo Image Version High and Combo Image Version Low) */ if (boot_cfg_tlv_len <2 ) { -ice_debug (hw,ICE_DBG_INIT , -"Invalid Boot Configuration Block TLV size.\n" ); +ice_debug (hw,ICE_DBG_INIT ,"Invalid Boot Configuration Block TLV size.\n" );return ICE_ERR_INVAL_SIZE ; }
@@ -444,14 +439,12 @@ static enum ice_status ice_discover_flash_size(struct ice_hw *hw) status =ice_read_flat_nvm (hw, offset, &len, &data, false);if (status ==ICE_ERR_AQ_ERROR && hw->adminq.sq_last_status ==ICE_AQ_RC_EINVAL ) { -ice_debug (hw,ICE_DBG_NVM , -"%s: New upper bound of %u bytes\n" , +ice_debug (hw,ICE_DBG_NVM ,"%s: New upper bound of %u bytes\n" , __func__, offset); status =ICE_SUCCESS ; max_size = offset; }else if (!status) { -ice_debug (hw,ICE_DBG_NVM , -"%s: New lower bound of %u bytes\n" , +ice_debug (hw,ICE_DBG_NVM ,"%s: New lower bound of %u bytes\n" , __func__, offset); min_size = offset; }else {
@@ -460,8 +453,7 @@ static enum ice_status ice_discover_flash_size(struct ice_hw *hw) } } -ice_debug (hw,ICE_DBG_NVM , -"Predicted flash size is %u bytes\n" , max_size); +ice_debug (hw,ICE_DBG_NVM ,"Predicted flash size is %u bytes\n" , max_size); hw->nvm.flash_size = max_size;
@@ -504,8 +496,7 @@ enum ice_status ice_init_nvm(struct ice_hw *hw) }else {/* Blank programming mode */ nvm->blank_nvm_mode = true; -ice_debug (hw,ICE_DBG_NVM , -"NVM init error: unsupported blank mode.\n" ); +ice_debug (hw,ICE_DBG_NVM ,"NVM init error: unsupported blank mode.\n" );return ICE_ERR_NVM_BLANK_MODE ; }
@@ -805,8 +796,7 @@ ice_nvm_access_write(struct ice_hw *hw, struct ice_nvm_access_cmd *cmd,break ; } -ice_debug (hw,ICE_DBG_NVM , -"NVM access: writing register %08x with value %08x\n" , +ice_debug (hw,ICE_DBG_NVM ,"NVM access: writing register %08x with value %08x\n" , cmd->offset, data->regval);/* Write the data field to the specified register */
drivers/net/ice/base/ice_sched.c +8 -16
@@ -165,8 +165,7 @@ ice_sched_add_node(struct ice_port_info *pi, u8 layer, parent =ice_sched_find_node_by_teid (pi->root,LE32_TO_CPU (info->parent_teid));if (!parent) { -ice_debug (hw,ICE_DBG_SCHED , -"Parent Node not found for parent_teid=0x%x\n" , +ice_debug (hw,ICE_DBG_SCHED ,"Parent Node not found for parent_teid=0x%x\n" ,LE32_TO_CPU (info->parent_teid));return ICE_ERR_PARAM ; }
@@ -742,8 +741,7 @@ static void ice_sched_clear_rl_prof(struct ice_port_info *pi) rl_prof_elem->prof_id_ref =0 ; status =ice_sched_del_rl_profile (hw, rl_prof_elem);if (status) { -ice_debug (hw,ICE_DBG_SCHED , -"Remove rl profile failed\n" ); +ice_debug (hw,ICE_DBG_SCHED ,"Remove rl profile failed\n" );/* On error, free mem required */ LIST_DEL (&rl_prof_elem->list_entry);ice_free (hw, rl_prof_elem);
@@ -930,8 +928,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,for (i =0 ; i < num_nodes; i++) { status =ice_sched_add_node (pi, layer, &buf->generic[i]);if (status !=ICE_SUCCESS ) { -ice_debug (hw,ICE_DBG_SCHED , -"add nodes in SW DB failed status =%d\n" , +ice_debug (hw,ICE_DBG_SCHED ,"add nodes in SW DB failed status =%d\n" , status);break ; }
@@ -939,8 +936,7 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node, teid =LE32_TO_CPU (buf->generic[i].node_teid); new_node =ice_sched_find_node_by_teid (parent, teid);if (!new_node) { -ice_debug (hw,ICE_DBG_SCHED , -"Node is missing for teid =%d\n" , teid); +ice_debug (hw,ICE_DBG_SCHED ,"Node is missing for teid =%d\n" , teid);break ; }
@@ -1297,8 +1293,7 @@ struct ice_sched_node *ice_sched_get_node(struct ice_port_info *pi, u32 teid)ice_release_lock (&pi->sched_lock);if (!node) -ice_debug (pi->hw,ICE_DBG_SCHED , -"Node not found for teid=0x%x\n" , teid); +ice_debug (pi->hw,ICE_DBG_SCHED ,"Node not found for teid=0x%x\n" , teid);return node; }
@@ -2048,8 +2043,7 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)continue ;if (ice_sched_is_leaf_node_present (vsi_node)) { -ice_debug (pi->hw,ICE_DBG_SCHED , -"VSI has leaf nodes in TC %d\n" , i); +ice_debug (pi->hw,ICE_DBG_SCHED ,"VSI has leaf nodes in TC %d\n" , i); status =ICE_ERR_IN_USE ; goto exit_sched_rm_vsi_cfg; }
@@ -2891,8 +2885,7 @@ static void ice_sched_rm_unused_rl_prof(struct ice_port_info *pi) &pi->rl_prof_list[ln], ice_aqc_rl_profile_info, list_entry) {if (!ice_sched_del_rl_profile (pi->hw, rl_prof_elem)) -ice_debug (pi->hw,ICE_DBG_SCHED , -"Removed rl profile\n" ); +ice_debug (pi->hw,ICE_DBG_SCHED ,"Removed rl profile\n" ); } } }
@@ -4143,8 +4136,7 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type,/* Remove old profile ID from database */ status =ice_sched_del_rl_profile (pi->hw, rl_prof_elem);if (status && status !=ICE_ERR_IN_USE ) -ice_debug (pi->hw,ICE_DBG_SCHED , -"Remove rl profile failed\n" ); +ice_debug (pi->hw,ICE_DBG_SCHED ,"Remove rl profile failed\n" );break ; }if (status ==ICE_ERR_IN_USE )
drivers/net/ice/base/ice_switch.c +13 -26
@@ -1823,8 +1823,7 @@ enum ice_status ice_free_sw(struct ice_hw *hw, u16 sw_id, u16 counter_id) status =ice_aq_alloc_free_res (hw,1 , counter_buf, buf_len, ice_aqc_opc_free_res,NULL );if (status) { -ice_debug (hw,ICE_DBG_SW , -"VEB counter resource could not be freed\n" ); +ice_debug (hw,ICE_DBG_SW ,"VEB counter resource could not be freed\n" ); ret_status = status; }
@@ -2218,8 +2217,7 @@ ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,return ICE_ERR_PARAM ;break ;default : -ice_debug (hw,ICE_DBG_SW , -"Error due to unsupported rule_type %u\n" , rule_type); +ice_debug (hw,ICE_DBG_SW ,"Error due to unsupported rule_type %u\n" , rule_type);return ICE_ERR_OUT_OF_RANGE ; }
@@ -2241,8 +2239,7 @@ ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,* than ICE_MAX_VSI, if not return with error. */ if (id >=ICE_MAX_VSI ) { -ice_debug (hw,ICE_DBG_SW , -"Error VSI index (%u) out-of-range\n" , +ice_debug (hw,ICE_DBG_SW ,"Error VSI index (%u) out-of-range\n" , id);ice_free (hw, mr_list);return ICE_ERR_OUT_OF_RANGE ;
@@ -2649,8 +2646,7 @@ ice_init_port_info(struct ice_port_info *pi, u16 vsi_port_num, u8 type, pi->dflt_rx_vsi_num =ICE_DFLT_VSI_INVAL ;break ;default : -ice_debug (pi->hw,ICE_DBG_SW , -"incorrect VSI/port type received\n" ); +ice_debug (pi->hw,ICE_DBG_SW ,"incorrect VSI/port type received\n" );break ; } }
@@ -2714,8 +2710,7 @@ enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw)case ICE_AQC_GET_SW_CONF_RESP_PHYS_PORT :case ICE_AQC_GET_SW_CONF_RESP_VIRT_PORT :if (j == num_total_ports) { -ice_debug (hw,ICE_DBG_SW , -"more ports than expected\n" ); +ice_debug (hw,ICE_DBG_SW ,"more ports than expected\n" ); status =ICE_ERR_CFG ; goto out; }
@@ -3709,8 +3704,7 @@ ice_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle, tmp_fltr_info.vsi_handle = rem_vsi_handle; status =ice_update_pkt_fwd_rule (hw, &tmp_fltr_info);if (status) { -ice_debug (hw,ICE_DBG_SW , -"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n" , +ice_debug (hw,ICE_DBG_SW ,"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n" , tmp_fltr_info.fwd_id.hw_vsi_id, status);return status; }
@@ -3726,8 +3720,7 @@ ice_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,/* Remove the VSI list since it is no longer used */ status =ice_remove_vsi_list_rule (hw, vsi_list_id, lkup_type);if (status) { -ice_debug (hw,ICE_DBG_SW , -"Failed to remove VSI list %d, error %d\n" , +ice_debug (hw,ICE_DBG_SW ,"Failed to remove VSI list %d, error %d\n" , vsi_list_id, status);return status; }
@@ -4188,8 +4181,7 @@ ice_add_vlan_internal(struct ice_hw *hw, struct ice_sw_recipe *recp_list,*/ if (v_list_itr->vsi_count >1 && v_list_itr->vsi_list_info->ref_cnt >1 ) { -ice_debug (hw,ICE_DBG_SW , -"Invalid configuration: Optimization to reuse VSI list with more than one VSI is not being done yet\n" ); +ice_debug (hw,ICE_DBG_SW ,"Invalid configuration: Optimization to reuse VSI list with more than one VSI is not being done yet\n" ); status =ICE_ERR_CFG ; goto exit; }
@@ -5403,8 +5395,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,ice_remove_eth_mac (hw, &remove_list_head);break ;case ICE_SW_LKUP_DFLT : -ice_debug (hw,ICE_DBG_SW , -"Remove filters for this lookup type hasn't been implemented yet\n" ); +ice_debug (hw,ICE_DBG_SW ,"Remove filters for this lookup type hasn't been implemented yet\n" );break ;case ICE_SW_LKUP_LAST :ice_debug (hw,ICE_DBG_SW ,"Unsupported lookup type\n" );
@@ -5526,8 +5517,7 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, status =ice_aq_alloc_free_res (hw,1 , buf, buf_len, ice_aqc_opc_free_res,NULL );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" );ice_free (hw, buf);return status;
@@ -6306,8 +6296,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,* that can be used. */ if (chain_idx >=ICE_MAX_FV_WORDS ) { -ice_debug (hw,ICE_DBG_SW , -"No chain index available\n" ); +ice_debug (hw,ICE_DBG_SW ,"No chain index available\n" ); status =ICE_ERR_MAX_LIMIT ; goto err_unroll; }
@@ -7948,8 +7937,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,*/ status =ice_update_pkt_fwd_rule (hw, &tmp_fltr);if (status) { -ice_debug (hw,ICE_DBG_SW , -"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n" , +ice_debug (hw,ICE_DBG_SW ,"Failed to update pkt fwd rule to FWD_TO_VSI on HW VSI %d, error %d\n" , tmp_fltr.fwd_id.hw_vsi_id, status);return status; }
@@ -7958,8 +7946,7 @@ ice_adv_rem_update_vsi_list(struct ice_hw *hw, u16 vsi_handle,/* Remove the VSI list since it is no longer used */ status =ice_remove_vsi_list_rule (hw, vsi_list_id, lkup_type);if (status) { -ice_debug (hw,ICE_DBG_SW , -"Failed to remove VSI list %d, error %d\n" , +ice_debug (hw,ICE_DBG_SW ,"Failed to remove VSI list %d, error %d\n" , vsi_list_id, status);return status; }
Signature · 1 line
2.13.6
PATCH v2 18/40 net/ice/base: introduce Tx rate limiting on port level
In reply to Qi ZhangThe PSM Configuration has a Rate Limiter for each associated switch port based on its relative speed from the total BW of switch ports connected to LAN controller. The rate limiters will be dynamic get readjusted if switch port speeds are changed at the root node layer of the scheduler tree. Adding a function to directly modify the EIR of root node.
--- drivers/net/ice/base/ice_common.c | 5 +++++ drivers/net/ice/base/ice_common.h | 1 + drivers/net/ice/base/ice_sched.c | 20 ++++++++++++++++++++ drivers/net/ice/base/ice_type.h | 1 + 4 files changed, 27 insertions(+)
drivers/net/ice/base/ice_common.c +5 -0
@@ -4382,6 +4382,7 @@ static bool ice_is_main_vsi(struct ice_hw *hw, u16 vsi_handle)static enum ice_status ice_replay_pre_init (struct ice_hw *hw,struct ice_switch_info *sw) { +enum ice_status status;u8 i;/* Delete old entries from replay filter list head if there is any */
@@ -4395,6 +4396,10 @@ ice_replay_pre_init(struct ice_hw *hw, struct ice_switch_info *sw) &sw->recp_list[i].filt_replay_rules);ice_sched_replay_agg_vsi_preinit (hw); + status =ice_sched_replay_root_node_bw (hw->port_info); +if (status) +return status; +return ice_sched_replay_tc_node_bw (hw->port_info); }
drivers/net/ice/base/ice_common.h +1 -0
@@ -202,6 +202,7 @@ void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw);void ice_sched_replay_agg (struct ice_hw *hw);enum ice_status ice_sched_replay_tc_node_bw (struct ice_port_info *pi);enum ice_status ice_replay_vsi_agg (struct ice_hw *hw,u16 vsi_handle); +enum ice_status ice_sched_replay_root_node_bw (struct ice_port_info *pi);enum ice_status ice_sched_replay_q_bw (struct ice_port_info *pi,struct ice_q_ctx *q_ctx); struct ice_q_ctx *
drivers/net/ice/base/ice_sched.c +20 -0
@@ -5382,6 +5382,26 @@ void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw) }/** +* ice_sched_replay_root_node_bw - replay root node BW +* @pi: port information structure +* +* Replay root node BW settings. +*/ +enum ice_status ice_sched_replay_root_node_bw (struct ice_port_info *pi) +{ +enum ice_status status =ICE_SUCCESS ; + +if (!pi->hw) +return ICE_ERR_PARAM ; +ice_acquire_lock (&pi->sched_lock); + + status =ice_sched_replay_node_bw (pi->hw, pi->root, + &pi->root_node_bw_t_info); +ice_release_lock (&pi->sched_lock); +return status; +} + +/** * ice_sched_replay_tc_node_bw - replay TC node(s) BW * @pi: port information structure *
drivers/net/ice/base/ice_type.h +1 -0
@@ -776,6 +776,7 @@ struct ice_port_info { sib_head[ICE_MAX_TRAFFIC_CLASS ][ICE_AQC_TOPO_MAX_LEVEL_NUM ];/* List contain profile ID(s) and other params per layer */ struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM ]; +struct ice_bw_type_info root_node_bw_t_info;struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS ];struct ice_dcbx_cfg local_dcbx_cfg;/* Oper/Local Cfg */ /* DCBX info */
Signature · 1 line
2.13.6
PATCH v2 19/40 net/ice/base: reduce profile to recip info get from firmware
In reply to Qi ZhangOnly need to get profile_to_recip info from firmware for profiles used by switch, no need for other free profile in order that we can reduce the time consumed when download a switch rule.
--- drivers/net/ice/base/ice_flex_pipe.c | 115 +++++++++++++++++++++++++---------- drivers/net/ice/base/ice_switch.c | 2 +- drivers/net/ice/base/ice_type.h | 1 + 3 files changed, 85 insertions(+), 33 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +83 -32
@@ -1345,6 +1345,88 @@ ice_chk_pkg_compat(struct ice_hw *hw, struct ice_pkg_hdr *ospkg, }/** +* ice_sw_fv_handler +* @sect_type: section type +* @section: pointer to section +* @index: index of the field vector entry to be returned +* @offset: ptr to variable that receives the offset in the field vector table +* +* This is a callback function that can be passed to ice_pkg_enum_entry. +* This function treats the given section as of type ice_sw_fv_section and +* enumerates offset field. "offset" is an index into the field vector table. +*/ +static void * +ice_sw_fv_handler (u32 sect_type,void *section,u32 index,u32 *offset) +{ +struct ice_sw_fv_section *fv_section = + (struct ice_sw_fv_section *)section; + +if (!section || sect_type !=ICE_SID_FLD_VEC_SW ) +return NULL ; +if (index >=LE16_TO_CPU (fv_section->count)) +return NULL ; +if (offset) +/* "index" passed in to this function is relative to a given +* 4k block. To get to the true index into the field vector +* table need to add the relative index to the base_offset +* field of this section +*/ + *offset =LE16_TO_CPU (fv_section->base_offset) + index; +return fv_section->fv + index; +} + +/** +* ice_get_prof_index_max - get the max profile index for used profile +* @hw: pointer to the HW struct +* +* Calling this function will get the max profile index for used profile +* and store the index number in struct ice_switch_info *switch_info +* in hw for following use. +*/ +static int ice_get_prof_index_max (struct ice_hw *hw) +{ +u16 prof_index =0 , j, max_prof_index =0 ; +struct ice_pkg_enum state; +struct ice_seg *ice_seg; +bool flag = false; +struct ice_fv *fv; +u32 offset; + +ice_memset (&state,0 ,sizeof (state),ICE_NONDMA_MEM ); + +if (!hw->seg) +return ICE_ERR_PARAM ; + + ice_seg = hw->seg; + +do { + fv = (struct ice_fv *) +ice_pkg_enum_entry (ice_seg, &state,ICE_SID_FLD_VEC_SW , + &offset, ice_sw_fv_handler); +if (!fv) +break ; + ice_seg =NULL ; + +/* in the profile that not be used, the prot_id is set to 0xff +* and the off is set to 0x1ff for all the field vectors. +*/ +for (j =0 ; j < hw->blk[ICE_BLK_SW ].es.fvw; j++) +if (fv->ew[j].prot_id !=ICE_PROT_INVALID || + fv->ew[j].off !=ICE_FV_OFFSET_INVAL ) + flag = true; +if (flag && prof_index > max_prof_index) + max_prof_index = prof_index; + + prof_index++; + flag = false; + }while (fv); + + hw->switch_info->max_used_prof_index = max_prof_index; + +return ICE_SUCCESS ; +} + +/** * ice_init_pkg - initialize/download package * @hw: pointer to the hardware structure * @buf: pointer to the package buffer
@@ -1423,6 +1505,7 @@ enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)*/ ice_init_pkg_regs (hw);ice_fill_blk_tbls (hw); +ice_get_prof_index_max (hw); }else {ice_debug (hw,ICE_DBG_INIT ,"package load failed, %d\n" , status);
@@ -1500,38 +1583,6 @@ static struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw) }/** -* ice_sw_fv_handler -* @sect_type: section type -* @section: pointer to section -* @index: index of the field vector entry to be returned -* @offset: ptr to variable that receives the offset in the field vector table -* -* This is a callback function that can be passed to ice_pkg_enum_entry. -* This function treats the given section as of type ice_sw_fv_section and -* enumerates offset field. "offset" is an index into the field vector -* vector table. -*/ -static void * -ice_sw_fv_handler (u32 sect_type,void *section,u32 index,u32 *offset) -{ -struct ice_sw_fv_section *fv_section = - (struct ice_sw_fv_section *)section; - -if (!section || sect_type !=ICE_SID_FLD_VEC_SW ) -return NULL ; -if (index >=LE16_TO_CPU (fv_section->count)) -return NULL ; -if (offset) -/* "index" passed in to this function is relative to a given -* 4k block. To get to the true index into the field vector -* table need to add the relative index to the base_offset -* field of this section -*/ - *offset =LE16_TO_CPU (fv_section->base_offset) + index; -return fv_section->fv + index; -} - -/** * ice_get_sw_prof_type - determine switch profile type * @hw: pointer to the HW structure * @fv: pointer to the switch field vector
drivers/net/ice/base/ice_switch.c +1 -1
@@ -1591,7 +1591,7 @@ static void ice_get_recp_to_prof_map(struct ice_hw *hw)ice_declare_bitmap (r_bitmap,ICE_MAX_NUM_RECIPES );u16 i; -for (i =0 ; i <ICE_MAX_NUM_PROFILES ; i++) { +for (i =0 ; i < hw->switch_info->max_used_prof_index +1 ; i++) {u16 j;ice_zero_bitmap (profile_to_recipe[i],ICE_MAX_NUM_RECIPES );
drivers/net/ice/base/ice_type.h +1 -0
@@ -792,6 +792,7 @@ struct ice_switch_info {struct LIST_HEAD_TYPE vsi_list_map_head;struct ice_sw_recipe *recp_list;u16 prof_res_bm_init; +u16 max_used_prof_index;ice_declare_bitmap (prof_res_bm[ICE_MAX_NUM_PROFILES ],ICE_MAX_FV_WORDS ); };
Signature · 1 line
2.13.6
PATCH v2 20/40 net/ice/base: refactor DCB related variables
In reply to Qi ZhangIn this patch, the DCB related variables will be refactored out of the ice_port_info_struct. The goal is to make the ice_port_info struct cleaner.
--- drivers/net/ice/base/ice_dcb.c | 40 ++++++++++++++++++++-------------------- drivers/net/ice/base/ice_type.h | 16 +++++++++------- 2 files changed, 29 insertions(+), 27 deletions(-)
drivers/net/ice/base/ice_dcb.c +20 -20
@@ -850,9 +850,9 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode)return ICE_ERR_PARAM ;if (dcbx_mode ==ICE_DCBX_MODE_IEEE ) - dcbx_cfg = &pi->local_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg;else if (dcbx_mode ==ICE_DCBX_MODE_CEE ) - dcbx_cfg = &pi->desired_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.desired_dcbx_cfg;/* Get Local DCB Config in case of ICE_DCBX_MODE_IEEE * or get CEE DCB Desired Config in case of ICE_DCBX_MODE_CEE
@@ -863,7 +863,7 @@ ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode) goto out;/* Get Remote DCB Config */ - dcbx_cfg = &pi->remote_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.remote_dcbx_cfg; ret =ice_aq_get_dcb_cfg (pi->hw,ICE_AQ_LLDP_MIB_REMOTE ,ICE_AQ_LLDP_BRID_TYPE_NEAREST_BRID , dcbx_cfg);/* Don't treat ENOENT as an error for Remote MIBs */
@@ -892,14 +892,14 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) ret =ice_aq_get_cee_dcb_cfg (pi->hw, &cee_cfg,NULL );if (ret ==ICE_SUCCESS ) {/* CEE mode */ - dcbx_cfg = &pi->local_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; dcbx_cfg->dcbx_mode =ICE_DCBX_MODE_CEE ; dcbx_cfg->tlv_status =LE32_TO_CPU (cee_cfg.tlv_status);ice_cee_to_dcb_cfg (&cee_cfg, dcbx_cfg); ret =ice_get_ieee_or_cee_dcb_cfg (pi,ICE_DCBX_MODE_CEE ); }else if (pi->hw->adminq.sq_last_status ==ICE_AQ_RC_ENOENT ) {/* CEE mode not enabled try querying IEEE data */ - dcbx_cfg = &pi->local_dcbx_cfg; + dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; dcbx_cfg->dcbx_mode =ICE_DCBX_MODE_IEEE ; ret =ice_get_ieee_or_cee_dcb_cfg (pi,ICE_DCBX_MODE_IEEE ); }
@@ -916,26 +916,26 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi)*/ enum ice_status ice_init_dcb (struct ice_hw *hw,bool enable_mib_change) { -struct ice_port_info *pi = hw->port_info; +struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;enum ice_status ret =ICE_SUCCESS ;if (!hw->func_caps.common_cap.dcb)return ICE_ERR_NOT_SUPPORTED ; - pi->is_sw_lldp = true; + qos_cfg->is_sw_lldp = true;/* Get DCBX status */ - pi->dcbx_status =ice_get_dcbx_status (hw); + qos_cfg->dcbx_status =ice_get_dcbx_status (hw); -if (pi->dcbx_status ==ICE_DCBX_STATUS_DONE || - pi->dcbx_status ==ICE_DCBX_STATUS_IN_PROGRESS || - pi->dcbx_status ==ICE_DCBX_STATUS_NOT_STARTED ) { +if (qos_cfg->dcbx_status ==ICE_DCBX_STATUS_DONE || + qos_cfg->dcbx_status ==ICE_DCBX_STATUS_IN_PROGRESS || + qos_cfg->dcbx_status ==ICE_DCBX_STATUS_NOT_STARTED ) {/* Get current DCBX configuration */ - ret =ice_get_dcb_cfg (pi); + ret =ice_get_dcb_cfg (hw->port_info);if (ret)return ret; - pi->is_sw_lldp = false; - }else if (pi->dcbx_status ==ICE_DCBX_STATUS_DIS ) { + qos_cfg->is_sw_lldp = false; + }else if (qos_cfg->dcbx_status ==ICE_DCBX_STATUS_DIS ) {return ICE_ERR_NOT_READY ; }
@@ -943,7 +943,7 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)if (enable_mib_change) { ret =ice_aq_cfg_lldp_mib_change (hw, true,NULL );if (ret) - pi->is_sw_lldp = true; + qos_cfg->is_sw_lldp = true; }return ret;
@@ -958,21 +958,21 @@ enum ice_status ice_init_dcb(struct ice_hw *hw, bool enable_mib_change)*/ enum ice_status ice_cfg_lldp_mib_change (struct ice_hw *hw,bool ena_mib) { -struct ice_port_info *pi = hw->port_info; +struct ice_qos_cfg *qos_cfg = &hw->port_info->qos_cfg;enum ice_status ret;if (!hw->func_caps.common_cap.dcb)return ICE_ERR_NOT_SUPPORTED ;/* Get DCBX status */ - pi->dcbx_status =ice_get_dcbx_status (hw); + qos_cfg->dcbx_status =ice_get_dcbx_status (hw); -if (pi->dcbx_status ==ICE_DCBX_STATUS_DIS ) +if (qos_cfg->dcbx_status ==ICE_DCBX_STATUS_DIS )return ICE_ERR_NOT_READY ; ret =ice_aq_cfg_lldp_mib_change (hw, ena_mib,NULL );if (!ret) - pi->is_sw_lldp = !ena_mib; + qos_cfg->is_sw_lldp = !ena_mib;return ret; }
@@ -1269,7 +1269,7 @@ enum ice_status ice_set_dcb_cfg(struct ice_port_info *pi) hw = pi->hw;/* update the HW local config */ - dcbcfg = &pi->local_dcbx_cfg; + dcbcfg = &pi->qos_cfg.local_dcbx_cfg;/* Allocate the LLDPDU */ lldpmib = (u8 *)ice_malloc (hw,ICE_LLDPDU_SIZE );if (!lldpmib)
drivers/net/ice/base/ice_type.h +9 -7
@@ -753,6 +753,14 @@ struct ice_dcbx_cfg {#define ICE_DCBX_APPS_NON_WILLING 0x1 }; +struct ice_qos_cfg { +struct ice_dcbx_cfg local_dcbx_cfg;/* Oper/Local Cfg */ +struct ice_dcbx_cfg desired_dcbx_cfg;/* CEE Desired Cfg */ +struct ice_dcbx_cfg remote_dcbx_cfg;/* Peer Cfg */ +u8 dcbx_status :3 ;/* see ICE_DCBX_STATUS_DIS */ +u8 is_sw_lldp :1 ; +}; +struct ice_port_info {struct ice_sched_node *root;/* Root Node per Port */ struct ice_hw *hw;/* back pointer to HW instance */
@@ -778,13 +786,7 @@ struct ice_port_info {struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM ];struct ice_bw_type_info root_node_bw_t_info;struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS ]; -struct ice_dcbx_cfg local_dcbx_cfg;/* Oper/Local Cfg */ -/* DCBX info */ -struct ice_dcbx_cfg remote_dcbx_cfg;/* Peer Cfg */ -struct ice_dcbx_cfg desired_dcbx_cfg;/* CEE Desired Cfg */ -/* LLDP/DCBX Status */ - u8 dcbx_status:3; /* see ICE_DCBX_STATUS_DIS */ - u8 is_sw_lldp:1; +struct ice_qos_cfg qos_cfg; u8 is_vf:1; };
Signature · 1 line
2.13.6
PATCH v2 21/40 net/ice/base: support outer IP filter for GTPC
In reply to Qi ZhangAdd ptype MAC_IPV4_GTPC_TEID and MAC_IPV4_GTPC into ice_ptypes_ipv4_ofos, ice_ptypes_ipv4_ofos_all and ice_ipv4_ofos_no_l4
Add ptype MAC_IPV6_GTPC_TEID and MAC_IPV6_GTPC into ice_ptypes_ipv6_ofos, ice_ptypes_ipv6_ofos_all and ice_ipv6_ofos_no_l4
So outer IP can be configured as input set for GTPC packet.
Also add MAC_IPV4_GTPC_TEID and MAC_IPV6_GTPC_TEID into ice_ptypes_gtpc, so when ICE_FLOW_SEG_HDR_GTPC is requested, it can take effect on all GTPC packets (with or without TEID).
--- drivers/net/ice/base/ice_flow.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_flow.c +7 -7
@@ -224,7 +224,7 @@ static const u32 ice_ptypes_macvlan_il[] = {static const u32 ice_ptypes_ipv4_ofos[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000FC000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x000FC000 ,0x000000A0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -238,7 +238,7 @@ static const u32 ice_ptypes_ipv4_ofos[] = {static const u32 ice_ptypes_ipv4_ofos_all[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000FC000 ,0x83E0F800 ,0x00000101 , +0x00000000 ,0x000FC000 ,0x83E0F8A0 ,0x00000101 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -264,7 +264,7 @@ static const u32 ice_ptypes_ipv4_il[] = {static const u32 ice_ptypes_ipv6_ofos[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , -0x00000000 ,0x03F00000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x03F00000 ,0x00000140 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -278,7 +278,7 @@ static const u32 ice_ptypes_ipv6_ofos[] = {static const u32 ice_ptypes_ipv6_ofos_all[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , -0x00000000 ,0x03F00000 ,0x7C1F0000 ,0x00000206 , +0x00000000 ,0x03F00000 ,0x7C1F0140 ,0x00000206 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -302,7 +302,7 @@ static const u32 ice_ptypes_ipv6_il[] = {static const u32 ice_ipv4_ofos_no_l4[] = {0x10C00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000cc000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x000cc000 ,0x000000A0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -326,7 +326,7 @@ static const u32 ice_ipv4_il_no_l4[] = {static const u32 ice_ipv6_ofos_no_l4[] = {0x00000000 ,0x00000000 ,0x43000000 ,0x10002000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x02300000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x02300000 ,0x00000140 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -448,7 +448,7 @@ static const u32 ice_ptypes_mac_il[] = {static const u32 ice_ptypes_gtpc[] = {0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000180 ,0x00000000 , +0x00000000 ,0x00000000 ,0x000001E0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
Signature · 1 line
2.13.6
PATCH v2 22/40 net/ice/base: support outer IP filter for GTPU without inner IP
In reply to Qi ZhangAdd ptype MAC_IPV4_GTPU intoice_ptypes_ipv4_ofos, ice_ptypes_ipv4_ofos_all and ice_ipv4_ofos_no_l4
Add ptype MAC_IPV6_GTPU intoice_ptypes_ipv6_ofos, ice_ptypes_ipv6_ofos_all and ice_ipv6_ofos_no_l4
Add ptype MAC_IPV4_GTPU and MAC_IPV6_GTPU into
the new ice_ptypes_gtpu_no_ip
So outer IP can be configured as input set for GTPU packet that without inner IP layer.
--- drivers/net/ice/base/ice_flow.c | 29 ++++++++++++++++++++++------- drivers/net/ice/base/ice_flow.h | 1 + 2 files changed, 23 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_flow.c +22 -7
@@ -224,7 +224,7 @@ static const u32 ice_ptypes_macvlan_il[] = {static const u32 ice_ptypes_ipv4_ofos[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000FC000 ,0x000000A0 ,0x00000000 , +0x00000000 ,0x000FC000 ,0x000002A0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -238,7 +238,7 @@ static const u32 ice_ptypes_ipv4_ofos[] = {static const u32 ice_ptypes_ipv4_ofos_all[] = {0x1DC00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000155 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000FC000 ,0x83E0F8A0 ,0x00000101 , +0x00000000 ,0x000FC000 ,0x83E0FAA0 ,0x00000101 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -264,7 +264,7 @@ static const u32 ice_ptypes_ipv4_il[] = {static const u32 ice_ptypes_ipv6_ofos[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , -0x00000000 ,0x03F00000 ,0x00000140 ,0x00000000 , +0x00000000 ,0x03F00000 ,0x00000540 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -278,7 +278,7 @@ static const u32 ice_ptypes_ipv6_ofos[] = {static const u32 ice_ptypes_ipv6_ofos_all[] = {0x00000000 ,0x00000000 ,0x77000000 ,0x10002000 ,0x00000000 ,0x000002AA ,0x00000000 ,0x00000000 , -0x00000000 ,0x03F00000 ,0x7C1F0140 ,0x00000206 , +0x00000000 ,0x03F00000 ,0x7C1F0540 ,0x00000206 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -302,7 +302,7 @@ static const u32 ice_ptypes_ipv6_il[] = {static const u32 ice_ipv4_ofos_no_l4[] = {0x10C00000 ,0x04000800 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x000cc000 ,0x000000A0 ,0x00000000 , +0x00000000 ,0x000cc000 ,0x000002A0 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -326,7 +326,7 @@ static const u32 ice_ipv4_il_no_l4[] = {static const u32 ice_ipv6_ofos_no_l4[] = {0x00000000 ,0x00000000 ,0x43000000 ,0x10002000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x02300000 ,0x00000140 ,0x00000000 , +0x00000000 ,0x02300000 ,0x00000540 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -667,6 +667,17 @@ static const u32 ice_ptypes_mac_non_ip_ofos[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +static const u32 ice_ptypes_gtpu_no_ip[] = { +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000600 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , +}; +/* Manage parameters and info. used during the creation of a flow profile */ struct ice_flow_prof_params {enum ice_block blk;
@@ -691,7 +702,7 @@ struct ice_flow_prof_params {ICE_FLOW_SEG_HDR_GTPC_TEID |ICE_FLOW_SEG_HDR_GTPU | \ICE_FLOW_SEG_HDR_PFCP_SESSION |ICE_FLOW_SEG_HDR_L2TPV3 | \ICE_FLOW_SEG_HDR_ESP |ICE_FLOW_SEG_HDR_AH | \ - ICE_FLOW_SEG_HDR_NAT_T_ESP) + ICE_FLOW_SEG_HDR_NAT_T_ESP | ICE_FLOW_SEG_HDR_GTPU_NON_IP) #define ICE_FLOW_SEG_HDRS_L2_MASK \ (ICE_FLOW_SEG_HDR_ETH |ICE_FLOW_SEG_HDR_VLAN )
@@ -911,6 +922,10 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) src = (const ice_bitmap_t *)ice_ptypes_gtpc_tid;ice_and_bitmap (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); + }else if (hdrs &ICE_FLOW_SEG_HDR_GTPU_NON_IP ) { + src = (const ice_bitmap_t *)ice_ptypes_gtpu_no_ip; +ice_and_bitmap (params->ptypes, params->ptypes, + src,ICE_FLOW_PTYPE_MAX ); }else if (hdrs &ICE_FLOW_SEG_HDR_GTPU_DWN ) { src = (const ice_bitmap_t *)ice_ptypes_gtpu; ice_and_bitmap(params->ptypes, params->ptypes,
drivers/net/ice/base/ice_flow.h +1 -0
@@ -178,6 +178,7 @@ enum ice_flow_seg_hdr {ICE_FLOW_SEG_HDR_AH =0x00200000 ,ICE_FLOW_SEG_HDR_NAT_T_ESP =0x00400000 ,ICE_FLOW_SEG_HDR_ETH_NON_IP =0x00800000 , +ICE_FLOW_SEG_HDR_GTPU_NON_IP =0x01000000 ,/* The following is an additive bit for ICE_FLOW_SEG_HDR_IPV4 and * ICE_FLOW_SEG_HDR_IPV6 which include the IPV4 other PTYPEs */
Signature · 1 line
2.13.6
PATCH v2 23/40 net/ice/base: move a function
In reply to Qi ZhangThe only caller of this function is within the file so mark it as static and move it up in the file to avoid a forward declaration.
--- drivers/net/ice/base/ice_acl.h | 1 - drivers/net/ice/base/ice_acl_ctrl.c | 93 ++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 49 deletions(-)
drivers/net/ice/base/ice_acl.h +0 -1
@@ -132,7 +132,6 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw);enum ice_status ice_acl_create_scen (struct ice_hw *hw,u16 match_width,u16 num_entries,u16 *scen_id); -enum ice_status ice_acl_destroy_scen (struct ice_hw *hw,u16 scen_id);enum ice_status ice_aq_alloc_acl_tbl (struct ice_hw *hw,struct ice_acl_alloc_tbl *tbl,struct ice_sq_cd *cd);
drivers/net/ice/base/ice_acl_ctrl.c +45 -48
102 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH v2 24/40 net/ice/base: clear advanced rules in reset preparation
In reply to Qi ZhangClear advanced rules from SW and HW before reset.
--- drivers/net/ice/base/ice_switch.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_switch.c +19 -11
@@ -8114,13 +8114,12 @@ ice_rem_adv_rule_by_id(struct ice_hw *hw,*/ enum ice_status ice_rem_adv_rule_for_vsi (struct ice_hw *hw,u16 vsi_handle) { -struct ice_adv_fltr_mgmt_list_entry *list_itr; +struct ice_adv_fltr_mgmt_list_entry *list_itr, *tmp_entry;struct ice_vsi_list_map_info *map_info;struct LIST_HEAD_TYPE *list_head;struct ice_adv_rule_info rinfo;struct ice_switch_info *sw;enum ice_status status; -u16 vsi_list_id =0 ;u8 rid; sw = hw->switch_info;
@@ -8129,22 +8128,31 @@ enum ice_status ice_rem_adv_rule_for_vsi(struct ice_hw *hw, u16 vsi_handle)continue ;if (!sw->recp_list[rid].adv_rule)continue ; + list_head = &sw->recp_list[rid].filt_rules; - map_info =NULL ; -LIST_FOR_EACH_ENTRY (list_itr, list_head, - ice_adv_fltr_mgmt_list_entry, list_entry) { - map_info =ice_find_vsi_list_entry (&sw->recp_list[rid], - vsi_handle, - &vsi_list_id); -if (!map_info) -continue ; +LIST_FOR_EACH_ENTRY_SAFE (list_itr, tmp_entry, list_head, + ice_adv_fltr_mgmt_list_entry, + list_entry) { rinfo = list_itr->rule_info; + +if (rinfo.sw_act.fltr_act ==ICE_FWD_TO_VSI_LIST ) { + map_info = list_itr->vsi_list_info; +if (!map_info) +continue ; + +if (!ice_is_bit_set (map_info->vsi_map, + vsi_handle)) +continue ; + }else if (rinfo.sw_act.vsi_handle != vsi_handle) { +continue ; + } + rinfo.sw_act.vsi_handle = vsi_handle; status =ice_rem_adv_rule (hw, list_itr->lkups, list_itr->lkups_cnt, &rinfo); +if (status)return status; - map_info =NULL ; } }return ICE_SUCCESS ;
Signature · 1 line
2.13.6
PATCH v2 25/40 net/ice/base: move a function
In reply to Qi ZhangMove ice_flow_get_hw_prof, this is not necessary for DPDK, just sync the code with other compile option which ice_flow_get_hw_prof is declared as a static function.
--- drivers/net/ice/base/ice_flow.c | 48 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/net/ice/base/ice_flow.c +24 -24
@@ -1642,6 +1642,30 @@ ice_dealloc_flow_entry(struct ice_hw *hw, struct ice_flow_entry *entry)ice_free (hw, entry); } +/** +* ice_flow_get_hw_prof - return the HW profile for a specific profile ID handle +* @hw: pointer to the HW struct +* @blk: classification stage +* @prof_id: the profile ID handle +* @hw_prof_id: pointer to variable to receive the HW profile ID +*/ +enum ice_status +ice_flow_get_hw_prof (struct ice_hw *hw,enum ice_block blk,u64 prof_id, +u8 *hw_prof_id) +{ +enum ice_status status =ICE_ERR_DOES_NOT_EXIST ; +struct ice_prof_map *map; + +ice_acquire_lock (&hw->blk[blk].es.prof_map_lock); + map =ice_search_prof_id (hw, blk, prof_id); +if (map) { + *hw_prof_id = map->prof_id; + status =ICE_SUCCESS ; + } +ice_release_lock (&hw->blk[blk].es.prof_map_lock); +return status; +} +#define ICE_ACL_INVALID_SCEN 0x3f/**
@@ -2233,30 +2257,6 @@ ice_flow_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 prof_id) }/** -* ice_flow_get_hw_prof - return the HW profile for a specific profile ID handle -* @hw: pointer to the HW struct -* @blk: classification stage -* @prof_id: the profile ID handle -* @hw_prof_id: pointer to variable to receive the HW profile ID -*/ -enum ice_status -ice_flow_get_hw_prof (struct ice_hw *hw,enum ice_block blk,u64 prof_id, -u8 *hw_prof_id) -{ -enum ice_status status =ICE_ERR_DOES_NOT_EXIST ; -struct ice_prof_map *map; - -ice_acquire_lock (&hw->blk[blk].es.prof_map_lock); - map =ice_search_prof_id (hw, blk, prof_id); -if (map) { - *hw_prof_id = map->prof_id; - status =ICE_SUCCESS ; - } -ice_release_lock (&hw->blk[blk].es.prof_map_lock); -return status; -} - -/** * ice_flow_find_entry - look for a flow entry using its unique ID * @hw: pointer to the HW struct * @blk: classification stage
Signature · 1 line
2.13.6
PATCH v2 26/40 net/ice/base: add check for failed acts allocation
In reply to Qi ZhangThere is no check for failed allocation of 'acts'. Add a check and return if memory was not successfully allocated. Also, as all 'goto out' occur after this check there is no need to perform a check for 'acts' as we will have returned if it is not set.
--- drivers/net/ice/base/ice_flow.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_flow.c +8 -7
@@ -1712,8 +1712,8 @@ ice_flow_acl_is_prof_in_use(struct ice_hw *hw, struct ice_flow_prof *prof, buf->pf_scenario_num[6] == ICE_ACL_INVALID_SCEN && buf->pf_scenario_num[7] == ICE_ACL_INVALID_SCEN)return ICE_SUCCESS ; - else - return ICE_ERR_IN_USE; + +return ICE_ERR_IN_USE ; }/**
@@ -2861,7 +2861,6 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof,*/ exist =ice_flow_acl_find_scen_entry_cond (prof, e, &do_chg_action, &do_add_entry, &do_rem_entry); -if (do_rem_entry) { status =ice_flow_rem_entry_sync (hw,ICE_BLK_ACL , exist);if (status)
@@ -2869,8 +2868,11 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof, }/* Prepare the result action buffer */ - acts = (struct ice_acl_act_entry *)ice_calloc - (hw, e->entry_sz,sizeof (struct ice_acl_act_entry )); + acts = (struct ice_acl_act_entry *) +ice_calloc (hw, e->entry_sz,sizeof (struct ice_acl_act_entry )); +if (!acts) +return ICE_ERR_NO_MEMORY ; +for (i =0 ; i < e->acts_cnt; i++) ice_memcpy(&acts[i], &e->acts[i].data.acl_act, sizeof(struct ice_acl_act_entry),
@@ -2937,8 +2939,7 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof, *(entry) = exist; } out: -if (acts) -ice_free (hw, acts); +ice_free (hw, acts);return status; }
Signature · 1 line
2.13.6
PATCH v2 27/40 net/ice/base: remove repeated words
In reply to Qi ZhangA new test in checkpatch detects repeated words; cleanup all pre-existing occurrences of those now.
--- drivers/net/ice/base/ice_adminq_cmd.h | 2 +- drivers/net/ice/base/ice_common.c | 2 +- drivers/net/ice/base/ice_flow.c | 4 ++-- drivers/net/ice/base/ice_nvm.c | 2 +- drivers/net/ice/base/ice_switch.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +1 -1
@@ -2130,7 +2130,7 @@ struct ice_aqc_acl_update_query_scen {*/ struct ice_aqc_acl_scen {struct { -/* Byte [x] selection for the TCAM key. This value must be set +/* Byte [x] selection for the TCAM key. This value must be * set to 0x0 for unusued TCAM. * Only Bit 6..0 is used in each byte and MSB is reserved */
drivers/net/ice/base/ice_common.c +1 -1
@@ -2084,7 +2084,7 @@ ice_parse_fdir_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,* @cap_count: the number of capabilities * * Helper device to parse device (0x000B) capabilities list. For -* capabilities shared between device and device, this relies on +* capabilities shared between device and function, this relies on * ice_parse_common_caps. * * Loop through the list of provided capabilities and extract the relevant
drivers/net/ice/base/ice_flow.c +2 -2
@@ -1254,7 +1254,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,* ice_flow_xtract_raws - Create extract sequence entries for raw bytes * @hw: pointer to the HW struct * @params: information about the flow to be processed -* @seg: index of packet segment whose raw fields are to be be extracted +* @seg: index of packet segment whose raw fields are to be extracted */ static enum ice_status ice_flow_xtract_raws(struct ice_hw *hw, struct ice_flow_prof_params *params,
@@ -3106,7 +3106,7 @@ enum ice_status ice_flow_rem_entry(struct ice_hw *hw, enum ice_block blk,* * This helper function stores information of a field being matched, including * the type of the field and the locations of the value to match, the mask, and -* and the upper-bound value in the start of the input buffer for a flow entry. +* the upper-bound value in the start of the input buffer for a flow entry. * This function should only be used for fixed-size data structures. * * This function also opportunistically determines the protocol headers to be
drivers/net/ice/base/ice_nvm.c +1 -1
@@ -629,7 +629,7 @@ ice_nvm_access_get_features(struct ice_nvm_access_cmd *cmd, {/* The provided data_size must be at least as large as our NVM * features structure. A larger size should not be treated as an -* error, to allow future extensions to to the features structure to +* error, to allow future extensions to the features structure to * work on older drivers. */ if (cmd->data_size <sizeof (struct ice_nvm_features ))
drivers/net/ice/base/ice_switch.c +2 -2
@@ -2367,7 +2367,7 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id,* @hw: pointer to the HW struct * @bcast_thresh: represents the upper threshold for broadcast storm control * @mcast_thresh: represents the upper threshold for multicast storm control -* @ctl_bitmask: storm control control knobs +* @ctl_bitmask: storm control knobs * * Sets the storm control configuration (0x0280) */
@@ -2394,7 +2394,7 @@ ice_aq_set_storm_ctrl(struct ice_hw *hw, u32 bcast_thresh, u32 mcast_thresh,* @hw: pointer to the HW struct * @bcast_thresh: represents the upper threshold for broadcast storm control * @mcast_thresh: represents the upper threshold for multicast storm control -* @ctl_bitmask: storm control control knobs +* @ctl_bitmask: storm control knobs * * Gets the storm control configuration (0x0281) */
Signature · 1 line
2.13.6
PATCH v2 28/40 net/ice/base: remove function ACL count query
In reply to Qi ZhangRemove debug function ice_aq_query_acl_cntrs.
--- drivers/net/ice/base/ice_acl.c | 36 ------------------------------------ drivers/net/ice/base/ice_acl.h | 3 --- 2 files changed, 39 deletions(-)
drivers/net/ice/base/ice_acl.c +0 -36
@@ -435,42 +435,6 @@ ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs, }/** -* ice_aq_query_acl_cntrs - query ACL counter -* @hw: pointer to the HW struct -* @bank: queries counter bank -* @index: queried counter index -* @cntr_val: pointer to counter or packet counter value -* @cd: pointer to command details structure or NULL -* -* Query ACL counter (direct 0x0C27) -*/ -enum ice_status -ice_aq_query_acl_cntrs (struct ice_hw *hw,u8 bank,u16 index,u64 *cntr_val, -struct ice_sq_cd *cd) -{ -struct ice_aqc_acl_query_counter *cmd; -struct ice_aq_desc desc; -enum ice_status status; - -if (!cntr_val) -return ICE_ERR_PARAM ; - -ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_query_acl_counter); - cmd = &desc.params.query_counter; - cmd->counter_index =CPU_TO_LE16 (index); - cmd->counter_bank = bank; - status =ice_aq_send_cmd (hw, &desc,NULL ,0 , cd); -if (!status) { -__le64 resp_val =0 ; - -ice_memcpy (&resp_val, cmd->ops.resp.val, -sizeof (cmd->ops.resp.val),ICE_NONDMA_TO_NONDMA ); - *cntr_val =LE64_TO_CPU (resp_val); - } -return status; -} - -/** * ice_prog_acl_prof_ranges - program ACL profile ranges * @hw: pointer to the HW struct * @prof_id: programmed or updated profile ID
drivers/net/ice/base/ice_acl.h +0 -3
@@ -172,9 +172,6 @@ enum ice_status ice_aq_dealloc_acl_cntrs(struct ice_hw *hw, struct ice_acl_cntrs *cntrs, struct ice_sq_cd *cd);enum ice_status -ice_aq_query_acl_cntrs (struct ice_hw *hw,u8 bank,u16 index,u64 *cntr_val, -struct ice_sq_cd *cd); -enum ice_status ice_prog_acl_prof_ranges (struct ice_hw *hw,u8 prof_id,struct ice_aqc_acl_profile_ranges *buf,struct ice_sq_cd *cd);
Signature · 1 line
2.13.6
PATCH v2 29/40 net/ice/base: preserve NVM capabilities in safe mode
In reply to Qi ZhangIf the driver initializes in safe mode, it will call ice_set_safe_mode_caps. This results in clearing the capabilities structures, in order to set them up for operating in safe mode, ensuring many features are disabled.
This has a side effect of also clearing the capability bits that relate to NVM update. The result is that the device driver will not indicate support for unified update, even if the firmware is capable.
Fix this by adding the relevant capability fields to the list of values we preserve. To simplify the code, use a common_cap structure instead of a handful of local variables. To reduce some duplication of the capability name, introduce a couple of macros used to restore the capabilities values from the cached copy.
--- drivers/net/ice/base/ice_common.c | 43 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-)
drivers/net/ice/base/ice_common.c +21 -22
@@ -2248,26 +2248,25 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) {struct ice_hw_func_caps *func_caps = &hw->func_caps;struct ice_hw_dev_caps *dev_caps = &hw->dev_caps; -u32 valid_func, rxq_first_id, txq_first_id; -u32 msix_vector_first_id, max_mtu; +struct ice_hw_common_caps cached_caps;u32 num_funcs;/* cache some func_caps values that should be restored after memset */ - valid_func = func_caps->common_cap.valid_functions; - txq_first_id = func_caps->common_cap.txq_first_id; - rxq_first_id = func_caps->common_cap.rxq_first_id; - msix_vector_first_id = func_caps->common_cap.msix_vector_first_id; - max_mtu = func_caps->common_cap.max_mtu; + cached_caps = func_caps->common_cap;/* unset func capabilities */ memset (func_caps,0 ,sizeof (*func_caps)); +#define ICE_RESTORE_FUNC_CAP (name) \ + func_caps->common_cap.name = cached_caps.name +/* restore cached values */ - func_caps->common_cap.valid_functions = valid_func; - func_caps->common_cap.txq_first_id = txq_first_id; - func_caps->common_cap.rxq_first_id = rxq_first_id; - func_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - func_caps->common_cap.max_mtu = max_mtu; +ICE_RESTORE_FUNC_CAP (valid_functions); +ICE_RESTORE_FUNC_CAP (txq_first_id); +ICE_RESTORE_FUNC_CAP (rxq_first_id); +ICE_RESTORE_FUNC_CAP (msix_vector_first_id); +ICE_RESTORE_FUNC_CAP (max_mtu); +ICE_RESTORE_FUNC_CAP (nvm_unified_update);/* one Tx and one Rx queue in safe mode */ func_caps->common_cap.num_rxq =1 ;
@@ -2278,22 +2277,22 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) func_caps->guar_num_vsi =1 ;/* cache some dev_caps values that should be restored after memset */ - valid_func = dev_caps->common_cap.valid_functions; - txq_first_id = dev_caps->common_cap.txq_first_id; - rxq_first_id = dev_caps->common_cap.rxq_first_id; - msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id; - max_mtu = dev_caps->common_cap.max_mtu; + cached_caps = dev_caps->common_cap; num_funcs = dev_caps->num_funcs;/* unset dev capabilities */ memset (dev_caps,0 ,sizeof (*dev_caps)); +#define ICE_RESTORE_DEV_CAP (name) \ + dev_caps->common_cap.name = cached_caps.name +/* restore cached values */ - dev_caps->common_cap.valid_functions = valid_func; - dev_caps->common_cap.txq_first_id = txq_first_id; - dev_caps->common_cap.rxq_first_id = rxq_first_id; - dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - dev_caps->common_cap.max_mtu = max_mtu; +ICE_RESTORE_DEV_CAP (valid_functions); +ICE_RESTORE_DEV_CAP (txq_first_id); +ICE_RESTORE_DEV_CAP (rxq_first_id); +ICE_RESTORE_DEV_CAP (msix_vector_first_id); +ICE_RESTORE_DEV_CAP (max_mtu); +ICE_RESTORE_DEV_CAP (nvm_unified_update); dev_caps->num_funcs = num_funcs;/* one Tx and one Rx queue per function in safe mode */
Signature · 1 line
2.13.6
PATCH v2 30/40 net/ice/base: misc minor ACL changes
In reply to Qi ZhangThis is a collection of minor ACL style changes including:
- When there is nothing to unroll, return a value directly.
- Return ICE_SUCCESS(0) in cases where an error was previously checked so ICE_SUCCESS is the only possible return.
- Remove unnecessary parentheses and newlines
- Move unroll of allocation to end of function and use goto on errors to free.
- Fix function header comment style
- Remove 'else' from an 'if else' condition where both conditions return a value to reduce indentation.
--- drivers/net/ice/base/ice_acl_ctrl.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/net/ice/base/ice_acl_ctrl.c +11 -13
@@ -149,10 +149,8 @@ static enum ice_status ice_acl_init_tbl(struct ice_hw *hw)u16 idx; tbl = hw->acl_tbl; -if (!tbl) { - status =ICE_ERR_CFG ; -return status; - } +if (!tbl) +return ICE_ERR_CFG ;ice_memset (&buf,0 ,sizeof (buf),ICE_NONDMA_MEM );ice_memset (&act_buf,0 ,sizeof (act_buf),ICE_NONDMA_MEM );
@@ -526,7 +524,7 @@ ice_acl_alloc_partition(struct ice_hw *hw, struct ice_acl_scen *req)break ; } - row = (dir >0 ) ? (row + width) : (row - width); + row = dir >0 ? row + width : row - width;if (row > hw->acl_tbl->last_tcam || row < hw->acl_tbl->first_tcam) {/* All rows have been checked. Increment 'off' that
@@ -668,8 +666,7 @@ static void ice_acl_assign_act_mem_for_scen(struct ice_acl_tbl *tbl, struct ice_acl_scen *scen, struct ice_aqc_acl_scen *scen_buf, - u8 current_tcam_idx, - u8 target_tcam_idx) + u8 current_tcam_idx, u8 target_tcam_idx) { u8 i;
@@ -761,10 +758,8 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries, scen->num_entry = num_entries; status =ice_acl_alloc_partition (hw, scen); -if (status) { -ice_free (hw, scen); -return status; - } +if (status) + goto out;ice_memset (&scen_buf,0 ,sizeof (scen_buf),ICE_NONDMA_MEM );
@@ -829,8 +824,7 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries,if (status) {ice_debug (hw,ICE_DBG_ACL ,"AQ allocation of ACL scenario failed. status: %d\n" , status); -ice_free (hw, scen); -return status; + goto out; } scen->id = *scen_id;
@@ -838,6 +832,10 @@ ice_acl_create_scen(struct ice_hw *hw, u16 match_width, u16 num_entries,ice_acl_init_entry (scen);LIST_ADD (&scen->list_entry, &hw->acl_tbl->scens); +out: +if (status) +ice_free (hw, scen); +return status; }
Signature · 1 line
2.13.6
PATCH v2 31/40 net/ice/base: adjust rate limit profile ids runtime database
In reply to Qi ZhangMoving the runtime profile ids database/storage to the hw structure.
--- drivers/net/ice/base/ice_sched.c | 54 +++++++++++++++++++--------------------- drivers/net/ice/base/ice_type.h | 4 +-- 2 files changed, 28 insertions(+), 30 deletions(-)
drivers/net/ice/base/ice_sched.c +26 -28
@@ -727,15 +727,15 @@ ice_sched_del_rl_profile(struct ice_hw *hw,static void ice_sched_clear_rl_prof (struct ice_port_info *pi) {u16 ln; +struct ice_hw *hw = pi->hw; -for (ln =0 ; ln < pi->hw->num_tx_sched_layers; ln++) { +for (ln =0 ; ln < hw->num_tx_sched_layers; ln++) {struct ice_aqc_rl_profile_info *rl_prof_elem;struct ice_aqc_rl_profile_info *rl_prof_tmp;LIST_FOR_EACH_ENTRY_SAFE (rl_prof_elem, rl_prof_tmp, - &pi->rl_prof_list[ln], + &hw->rl_prof_list[ln], ice_aqc_rl_profile_info, list_entry) { -struct ice_hw *hw = pi->hw;enum ice_status status; rl_prof_elem->prof_id_ref =0 ;
@@ -1260,7 +1260,7 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi) pi->port_state =ICE_SCHED_PORT_STATE_READY ;ice_init_lock (&pi->sched_lock);for (i =0 ; i <ICE_AQC_TOPO_MAX_LEVEL_NUM ; i++) -INIT_LIST_HEAD (&pi->rl_prof_list[i]); +INIT_LIST_HEAD (&hw->rl_prof_list[i]); err_init_port:if (status && pi->root) {
@@ -2868,24 +2868,24 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,/** * ice_sched_rm_unused_rl_prof - remove unused RL profile -* @pi: port information structure +* @hw: pointer to the hardware structure * * This function removes unused rate limit profiles from the HW and * SW DB. The caller needs to hold scheduler lock. */ -static void ice_sched_rm_unused_rl_prof (struct ice_port_info *pi) +static void ice_sched_rm_unused_rl_prof (struct ice_hw *hw) {u16 ln; -for (ln =0 ; ln < pi->hw->num_tx_sched_layers; ln++) { +for (ln =0 ; ln < hw->num_tx_sched_layers; ln++) {struct ice_aqc_rl_profile_info *rl_prof_elem;struct ice_aqc_rl_profile_info *rl_prof_tmp;LIST_FOR_EACH_ENTRY_SAFE (rl_prof_elem, rl_prof_tmp, - &pi->rl_prof_list[ln], + &hw->rl_prof_list[ln], ice_aqc_rl_profile_info, list_entry) { -if (!ice_sched_del_rl_profile (pi->hw, rl_prof_elem)) -ice_debug (pi->hw,ICE_DBG_SCHED ,"Removed rl profile\n" ); +if (!ice_sched_del_rl_profile (hw, rl_prof_elem)) +ice_debug (hw,ICE_DBG_SCHED ,"Removed rl profile\n" ); } } }
@@ -3031,7 +3031,7 @@ enum ice_status ice_rm_agg_cfg(struct ice_port_info *pi, u32 agg_id)ice_free (pi->hw, agg_info);/* Remove unused RL profile IDs from HW and SW DB */ -ice_sched_rm_unused_rl_prof (pi); +ice_sched_rm_unused_rl_prof (pi->hw); exit_ice_rm_agg_cfg:ice_release_lock (&pi->sched_lock);
@@ -3852,7 +3852,7 @@ ice_sched_bw_to_rl_profile(struct ice_hw *hw, u32 bw,/** * ice_sched_add_rl_profile - add RL profile -* @pi: port information structure +* @hw: pointer to the hardware structure * @rl_type: type of rate limit BW - min, max, or shared * @bw: bandwidth in Kbps - Kilo bits per sec * @layer_num: specifies in which layer to create profile
@@ -3864,14 +3864,13 @@ ice_sched_bw_to_rl_profile(struct ice_hw *hw, u32 bw,* The caller needs to hold the scheduler lock. */ 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) +ice_sched_add_rl_profile (struct ice_hw *hw,enum ice_rl_type rl_type, +u32 bw,u8 layer_num) {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;if (layer_num >=ICE_AQC_TOPO_MAX_LEVEL_NUM )
@@ -3890,10 +3889,9 @@ ice_sched_add_rl_profile(struct ice_port_info *pi,return NULL ; } -if (!pi) +if (!hw)return NULL ; - hw = pi->hw; -LIST_FOR_EACH_ENTRY (rl_prof_elem, &pi->rl_prof_list[layer_num], +LIST_FOR_EACH_ENTRY (rl_prof_elem, &hw->rl_prof_list[layer_num], ice_aqc_rl_profile_info, list_entry) if ((rl_prof_elem->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M) == profile_type && rl_prof_elem->bw == bw)
@@ -3926,7 +3924,7 @@ ice_sched_add_rl_profile(struct ice_port_info *pi,/* Good entry - add in the list */ rl_prof_elem->prof_id_ref =0 ; -LIST_ADD (&rl_prof_elem->list_entry, &pi->rl_prof_list[layer_num]); +LIST_ADD (&rl_prof_elem->list_entry, &hw->rl_prof_list[layer_num]);return rl_prof_elem; exit_add_rl_prof:
@@ -4105,7 +4103,7 @@ ice_sched_get_srl_node(struct ice_sched_node *node, u8 srl_layer)/** * ice_sched_rm_rl_profile - remove RL profile ID -* @pi: port information structure +* @hw: pointer to the hardware structure * @layer_num: layer number where profiles are saved * @profile_type: profile type like EIR, CIR, or SRL * @profile_id: profile ID to remove
@@ -4115,7 +4113,7 @@ ice_sched_get_srl_node(struct ice_sched_node *node, u8 srl_layer)* scheduler lock. */ static enum ice_status -ice_sched_rm_rl_profile (struct ice_port_info *pi,u8 layer_num,u8 profile_type, +ice_sched_rm_rl_profile (struct ice_hw *hw,u8 layer_num,u8 profile_type,u16 profile_id) {struct ice_aqc_rl_profile_info *rl_prof_elem;
@@ -4124,7 +4122,7 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type,if (layer_num >=ICE_AQC_TOPO_MAX_LEVEL_NUM )return ICE_ERR_PARAM ;/* Check the existing list for RL profile */ -LIST_FOR_EACH_ENTRY (rl_prof_elem, &pi->rl_prof_list[layer_num], +LIST_FOR_EACH_ENTRY (rl_prof_elem, &hw->rl_prof_list[layer_num], ice_aqc_rl_profile_info, list_entry) if ((rl_prof_elem->profile.flags & ICE_AQC_RL_PROFILE_TYPE_M) == profile_type &&
@@ -4134,9 +4132,9 @@ ice_sched_rm_rl_profile(struct ice_port_info *pi, u8 layer_num, u8 profile_type, rl_prof_elem->prof_id_ref--;/* Remove old profile ID from database */ - status =ice_sched_del_rl_profile (pi->hw, rl_prof_elem); + status =ice_sched_del_rl_profile (hw, rl_prof_elem);if (status && status !=ICE_ERR_IN_USE ) -ice_debug (pi->hw,ICE_DBG_SCHED ,"Remove rl profile failed\n" ); +ice_debug (hw,ICE_DBG_SCHED ,"Remove rl profile failed\n" );break ; }if (status ==ICE_ERR_IN_USE )
@@ -4196,7 +4194,7 @@ ice_sched_set_node_bw_dflt(struct ice_port_info *pi, old_id == ICE_SCHED_INVAL_PROF_ID)return ICE_SUCCESS ; -return ice_sched_rm_rl_profile (pi, layer_num, profile_type, old_id); +return ice_sched_rm_rl_profile (hw, layer_num, profile_type, old_id); }/**
@@ -4265,7 +4263,7 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node,struct ice_hw *hw = pi->hw;u16 old_id, rl_prof_id; - rl_prof_info =ice_sched_add_rl_profile (pi, rl_type, bw, layer_num); + rl_prof_info =ice_sched_add_rl_profile (hw, rl_type, bw, layer_num);if (!rl_prof_info)return status;
@@ -4287,7 +4285,7 @@ ice_sched_set_node_bw(struct ice_port_info *pi, struct ice_sched_node *node, old_id == ICE_SCHED_INVAL_PROF_ID || old_id == rl_prof_id)return ICE_SUCCESS ; -return ice_sched_rm_rl_profile (pi, layer_num, +return ice_sched_rm_rl_profile (hw, layer_num, rl_prof_info->profile.flags &ICE_AQC_RL_PROFILE_TYPE_M , old_id); }
@@ -4316,7 +4314,7 @@ ice_sched_set_node_bw_lmt(struct ice_port_info *pi, struct ice_sched_node *node,return ICE_ERR_PARAM ; hw = pi->hw;/* Remove unused RL profile IDs from HW and SW DB */ -ice_sched_rm_unused_rl_prof (pi); +ice_sched_rm_unused_rl_prof (hw); layer_num =ice_sched_get_rl_prof_layer (pi, rl_type, node->tx_sched_layer);if (layer_num >= hw->num_tx_sched_layers)
drivers/net/ice/base/ice_type.h +2 -2
@@ -782,8 +782,6 @@ struct ice_port_info {struct ice_lock sched_lock;/* protect access to TXSched tree */ struct ice_sched_node * sib_head[ICE_MAX_TRAFFIC_CLASS ][ICE_AQC_TOPO_MAX_LEVEL_NUM ]; -/* List contain profile ID(s) and other params per layer */ -struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM ];struct ice_bw_type_info root_node_bw_t_info;struct ice_bw_type_info tc_node_bw_t_info[ICE_MAX_TRAFFIC_CLASS ];struct ice_qos_cfg qos_cfg;
@@ -834,6 +832,8 @@ struct ice_hw {u8 sw_entry_point_layer;u16 max_children[ICE_AQC_TOPO_MAX_LEVEL_NUM ];struct LIST_HEAD_TYPE agg_list;/* lists all aggregator */ +/* List contain profile ID(s) and other params per layer */ +struct LIST_HEAD_TYPE rl_prof_list[ICE_AQC_TOPO_MAX_LEVEL_NUM ];struct ice_vsi_ctx *vsi_ctx[ICE_MAX_VSI ];u8 evb_veb;/* true for VEB, false for VEPA */ u8 reset_ongoing;/* true if HW is in reset, false otherwise */
Signature · 1 line
2.13.6
PATCH v2 32/40 net/ice/base: enable QinQ filter for switch advanced rule
In reply to Qi ZhangEnable QinQ type filter for switch advanced rule, it support tunnel and non-tunnel packet use external and inner vlan id as input set for rules, it also support session id as input set for PPPoE rule with QinQ flag in packet.
--- drivers/net/ice/base/ice_protocol_type.h | 8 ++ drivers/net/ice/base/ice_switch.c | 236 +++++++++++++++++++++++++++++-- 2 files changed, 230 insertions(+), 14 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +8 -0
@@ -52,6 +52,7 @@ enum ice_protocol_type {ICE_AH ,ICE_NAT_T ,ICE_GTP_NO_PAY , +ICE_VLAN_EX , ICE_PROTOCOL_LAST };
@@ -102,6 +103,12 @@ enum ice_sw_tunnel_type {ICE_SW_TUN_PROFID_IPV4_PFCP_SESSION ,ICE_SW_TUN_PROFID_IPV6_PFCP_NODE ,ICE_SW_TUN_PROFID_IPV6_PFCP_SESSION , +ICE_SW_TUN_AND_NON_TUN_QINQ , +ICE_NON_TUN_QINQ , +ICE_SW_TUN_PPPOE_QINQ , +ICE_SW_TUN_PPPOE_PAY_QINQ , +ICE_SW_TUN_PPPOE_IPV4_QINQ , +ICE_SW_TUN_PPPOE_IPV6_QINQ ,ICE_ALL_TUNNELS /* All tunnel types including NVGRE */ };
@@ -160,6 +167,7 @@ enum ice_prot_id {#define ICE_MAC_OFOS_HW 1#define ICE_MAC_IL_HW 4#define ICE_ETYPE_OL_HW 9 +#define ICE_VLAN_OF_HW 16#define ICE_VLAN_OL_HW 17#define ICE_IPV4_OFOS_HW 32#define ICE_IPV4_IL_HW 33
drivers/net/ice/base/ice_switch.c +222 -14
370 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH v2 33/40 net/ice/base: create flash info structure and separate NVM version
In reply to Qi ZhangThe ice_nvm_info structure has become somewhat of a dumping ground for all of the fields related to flash version. It holds the NVM version and EETRACK id, the OptionROM info structure, the flash size, the ShadowRAM size, and more.
A future change is going to add the ability to read the NVM version and EETRACK ID from the inactive NVM bank. To make this simpler, it is useful to have these NVM version info fields extracted to their own structure.
Rename ice_nvm_info into ice_flash_info, and create a separate ice_nvm_info structure that will contain the eetrack and NVM map version. Move the netlist_ver structure into ice_flash_info and rename it ice_netlist_info for consistency.
Modify the static ice_get_orom_ver_info to take the option rom structure as a pointer. This makes it more obvious what portion of the hw struct is being modified. Do the same for ice_get_netlist_ver_info.
Introduce a new ice_get_nvm_ver_info function, which will be similar to ice_get_orom_ver_info and ice_get_netlist_ver_info, used to keep the NVM version extraction code co-located.
--- drivers/net/ice/base/ice_common.c | 7 +-- drivers/net/ice/base/ice_nvm.c | 108 +++++++++++++++++++------------------- drivers/net/ice/base/ice_type.h | 15 ++++-- drivers/net/ice/ice_ethdev.c | 14 ++--- 4 files changed, 75 insertions(+), 69 deletions(-)
drivers/net/ice/base/ice_common.c +4 -3
@@ -675,13 +675,14 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw)void ice_print_rollback_msg (struct ice_hw *hw) {char nvm_str[ICE_NVM_VER_LEN ] = {0 }; -struct ice_nvm_info *nvm = &hw->nvm;struct ice_orom_info *orom; +struct ice_nvm_info *nvm; - orom = &nvm->orom; + orom = &hw->flash.orom; + nvm = &hw->flash.nvm;SNPRINTF (nvm_str,sizeof (nvm_str),"%x.%02x 0x%x %d.%d.%d" , - nvm->major_ver, nvm->minor_ver, nvm->eetrack, orom->major, + nvm->major, nvm->minor, nvm->eetrack, orom->major, orom->build, orom->patch); ice_warn(hw, "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode\n",
drivers/net/ice/base/ice_nvm.c +54 -54
176 lines not on this page · raw message
drivers/net/ice/base/ice_type.h +10 -5
@@ -511,14 +511,19 @@ struct ice_orom_info {u16 build;/* Build version of OROM */ }; -/* NVM Information */ +/* NVM version information */ struct ice_nvm_info { +u32 eetrack; +u8 major; +u8 minor; +}; + +/* Flash Chip Information */ +struct ice_flash_info {struct ice_orom_info orom;/* Option ROM version info */ -u32 eetrack;/* NVM data version */ +struct ice_nvm_info nvm;/* NVM version information */ u16 sr_words;/* Shadow RAM size in words */ u32 flash_size;/* Size of available flash in bytes */ -u8 major_ver;/* major version of dev starter */ -u8 minor_ver;/* minor version of dev starter */ u8 blank_nvm_mode;/* is NVM empty (no FW present) */ };
@@ -838,7 +843,7 @@ struct ice_hw {u8 evb_veb;/* true for VEB, false for VEPA */ u8 reset_ongoing;/* true if HW is in reset, false otherwise */ struct ice_bus_info bus; -struct ice_nvm_info nvm; +struct ice_flash_info flash;struct ice_hw_dev_caps dev_caps;/* device capabilities */ struct ice_hw_func_caps func_caps;/* function capabilities */
drivers/net/ice/ice_ethdev.c +7 -7
@@ -4410,15 +4410,15 @@ ice_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)u16 build;int ret; - ver = hw->nvm.orom.major; - patch = hw->nvm.orom.patch; - build = hw->nvm.orom.build; + ver = hw->flash.orom.major; + patch = hw->flash.orom.patch; + build = hw->flash.orom.build; ret =snprintf (fw_version, fw_size,"%d.%d 0x%08x %d.%d.%d" , - hw->nvm.major_ver, - hw->nvm.minor_ver, - hw->nvm.eetrack, + hw->flash.nvm.major, + hw->flash.nvm.minor, + hw->flash.nvm.eetrack, ver, build, patch);/* add the size of '\0' */
@@ -4516,7 +4516,7 @@ ice_get_eeprom_length(struct rte_eth_dev *dev) {struct ice_hw *hw =ICE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -return hw->nvm.flash_size; +return hw->flash.flash_size; } static int
Signature · 1 line
2.13.6
PATCH v2 34/40 net/ice/base: remove unused parameter
In reply to Qi Zhangremove unused parameter of ice_parse_fdir_func_caps
--- drivers/net/ice/base/ice_common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_common.c +2 -4
@@ -1942,13 +1942,11 @@ ice_parse_vsi_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,* ice_parse_fdir_func_caps - Parse ICE_AQC_CAPS_FD function caps * @hw: pointer to the HW struct * @func_p: pointer to function capabilities structure -* @cap: pointer to the capability element to parse * * Extract function capabilities for ICE_AQC_CAPS_FD. */ static void -ice_parse_fdir_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_p, -struct ice_aqc_list_caps_elem *cap) +ice_parse_fdir_func_caps (struct ice_hw *hw,struct ice_hw_func_caps *func_p) {u32 reg_val, val;
@@ -2006,7 +2004,7 @@ ice_parse_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_p,ice_parse_vsi_func_caps (hw, func_p, &cap_resp[i]);break ;case ICE_AQC_CAPS_FD : -ice_parse_fdir_func_caps (hw, func_p, &cap_resp[i]); +ice_parse_fdir_func_caps (hw, func_p);break ;default :/* Don't list common capabilities as unknown */
Signature · 1 line
2.13.6
PATCH v2 35/40 net/ice/base: minor code clean
In reply to Qi ZhangRemove unnecessary mac_type check, fix couple comment, and remove unnecessary empty line.
--- drivers/net/ice/base/ice_common.c | 7 +------ drivers/net/ice/base/ice_flow.c | 9 ++++----- 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_common.c +1 -6
@@ -782,8 +782,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw) ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL);ice_free (hw, pcaps);if (status) -ice_debug (hw,ICE_DBG_PHY ,"%s: Get PHY capabilities failed, continuing anyway\n" , - __func__); +ice_debug (hw,ICE_DBG_PHY ,"Get PHY capabilities failed, continuing anyway\n" );/* Initialize port_info struct with link information */ status =ice_aq_get_link_info (hw->port_info, false,NULL ,NULL );
@@ -4632,10 +4631,6 @@ enum ice_fw_modes ice_get_fw_mode(struct ice_hw *hw)*/ bool ice_fw_supports_link_override (struct ice_hw *hw) { -/* Currently, only supported for E810 devices */ -if (hw->mac_type !=ICE_MAC_E810 ) -return false; -if (hw->api_maj_ver ==ICE_FW_API_LINK_OVERRIDE_MAJ ) {if (hw->api_min_ver >ICE_FW_API_LINK_OVERRIDE_MIN )return true;
drivers/net/ice/base/ice_flow.c +4 -5
@@ -2818,7 +2818,7 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof,if (!entry || !(*entry) || !prof)return ICE_ERR_BAD_PTR ; - e = *(entry); + e = *entry; do_chg_rng_chk = false;if (e->range_buf) {
@@ -3236,8 +3236,7 @@ ice_flow_add_fld_raw(struct ice_flow_seg_info *seg, u16 off, u8 len, (ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV6)#define ICE_FLOW_RSS_SEG_HDR_L4_MASKS \ - (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | \ - ICE_FLOW_SEG_HDR_SCTP) + (ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_SCTP)#define ICE_FLOW_RSS_SEG_HDR_VAL_MASKS \ (ICE_FLOW_RSS_SEG_HDR_L2_MASKS | \
@@ -3573,7 +3572,7 @@ ice_add_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,if (status) goto exit; -/* don't do RSS for GTPU outer */ +/* Don't do RSS for GTPU Outer */ if (segs_cnt ==ICE_RSS_OUTER_HEADERS && segs[segs_cnt -1 ].hdrs &ICE_FLOW_SEG_HDR_GTPU ) { status =ICE_SUCCESS ;
@@ -3696,7 +3695,6 @@ ice_add_rss_cfg(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,ice_acquire_lock (&hw->rss_locks); status =ice_add_rss_cfg_sync (hw, vsi_handle, hashed_flds, addl_hdrs,ICE_RSS_OUTER_HEADERS , symm); -if (!status) status = ice_add_rss_cfg_sync(hw, vsi_handle, hashed_flds, addl_hdrs, ICE_RSS_INNER_HEADERS,
@@ -3736,6 +3734,7 @@ ice_rem_rss_cfg_sync(struct ice_hw *hw, u16 vsi_handle, u64 hashed_flds,if (status) goto out; +/* Don't do RSS for GTPU Outer */ if (segs_cnt ==ICE_RSS_OUTER_HEADERS && segs[segs_cnt -1 ].hdrs &ICE_FLOW_SEG_HDR_GTPU ) { status =ICE_SUCCESS ;
Signature · 1 line
2.13.6
PATCH v2 36/40 net/ice/base: cache NVM module bank information
In reply to Qi ZhangThe ice flash contains two copies of each of the NVM, Option ROM, and Netlist modules. Each bank has a pointer word and a size word. In order to correctly read from the active flash bank, the driver must calculate the offset manually.
During NVM initialization, read the Shadow RAM control word and determine which bank is active for each NVM module. Additionally, cache the size and pointer values for use in calculating the correct offset.
--- drivers/net/ice/base/ice_nvm.c | 151 ++++++++++++++++++++++++++++++++++++++++ drivers/net/ice/base/ice_type.h | 29 ++++++++ 2 files changed, 180 insertions(+)
drivers/net/ice/base/ice_nvm.c +151 -0
@@ -503,6 +503,151 @@ static enum ice_status ice_discover_flash_size(struct ice_hw *hw) }/** +* ice_read_sr_pointer - Read the value of a Shadow RAM pointer word +* @hw: pointer to the HW structure +* @offset: the word offset of the Shadow RAM word to read +* @pointer: pointer value read from Shadow RAM +* +* Read the given Shadow RAM word, and convert it to a pointer value specified +* in bytes. This function assumes the specified offset is a valid pointer +* word. +* +* Each pointer word specifies whether it is stored in word size or 4KB +* sector size by using the highest bit. The reported pointer value will be in +* bytes, intended for flat NVM reads. +*/ +static enum ice_status +ice_read_sr_pointer (struct ice_hw *hw,u16 offset,u32 *pointer) +{ +enum ice_status status; +u16 value; + + status =ice_read_sr_word (hw, offset, &value); +if (status) +return status; + +/* Determine if the pointer is in 4KB or word units */ +if (value &ICE_SR_NVM_PTR_4KB_UNITS ) + *pointer = (value & ~ICE_SR_NVM_PTR_4KB_UNITS ) *4 *1024 ; +else + *pointer = value *2 ; + +return ICE_SUCCESS ; +} + +/** +* ice_read_sr_area_size - Read an area size from a Shadow RAM word +* @hw: pointer to the HW structure +* @offset: the word offset of the Shadow RAM to read +* @size: size value read from the Shadow RAM +* +* Read the given Shadow RAM word, and convert it to an area size value +* specified in bytes. This function assumes the specified offset is a valid +* area size word. +* +* Each area size word is specified in 4KB sector units. This function reports +* the size in bytes, intended for flat NVM reads. +*/ +static enum ice_status +ice_read_sr_area_size (struct ice_hw *hw,u16 offset,u32 *size) +{ +enum ice_status status; +u16 value; + + status =ice_read_sr_word (hw, offset, &value); +if (status) +return status; + +/* Area sizes are always specified in 4KB units */ + *size = value *4 *1024 ; + +return ICE_SUCCESS ; +} + +/** +* ice_determine_active_flash_banks - Discover active bank for each module +* @hw: pointer to the HW struct +* +* Read the Shadow RAM control word and determine which banks are active for +* the NVM, OROM, and Netlist modules. Also read and calculate the associated +* pointer and size. These values are then cached into the ice_flash_info +* structure for later use in order to calculate the correct offset to read +* from the active module. +*/ +static enum ice_status +ice_determine_active_flash_banks (struct ice_hw *hw) +{ +struct ice_bank_info *banks = &hw->flash.banks; +enum ice_status status; +u16 ctrl_word; + + status =ice_read_sr_word (hw,ICE_SR_NVM_CTRL_WORD , &ctrl_word); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read the Shadow RAM control word\n" ); +return status; + } + +/* Check that the control word indicates validity */ +if ((ctrl_word &ICE_SR_CTRL_WORD_1_M ) >>ICE_SR_CTRL_WORD_1_S !=ICE_SR_CTRL_WORD_VALID ) { +ice_debug (hw,ICE_DBG_NVM ,"Shadow RAM control word is invalid\n" ); +return ICE_ERR_CFG ; + } + +if (!(ctrl_word &ICE_SR_CTRL_WORD_NVM_BANK )) + banks->nvm_bank =ICE_1ST_FLASH_BANK ; +else + banks->nvm_bank =ICE_2ND_FLASH_BANK ; + +if (!(ctrl_word &ICE_SR_CTRL_WORD_OROM_BANK )) + banks->orom_bank =ICE_1ST_FLASH_BANK ; +else + banks->orom_bank =ICE_2ND_FLASH_BANK ; + +if (!(ctrl_word &ICE_SR_CTRL_WORD_NETLIST_BANK )) + banks->netlist_bank =ICE_1ST_FLASH_BANK ; +else + banks->netlist_bank =ICE_2ND_FLASH_BANK ; + + status =ice_read_sr_pointer (hw,ICE_SR_1ST_NVM_BANK_PTR , &banks->nvm_ptr); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read NVM bank pointer\n" ); +return status; + } + + status =ice_read_sr_area_size (hw,ICE_SR_NVM_BANK_SIZE , &banks->nvm_size); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read NVM bank area size\n" ); +return status; + } + + status =ice_read_sr_pointer (hw,ICE_SR_1ST_OROM_BANK_PTR , &banks->orom_ptr); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read OROM bank pointer\n" ); +return status; + } + + status =ice_read_sr_area_size (hw,ICE_SR_OROM_BANK_SIZE , &banks->orom_size); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read OROM bank area size\n" ); +return status; + } + + status =ice_read_sr_pointer (hw,ICE_SR_NETLIST_BANK_PTR , &banks->netlist_ptr); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read Netlist bank pointer\n" ); +return status; + } + + status =ice_read_sr_area_size (hw,ICE_SR_NETLIST_BANK_SIZE , &banks->netlist_size); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to read Netlist bank area size\n" ); +return status; + } + +return ICE_SUCCESS ; +} + +/** * ice_init_nvm - initializes NVM setting * @hw: pointer to the HW struct *
@@ -544,6 +689,12 @@ enum ice_status ice_init_nvm(struct ice_hw *hw)return status; } + status =ice_determine_active_flash_banks (hw); +if (status) { +ice_debug (hw,ICE_DBG_NVM ,"Failed to determine active flash banks.\n" ); +return status; + } + status =ice_get_nvm_ver_info (hw, &flash->nvm);if (status) {ice_debug (hw,ICE_DBG_INIT ,"Failed to read NVM info.\n" );
drivers/net/ice/base/ice_type.h +29 -0
@@ -518,10 +518,33 @@ struct ice_nvm_info {u8 minor; }; +/* Enumeration of possible flash banks for the NVM, OROM, and Netlist modules +* of the flash image. +*/ +enum ice_flash_bank { +ICE_INVALID_FLASH_BANK , +ICE_1ST_FLASH_BANK , +ICE_2ND_FLASH_BANK , +}; + +/* information for accessing NVM, OROM, and Netlist flash banks */ +struct ice_bank_info { +u32 nvm_ptr;/* Pointer to 1st NVM bank */ +u32 nvm_size;/* Size of NVM bank */ +u32 orom_ptr;/* Pointer to 1st OROM bank */ +u32 orom_size;/* Size of OROM bank */ +u32 netlist_ptr;/* Pointer to 1st Netlist bank */ +u32 netlist_size;/* Size of Netlist bank */ +enum ice_flash_bank nvm_bank;/* Active NVM bank */ +enum ice_flash_bank orom_bank;/* Active OROM bank */ +enum ice_flash_bank netlist_bank;/* Active Netlist bank */ +}; +/* Flash Chip Information */ struct ice_flash_info {struct ice_orom_info orom;/* Option ROM version info */ struct ice_nvm_info nvm;/* NVM version information */ +struct ice_bank_info banks;/* Flash Bank information */ u16 sr_words;/* Shadow RAM size in words */ u32 flash_size;/* Size of available flash in bytes */ u8 blank_nvm_mode;/* is NVM empty (no FW present) */
@@ -1099,6 +1122,12 @@ enum ice_sw_fwd_act_type {#define ICE_SR_PCIE_ALT_SIZE_WORDS 512#define ICE_SR_CTRL_WORD_1_S 0x06#define ICE_SR_CTRL_WORD_1_M (0x03 << ICE_SR_CTRL_WORD_1_S) +#define ICE_SR_CTRL_WORD_VALID 0x1 +#define ICE_SR_CTRL_WORD_OROM_BANK BIT(3) +#define ICE_SR_CTRL_WORD_NETLIST_BANK BIT(4) +#define ICE_SR_CTRL_WORD_NVM_BANK BIT(5) + +#define ICE_SR_NVM_PTR_4KB_UNITS BIT(15)/* Shadow RAM related */ #define ICE_SR_SECTOR_SIZE_IN_WORDS 0x800
Signature · 1 line
2.13.6
PATCH v2 37/40 net/ice/base: rename function
In reply to Qi Zhang'xtrct' or 'xtract' is currently used in the code to shorten 'extract'. Rename ice_prgm_acl_prof_extrt() to ice_prgm_acl_prof_xtrct() so we don't have another variation of a 'extract'.
--- drivers/net/ice/base/ice_acl.c | 4 ++-- drivers/net/ice/base/ice_acl.h | 2 +- drivers/net/ice/base/ice_flow.c | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/ice/base/ice_acl.c +2 -2
@@ -288,7 +288,7 @@ ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id, }/** -* ice_prgm_acl_prof_extrt - program ACL profile extraction sequence +* ice_prgm_acl_prof_xtrct - program ACL profile extraction sequence * @hw: pointer to the HW struct * @prof_id: profile ID * @buf: ptr to buffer
@@ -297,7 +297,7 @@ ice_acl_prof_aq_send(struct ice_hw *hw, u16 opc, u8 prof_id,* Program ACL profile extraction (indirect 0x0C1D) */ enum ice_status -ice_prgm_acl_prof_extrt (struct ice_hw *hw,u8 prof_id, +ice_prgm_acl_prof_xtrct (struct ice_hw *hw,u8 prof_id,struct ice_aqc_acl_prof_generic_frmt *buf,struct ice_sq_cd *cd) {
drivers/net/ice/base/ice_acl.h +1 -1
@@ -158,7 +158,7 @@ ice_aq_query_actpair(struct ice_hw *hw, u8 act_mem_idx, u16 act_entry_idx, struct ice_aqc_actpair *buf, struct ice_sq_cd *cd);enum ice_status ice_aq_dealloc_acl_res (struct ice_hw *hw,struct ice_sq_cd *cd);enum ice_status -ice_prgm_acl_prof_extrt (struct ice_hw *hw,u8 prof_id, +ice_prgm_acl_prof_xtrct (struct ice_hw *hw,u8 prof_id,struct ice_aqc_acl_prof_generic_frmt *buf,struct ice_sq_cd *cd);enum ice_status
drivers/net/ice/base/ice_flow.c +2 -3
@@ -1780,7 +1780,7 @@ ice_flow_acl_disassoc_scen(struct ice_hw *hw, struct ice_flow_prof *prof)/* Clear scenario for this PF */ buf.pf_scenario_num[hw->pf_id] =ICE_ACL_INVALID_SCEN ; - status =ice_prgm_acl_prof_extrt (hw, prof_id, &buf,NULL ); + status =ice_prgm_acl_prof_xtrct (hw, prof_id, &buf,NULL );return status; }
@@ -2082,7 +2082,7 @@ ice_flow_acl_set_xtrct_seq(struct ice_hw *hw, struct ice_flow_prof *prof)/* Update the current PF */ buf.pf_scenario_num[hw->pf_id] = (u8 )prof->cfg.scen->id; - status =ice_prgm_acl_prof_extrt (hw, prof_id, &buf,NULL ); + status =ice_prgm_acl_prof_xtrct (hw, prof_id, &buf,NULL );return status; }
@@ -2510,7 +2510,6 @@ ice_flow_acl_frmt_entry(struct ice_hw *hw, struct ice_flow_prof *prof, e->acts = (struct ice_flow_action *)ice_memdup (hw, acts, acts_cnt *sizeof (*acts),ICE_NONDMA_TO_NONDMA ); -if (!e->acts) goto out;
Signature · 1 line
2.13.6
PATCH v2 38/40 net/ice/base: remove unnecessary conditional
In reply to Qi ZhangThese two conditional statements are unnecessary because the condition is always true based on existing code flow. Remove them to resolve potential errors from some static analysis tools.
--- drivers/net/ice/base/ice_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_flow.c +2 -2
@@ -1089,7 +1089,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,*/ if (fld ==ICE_FLOW_FIELD_IDX_IPV4_TTL ) sib =ICE_FLOW_FIELD_IDX_IPV4_PROT ; -else if (fld ==ICE_FLOW_FIELD_IDX_IPV4_PROT ) +else sib =ICE_FLOW_FIELD_IDX_IPV4_TTL ;/* If the sibling field is also included, that field's
@@ -1108,7 +1108,7 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params,*/ if (fld ==ICE_FLOW_FIELD_IDX_IPV6_TTL ) sib =ICE_FLOW_FIELD_IDX_IPV6_PROT ; -else if (fld ==ICE_FLOW_FIELD_IDX_IPV6_PROT ) +else sib =ICE_FLOW_FIELD_IDX_IPV6_TTL ;/* If the sibling field is also included, that field's
Signature · 1 line
2.13.6
PATCH v2 39/40 net/ice/base: rename ACL priority values
In reply to Qi ZhangThe naming convention used to shorten 'priority' is 'prio'. Convert the ACL related entries that use 'prior' to 'prio'.
Also, as ICE_LOW, ICE_NORMAL,... are not very descriptive of what they represent. Add 'ACL_PRIO' to help convey their use.
--- drivers/net/ice/base/ice_acl.h | 16 ++++++++-------- drivers/net/ice/base/ice_acl_ctrl.c | 32 +++++++++++++++++--------------- drivers/net/ice/base/ice_flow.c | 25 ++++++++++++------------- 3 files changed, 37 insertions(+), 36 deletions(-)
drivers/net/ice/base/ice_acl.h +8 -8
@@ -47,11 +47,11 @@ struct ice_acl_tbl { };#define ICE_MAX_ACL_TCAM_ENTRY (ICE_AQC_ACL_TCAM_DEPTH * ICE_AQC_ACL_SLICES) -enum ice_acl_entry_prior { -ICE_LOW =0 , -ICE_NORMAL , -ICE_HIGH , -ICE_MAX_PRIOR +enum ice_acl_entry_prio { +ICE_ACL_PRIO_LOW =0 , +ICE_ACL_PRIO_NORMAL , +ICE_ACL_PRIO_HIGH , +ICE_ACL_MAX_PRIO };/* Scenario structure
@@ -74,8 +74,8 @@ struct ice_acl_scen {* be available in this scenario */ ice_declare_bitmap (entry_bitmap,ICE_MAX_ACL_TCAM_ENTRY ); -u16 first_idx[ICE_MAX_PRIOR ]; -u16 last_idx[ICE_MAX_PRIOR ]; +u16 first_idx[ICE_ACL_MAX_PRIO ]; +u16 last_idx[ICE_ACL_MAX_PRIO ];u16 id;u16 start;/* Number of entry from the start of the parent table */
@@ -192,7 +192,7 @@ ice_aq_query_acl_scen(struct ice_hw *hw, u16 scen_id, struct ice_aqc_acl_scen *buf, struct ice_sq_cd *cd);enum ice_status ice_acl_add_entry (struct ice_hw *hw,struct ice_acl_scen *scen, -enum ice_acl_entry_prior prior,u8 *keys,u8 *inverts, +enum ice_acl_entry_prio prio,u8 *keys,u8 *inverts,struct ice_acl_act_entry *acts,u8 acts_cnt,u16 *entry_idx); enum ice_status ice_acl_prog_act(struct ice_hw *hw, struct ice_acl_scen *scen,
drivers/net/ice/base/ice_acl_ctrl.c +17 -15
@@ -25,19 +25,21 @@ static void ice_acl_init_entry(struct ice_acl_scen *scen)* normal priority: start from the highest index, 50% of total entries * high priority: start from the lowest index, 25% of total entries */ - scen->first_idx[ICE_LOW ] = scen->num_entry -1 ; - scen->first_idx[ICE_NORMAL ] = scen->num_entry - scen->num_entry /4 -1 ; - scen->first_idx[ICE_HIGH ] =0 ; - - scen->last_idx[ICE_LOW ] = scen->num_entry - scen->num_entry /4 ; - scen->last_idx[ICE_NORMAL ] = scen->num_entry /4 ; - scen->last_idx[ICE_HIGH ] = scen->num_entry /4 -1 ; + scen->first_idx[ICE_ACL_PRIO_LOW ] = scen->num_entry -1 ; + scen->first_idx[ICE_ACL_PRIO_NORMAL ] = scen->num_entry - + scen->num_entry /4 -1 ; + scen->first_idx[ICE_ACL_PRIO_HIGH ] =0 ; + + scen->last_idx[ICE_ACL_PRIO_LOW ] = scen->num_entry - + scen->num_entry /4 ; + scen->last_idx[ICE_ACL_PRIO_NORMAL ] = scen->num_entry /4 ; + scen->last_idx[ICE_ACL_PRIO_HIGH ] = scen->num_entry /4 -1 ; }/** * ice_acl_scen_assign_entry_idx * @scen: pointer to the scenario struct -* @prior: the priority of the flow entry being allocated +* @prio: the priority of the flow entry being allocated * * To find the index of an available entry in scenario *
@@ -46,16 +48,16 @@ static void ice_acl_init_entry(struct ice_acl_scen *scen)*/ static u16 ice_acl_scen_assign_entry_idx (struct ice_acl_scen *scen, -enum ice_acl_entry_prior prior) +enum ice_acl_entry_prio prio) {u16 first_idx, last_idx, i;s8 step; -if (prior >=ICE_MAX_PRIOR ) +if (prio >=ICE_ACL_MAX_PRIO )return ICE_ACL_SCEN_ENTRY_INVAL ; - first_idx = scen->first_idx[prior]; - last_idx = scen->last_idx[prior]; + first_idx = scen->first_idx[prio]; + last_idx = scen->last_idx[prio]; step = first_idx <= last_idx ?1 :-1 ;for (i = first_idx; i != last_idx + step; i += step)
@@ -953,7 +955,7 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw)* ice_acl_add_entry - Add a flow entry to an ACL scenario * @hw: pointer to the HW struct * @scen: scenario to add the entry to -* @prior: priority level of the entry being added +* @prio: priority level of the entry being added * @keys: buffer of the value of the key to be programmed to the ACL entry * @inverts: buffer of the value of the key inverts to be programmed * @acts: pointer to a buffer containing formatted actions
@@ -967,7 +969,7 @@ enum ice_status ice_acl_destroy_tbl(struct ice_hw *hw)*/ enum ice_status ice_acl_add_entry (struct ice_hw *hw,struct ice_acl_scen *scen, -enum ice_acl_entry_prior prior,u8 *keys,u8 *inverts, +enum ice_acl_entry_prio prio,u8 *keys,u8 *inverts,struct ice_acl_act_entry *acts,u8 acts_cnt,u16 *entry_idx) {u8 i, entry_tcam, num_cscd, offset;
@@ -978,7 +980,7 @@ ice_acl_add_entry(struct ice_hw *hw, struct ice_acl_scen *scen,if (!scen)return ICE_ERR_DOES_NOT_EXIST ; - *entry_idx =ice_acl_scen_assign_entry_idx (scen, prior); + *entry_idx =ice_acl_scen_assign_entry_idx (scen, prio);if (*entry_idx >= scen->num_entry) { *entry_idx =0 ;return ICE_ERR_MAX_LIMIT ;
drivers/net/ice/base/ice_flow.c +12 -13
@@ -2715,30 +2715,30 @@ ice_flow_acl_find_scen_entry_cond(struct ice_flow_prof *prof, }/** -* ice_flow_acl_convert_to_acl_prior - Convert to ACL priority +* ice_flow_acl_convert_to_acl_prio - Convert to ACL priority * @p: flow priority */ -static enum ice_acl_entry_prior -ice_flow_acl_convert_to_acl_prior (enum ice_flow_priority p) +static enum ice_acl_entry_prio +ice_flow_acl_convert_to_acl_prio (enum ice_flow_priority p) { -enum ice_acl_entry_prior acl_prior; +enum ice_acl_entry_prio acl_prio;switch (p) {case ICE_FLOW_PRIO_LOW : - acl_prior =ICE_LOW ; + acl_prio =ICE_ACL_PRIO_LOW ;break ;case ICE_FLOW_PRIO_NORMAL : - acl_prior =ICE_NORMAL ; + acl_prio =ICE_ACL_PRIO_NORMAL ;break ;case ICE_FLOW_PRIO_HIGH : - acl_prior =ICE_HIGH ; + acl_prio =ICE_ACL_PRIO_HIGH ;break ;default : - acl_prior =ICE_NORMAL ; + acl_prio =ICE_ACL_PRIO_NORMAL ;break ; } -return acl_prior; +return acl_prio; }/**
@@ -2878,15 +2878,15 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof, ICE_NONDMA_TO_NONDMA);if (do_add_entry) { -enum ice_acl_entry_prior prior; +enum ice_acl_entry_prio prio;u8 *keys, *inverts;u16 entry_idx; keys = (u8 *)e->entry; inverts = keys + (e->entry_sz /2 ); - prior =ice_flow_acl_convert_to_acl_prior (e->priority); + prio =ice_flow_acl_convert_to_acl_prio (e->priority); - status =ice_acl_add_entry (hw, prof->cfg.scen, prior, keys, + status =ice_acl_add_entry (hw, prof->cfg.scen, prio, keys, inverts, acts, e->acts_cnt, &entry_idx);if (status)
@@ -2904,7 +2904,6 @@ ice_flow_acl_add_scen_entry_sync(struct ice_hw *hw, struct ice_flow_prof *prof, exist->acts = (struct ice_flow_action *)ice_calloc (hw, exist->acts_cnt,sizeof (struct ice_flow_action )); -if (!exist->acts) { status =ICE_ERR_NO_MEMORY ; goto out;
Signature · 1 line
2.13.6
PATCH v2 40/40 net/ice/base: preserve default aggr vsi information
In reply to Qi ZhangAdded the change to keep the default aggregator VSI information.
--- drivers/net/ice/base/ice_sched.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/net/ice/base/ice_sched.c +1 -10
@@ -2852,16 +2852,7 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,if (status)break ; -if (agg_id !=ICE_DFLT_AGG_ID ) -ice_set_bit (tc, agg_vsi_info->tc_bitmap); -else -ice_clear_bit (tc, agg_vsi_info->tc_bitmap); - } -/* If VSI moved back to default aggregator, delete agg_vsi_info. */ -if (!ice_is_any_bit_set (agg_vsi_info->tc_bitmap, -ICE_MAX_TRAFFIC_CLASS )) { -LIST_DEL (&agg_vsi_info->list_entry); -ice_free (hw, agg_vsi_info); +ice_set_bit (tc, agg_vsi_info->tc_bitmap); }return status; }
Signature · 1 line
2.13.6