shared code update
PATCH v3 34/69 net/ice/base: track HW stat registers past rollover
In reply to Leyi RongModify ice_stat_update40 to use rd64 instead of two calls to rd32. Additionally, drop the now unnecessary hireg function parameter.
--- drivers/net/ice/base/ice_common.c | 57 +++++++++++++++++++------------ drivers/net/ice/base/ice_common.h | 8 ++--- 2 files changed, 38 insertions(+), 27 deletions(-)
drivers/net/ice/base/ice_common.c +35 -22
@@ -4004,40 +4004,44 @@ void ice_replay_post(struct ice_hw *hw)/** * ice_stat_update40 - read 40 bit stat from the chip and update stat values * @hw: ptr to the hardware info -* @hireg: high 32 bit HW register to read from -* @loreg: low 32 bit HW register to read from +* @reg: offset of 64 bit HW register to read from * @prev_stat_loaded: bool to specify if previous stats are loaded * @prev_stat: ptr to previous loaded stat value * @cur_stat: ptr to current stat value */ void -ice_stat_update40 (struct ice_hw *hw,u32 hireg,u32 loreg, -bool prev_stat_loaded,u64 *prev_stat,u64 *cur_stat) +ice_stat_update40 (struct ice_hw *hw,u32 reg,bool prev_stat_loaded, +u64 *prev_stat,u64 *cur_stat) { -u64 new_data; - - new_data =rd32 (hw, loreg); - new_data |= ((u64)(rd32 (hw, hireg) &0xFFFF )) <<32 ; +u64 new_data =rd64 (hw, reg) & (BIT_ULL (40 ) -1 );/* device stats are not reset at PFR, they likely will not be zeroed -* when the driver starts. So save the first values read and use them as -* offsets to be subtracted from the raw values in order to report stats -* that count from zero. +* when the driver starts. Thus, save the value from the first read +* without adding to the statistic value so that we report stats which +* count up from zero. */ -if (!prev_stat_loaded) +if (!prev_stat_loaded) { *prev_stat = new_data; +return ; + } + +/* Calculate the difference between the new and old values, and then +* add it to the software stat value. +*/ if (new_data >= *prev_stat) - *cur_stat = new_data - *prev_stat; + *cur_stat += new_data - *prev_stat;else /* to manage the potential roll-over */ - *cur_stat = (new_data +BIT_ULL (40 )) - *prev_stat; - *cur_stat &=0xFFFFFFFFFFULL ; + *cur_stat += (new_data +BIT_ULL (40 )) - *prev_stat; + +/* Update the previously stored value to prepare for next read */ + *prev_stat = new_data; }/** * ice_stat_update32 - read 32 bit stat from the chip and update stat values * @hw: ptr to the hardware info -* @reg: HW register to read from +* @reg: offset of HW register to read from * @prev_stat_loaded: bool to specify if previous stats are loaded * @prev_stat: ptr to previous loaded stat value * @cur_stat: ptr to current stat value
@@ -4051,17 +4055,26 @@ ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded, new_data =rd32 (hw, reg);/* device stats are not reset at PFR, they likely will not be zeroed -* when the driver starts. So save the first values read and use them as -* offsets to be subtracted from the raw values in order to report stats -* that count from zero. +* when the driver starts. Thus, save the value from the first read +* without adding to the statistic value so that we report stats which +* count up from zero. */ -if (!prev_stat_loaded) +if (!prev_stat_loaded) { *prev_stat = new_data; +return ; + } + +/* Calculate the difference between the new and old values, and then +* add it to the software stat value. +*/ if (new_data >= *prev_stat) - *cur_stat = new_data - *prev_stat; + *cur_stat += new_data - *prev_stat;else /* to manage the potential roll-over */ - *cur_stat = (new_data +BIT_ULL (32 )) - *prev_stat; + *cur_stat += (new_data +BIT_ULL (32 )) - *prev_stat; + +/* Update the previously stored value to prepare for next read */ + *prev_stat = new_data; }
drivers/net/ice/base/ice_common.h +3 -5
@@ -6,7 +6,6 @@#define _ICE_COMMON_H_#include "ice_type.h" -#include "ice_flex_pipe.h" #include "ice_switch.h" #include "ice_fdir.h"
@@ -34,8 +33,7 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq, struct ice_rq_event_info *e, u16 *pending);enum ice_status ice_get_link_status (struct ice_port_info *pi,bool *link_up); -enum ice_status -ice_update_link_info (struct ice_port_info *pi); +enum ice_status ice_update_link_info (struct ice_port_info *pi);enum ice_status ice_acquire_res (struct ice_hw *hw,enum ice_aq_res_ids res,enum ice_aq_res_access_type access,u32 timeout);
@@ -195,8 +193,8 @@ ice_cfg_tc_node_bw_alloc(struct ice_port_info *pi, u8 tc,enum ice_status ice_cfg_rl_burst_size (struct ice_hw *hw,u32 bytes);void ice_output_fw_log (struct ice_hw *hw,struct ice_aq_desc *desc,void *buf);void -ice_stat_update40 (struct ice_hw *hw,u32 hireg,u32 loreg, -bool prev_stat_loaded,u64 *prev_stat,u64 *cur_stat); +ice_stat_update40 (struct ice_hw *hw,u32 reg,bool prev_stat_loaded, +u64 *prev_stat,u64 *cur_stat);void ice_stat_update32 (struct ice_hw *hw,u32 reg,bool prev_stat_loaded,u64 *prev_stat,u64 *cur_stat);
Signature · 1 line
2.17.1
PATCH v3 35/69 net/ice/base: implement LLDP persistent settings
In reply to Leyi RongThis patch implements persistent, across reboots, start and stop of LLDP agent. Added additional function parameter to ice_aq_start_lldp and ice_aq_stop_lldp.
--- drivers/net/ice/base/ice_dcb.c | 33 ++++++++++++++++++++++----------- drivers/net/ice/base/ice_dcb.h | 9 ++++----- drivers/net/ice/ice_ethdev.c | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-)
drivers/net/ice/base/ice_dcb.c +22 -11
@@ -83,12 +83,14 @@ ice_aq_cfg_lldp_mib_change(struct ice_hw *hw, bool ena_update,* @hw: pointer to the HW struct * @shutdown_lldp_agent: True if LLDP Agent needs to be Shutdown * False if LLDP Agent needs to be Stopped +* @persist: True if Stop/Shutdown of LLDP Agent needs to be persistent across +* reboots * @cd: pointer to command details structure or NULL * * Stop or Shutdown the embedded LLDP Agent (0x0A05) */ enum ice_status -ice_aq_stop_lldp (struct ice_hw *hw,bool shutdown_lldp_agent, +ice_aq_stop_lldp (struct ice_hw *hw,bool shutdown_lldp_agent,bool persist,struct ice_sq_cd *cd) {struct ice_aqc_lldp_stop *cmd;
@@ -101,17 +103,22 @@ ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent,if (shutdown_lldp_agent) cmd->command |=ICE_AQ_LLDP_AGENT_SHUTDOWN ; +if (persist) + cmd->command |=ICE_AQ_LLDP_AGENT_PERSIST_DIS ; +return ice_aq_send_cmd (hw, &desc,NULL ,0 , cd); }/** * ice_aq_start_lldp * @hw: pointer to the HW struct +* @persist: True if Start of LLDP Agent needs to be persistent across reboots * @cd: pointer to command details structure or NULL * * Start the embedded LLDP Agent on all ports. (0x0A06) */ -enum ice_status ice_aq_start_lldp (struct ice_hw *hw,struct ice_sq_cd *cd) +enum ice_status +ice_aq_start_lldp (struct ice_hw *hw,bool persist,struct ice_sq_cd *cd) {struct ice_aqc_lldp_start *cmd;struct ice_aq_desc desc;
@@ -122,6 +129,9 @@ enum ice_status ice_aq_start_lldp(struct ice_hw *hw, struct ice_sq_cd *cd) cmd->command =ICE_AQ_LLDP_AGENT_START ; +if (persist) + cmd->command |=ICE_AQ_LLDP_AGENT_PERSIST_ENA ; +return ice_aq_send_cmd (hw, &desc,NULL ,0 , cd); }
@@ -615,7 +625,8 @@ ice_parse_org_tlv(struct ice_lldp_org_tlv *tlv, struct ice_dcbx_cfg *dcbcfg)* * Parse DCB configuration from the LLDPDU */ -enum ice_status ice_lldp_to_dcb_cfg (u8 *lldpmib,struct ice_dcbx_cfg *dcbcfg) +enum ice_status +ice_lldp_to_dcb_cfg (u8 *lldpmib,struct ice_dcbx_cfg *dcbcfg) {struct ice_lldp_org_tlv *tlv;enum ice_status ret =ICE_SUCCESS ;
@@ -659,7 +670,7 @@ enum ice_status ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)/** * ice_aq_get_dcb_cfg * @hw: pointer to the HW struct -* @mib_type: mib type for the query +* @mib_type: MIB type for the query * @bridgetype: bridge type for the query (remote) * @dcbcfg: store for LLDPDU data *
@@ -690,13 +701,13 @@ ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype, }/** -* ice_aq_start_stop_dcbx - Start/Stop DCBx service in FW +* ice_aq_start_stop_dcbx - Start/Stop DCBX service in FW * @hw: pointer to the HW struct -* @start_dcbx_agent: True if DCBx Agent needs to be started -* False if DCBx Agent needs to be stopped -* @dcbx_agent_status: FW indicates back the DCBx agent status -* True if DCBx Agent is active -* False if DCBx Agent is stopped +* @start_dcbx_agent: True if DCBX Agent needs to be started +* False if DCBX Agent needs to be stopped +* @dcbx_agent_status: FW indicates back the DCBX agent status +* True if DCBX Agent is active +* False if DCBX Agent is stopped * @cd: pointer to command details structure or NULL * * Start/Stop the embedded dcbx Agent. In case that this wrapper function
@@ -1236,7 +1247,7 @@ ice_add_dcb_tlv(struct ice_lldp_org_tlv *tlv, struct ice_dcbx_cfg *dcbcfg,/** * ice_dcb_cfg_to_lldp - Convert DCB configuration to MIB format * @lldpmib: pointer to the HW struct -* @miblen: length of LLDP mib +* @miblen: length of LLDP MIB * @dcbcfg: Local store which holds the DCB Config * * Convert the DCB configuration to MIB format
drivers/net/ice/base/ice_dcb.h +4 -5
@@ -114,7 +114,6 @@ struct ice_lldp_org_tlv {__be32 ouisubtype;u8 tlvinfo[1 ]; }; -#pragma pack()struct ice_cee_tlv_hdr {
@@ -147,7 +146,6 @@ struct ice_cee_app_prio {__be16 lower_oui;u8 prio_map; }; -#pragma pack()/* TODO: The below structures related LLDP/DCBX variables
@@ -190,8 +188,8 @@ enum ice_status ice_aq_get_cee_dcb_cfg(struct ice_hw *hw, struct ice_aqc_get_cee_dcb_cfg_resp *buff, struct ice_sq_cd *cd); -u8 ice_get_dcbx_status (struct ice_hw *hw);enum ice_status ice_lldp_to_dcb_cfg (u8 *lldpmib,struct ice_dcbx_cfg *dcbcfg); +u8 ice_get_dcbx_status (struct ice_hw *hw);enum ice_status ice_aq_get_dcb_cfg (struct ice_hw *hw,u8 mib_type,u8 bridgetype,struct ice_dcbx_cfg *dcbcfg);
@@ -211,9 +209,10 @@ enum ice_status ice_update_port_tc_tree_cfg(struct ice_port_info *pi, struct ice_aqc_port_ets_elem *buf);enum ice_status -ice_aq_stop_lldp (struct ice_hw *hw,bool shutdown_lldp_agent, +ice_aq_stop_lldp (struct ice_hw *hw,bool shutdown_lldp_agent,bool persist,struct ice_sq_cd *cd); -enum ice_status ice_aq_start_lldp (struct ice_hw *hw,struct ice_sq_cd *cd); +enum ice_status +ice_aq_start_lldp (struct ice_hw *hw,bool persist,struct ice_sq_cd *cd);enum ice_status ice_aq_start_stop_dcbx (struct ice_hw *hw,bool start_dcbx_agent,bool *dcbx_agent_status,struct ice_sq_cd *cd);
drivers/net/ice/ice_ethdev.c +1 -1
@@ -1447,7 +1447,7 @@ ice_dev_init(struct rte_eth_dev *dev)/* Disable double vlan by default */ ice_vsi_config_double_vlan (vsi, FALSE); - ret =ice_aq_stop_lldp (hw, TRUE,NULL ); + ret =ice_aq_stop_lldp (hw, TRUE, FALSE,NULL );if (ret !=ICE_SUCCESS )PMD_INIT_LOG (DEBUG ,"lldp has already stopped\n" );
Signature · 1 line
2.17.1
PATCH v3 36/69 net/ice/base: check new FD filter duplicate location
In reply to Leyi RongFunction ice_fdir_is_dup_fltr tests if new Flow Director rule is not a duplicate.
--- drivers/net/ice/base/ice_fdir.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_fdir.c +7 -2
@@ -692,8 +692,13 @@ bool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input) ret =ice_fdir_comp_rules (rule, input, false); else ret =ice_fdir_comp_rules (rule, input, true); -if (ret) -break ; +if (ret) { +if (rule->fltr_id == input->fltr_id && + rule->q_index != input->q_index) + ret = false; +else +break ; + } } }
Signature · 1 line
2.17.1
PATCH v3 37/69 net/ice/base: correct UDP/TCP PTYPE assignments
In reply to Leyi Rong1. Using the UDP-IL PTYPEs when processing packet segments as it contains all PTYPEs with UDP and allow packets to be forwarded to associated VSIs as switch rules are based on outer IPs.
2. Add PTYPE 0x088 to TCP PTYPE bitmap list.
--- drivers/net/ice/base/ice_flow.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
drivers/net/ice/base/ice_flow.c +6 -17
@@ -195,21 +195,11 @@ static const u32 ice_ptypes_arp_of[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; -/* Packet types for packets with an Outermost/First UDP header */ -static const u32 ice_ptypes_udp_of[] = { -0x81000000 ,0x00000000 ,0x04000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 , -}; - -/* Packet types for packets with an Innermost/Last UDP header */ +/* UDP Packet types for non-tunneled packets or tunneled +* packets with inner UDP. +*/ static const u32 ice_ptypes_udp_il[] = { -0x80000000 ,0x20204040 ,0x00081010 ,0x80810102 , +0x81000000 ,0x20204040 ,0x04081010 ,0x80810102 ,0x00204040 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -222,7 +212,7 @@ static const u32 ice_ptypes_udp_il[] = {/* Packet types for packets with an Innermost/Last TCP header */ static const u32 ice_ptypes_tcp_il[] = {0x04000000 ,0x80810102 ,0x10204040 ,0x42040408 , -0x00810002 ,0x00000000 ,0x00000000 ,0x00000000 , +0x00810102 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,0x00000000 ,
@@ -473,8 +463,7 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) ICE_FLOW_PTYPE_MAX); hdrs &= ~ICE_FLOW_SEG_HDR_ICMP ; }else if (hdrs &ICE_FLOW_SEG_HDR_UDP ) { - src = !i ? (const ice_bitmap_t *)ice_ptypes_udp_of : - (const ice_bitmap_t *)ice_ptypes_udp_il; + src = (const ice_bitmap_t *)ice_ptypes_udp_il;ice_and_bitmap (params->ptypes, params->ptypes, src,ICE_FLOW_PTYPE_MAX ); hdrs &= ~ICE_FLOW_SEG_HDR_UDP ;
Signature · 1 line
2.17.1
PATCH v3 38/69 net/ice/base: calculate rate limit burst size correctly
In reply to Leyi RongWhen the MSB is not set, the lower 11 bits do not represent bytes, but chunks of 64 bytes. Adjust the rate limit burst size calculation accordingly, and update the comments to indicate the way the hardware actually works.
--- drivers/net/ice/base/ice_sched.c | 17 ++++++++--------- drivers/net/ice/base/ice_sched.h | 14 ++++++++------ 2 files changed, 16 insertions(+), 15 deletions(-)
drivers/net/ice/base/ice_sched.c +8 -9
@@ -5060,16 +5060,15 @@ enum ice_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes)if (bytes <ICE_MIN_BURST_SIZE_ALLOWED || bytes >ICE_MAX_BURST_SIZE_ALLOWED )return ICE_ERR_PARAM ; -if (bytes <=ICE_MAX_BURST_SIZE_BYTE_GRANULARITY ) { -/* byte granularity case */ +if (ice_round_to_num (bytes,64 ) <= +ICE_MAX_BURST_SIZE_64_BYTE_GRANULARITY ) { +/* 64 byte granularity case */ /* Disable MSB granularity bit */ - burst_size_to_prog =ICE_BYTE_GRANULARITY ; -/* round number to nearest 256 granularity */ - bytes =ice_round_to_num (bytes,256 ); -/* check rounding doesn't go beyond allowed */ -if (bytes >ICE_MAX_BURST_SIZE_BYTE_GRANULARITY ) - bytes =ICE_MAX_BURST_SIZE_BYTE_GRANULARITY ; - burst_size_to_prog |= (u16 )bytes; + burst_size_to_prog =ICE_64_BYTE_GRANULARITY ; +/* round number to nearest 64 byte granularity */ + bytes =ice_round_to_num (bytes,64 ); +/* The value is in 64 byte chunks */ + burst_size_to_prog |= (u16)(bytes /64 ); }else {/* k bytes granularity case */ /* Enable MSB granularity bit */
drivers/net/ice/base/ice_sched.h +8 -6
@@ -13,14 +13,16 @@#define ICE_SCHED_INVAL_LAYER_NUM 0xFF/* Burst size is a 12 bits register that is configured while creating the RL * profile(s). MSB is a granularity bit and tells the granularity type -* 0 - LSB bits are in bytes granularity +* 0 - LSB bits are in 64 bytes granularity * 1 - LSB bits are in 1K bytes granularity */ -#define ICE_BYTE_GRANULARITY 0 -#define ICE_KBYTE_GRANULARITY 0x800 -#define ICE_MIN_BURST_SIZE_ALLOWED 1/* In Bytes */ -#define ICE_MAX_BURST_SIZE_ALLOWED (2047 * 1024)/* In Bytes */ -#define ICE_MAX_BURST_SIZE_BYTE_GRANULARITY 2047/* In Bytes */ +#define ICE_64_BYTE_GRANULARITY 0 +#define ICE_KBYTE_GRANULARITY BIT(11) +#define ICE_MIN_BURST_SIZE_ALLOWED 64/* In Bytes */ +#define ICE_MAX_BURST_SIZE_ALLOWED \ + ((BIT(11) - 1) * 1024)/* In Bytes */ +#define ICE_MAX_BURST_SIZE_64_BYTE_GRANULARITY \ + ((BIT(11) - 1) * 64)/* In Bytes */ #define ICE_MAX_BURST_SIZE_KBYTE_GRANULARITY ICE_MAX_BURST_SIZE_ALLOWED#define ICE_RL_PROF_FREQUENCY 446000000
Signature · 1 line
2.17.1
PATCH v3 39/69 net/ice/base: fix Flow Director VSI count
In reply to Leyi RongFlow director keeps a list of VSIs for each flow type (TCP4, UDP6, etc.) This list varies in length depending on the number of traffic classes (ADQ). This patch uses the define of max TCs to calculate the size of the VSI array.
--- drivers/net/ice/base/ice_type.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_type.h +2 -2
@@ -261,8 +261,8 @@ enum ice_fltr_ptype { ICE_FLTR_PTYPE_MAX, }; -/* 6 VSI = 1 ICE_VSI_PF + 1 ICE_VSI_CTRL + 4 ICE_VSI_CHNL */ -#define ICE_MAX_FDIR_VSI_PER_FILTER 6 +/* 2 VSI = 1 ICE_VSI_PF + 1 ICE_VSI_CTRL */ +#define ICE_MAX_FDIR_VSI_PER_FILTER 2struct ice_fd_hw_prof {struct ice_flow_seg_info *fdir_seg;
Signature · 1 line
2.17.1
PATCH v3 40/69 net/ice/base: use more efficient structures
In reply to Leyi RongMove a bunch of members around to make more efficient use of memory, eliminating holes where possible. None of these members are hot path so cache line alignment is not very important here.
--- drivers/net/ice/base/ice_controlq.h | 4 +-- drivers/net/ice/base/ice_flex_type.h | 38 +++++++++++++--------------- drivers/net/ice/base/ice_flow.c | 4 +-- drivers/net/ice/base/ice_flow.h | 18 ++++++------- 4 files changed, 29 insertions(+), 35 deletions(-)
drivers/net/ice/base/ice_controlq.h +2 -2
@@ -81,6 +81,7 @@ struct ice_rq_event_info {/* Control Queue information */ struct ice_ctl_q_info {enum ice_ctl_q qtype; +enum ice_aq_err rq_last_status;/* last status on receive queue */ struct ice_ctl_q_ring rq;/* receive queue */ struct ice_ctl_q_ring sq;/* send queue */ u32 sq_cmd_timeout;/* send queue cmd write back timeout */
@@ -88,10 +89,9 @@ struct ice_ctl_q_info {u16 num_sq_entries;/* send queue depth */ u16 rq_buf_size;/* receive queue buffer size */ u16 sq_buf_size;/* send queue buffer size */ +enum ice_aq_err sq_last_status;/* last status on send queue */ struct ice_lock sq_lock;/* Send queue lock */ struct ice_lock rq_lock; /* Receive queue lock */ -enum ice_aq_err sq_last_status;/* last status on send queue */ - enum ice_aq_err rq_last_status; /* last status on receive queue */ };#endif /* _ICE_CONTROLQ_H_ */
drivers/net/ice/base/ice_flex_type.h +17 -21
@@ -5,7 +5,7 @@#ifndef _ICE_FLEX_TYPE_H_#define _ICE_FLEX_TYPE_H_ -#define ICE_FV_OFFSET_INVAL 0x1FF +#define ICE_FV_OFFSET_INVAL 0x1FF#pragma pack(1)/* Extraction Sequence (Field Vector) Table */
@@ -14,7 +14,6 @@ struct ice_fv_word {u16 off;/* Offset within the protocol header */ u8 resvrd; }; -#pragma pack()#define ICE_MAX_FV_WORDS 48
@@ -367,7 +366,6 @@ struct ice_boost_key_value {__le16 hv_src_port_key;u8 tcam_search_key; }; -#pragma pack()struct ice_boost_key {
@@ -406,7 +404,6 @@ struct ice_xlt1_section {__le16 offset;u8 value[1 ]; }; -#pragma pack()#define ICE_XLT1_SIZE (n) (sizeof(struct ice_xlt1_section) + \
@@ -467,19 +464,19 @@ struct ice_tunnel_type_scan {struct ice_tunnel_entry {enum ice_tunnel_type type; -u8 valid; -u8 in_use; -u8 marked;u16 boost_addr;u16 port;struct ice_boost_tcam_entry *boost_entry; +u8 valid; +u8 in_use; +u8 marked; };#define ICE_TUNNEL_MAX_ENTRIES 16struct ice_tunnel_table { -u16 count;struct ice_tunnel_entry tbl[ICE_TUNNEL_MAX_ENTRIES ]; +u16 count; };struct ice_pkg_es {
@@ -511,13 +508,13 @@ struct ice_es {#define ICE_DEFAULT_PTG 0struct ice_ptg_entry { -u8 in_use;struct ice_ptg_ptype *first_ptype; +u8 in_use; };struct ice_ptg_ptype { -u8 ptg;struct ice_ptg_ptype *next_ptype; +u8 ptg; };#define ICE_MAX_TCAM_PER_PROFILE 8
@@ -535,9 +532,9 @@ struct ice_prof_map {#define ICE_INVALID_TCAM 0xFFFFstruct ice_tcam_inf { +u16 tcam_idx;u8 ptg;u8 prof_id; -u16 tcam_idx;u8 in_use; };
@@ -550,16 +547,16 @@ struct ice_vsig_prof { };struct ice_vsig_entry { -u8 in_use;struct LIST_HEAD_TYPE prop_lst;struct ice_vsig_vsi *first_vsi; +u8 in_use; };struct ice_vsig_vsi { +struct ice_vsig_vsi *next_vsi; +u32 prop_mask;u16 changed;u16 vsig; -u32 prop_mask; -struct ice_vsig_vsi *next_vsi; };#define ICE_XLT1_CNT 1024
@@ -567,11 +564,11 @@ struct ice_vsig_vsi {/* XLT1 Table */ struct ice_xlt1 { -u32 sid; -u16 count;struct ice_ptg_entry *ptg_tbl;struct ice_ptg_ptype *ptypes;u8 *t; +u32 sid; +u16 count; };#define ICE_XLT2_CNT 768
@@ -591,11 +588,11 @@ struct ice_xlt1 {/* XLT2 Table */ struct ice_xlt2 { -u32 sid; -u16 count;struct ice_vsig_entry *vsig_tbl;struct ice_vsig_vsi *vsis;u16 *t; +u32 sid; +u16 count; };/* Extraction sequence - list of match fields:
@@ -641,21 +638,20 @@ struct ice_prof_id_section {__le16 count;struct ice_prof_tcam_entry entry[1 ]; }; -#pragma pack()struct ice_prof_tcam {u32 sid;u16 count;u16 max_prof_id; -u8 cdid_bits;/* # cdid bits to use in key, 0, 2, 4, or 8 */ struct ice_prof_tcam_entry *t; +u8 cdid_bits;/* # cdid bits to use in key, 0, 2, 4, or 8 */ };struct ice_prof_redir { +u8 *t;u32 sid;u16 count; -u8 *t; };/* Tables per block */
drivers/net/ice/base/ice_flow.c +2 -2
@@ -284,10 +284,10 @@ static const u32 ice_ptypes_mac_il[] = {/* Manage parameters and info. used during the creation of a flow profile */ struct ice_flow_prof_params {enum ice_block blk; -struct ice_flow_prof *prof; -u16 entry_length;/* # of bytes formatted entry will require */ u8 es_cnt; +struct ice_flow_prof *prof; +/* For ACL, the es[0] will have the data of ICE_RX_MDID_PKT_FLAGS_15_0 * This will give us the direction flags. */
drivers/net/ice/base/ice_flow.h +8 -10
@@ -225,20 +225,18 @@ struct ice_flow_entry {struct LIST_ENTRY_TYPE l_entry;u64 id; -u16 vsi_handle; -enum ice_flow_priority priority;struct ice_flow_prof *prof; - +/* Action list */ +struct ice_flow_action *acts;/* Flow entry's content */ -u16 entry_sz;void *entry; - -/* Action list */ +enum ice_flow_priority priority; +u16 vsi_handle; +u16 entry_sz;u8 acts_cnt; -struct ice_flow_action *acts; }; -#define ICE_FLOW_ENTRY_HNDL (e) ((unsigned long)e) +#define ICE_FLOW_ENTRY_HNDL (e) ((u64)e)#define ICE_FLOW_ENTRY_PTR (h) ((struct ice_flow_entry *)(h))struct ice_flow_prof {
@@ -246,12 +244,13 @@ struct ice_flow_prof {u64 id;enum ice_flow_dir dir; +u8 segs_cnt; +u8 acts_cnt;/* Keep track of flow entries associated with this flow profile */ struct ice_lock entries_lock;struct LIST_HEAD_TYPE entries; -u8 segs_cnt;struct ice_flow_seg_info segs[ICE_FLOW_SEG_MAX ];/* software VSI handles referenced by this flow profile */
@@ -264,7 +263,6 @@ struct ice_flow_prof { } cfg;/* Default actions */ -u8 acts_cnt;struct ice_flow_action *acts; };
Signature · 1 line
2.17.1
PATCH v3 41/69 net/ice/base: silent semantic parser warnings
In reply to Leyi RongEliminate some semantic warnings, static analysis warnings.
--- drivers/net/ice/base/ice_flex_pipe.c | 8 ++++---- drivers/net/ice/base/ice_flow.c | 5 +---- drivers/net/ice/base/ice_nvm.c | 4 ++-- drivers/net/ice/base/ice_protocol_type.h | 1 + drivers/net/ice/base/ice_switch.c | 8 +++----- drivers/net/ice/base/ice_type.h | 7 ++++++- 6 files changed, 17 insertions(+), 16 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +4 -4
@@ -134,7 +134,7 @@ static struct ice_buf_table *ice_find_buf_table(struct ice_seg *ice_seg) nvms = (struct ice_nvm_table *)(ice_seg->device_table +LE32_TO_CPU (ice_seg->device_table_count)); -return (struct ice_buf_table *) + return (_FORCE_ struct ice_buf_table *) (nvms->vers +LE32_TO_CPU (nvms->table_count)); }
@@ -2937,7 +2937,7 @@ static void ice_fill_tbl(struct ice_hw *hw, enum ice_block block_id, u32 sid)case ICE_SID_XLT2_ACL :case ICE_SID_XLT2_PE : xlt2 = (struct ice_xlt2_section *)sect; - src = (u8 *)xlt2->value; + src = (_FORCE_ u8 *)xlt2->value; sect_len =LE16_TO_CPU (xlt2->count) *sizeof (*hw->blk[block_id].xlt2.t); dst = (u8 *)hw->blk[block_id].xlt2.t;
@@ -3824,7 +3824,7 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)/* fill in the swap array */ si = hw->blk[ICE_BLK_FD ].es.fvw -1 ; - do { +while (si >=0 ) {u8 indexes_used =1 ;/* assume flat at this index */
@@ -3856,7 +3856,7 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es) } si -= indexes_used; - }while (si >=0 ); + }/* for each set of 4 swap indexes, write the appropriate register */ for (j =0 ; j < hw->blk[ICE_BLK_FD ].es.fvw /4 ; j++) {
drivers/net/ice/base/ice_flow.c +1 -4
@@ -415,9 +415,6 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)const ice_bitmap_t *src;u32 hdrs; -if (i >0 && (i +1 ) < prof->segs_cnt) -continue ; - hdrs = prof->segs[i].hdrs;if (hdrs &ICE_FLOW_SEG_HDR_ETH ) {
@@ -1397,7 +1394,7 @@ enum ice_status ice_flow_rem_entry(struct ice_hw *hw, u64 entry_h)if (entry_h ==ICE_FLOW_ENTRY_HANDLE_INVAL )return ICE_ERR_PARAM ; - entry =ICE_FLOW_ENTRY_PTR ((unsigned long )entry_h); + entry =ICE_FLOW_ENTRY_PTR (entry_h);/* Retain the pointer to the flow profile as the entry will be freed */ prof = entry->prof;
drivers/net/ice/base/ice_nvm.c +2 -2
@@ -127,7 +127,7 @@ ice_read_sr_word_aq(struct ice_hw *hw, u16 offset, u16 *data) status =ice_read_sr_aq (hw, offset,1 , data, true);if (!status) - *data =LE16_TO_CPU (*(__le16 *)data); + *data = LE16_TO_CPU(*(_FORCE_ __le16 *)data);return status; }
@@ -185,7 +185,7 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data) }while (words_read < *words);for (i =0 ; i < *words; i++) - data[i] =LE16_TO_CPU (((__le16 *)data)[i]); + data[i] = LE16_TO_CPU(((_FORCE_ __le16 *)data)[i]); read_nvm_buf_aq_exit: *words = words_read;
drivers/net/ice/base/ice_protocol_type.h +1 -0
@@ -189,6 +189,7 @@ struct ice_udp_tnl_hdr {u16 field;u16 proto_type;u16 vni; +u16 reserved; };struct ice_nvgre {
drivers/net/ice/base/ice_switch.c +3 -5
@@ -860,7 +860,7 @@ ice_aq_add_update_mir_rule(struct ice_hw *hw, u16 rule_type, u16 dest_vsi,return ICE_ERR_PARAM ; buf_size = count *sizeof (__le16); - mr_list = (__le16 *)ice_malloc (hw, buf_size); + mr_list = (_FORCE_ __le16 *)ice_malloc(hw, buf_size);if (!mr_list)return ICE_ERR_NO_MEMORY ;break ;
@@ -1460,7 +1460,6 @@ static int ice_ilog2(u64 n)return -1 ; } -/** * ice_fill_sw_rule - Helper function to fill switch rule structure * @hw: pointer to the hardware structure
@@ -1480,7 +1479,6 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,__be16 *off;u8 q_rgn; -if (opc == ice_aqc_opc_remove_sw_rules) { s_rule->pdata.lkup_tx_rx.act =0 ; s_rule->pdata.lkup_tx_rx.index =
@@ -1556,7 +1554,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, daddr = f_info->l_data.ethertype_mac.mac_addr;/* fall-through */ case ICE_SW_LKUP_ETHERTYPE : - off = (__be16 *)(eth_hdr +ICE_ETH_ETHTYPE_OFFSET ); + off = (_FORCE_ __be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET); *off =CPU_TO_BE16 (f_info->l_data.ethertype_mac.ethertype);break ;case ICE_SW_LKUP_MAC_VLAN :
@@ -1587,7 +1585,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, ICE_NONDMA_TO_NONDMA);if (!(vlan_id >ICE_MAX_VLAN_ID )) { - off = (__be16 *)(eth_hdr +ICE_ETH_VLAN_TCI_OFFSET ); + off = (_FORCE_ __be16 *)(eth_hdr + ICE_ETH_VLAN_TCI_OFFSET); *off =CPU_TO_BE16 (vlan_id); }
drivers/net/ice/base/ice_type.h +6 -1
@@ -14,6 +14,10 @@#define BITS_PER_BYTE 8 +#ifndef _FORCE_ +#define _FORCE_ +#endif +#define ICE_BYTES_PER_WORD 2#define ICE_BYTES_PER_DWORD 4#define ICE_MAX_TRAFFIC_CLASS 8
@@ -23,7 +27,7 @@#endif #ifndef IS_ASCII -#define IS_ASCII (_ch) ((_ch) < 0x80) +#define IS_ASCII (_ch) ((_ch) < 0x80)#endif #include "ice_status.h"
@@ -728,6 +732,7 @@ struct ice_hw {u8 pf_id;/* device profile info */ u16 max_burst_size;/* driver sets this value */ +/* Tx Scheduler values */ u16 num_tx_sched_layers;u16 num_tx_sched_phys_layers;
Signature · 1 line
2.17.1
PATCH v3 42/69 net/ice/base: fix for signed package download
In reply to Leyi RongIn order to properly support signed packages, we always have to send the complete buffer to firmware, regardless of any unused space at the end. This is because the SHA hash value is computed over the entire buffer.
--- drivers/net/ice/base/ice_flex_pipe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +2 -3
@@ -1005,9 +1005,8 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count) bh = (struct ice_buf_hdr *)(bufs + i); - status =ice_aq_download_pkg (hw, bh,LE16_TO_CPU (bh->data_end), - last, &offset, &info,NULL ); - + status =ice_aq_download_pkg (hw, bh,ICE_PKG_BUF_SIZE , last, + &offset, &info,NULL );if (status) { ice_debug(hw, ICE_DBG_PKG, "Pkg download failed: err %d off %d inf %d\n",
Signature · 1 line
2.17.1
PATCH v3 43/69 net/ice/base: add new API to dealloc flow entry
In reply to Leyi RongDecouple ice_dealloc_flow_entry from ice_flow_rem_entry_sync.
--- drivers/net/ice/base/ice_flow.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/net/ice/base/ice_flow.c +20 -6
@@ -932,17 +932,15 @@ ice_flow_find_prof_id(struct ice_hw *hw, enum ice_block blk, u64 prof_id) }/** -* ice_flow_rem_entry_sync - Remove a flow entry +* ice_dealloc_flow_entry - Deallocate flow entry memory * @hw: pointer to the HW struct * @entry: flow entry to be removed */ -static enum ice_status -ice_flow_rem_entry_sync (struct ice_hw *hw,struct ice_flow_entry *entry) +static void +ice_dealloc_flow_entry (struct ice_hw *hw,struct ice_flow_entry *entry) {if (!entry) -return ICE_ERR_BAD_PTR ; - -LIST_DEL (&entry->l_entry); +return ;if (entry->entry)ice_free (hw, entry->entry);
@@ -954,6 +952,22 @@ ice_flow_rem_entry_sync(struct ice_hw *hw, struct ice_flow_entry *entry) }ice_free (hw, entry); +} + +/** +* ice_flow_rem_entry_sync - Remove a flow entry +* @hw: pointer to the HW struct +* @entry: flow entry to be removed +*/ +static enum ice_status +ice_flow_rem_entry_sync (struct ice_hw *hw,struct ice_flow_entry *entry) +{ +if (!entry) +return ICE_ERR_BAD_PTR ; + +LIST_DEL (&entry->l_entry); + +ice_dealloc_flow_entry (hw, entry);return ICE_SUCCESS ; }
Signature · 1 line
2.17.1
PATCH v3 44/69 net/ice/base: check RSS flow profile list
In reply to Leyi RongMinor change to check if there are any RSS flow profiles to remove. This will avoid flow profile lock acquisition and release if the list is empty.
--- drivers/net/ice/base/ice_flow.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ice/base/ice_flow.c +3 -0
@@ -1659,6 +1659,9 @@ enum ice_status ice_rem_vsi_rss_cfg(struct ice_hw *hw, u16 vsi_handle)if (!ice_is_vsi_valid (hw, vsi_handle))return ICE_ERR_PARAM ; +if (LIST_EMPTY (&hw->fl_profs[blk])) +return ICE_SUCCESS ; +ice_acquire_lock (&hw->fl_profs_locks[blk]);LIST_FOR_EACH_ENTRY_SAFE (p, t, &hw->fl_profs[blk], ice_flow_prof, l_entry) {
Signature · 1 line
2.17.1
PATCH v3 45/69 net/ice/base: protect list add with lock
In reply to Leyi RongFunction ice_add_rule_internal needs to call ice_create_pkt_fwd_rule with lock held because it uses the LIST_ADD to modify the filter rule list. It needs to be protected when modified.
--- drivers/net/ice/base/ice_switch.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ice/base/ice_switch.c +4 -3
@@ -2288,14 +2288,15 @@ ice_add_rule_internal(struct ice_hw *hw, u8 recp_id, m_entry =ice_find_rule_entry (hw, recp_id, new_fltr);if (!m_entry) { -ice_release_lock (rule_lock); -return ice_create_pkt_fwd_rule (hw, f_entry); + status =ice_create_pkt_fwd_rule (hw, f_entry); + goto exit_add_rule_internal; } cur_fltr = &m_entry->fltr_info; status =ice_add_update_vsi_list (hw, m_entry, cur_fltr, new_fltr); -ice_release_lock (rule_lock); +exit_add_rule_internal: +ice_release_lock (rule_lock);return status; }
Signature · 1 line
2.17.1
PATCH v3 46/69 net/ice/base: fix Rx functionality for ethertype filters
In reply to Leyi RongIn the function ice_add_eth_mac(), there is a line that hard-codes the filter info flag to TX. This is redundant and inaccurate. That flag will be set by the calling function that built the list of filters to add, and hard-coding it eliminates the Rx functionality of this code. The paired function ice_remove_eth_mac() does not do this, making a mis-matched pair.
--- drivers/net/ice/base/ice_switch.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_switch.c +7 -1
@@ -2975,12 +2975,19 @@ ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list)* ice_add_eth_mac - Add ethertype and MAC based filter rule * @hw: pointer to the hardware structure * @em_list: list of ether type MAC filter, MAC is optional +* +* This function requires the caller to populate the entries in +* the filter list with the necessary fields (including flags to +* indicate Tx or Rx rules). */ enum ice_status ice_add_eth_mac (struct ice_hw *hw,struct LIST_HEAD_TYPE *em_list) {struct ice_fltr_list_entry *em_list_itr; +if (!em_list || !hw) +return ICE_ERR_PARAM ; +LIST_FOR_EACH_ENTRY (em_list_itr, em_list, ice_fltr_list_entry, list_entry) { enum ice_sw_lkup_type l_type =
@@ -2990,7 +2997,6 @@ ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list) l_type != ICE_SW_LKUP_ETHERTYPE)return ICE_ERR_PARAM ; - em_list_itr->fltr_info.flag =ICE_FLTR_TX ; em_list_itr->status =ice_add_rule_internal (hw, l_type, em_list_itr);if (em_list_itr->status)
Signature · 1 line
2.17.1
PATCH v3 47/69 net/ice/base: introduce some new macros
In reply to Leyi RongIntroduce some more new macros, like ICE_VSI_LB and the like.
--- drivers/net/ice/base/ice_flow.c | 4 +++- drivers/net/ice/base/ice_switch.h | 14 +++++--------- drivers/net/ice/base/ice_type.h | 6 +++++- 3 files changed, 13 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_flow.c +3 -1
@@ -844,6 +844,7 @@ ice_flow_proc_segs(struct ice_hw *hw, struct ice_flow_prof_params *params)#define ICE_FLOW_FIND_PROF_CHK_FLDS 0x00000001#define ICE_FLOW_FIND_PROF_CHK_VSI 0x00000002 +#define ICE_FLOW_FIND_PROF_NOT_CHK_DIR 0x00000004/** * ice_flow_find_prof_conds - Find a profile matching headers and conditions
@@ -863,7 +864,8 @@ ice_flow_find_prof_conds(struct ice_hw *hw, enum ice_block blk,struct ice_flow_prof *p; LIST_FOR_EACH_ENTRY(p, &hw->fl_profs[blk], ice_flow_prof, l_entry) { -if (p->dir == dir && segs_cnt && segs_cnt == p->segs_cnt) { +if ((p->dir == dir || conds &ICE_FLOW_FIND_PROF_NOT_CHK_DIR ) && + segs_cnt && segs_cnt == p->segs_cnt) {u8 i;/* Check for profile-VSI association if specified */
drivers/net/ice/base/ice_switch.h +5 -9
@@ -11,6 +11,9 @@#define ICE_SW_CFG_MAX_BUF_LEN 2048#define ICE_MAX_SW 256#define ICE_DFLT_VSI_INVAL 0xff +#define ICE_FLTR_RX BIT(0) +#define ICE_FLTR_TX BIT(1) +#define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)/* Worst case buffer length for ice_aqc_opc_get_res_alloc */
@@ -77,9 +80,6 @@ struct ice_fltr_info {/* rule ID returned by firmware once filter rule is created */ u16 fltr_rule_id;u16 flag; -#define ICE_FLTR_RX BIT(0) -#define ICE_FLTR_TX BIT(1) -#define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ u16 src;
@@ -145,10 +145,6 @@ struct ice_sw_act_ctrl {/* Source VSI for LOOKUP_TX or source port for LOOKUP_RX */ u16 src;u16 flag; -#define ICE_FLTR_RX BIT(0) -#define ICE_FLTR_TX BIT(1) -#define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX) -enum ice_sw_fwd_act_type fltr_act;/* Depending on filter action */ union {
@@ -368,6 +364,8 @@ ice_aq_get_res_descs(struct ice_hw *hw, u16 num_entries, struct ice_sq_cd *cd);enum ice_status ice_add_vlan (struct ice_hw *hw,struct LIST_HEAD_TYPE *m_list); +enum ice_status +ice_remove_vlan (struct ice_hw *hw,struct LIST_HEAD_TYPE *v_list);void ice_rem_all_sw_rules_info (struct ice_hw *hw);enum ice_status ice_add_mac (struct ice_hw *hw,struct LIST_HEAD_TYPE *m_lst);enum ice_status ice_remove_mac (struct ice_hw *hw,struct LIST_HEAD_TYPE *m_lst);
@@ -375,8 +373,6 @@ enum ice_status ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list);enum ice_status ice_remove_eth_mac (struct ice_hw *hw,struct LIST_HEAD_TYPE *em_list); -enum ice_status -ice_remove_vlan (struct ice_hw *hw,struct LIST_HEAD_TYPE *v_list);#ifndef NO_MACVLAN_SUPPORT enum ice_status ice_add_mac_vlan (struct ice_hw *hw,struct LIST_HEAD_TYPE *m_list);
drivers/net/ice/base/ice_type.h +5 -1
@@ -72,6 +72,7 @@ static inline u32 ice_round_to_num(u32 N, u32 R)#define ICE_HI_WORD (x) ((u16)(((x) >> 16) & 0xFFFF))/* debug masks - set these bits in hw->debug_mask to control output */ +#define ICE_DBG_TRACE BIT_ULL(0)/* for function-trace only */ #define ICE_DBG_INIT BIT_ULL(1)#define ICE_DBG_RELEASE BIT_ULL(2)#define ICE_DBG_FW_LOG BIT_ULL(3)
@@ -191,6 +192,7 @@ enum ice_vsi_type { #ifdef ADQ_SUPPORT ICE_VSI_CHNL = 4, #endif /* ADQ_SUPPORT */ + ICE_VSI_LB = 6, }; struct ice_link_status {
@@ -705,6 +707,8 @@ struct ice_fw_log_cfg {#define ICE_FW_LOG_EVNT_INIT (ICE_AQC_FW_LOG_INIT_EN >> ICE_AQC_FW_LOG_EN_S)#define ICE_FW_LOG_EVNT_FLOW (ICE_AQC_FW_LOG_FLOW_EN >> ICE_AQC_FW_LOG_EN_S)#define ICE_FW_LOG_EVNT_ERR (ICE_AQC_FW_LOG_ERR_EN >> ICE_AQC_FW_LOG_EN_S) +#define ICE_FW_LOG_EVNT_ALL (ICE_FW_LOG_EVNT_INFO | ICE_FW_LOG_EVNT_INIT | \ + ICE_FW_LOG_EVNT_FLOW | ICE_FW_LOG_EVNT_ERR)struct ice_fw_log_evnt evnts[ICE_AQC_FW_LOG_ID_MAX ]; };
@@ -934,7 +938,6 @@ enum ice_sw_fwd_act_type {#define ICE_SR_CSR_PROTECTED_LIST_PTR 0x0D#define ICE_SR_MNG_CFG_PTR 0x0E#define ICE_SR_EMP_MODULE_PTR 0x0F -#define ICE_SR_PBA_FLAGS 0x15#define ICE_SR_PBA_BLOCK_PTR 0x16#define ICE_SR_BOOT_CFG_PTR 0x17#define ICE_SR_NVM_WOL_CFG 0x19
@@ -980,6 +983,7 @@ enum ice_sw_fwd_act_type {#define ICE_SR_EMP_SR_SETTINGS_PTR 0x48#define ICE_SR_CONFIGURATION_METADATA_PTR 0x4D#define ICE_SR_IMMEDIATE_VALUES_PTR 0x4E +#define ICE_SR_POR_REGISTERS_AUTOLOAD_PTR 0x118/* Auxiliary field, mask and shift definition for Shadow RAM and NVM Flash */ #define ICE_SR_VPD_SIZE_WORDS 512
Signature · 1 line
2.17.1
PATCH v3 48/69 net/ice/base: new marker to mark func parameters unused
In reply to Leyi Ronguse __ALWAYS_UNUSED to mark function parameters unused to replace __always_unused marker.
--- drivers/net/ice/base/ice_flex_pipe.c | 2 +- drivers/net/ice/base/ice_type.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_flex_pipe.c +1 -1
@@ -398,7 +398,7 @@ ice_find_boost_entry(struct ice_seg *ice_seg, u16 addr,* Handles enumeration of individual label entries. */ static void * -ice_label_enum_handler (u32 __always_unused sect_type,void *section,u32 index, +ice_label_enum_handler(u32 __ALWAYS_UNUSED sect_type, void *section, u32 index,u32 *offset) {struct ice_label_section *labels;
drivers/net/ice/base/ice_type.h +3 -0
@@ -102,6 +102,9 @@ static inline u32 ice_round_to_num(u32 N, u32 R)#define ICE_DBG_USER BIT_ULL(31)#define ICE_DBG_ALL 0xFFFFFFFFFFFFFFFFULL +#ifndef __ALWAYS_UNUSED +#define __ALWAYS_UNUSED +#endif
Signature · 1 line
2.17.1
PATCH v3 49/69 net/ice/base: code clean up
In reply to Leyi RongCleanup the useless code.
--- drivers/net/ice/base/ice_controlq.c | 62 +--------------------------- drivers/net/ice/base/ice_fdir.h | 4 -- drivers/net/ice/base/ice_flex_pipe.c | 5 ++- drivers/net/ice/base/ice_sched.c | 4 +- drivers/net/ice/base/ice_switch.c | 8 ---- drivers/net/ice/base/ice_switch.h | 2 - drivers/net/ice/base/ice_type.h | 12 ------ 7 files changed, 7 insertions(+), 90 deletions(-)
drivers/net/ice/base/ice_controlq.c +1 -61
@@ -262,7 +262,7 @@ ice_cfg_sq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)* @hw: pointer to the hardware structure * @cq: pointer to the specific Control queue * -* Configure base address and length registers for the receive (event q) +* Configure base address and length registers for the receive (event queue) */ static enum ice_status ice_cfg_rq_regs (struct ice_hw *hw,struct ice_ctl_q_info *cq)
@@ -772,9 +772,6 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)struct ice_ctl_q_ring *sq = &cq->sq;u16 ntc = sq->next_to_clean;struct ice_sq_cd *details; -#if 0 -struct ice_aq_desc desc_cb; -#endif struct ice_aq_desc *desc; desc =ICE_CTL_Q_DESC (*sq, ntc);
@@ -783,15 +780,6 @@ static u16 ice_clean_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)while (rd32 (hw, cq->sq.head) != ntc) {ice_debug (hw,ICE_DBG_AQ_MSG ,"ntc %d head %d.\n" , ntc,rd32 (hw, cq->sq.head)); -#if 0 -if (details->callback) { -ICE_CTL_Q_CALLBACK cb_func = - (ICE_CTL_Q_CALLBACK )details->callback; -ice_memcpy (&desc_cb, desc,sizeof (desc_cb), -ICE_DMA_TO_DMA ); -cb_func (hw, &desc_cb); - } -#endif ice_memset (desc,0 ,sizeof (*desc),ICE_DMA_MEM );ice_memset (details,0 ,sizeof (*details),ICE_NONDMA_MEM ); ntc++;
@@ -941,38 +929,8 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq, details =ICE_CTL_Q_DETAILS (cq->sq, cq->sq.next_to_use);if (cd) *details = *cd; -#if 0 -/* FIXME: if/when this block gets enabled (when the #if 0 -* is removed), add braces to both branches of the surrounding -* conditional expression. The braces have been removed to -* prevent checkpatch complaining. -*/ - -/* If the command details are defined copy the cookie. The -* CPU_TO_LE32 is not needed here because the data is ignored -* by the FW, only used by the driver -*/ -if (details->cookie) { - desc->cookie_high = -CPU_TO_LE32 (ICE_HI_DWORD (details->cookie)); - desc->cookie_low = -CPU_TO_LE32 (ICE_LO_DWORD (details->cookie)); - } -#endif else ice_memset (details,0 ,sizeof (*details),ICE_NONDMA_MEM ); -#if 0 -/* clear requested flags and then set additional flags if defined */ - desc->flags &= ~CPU_TO_LE16 (details->flags_dis); - desc->flags |=CPU_TO_LE16 (details->flags_ena); - -if (details->postpone && !details->async) { -ice_debug (hw,ICE_DBG_AQ_MSG , -"Async flag not set along with postpone flag\n" ); - status =ICE_ERR_PARAM ; - goto sq_send_command_error; - } -#endif /* Call clean and check queue available function to reclaim the * descriptors that were processed by FW/MBX; the function returns the
@@ -1019,20 +977,8 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq, (cq->sq.next_to_use)++;if (cq->sq.next_to_use == cq->sq.count) cq->sq.next_to_use =0 ; -#if 0 - /* FIXME - handle this case? */ - if (!details->postpone) -#endifwr32 (hw, cq->sq.tail, cq->sq.next_to_use); -#if 0 - /* if command details are not defined or async flag is not set, - * we need to wait for desc write back - */ - if (!details->async && !details->postpone) { - /* FIXME - handle this case? */ - } -#endif do { if (ice_sq_done(hw, cq)) break;
@@ -1087,9 +1033,6 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,/* update the error if time out occurred */ if (!cmd_completed) { -#if 0 - (!details->async && !details->postpone)) { -#endif ice_debug (hw,ICE_DBG_AQ_MSG ,"Control Send Queue Writeback timeout.\n" ); status =ICE_ERR_AQ_TIMEOUT ;
@@ -1208,9 +1151,6 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq, cq->rq.next_to_clean = ntc; cq->rq.next_to_use = ntu; -#if 0 -ice_nvmupd_check_wait_event (hw,LE16_TO_CPU (e->desc.opcode)); -#endif clean_rq_elem_out:/* Set pending if needed, unlock and return */ if (pending) {
drivers/net/ice/base/ice_fdir.h +0 -4
@@ -163,9 +163,6 @@ struct ice_fdir_fltr {/* filter control */ u16 q_index; -#ifdef ADQ_SUPPORT -u16 orig_q_index; -#endif /* ADQ_SUPPORT */ u16 dest_vsi;u8 dest_ctl;u8 fltr_status;
@@ -173,7 +170,6 @@ struct ice_fdir_fltr {u32 fltr_id; }; -/* Dummy packet filter definition structure. */ struct ice_fdir_base_pkt {enum ice_fltr_ptype flow;
drivers/net/ice/base/ice_flex_pipe.c +3 -2
@@ -640,7 +640,7 @@ static bool ice_bits_max_set(const u8 *mask, u16 size, u16 max)* @size: the size of the complete key in bytes (must be even) * @val: array of 8-bit values that makes up the value portion of the key * @upd: array of 8-bit masks that determine what key portion to update -* @dc: array of 8-bit masks that make up the dont' care mask +* @dc: array of 8-bit masks that make up the don't care mask * @nm: array of 8-bit masks that make up the never match mask * @off: the offset of the first byte in the key to update * @len: the number of bytes in the key update
@@ -897,7 +897,7 @@ ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,u32 i;ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__); -ice_debug (hw,ICE_DBG_PKG ,"Package version: %d.%d.%d.%d\n" , +ice_debug (hw,ICE_DBG_PKG ,"Package format version: %d.%d.%d.%d\n" , pkg_hdr->format_ver.major, pkg_hdr->format_ver.minor, pkg_hdr->format_ver.update, pkg_hdr->format_ver.draft);
@@ -4479,6 +4479,7 @@ ice_move_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig, status =ice_vsig_find_vsi (hw, blk, vsi, &orig_vsig);if (!status) status =ice_vsig_add_mv_vsi (hw, blk, vsi, vsig); +if (status) {ice_free (hw, p);return status;
drivers/net/ice/base/ice_sched.c +3 -1
@@ -1233,7 +1233,7 @@ enum ice_status ice_sched_init_port(struct ice_port_info *pi) goto err_init_port; } -/* If the last node is a leaf node then the index of the Q group +/* If the last node is a leaf node then the index of the queue group * layer is two less than the number of elements. */ if (num_elems > 2 && buf[0].generic[num_elems - 1].data.elem_type ==
@@ -3529,9 +3529,11 @@ ice_cfg_agg_vsi_priority_per_tc(struct ice_port_info *pi, u32 agg_id,LIST_FOR_EACH_ENTRY (agg_vsi_info, &agg_info->agg_vsi_list, ice_sched_agg_vsi_info, list_entry)if (agg_vsi_info->vsi_handle == vsi_handle) { +/* cppcheck-suppress unreadVariable */ vsi_handle_valid = true;break ; } +if (!vsi_handle_valid) goto exit_agg_priority_per_tc;
drivers/net/ice/base/ice_switch.c +0 -8
@@ -2934,7 +2934,6 @@ ice_add_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list)return ICE_SUCCESS ; } -#ifndef NO_MACVLAN_SUPPORT /** * ice_add_mac_vlan - Add MAC and VLAN pair based filter rule * @hw: pointer to the hardware structure
@@ -2969,7 +2968,6 @@ ice_add_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *mv_list) }return ICE_SUCCESS ; } -#endif /** * ice_add_eth_mac - Add ethertype and MAC based filter rule
@@ -3307,7 +3305,6 @@ ice_remove_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list)return ICE_SUCCESS ; } -#ifndef NO_MACVLAN_SUPPORT /** * ice_remove_mac_vlan - Remove MAC VLAN based filter rule * @hw: pointer to the hardware structure
@@ -3335,7 +3332,6 @@ ice_remove_mac_vlan(struct ice_hw *hw, struct LIST_HEAD_TYPE *v_list) }return ICE_SUCCESS ; } -#endif /* !NO_MACVLAN_SUPPORT */ /** * ice_vsi_uses_fltr - Determine if given VSI uses specified filter
@@ -3850,11 +3846,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,ice_remove_promisc (hw, lkup, &remove_list_head);break ;case ICE_SW_LKUP_MAC_VLAN : -#ifndef NO_MACVLAN_SUPPORT ice_remove_mac_vlan (hw, &remove_list_head); -#else -ice_debug (hw,ICE_DBG_SW ,"MAC VLAN look up is not supported yet\n" ); -#endif /* !NO_MACVLAN_SUPPORT */ break ;case ICE_SW_LKUP_ETHERTYPE :case ICE_SW_LKUP_ETHERTYPE_MAC :
drivers/net/ice/base/ice_switch.h +0 -2
@@ -373,12 +373,10 @@ enum ice_status ice_add_eth_mac(struct ice_hw *hw, struct LIST_HEAD_TYPE *em_list);enum ice_status ice_remove_eth_mac (struct ice_hw *hw,struct LIST_HEAD_TYPE *em_list); -#ifndef NO_MACVLAN_SUPPORT enum ice_status ice_add_mac_vlan (struct ice_hw *hw,struct LIST_HEAD_TYPE *m_list);enum ice_status ice_remove_mac_vlan (struct ice_hw *hw,struct LIST_HEAD_TYPE *v_list); -#endif /* !NO_MACVLAN_SUPPORT */ enum ice_status ice_add_mac_with_sw_marker(struct ice_hw *hw, struct ice_fltr_info *f_info,
drivers/net/ice/base/ice_type.h +0 -12
@@ -22,13 +22,9 @@#define ICE_BYTES_PER_DWORD 4#define ICE_MAX_TRAFFIC_CLASS 8 -#ifndef MIN_T #define MIN_T (_t, _a, _b) min((_t)(_a), (_t)(_b)) -#endif -#ifndef IS_ASCII #define IS_ASCII (_ch) ((_ch) < 0x80) -#endif #include "ice_status.h" #include "ice_hw_autogen.h"
@@ -45,9 +41,7 @@ static inline bool ice_is_tc_ena(ice_bitmap_t bitmap, u8 tc)return ice_is_bit_set (&bitmap, tc); } -#ifndef DIV_64BIT #define DIV_64BIT (n, d) ((n) / (d)) -#endif /* DIV_64BIT */ static inline u64 round_up_64bit (u64 a,u32 b) {
@@ -192,9 +186,6 @@ enum ice_media_type {enum ice_vsi_type {ICE_VSI_PF =0 ,ICE_VSI_CTRL =3 ,/* equates to ICE_VSI_PF with 1 queue pair */ -#ifdef ADQ_SUPPORT -ICE_VSI_CHNL =4 , -#endif /* ADQ_SUPPORT */ ICE_VSI_LB =6 , };
@@ -914,9 +905,6 @@ struct ice_hw_port_stats {/* flow director stats */ u32 fd_sb_status;u64 fd_sb_match; -#ifdef ADQ_SUPPORT -u64 ch_atr_match; -#endif /* ADQ_SUPPORT */ };enum ice_sw_fwd_act_type {
Signature · 1 line
2.17.1
PATCH v3 50/69 net/ice/base: cleanup ice flex pipe files
In reply to Leyi RongMake functions that can be, static. Remove some code that is not currently called.
--- drivers/net/ice/base/ice_flex_pipe.c | 523 ++++----------------------- drivers/net/ice/base/ice_flex_pipe.h | 59 --- 2 files changed, 78 insertions(+), 504 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +78 -445
@@ -461,7 +461,7 @@ ice_enum_labels(struct ice_seg *ice_seg, u32 type, struct ice_pkg_enum *state,* since the first call to ice_enum_labels requires a pointer to an actual * ice_seg structure. */ -void ice_init_pkg_hints (struct ice_hw *hw,struct ice_seg *ice_seg) +static void ice_init_pkg_hints (struct ice_hw *hw,struct ice_seg *ice_seg) {struct ice_pkg_enum state;char *label_name;
@@ -808,27 +808,6 @@ ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,return status; } -/** -* ice_aq_upload_section -* @hw: pointer to the hardware structure -* @pkg_buf: the package buffer which will receive the section -* @buf_size: the size of the package buffer -* @cd: pointer to command details structure or NULL -* -* Upload Section (0x0C41) -*/ -enum ice_status -ice_aq_upload_section (struct ice_hw *hw,struct ice_buf_hdr *pkg_buf, -u16 buf_size,struct ice_sq_cd *cd) -{ -struct ice_aq_desc desc; - -ice_debug (hw,ICE_DBG_TRACE ,"ice_aq_upload_section" ); -ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_upload_section); - desc.flags |=CPU_TO_LE16 (ICE_AQ_FLAG_RD ); - -return ice_aq_send_cmd (hw, &desc, pkg_buf, buf_size, cd); -}/** * ice_aq_update_pkg
@@ -890,7 +869,7 @@ ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf, u16 buf_size,* success it returns a pointer to the segment header, otherwise it will * return NULL. */ -struct ice_generic_seg_hdr * +static struct ice_generic_seg_hdr *ice_find_seg_in_pkg (struct ice_hw *hw,u32 seg_type,struct ice_pkg_hdr *pkg_hdr) {
@@ -1052,7 +1031,8 @@ ice_aq_get_pkg_info_list(struct ice_hw *hw,* * Handles the download of a complete package. */ -enum ice_status ice_download_pkg (struct ice_hw *hw,struct ice_seg *ice_seg) +static enum ice_status +ice_download_pkg (struct ice_hw *hw,struct ice_seg *ice_seg) {struct ice_buf_table *ice_buf_tbl;
@@ -1081,7 +1061,7 @@ enum ice_status ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg)* * Saves off the package details into the HW structure. */ -enum ice_status +static enum ice_status ice_init_pkg_info (struct ice_hw *hw,struct ice_pkg_hdr *pkg_hdr) {struct ice_global_metadata_seg *meta_seg;
@@ -1133,8 +1113,7 @@ ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr)* * Store details of the package currently loaded in HW into the HW structure. */ -enum ice_status -ice_get_pkg_info (struct ice_hw *hw) +static enum ice_status ice_get_pkg_info (struct ice_hw *hw) {struct ice_aqc_get_pkg_info_resp *pkg_info;enum ice_status status;
@@ -1187,40 +1166,6 @@ ice_get_pkg_info(struct ice_hw *hw)return status; } -/** -* ice_find_label_value -* @ice_seg: pointer to the ice segment (non-NULL) -* @name: name of the label to search for -* @type: the section type that will contain the label -* @value: pointer to a value that will return the label's value if found -* -* Finds a label's value given the label name and the section type to search. -* The ice_seg parameter must not be NULL since the first call to -* ice_enum_labels requires a pointer to an actual ice_seg structure. -*/ -enum ice_status -ice_find_label_value (struct ice_seg *ice_seg,char const *name,u32 type, -u16 *value) -{ -struct ice_pkg_enum state; -char *label_name; -u16 val; - -if (!ice_seg) -return ICE_ERR_PARAM ; - -do { - label_name =ice_enum_labels (ice_seg, type, &state, &val); -if (label_name && !strcmp (label_name, name)) { - *value = val; -return ICE_SUCCESS ; - } - - ice_seg =NULL ; - }while (label_name); - -return ICE_ERR_CFG ; -}/** * ice_verify_pkg - verify package
@@ -1499,7 +1444,7 @@ enum ice_status ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len)* Allocates a package buffer and returns a pointer to the buffer header. * Note: all package contents must be in Little Endian form. */ -struct ice_buf_build *ice_pkg_buf_alloc (struct ice_hw *hw) +static struct ice_buf_build *ice_pkg_buf_alloc (struct ice_hw *hw) {struct ice_buf_build *bld;struct ice_buf_hdr *buf;
@@ -1623,40 +1568,15 @@ ice_get_sw_fv_list(struct ice_hw *hw, u16 *prot_ids, u8 ids_cnt, }/** -* ice_pkg_buf_alloc_single_section +* ice_pkg_buf_free * @hw: pointer to the HW structure -* @type: the section type value -* @size: the size of the section to reserve (in bytes) -* @section: returns pointer to the section +* @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc()) * -* Allocates a package buffer with a single section. -* Note: all package contents must be in Little Endian form. +* Frees a package buffer */ -static struct ice_buf_build * -ice_pkg_buf_alloc_single_section (struct ice_hw *hw,u32 type,u16 size, -void **section) +static void ice_pkg_buf_free (struct ice_hw *hw,struct ice_buf_build *bld) { -struct ice_buf_build *buf; - -if (!section) -return NULL ; - - buf =ice_pkg_buf_alloc (hw); -if (!buf) -return NULL ; - -if (ice_pkg_buf_reserve_section (buf,1 )) - goto ice_pkg_buf_alloc_single_section_err; - - *section =ice_pkg_buf_alloc_section (buf, type, size); -if (!*section) - goto ice_pkg_buf_alloc_single_section_err; - -return buf; - -ice_pkg_buf_alloc_single_section_err: -ice_pkg_buf_free (hw, buf); -return NULL ; +ice_free (hw, bld); }/**
@@ -1672,7 +1592,7 @@ ice_pkg_buf_alloc_single_section(struct ice_hw *hw, u32 type, u16 size,* result in some wasted space in the buffer. * Note: all package contents must be in Little Endian form. */ -enum ice_status +static enum ice_status ice_pkg_buf_reserve_section (struct ice_buf_build *bld,u16 count) {struct ice_buf_hdr *buf;
@@ -1700,48 +1620,6 @@ ice_pkg_buf_reserve_section(struct ice_buf_build *bld, u16 count)return ICE_SUCCESS ; } -/** -* ice_pkg_buf_unreserve_section -* @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc()) -* @count: the number of sections to unreserve -* -* Unreserves one or more section table entries in a package buffer, releasing -* space that can be used for section data. This routine can be called -* multiple times as long as they are made before calling -* ice_pkg_buf_alloc_section(). Once ice_pkg_buf_alloc_section() -* is called once, the number of sections that can be allocated will not be able -* to be increased; not using all reserved sections is fine, but this will -* result in some wasted space in the buffer. -* Note: all package contents must be in Little Endian form. -*/ -enum ice_status -ice_pkg_buf_unreserve_section (struct ice_buf_build *bld,u16 count) -{ -struct ice_buf_hdr *buf; -u16 section_count; -u16 data_end; - -if (!bld) -return ICE_ERR_PARAM ; - - buf = (struct ice_buf_hdr *)&bld->buf; - -/* already an active section, can't decrease table size */ - section_count =LE16_TO_CPU (buf->section_count); -if (section_count >0 ) -return ICE_ERR_CFG ; - -if (count > bld->reserved_section_table_entries) -return ICE_ERR_CFG ; - bld->reserved_section_table_entries -= count; - - data_end =LE16_TO_CPU (buf->data_end) - - (count *sizeof (buf->section_entry[0 ])); - buf->data_end =CPU_TO_LE16 (data_end); - -return ICE_SUCCESS ; -} -/** * ice_pkg_buf_alloc_section * @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc())
@@ -1754,7 +1632,7 @@ ice_pkg_buf_unreserve_section(struct ice_buf_build *bld, u16 count)* section contents. * Note: all package contents must be in Little Endian form. */ -void * +static void *ice_pkg_buf_alloc_section (struct ice_buf_build *bld,u32 type,u16 size) {struct ice_buf_hdr *buf;
@@ -1795,24 +1673,6 @@ ice_pkg_buf_alloc_section(struct ice_buf_build *bld, u32 type, u16 size)return NULL ; } -/** -* ice_pkg_buf_get_free_space -* @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc()) -* -* Returns the number of free bytes remaining in the buffer. -* Note: all package contents must be in Little Endian form. -*/ -u16 ice_pkg_buf_get_free_space (struct ice_buf_build *bld) -{ -struct ice_buf_hdr *buf; - -if (!bld) -return 0 ; - - buf = (struct ice_buf_hdr *)&bld->buf; -return ICE_MAX_S_DATA_END -LE16_TO_CPU (buf->data_end); -} -/** * ice_pkg_buf_get_active_sections * @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc())
@@ -1823,7 +1683,7 @@ u16 ice_pkg_buf_get_free_space(struct ice_buf_build *bld)* not be used. * Note: all package contents must be in Little Endian form. */ -u16 ice_pkg_buf_get_active_sections (struct ice_buf_build *bld) +static u16 ice_pkg_buf_get_active_sections (struct ice_buf_build *bld) {struct ice_buf_hdr *buf;
@@ -1840,7 +1700,7 @@ u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld)* * Return a pointer to the buffer's header */ -struct ice_buf *ice_pkg_buf (struct ice_buf_build *bld) +static struct ice_buf *ice_pkg_buf (struct ice_buf_build *bld) {if (!bld)return NULL ;
@@ -1848,18 +1708,6 @@ struct ice_buf *ice_pkg_buf(struct ice_buf_build *bld)return &bld->buf; } -/** -* ice_pkg_buf_free -* @hw: pointer to the HW structure -* @bld: pointer to pkg build (allocated by ice_pkg_buf_alloc()) -* -* Frees a package buffer -*/ -void ice_pkg_buf_free (struct ice_hw *hw,struct ice_buf_build *bld) -{ -ice_free (hw, bld); -} -/** * ice_find_prot_off - find prot ID and offset pair, based on prof and FV index * @hw: pointer to the hardware structure
@@ -1891,38 +1739,6 @@ ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u8 fv_idx,/* PTG Management */ -/** -* ice_ptg_update_xlt1 - Updates packet type groups in HW via XLT1 table -* @hw: pointer to the hardware structure -* @blk: HW block -* -* This function will update the XLT1 hardware table to reflect the new -* packet type group configuration. -*/ -enum ice_status ice_ptg_update_xlt1 (struct ice_hw *hw,enum ice_block blk) -{ -struct ice_xlt1_section *sect; -struct ice_buf_build *bld; -enum ice_status status; -u16 index; - - bld =ice_pkg_buf_alloc_single_section (hw,ice_sect_id (blk,ICE_XLT1 ), -ICE_XLT1_SIZE (ICE_XLT1_CNT ), - (void **)§); -if (!bld) -return ICE_ERR_NO_MEMORY ; - - sect->count =CPU_TO_LE16 (ICE_XLT1_CNT ); - sect->offset =CPU_TO_LE16 (0 ); -for (index =0 ; index <ICE_XLT1_CNT ; index++) - sect->value[index] = hw->blk[blk].xlt1.ptypes[index].ptg; - - status =ice_update_pkg (hw,ice_pkg_buf (bld),1 ); - -ice_pkg_buf_free (hw, bld); - -return status; -}/** * ice_ptg_find_ptype - Search for packet type group using packet type (ptype)
@@ -1935,7 +1751,7 @@ enum ice_status ice_ptg_update_xlt1(struct ice_hw *hw, enum ice_block blk)* PTG ID that contains it through the ptg parameter, with the value of * ICE_DEFAULT_PTG (0) meaning it is part the default PTG. */ -enum ice_status +static enum ice_status ice_ptg_find_ptype (struct ice_hw *hw,enum ice_block blk,u16 ptype,u8 *ptg) {if (ptype >=ICE_XLT1_CNT || !ptg)
@@ -1969,7 +1785,7 @@ void ice_ptg_alloc_val(struct ice_hw *hw, enum ice_block blk, u8 ptg)* that 0 is the default packet type group, so successfully created PTGs will * have a non-zero ID value; which means a 0 return value indicates an error. */ -u8 ice_ptg_alloc (struct ice_hw *hw,enum ice_block blk) +static u8 ice_ptg_alloc (struct ice_hw *hw,enum ice_block blk) {u16 i;
@@ -1984,31 +1800,6 @@ u8 ice_ptg_alloc(struct ice_hw *hw, enum ice_block blk)return 0 ; } -/** -* ice_ptg_free - Frees a packet type group -* @hw: pointer to the hardware structure -* @blk: HW block -* @ptg: the ptg ID to free -* -* This function frees a packet type group, and returns all the current ptypes -* within it to the default PTG. -*/ -void ice_ptg_free (struct ice_hw *hw,enum ice_block blk,u8 ptg) -{ -struct ice_ptg_ptype *p, *temp; - - hw->blk[blk].xlt1.ptg_tbl[ptg].in_use = false; - p = hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype; -while (p) { - p->ptg =ICE_DEFAULT_PTG ; - temp = p->next_ptype; - p->next_ptype =NULL ; - p = temp; - } - - hw->blk[blk].xlt1.ptg_tbl[ptg].first_ptype =NULL ; -} -/** * ice_ptg_remove_ptype - Removes ptype from a particular packet type group * @hw: pointer to the hardware structure
@@ -2066,7 +1857,7 @@ ice_ptg_remove_ptype(struct ice_hw *hw, enum ice_block blk, u16 ptype, u8 ptg)* a destination PTG ID of ICE_DEFAULT_PTG (0) will move the ptype to the * default PTG. */ -enum ice_status +static enum ice_status ice_ptg_add_mv_ptype (struct ice_hw *hw,enum ice_block blk,u16 ptype,u8 ptg) {enum ice_status status;
@@ -2202,70 +1993,6 @@ ice_match_prop_lst(struct LIST_HEAD_TYPE *list1, struct LIST_HEAD_TYPE *list2)/* VSIG Management */ -/** -* ice_vsig_update_xlt2_sect - update one section of XLT2 table -* @hw: pointer to the hardware structure -* @blk: HW block -* @vsi: HW VSI number to program -* @vsig: vsig for the VSI -* -* This function will update the XLT2 hardware table with the input VSI -* group configuration. -*/ -static enum ice_status -ice_vsig_update_xlt2_sect (struct ice_hw *hw,enum ice_block blk,u16 vsi, -u16 vsig) -{ -struct ice_xlt2_section *sect; -struct ice_buf_build *bld; -enum ice_status status; - - bld =ice_pkg_buf_alloc_single_section (hw,ice_sect_id (blk,ICE_XLT2 ), -sizeof (struct ice_xlt2_section ), - (void **)§); -if (!bld) -return ICE_ERR_NO_MEMORY ; - - sect->count =CPU_TO_LE16 (1 ); - sect->offset =CPU_TO_LE16 (vsi); - sect->value[0 ] =CPU_TO_LE16 (vsig); - - status =ice_update_pkg (hw,ice_pkg_buf (bld),1 ); - -ice_pkg_buf_free (hw, bld); - -return status; -} - -/** -* ice_vsig_update_xlt2 - update XLT2 table with VSIG configuration -* @hw: pointer to the hardware structure -* @blk: HW block -* -* This function will update the XLT2 hardware table with the input VSI -* group configuration of used vsis. -*/ -enum ice_status ice_vsig_update_xlt2 (struct ice_hw *hw,enum ice_block blk) -{ -u16 vsi; - -for (vsi =0 ; vsi <ICE_MAX_VSI ; vsi++) { -/* update only vsis that have been changed */ -if (hw->blk[blk].xlt2.vsis[vsi].changed) { -enum ice_status status; -u16 vsig; - - vsig = hw->blk[blk].xlt2.vsis[vsi].vsig; - status =ice_vsig_update_xlt2_sect (hw, blk, vsi, vsig); -if (status) -return status; - - hw->blk[blk].xlt2.vsis[vsi].changed =0 ; - } - } - -return ICE_SUCCESS ; -}/** * ice_vsig_find_vsi - find a VSIG that contains a specified VSI
@@ -2346,7 +2073,7 @@ static u16 ice_vsig_alloc(struct ice_hw *hw, enum ice_block blk)* for, the list must match exactly, including the order in which the * characteristics are listed. */ -enum ice_status +static enum ice_status ice_find_dup_props_vsig (struct ice_hw *hw,enum ice_block blk,struct LIST_HEAD_TYPE *chs,u16 *vsig) {
@@ -2373,7 +2100,7 @@ ice_find_dup_props_vsig(struct ice_hw *hw, enum ice_block blk,* The function will remove all VSIs associated with the input VSIG and move * them to the DEFAULT_VSIG and mark the VSIG available. */ -enum ice_status +static enum ice_status ice_vsig_free (struct ice_hw *hw,enum ice_block blk,u16 vsig) {struct ice_vsig_prof *dtmp, *del;
@@ -2424,6 +2151,62 @@ ice_vsig_free(struct ice_hw *hw, enum ice_block blk, u16 vsig)return ICE_SUCCESS ; } +/** +* ice_vsig_remove_vsi - remove VSI from VSIG +* @hw: pointer to the hardware structure +* @blk: HW block +* @vsi: VSI to remove +* @vsig: VSI group to remove from +* +* The function will remove the input VSI from its VSI group and move it +* to the DEFAULT_VSIG. +*/ +static enum ice_status +ice_vsig_remove_vsi (struct ice_hw *hw,enum ice_block blk,u16 vsi,u16 vsig) +{ +struct ice_vsig_vsi **vsi_head, *vsi_cur, *vsi_tgt; +u16 idx; + + idx = vsig &ICE_VSIG_IDX_M ; + +if (vsi >=ICE_MAX_VSI || idx >=ICE_MAX_VSIGS ) +return ICE_ERR_PARAM ; + +if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) +return ICE_ERR_DOES_NOT_EXIST ; + +/* entry already in default VSIG, don't have to remove */ +if (idx ==ICE_DEFAULT_VSIG ) +return ICE_SUCCESS ; + + vsi_head = &hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; +if (!(*vsi_head)) +return ICE_ERR_CFG ; + + vsi_tgt = &hw->blk[blk].xlt2.vsis[vsi]; + vsi_cur = (*vsi_head); + +/* iterate the VSI list, skip over the entry to be removed */ +while (vsi_cur) { +if (vsi_tgt == vsi_cur) { + (*vsi_head) = vsi_cur->next_vsi; +break ; + } + vsi_head = &vsi_cur->next_vsi; + vsi_cur = vsi_cur->next_vsi; + } + +/* verify if VSI was removed from group list */ +if (!vsi_cur) +return ICE_ERR_DOES_NOT_EXIST ; + + vsi_cur->vsig =ICE_DEFAULT_VSIG ; + vsi_cur->changed =1 ; + vsi_cur->next_vsi =NULL ; + +return ICE_SUCCESS ; +} +/** * ice_vsig_add_mv_vsi - add or move a VSI to a VSI group * @hw: pointer to the hardware structure
@@ -2436,7 +2219,7 @@ ice_vsig_free(struct ice_hw *hw, enum ice_block blk, u16 vsig)* move the entry to the DEFAULT_VSIG, update the original VSIG and * then move entry to the new VSIG. */ -enum ice_status +static enum ice_status ice_vsig_add_mv_vsi (struct ice_hw *hw,enum ice_block blk,u16 vsi,u16 vsig) {struct ice_vsig_vsi *tmp;
@@ -2487,62 +2270,6 @@ ice_vsig_add_mv_vsi(struct ice_hw *hw, enum ice_block blk, u16 vsi, u16 vsig)return ICE_SUCCESS ; } -/** -* ice_vsig_remove_vsi - remove VSI from VSIG -* @hw: pointer to the hardware structure -* @blk: HW block -* @vsi: VSI to remove -* @vsig: VSI group to remove from -* -* The function will remove the input VSI from its VSI group and move it -* to the DEFAULT_VSIG. -*/ -enum ice_status -ice_vsig_remove_vsi (struct ice_hw *hw,enum ice_block blk,u16 vsi,u16 vsig) -{ -struct ice_vsig_vsi **vsi_head, *vsi_cur, *vsi_tgt; -u16 idx; - - idx = vsig &ICE_VSIG_IDX_M ; - -if (vsi >=ICE_MAX_VSI || idx >=ICE_MAX_VSIGS ) -return ICE_ERR_PARAM ; - -if (!hw->blk[blk].xlt2.vsig_tbl[idx].in_use) -return ICE_ERR_DOES_NOT_EXIST ; - -/* entry already in default VSIG, don't have to remove */ -if (idx ==ICE_DEFAULT_VSIG ) -return ICE_SUCCESS ; - - vsi_head = &hw->blk[blk].xlt2.vsig_tbl[idx].first_vsi; -if (!(*vsi_head)) -return ICE_ERR_CFG ; - - vsi_tgt = &hw->blk[blk].xlt2.vsis[vsi]; - vsi_cur = (*vsi_head); - -/* iterate the VSI list, skip over the entry to be removed */ -while (vsi_cur) { -if (vsi_tgt == vsi_cur) { - (*vsi_head) = vsi_cur->next_vsi; -break ; - } - vsi_head = &vsi_cur->next_vsi; - vsi_cur = vsi_cur->next_vsi; - } - -/* verify if VSI was removed from group list */ -if (!vsi_cur) -return ICE_ERR_DOES_NOT_EXIST ; - - vsi_cur->vsig =ICE_DEFAULT_VSIG ; - vsi_cur->changed =1 ; - vsi_cur->next_vsi =NULL ; - -return ICE_SUCCESS ; -} -/** * ice_find_prof_id - find profile ID for a given field vector * @hw: pointer to the hardware structure
@@ -4035,44 +3762,6 @@ ice_search_prof_id(struct ice_hw *hw, enum ice_block blk, u64 id)return entry; } -/** -* ice_set_prof_context - Set context for a given profile -* @hw: pointer to the HW struct -* @blk: hardware block -* @id: profile tracking ID -* @cntxt: context -*/ -struct ice_prof_map * -ice_set_prof_context (struct ice_hw *hw,enum ice_block blk,u64 id,u64 cntxt) -{ -struct ice_prof_map *entry; - - entry =ice_search_prof_id (hw, blk, id); -if (entry) - entry->context = cntxt; - -return entry; -} - -/** -* ice_get_prof_context - Get context for a given profile -* @hw: pointer to the HW struct -* @blk: hardware block -* @id: profile tracking ID -* @cntxt: pointer to variable to receive the context -*/ -struct ice_prof_map * -ice_get_prof_context (struct ice_hw *hw,enum ice_block blk,u64 id,u64 *cntxt) -{ -struct ice_prof_map *entry; - - entry =ice_search_prof_id (hw, blk, id); -if (entry) - *cntxt = entry->context; - -return entry; -} -/** * ice_vsig_prof_id_count - count profiles in a VSIG * @hw: pointer to the HW struct
@@ -4988,34 +4677,6 @@ ice_add_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)return status; } -/** -* ice_add_flow - add flow -* @hw: pointer to the HW struct -* @blk: hardware block -* @vsi: array of VSIs to enable with the profile specified by ID -* @count: number of elements in the VSI array -* @id: profile tracking ID -* -* Calling this function will update the hardware tables to enable the -* profile indicated by the ID parameter for the VSIs specified in the VSI -* array. Once successfully called, the flow will be enabled. -*/ -enum ice_status -ice_add_flow (struct ice_hw *hw,enum ice_block blk,u16 vsi[],u8 count, -u64 id) -{ -enum ice_status status; -u16 i; - -for (i =0 ; i < count; i++) { - status =ice_add_prof_id_flow (hw, blk, vsi[i], id); -if (status) -return status; - } - -return ICE_SUCCESS ; -} -/** * ice_rem_prof_from_list - remove a profile from list * @hw: pointer to the HW struct
@@ -5169,31 +4830,3 @@ ice_rem_prof_id_flow(struct ice_hw *hw, enum ice_block blk, u16 vsi, u64 hdl)return status; } - -/** -* ice_rem_flow - remove flow -* @hw: pointer to the HW struct -* @blk: hardware block -* @vsi: array of VSIs from which to remove the profile specified by ID -* @count: number of elements in the VSI array -* @id: profile tracking ID -* -* The function will remove flows from the specified VSIs that were enabled -* using ice_add_flow. The ID value will indicated which profile will be -* removed. Once successfully called, the flow will be disabled. -*/ -enum ice_status -ice_rem_flow (struct ice_hw *hw,enum ice_block blk,u16 vsi[],u8 count, -u64 id) -{ -enum ice_status status; -u16 i; - -for (i =0 ; i < count; i++) { - status =ice_rem_prof_id_flow (hw, blk, vsi[i], id); -if (status) -return status; - } - -return ICE_SUCCESS ; -}
drivers/net/ice/base/ice_flex_pipe.h +0 -59
89 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 51/69 net/ice/base: refactor VSI node sched code
In reply to Leyi RongRefactored VSI node sched code to use port_info ptr as call arg.
The declaration of VSI node getter function has been modified to use pointer to ice_port_info structure instead of pointer to hw structure. This way suitable port_info structure is used to find VSI node.
--- drivers/net/ice/base/ice_sched.c | 47 ++++++++++++++++---------------- drivers/net/ice/base/ice_sched.h | 2 +- 2 files changed, 24 insertions(+), 25 deletions(-)
drivers/net/ice/base/ice_sched.c +23 -24
@@ -1451,7 +1451,7 @@ ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,/** * ice_sched_get_vsi_node - Get a VSI node based on VSI ID -* @hw: pointer to the HW struct +* @pi: pointer to the port information structure * @tc_node: pointer to the TC node * @vsi_handle: software VSI handle *
@@ -1459,14 +1459,14 @@ ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,* TC branch */ struct ice_sched_node * -ice_sched_get_vsi_node (struct ice_hw *hw,struct ice_sched_node *tc_node, +ice_sched_get_vsi_node (struct ice_port_info *pi,struct ice_sched_node *tc_node,u16 vsi_handle) {struct ice_sched_node *node;u8 vsi_layer; - vsi_layer =ice_sched_get_vsi_layer (hw); - node =ice_sched_get_first_node (hw->port_info, tc_node, vsi_layer); + vsi_layer =ice_sched_get_vsi_layer (pi->hw); + node =ice_sched_get_first_node (pi, tc_node, vsi_layer);/* Check whether it already exists */ while (node) {
@@ -1587,7 +1587,7 @@ ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle, qgl =ice_sched_get_qgrp_layer (hw); vsil =ice_sched_get_vsi_layer (hw); - parent =ice_sched_get_vsi_node (hw, tc_node, vsi_handle); + parent =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);for (i = vsil +1 ; i <= qgl; i++) {if (!parent)return ICE_ERR_CFG ;
@@ -1620,7 +1620,7 @@ ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,/** * ice_sched_calc_vsi_support_nodes - calculate number of VSI support nodes -* @hw: pointer to the HW struct +* @pi: pointer to the port info structure * @tc_node: pointer to TC node * @num_nodes: pointer to num nodes array *
@@ -1629,15 +1629,15 @@ ice_sched_add_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,* layers */ static void -ice_sched_calc_vsi_support_nodes (struct ice_hw *hw, +ice_sched_calc_vsi_support_nodes (struct ice_port_info *pi,struct ice_sched_node *tc_node,u16 *num_nodes) {struct ice_sched_node *node;u8 vsil;int i; - vsil =ice_sched_get_vsi_layer (hw); -for (i = vsil; i >= hw->sw_entry_point_layer; i--) + vsil =ice_sched_get_vsi_layer (pi->hw); +for (i = vsil; i >= pi->hw->sw_entry_point_layer; i--)/* Add intermediate nodes if TC has no children and * need at least one node for VSI */
@@ -1647,11 +1647,11 @@ ice_sched_calc_vsi_support_nodes(struct ice_hw *hw,/* If intermediate nodes are reached max children * then add a new one. */ - node =ice_sched_get_first_node (hw->port_info, tc_node, - (u8 )i); + node =ice_sched_get_first_node (pi, tc_node, (u8 )i);/* scan all the siblings */ while (node) { -if (node->num_children < hw->max_children[i]) +if (node->num_children < + pi->hw->max_children[i])break ; node = node->sibling; }
@@ -1731,14 +1731,13 @@ ice_sched_add_vsi_to_topo(struct ice_port_info *pi, u16 vsi_handle, u8 tc) {u16 num_nodes[ICE_AQC_TOPO_MAX_LEVEL_NUM ] = {0 };struct ice_sched_node *tc_node; -struct ice_hw *hw = pi->hw; tc_node =ice_sched_get_tc_node (pi, tc);if (!tc_node)return ICE_ERR_PARAM ;/* calculate number of supported nodes needed for this VSI */ -ice_sched_calc_vsi_support_nodes (hw, tc_node, num_nodes); +ice_sched_calc_vsi_support_nodes (pi, tc_node, num_nodes);/* add VSI supported nodes to TC subtree */ return ice_sched_add_vsi_support_nodes(pi, vsi_handle, tc_node,
@@ -1771,7 +1770,7 @@ ice_sched_update_vsi_child_nodes(struct ice_port_info *pi, u16 vsi_handle,if (!tc_node)return ICE_ERR_CFG ; - vsi_node =ice_sched_get_vsi_node (hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node)return ICE_ERR_CFG ;
@@ -1834,7 +1833,7 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs, vsi_ctx =ice_get_vsi_ctx (hw, vsi_handle);if (!vsi_ctx)return ICE_ERR_PARAM ; - vsi_node =ice_sched_get_vsi_node (hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);/* suspend the VSI if TC is not enabled */ if (!enable) {
@@ -1855,7 +1854,7 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs,if (status)return status; - vsi_node =ice_sched_get_vsi_node (hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node)return ICE_ERR_CFG ;
@@ -1966,7 +1965,7 @@ ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)if (!tc_node)continue ; - vsi_node =ice_sched_get_vsi_node (pi->hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node)continue ;
@@ -2256,7 +2255,7 @@ ice_sched_move_vsi_to_agg(struct ice_port_info *pi, u16 vsi_handle, u32 agg_id,if (!agg_node)return ICE_ERR_DOES_NOT_EXIST ; - vsi_node =ice_sched_get_vsi_node (pi->hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node)return ICE_ERR_DOES_NOT_EXIST ;
@@ -3537,7 +3536,7 @@ ice_cfg_agg_vsi_priority_per_tc(struct ice_port_info *pi, u32 agg_id,if (!vsi_handle_valid) goto exit_agg_priority_per_tc; - vsi_node =ice_sched_get_vsi_node (hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node) goto exit_agg_priority_per_tc;
@@ -3593,7 +3592,7 @@ ice_cfg_vsi_bw_alloc(struct ice_port_info *pi, u16 vsi_handle, u8 ena_tcmap,if (!tc_node)continue ; - vsi_node =ice_sched_get_vsi_node (pi->hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node)continue ;
@@ -4805,7 +4804,7 @@ ice_sched_validate_vsi_srl_node(struct ice_port_info *pi, u16 vsi_handle)if (!tc_node)continue ; - vsi_node =ice_sched_get_vsi_node (pi->hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node)continue ;
@@ -4864,7 +4863,7 @@ ice_sched_set_vsi_bw_shared_lmt(struct ice_port_info *pi, u16 vsi_handle,if (!tc_node)continue ; - vsi_node =ice_sched_get_vsi_node (pi->hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node)continue ;
@@ -5368,7 +5367,7 @@ ice_sched_replay_vsi_bw(struct ice_hw *hw, u16 vsi_handle, tc_node =ice_sched_get_tc_node (pi, tc);if (!tc_node)continue ; - vsi_node =ice_sched_get_vsi_node (hw, tc_node, vsi_handle); + vsi_node =ice_sched_get_vsi_node (pi, tc_node, vsi_handle);if (!vsi_node)continue ; bw_t_info = &vsi_ctx->sched.bw_t_info[tc];
drivers/net/ice/base/ice_sched.h +1 -1
@@ -107,7 +107,7 @@ ice_sched_cfg_vsi(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 maxqs, u8 owner, bool enable);enum ice_status ice_rm_vsi_lan_cfg (struct ice_port_info *pi,u16 vsi_handle);struct ice_sched_node * -ice_sched_get_vsi_node (struct ice_hw *hw,struct ice_sched_node *tc_node, +ice_sched_get_vsi_node (struct ice_port_info *pi,struct ice_sched_node *tc_node,u16 vsi_handle);bool ice_sched_is_tree_balanced (struct ice_hw *hw,struct ice_sched_node *node);enum ice_status
Signature · 1 line
2.17.1
PATCH v3 52/69 net/ice/base: add some minor new defines
In reply to Leyi Rong1. Add defines for Link Topology Netlist Section.
2. Add missing Read MAC command response bits.
3. Adds AQ error 29.
--- drivers/net/ice/base/ice_adminq_cmd.h | 3 +++ drivers/net/ice/base/ice_type.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/net/ice/base/ice_adminq_cmd.h +3 -0
@@ -142,6 +142,8 @@ struct ice_aqc_manage_mac_read {#define ICE_AQC_MAN_MAC_SAN_ADDR_VALID BIT(5)#define ICE_AQC_MAN_MAC_PORT_ADDR_VALID BIT(6)#define ICE_AQC_MAN_MAC_WOL_ADDR_VALID BIT(7) +#define ICE_AQC_MAN_MAC_MC_MAG_EN BIT(8) +#define ICE_AQC_MAN_MAC_WOL_PRESERVE_ON_PFR BIT(9)#define ICE_AQC_MAN_MAC_READ_S 4#define ICE_AQC_MAN_MAC_READ_M (0xF << ICE_AQC_MAN_MAC_READ_S)u8 rsvd[2 ];
@@ -2389,6 +2391,7 @@ enum ice_aq_err {ICE_AQ_RC_ESVN =26 ,/* SVN number prohibits this package */ ICE_AQ_RC_EBADMAN =27 ,/* Manifest hash mismatch */ ICE_AQ_RC_EBADBUF =28 ,/* Buffer hash mismatches manifest */ + ICE_AQ_RC_EACCES_BMCU = 29, /* BMC Update in progress */ };/* Admin Queue command opcodes */
drivers/net/ice/base/ice_type.h +2 -0
@@ -971,6 +971,8 @@ enum ice_sw_fwd_act_type {#define ICE_SR_NVM_BANK_SIZE 0x43#define ICE_SR_1ND_OROM_BANK_PTR 0x44#define ICE_SR_OROM_BANK_SIZE 0x45 +#define ICE_SR_NETLIST_BANK_PTR 0x46 +#define ICE_SR_NETLIST_BANK_SIZE 0x47#define ICE_SR_EMP_SR_SETTINGS_PTR 0x48#define ICE_SR_CONFIGURATION_METADATA_PTR 0x4D#define ICE_SR_IMMEDIATE_VALUES_PTR 0x4E
Signature · 1 line
2.17.1
PATCH v3 53/69 net/ice/base: add vxlan/generic tunnel management
In reply to Leyi RongAdded routines for handling tunnel management:
- ice_tunnel_port_in_use()
- ice_tunnel_get_type()
- ice_find_free_tunnel_entry()
- ice_create_tunnel()
- ice_destroy_tunnel()
--- drivers/net/ice/base/ice_flex_pipe.c | 228 +++++++++++++++++++++++++++ drivers/net/ice/base/ice_flex_pipe.h | 6 + 2 files changed, 234 insertions(+)
drivers/net/ice/base/ice_flex_pipe.c +228 -0
@@ -1708,6 +1708,234 @@ static struct ice_buf *ice_pkg_buf(struct ice_buf_build *bld)return &bld->buf; } +/** +* ice_tunnel_port_in_use +* @hw: pointer to the HW structure +* @port: port to search for +* @index: optionally returns index +* +* Returns whether a port is already in use as a tunnel, and optionally its +* index +*/ +bool ice_tunnel_port_in_use (struct ice_hw *hw,u16 port,u16 *index) +{ +u16 i; + +for (i =0 ; i < hw->tnl.count && i <ICE_TUNNEL_MAX_ENTRIES ; i++) +if (hw->tnl.tbl[i].in_use && hw->tnl.tbl[i].port == port) { +if (index) + *index = i; +return true; + } + +return false; +} + +/** +* ice_tunnel_get_type +* @hw: pointer to the HW structure +* @port: port to search for +* @type: returns tunnel index +* +* For a given port number, will return the type of tunnel. +*/ +bool +ice_tunnel_get_type (struct ice_hw *hw,u16 port,enum ice_tunnel_type *type) +{ +u16 i; + +for (i =0 ; i < hw->tnl.count && i <ICE_TUNNEL_MAX_ENTRIES ; i++) +if (hw->tnl.tbl[i].in_use && hw->tnl.tbl[i].port == port) { + *type = hw->tnl.tbl[i].type; +return true; + } + +return false; +} + +/** +* ice_find_free_tunnel_entry +* @hw: pointer to the HW structure +* @type: tunnel type +* @index: optionally returns index +* +* Returns whether there is a free tunnel entry, and optionally its index +*/ +static bool +ice_find_free_tunnel_entry (struct ice_hw *hw,enum ice_tunnel_type type, +u16 *index) +{ +u16 i; + +for (i =0 ; i < hw->tnl.count && i <ICE_TUNNEL_MAX_ENTRIES ; i++) +if (hw->tnl.tbl[i].valid && !hw->tnl.tbl[i].in_use && + hw->tnl.tbl[i].type == type) { +if (index) + *index = i; +return true; + } + +return false; +} + +/** +* ice_create_tunnel +* @hw: pointer to the HW structure +* @type: type of tunnel +* @port: port to use for vxlan tunnel +* +* Creates a tunnel +*/ +enum ice_status +ice_create_tunnel (struct ice_hw *hw,enum ice_tunnel_type type,u16 port) +{ +struct ice_boost_tcam_section *sect_rx, *sect_tx; +enum ice_status status =ICE_ERR_MAX_LIMIT ; +struct ice_buf_build *bld; +u16 index; + +if (ice_tunnel_port_in_use (hw, port,NULL )) +return ICE_ERR_ALREADY_EXISTS ; + +if (!ice_find_free_tunnel_entry (hw, type, &index)) +return ICE_ERR_OUT_OF_RANGE ; + + bld =ice_pkg_buf_alloc (hw); +if (!bld) +return ICE_ERR_NO_MEMORY ; + +/* allocate 2 sections, one for RX parser, one for TX parser */ +if (ice_pkg_buf_reserve_section (bld,2 )) + goto ice_create_tunnel_err; + + sect_rx = (struct ice_boost_tcam_section *) +ice_pkg_buf_alloc_section (bld,ICE_SID_RXPARSER_BOOST_TCAM , +sizeof (*sect_rx)); +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)); +if (!sect_tx) + goto ice_create_tunnel_err; + sect_tx->count =CPU_TO_LE16 (1 ); + +/* copy original boost entry to update package buffer */ +ice_memcpy (sect_rx->tcam, hw->tnl.tbl[index].boost_entry, +sizeof (*sect_rx->tcam),ICE_NONDMA_TO_NONDMA ); + +/* over-write the never-match dest port key bits with the encoded port +* bits +*/ +ice_set_key ((u8 *)§_rx->tcam[0 ].key,sizeof (sect_rx->tcam[0 ].key), + (u8 *)&port,NULL ,NULL ,NULL , + offsetof(struct ice_boost_key_value , hv_dst_port_key), +sizeof (sect_rx->tcam[0 ].key.key.hv_dst_port_key)); + +/* exact copy of entry to TX section entry */ +ice_memcpy (sect_tx->tcam, sect_rx->tcam,sizeof (*sect_tx->tcam), +ICE_NONDMA_TO_NONDMA ); + + status =ice_update_pkg (hw,ice_pkg_buf (bld),1 ); +if (!status) { + hw->tnl.tbl[index].port = port; + hw->tnl.tbl[index].in_use = true; + } + +ice_create_tunnel_err: +ice_pkg_buf_free (hw, bld); + +return status; +} + +/** +* ice_destroy_tunnel +* @hw: pointer to the HW structure +* @port: port of tunnel to destroy (ignored if the all parameter is true) +* @all: flag that states to destroy all tunnels +* +* Destroys a tunnel or all tunnels by creating an update package buffer +* targeting the specific updates requested and then performing an update +* package. +*/ +enum ice_status ice_destroy_tunnel (struct ice_hw *hw,u16 port,bool all) +{ +struct ice_boost_tcam_section *sect_rx, *sect_tx; +enum ice_status status =ICE_ERR_MAX_LIMIT ; +struct ice_buf_build *bld; +u16 count =0 ; +u16 size; +u16 i; + +/* determine count */ +for (i =0 ; i < hw->tnl.count && i <ICE_TUNNEL_MAX_ENTRIES ; i++) +if (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].in_use && + (all || hw->tnl.tbl[i].port == port)) + count++; + +if (!count) +return ICE_ERR_PARAM ; + +/* size of section - there is at least one entry */ + size = (count -1 ) *sizeof (*sect_rx->tcam) +sizeof (*sect_rx); + + bld =ice_pkg_buf_alloc (hw); +if (!bld) +return ICE_ERR_NO_MEMORY ; + +/* allocate 2 sections, one for RX parser, one for TX parser */ +if (ice_pkg_buf_reserve_section (bld,2 )) + goto ice_destroy_tunnel_err; + + sect_rx = (struct ice_boost_tcam_section *) +ice_pkg_buf_alloc_section (bld,ICE_SID_RXPARSER_BOOST_TCAM , + size); +if (!sect_rx) + goto ice_destroy_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 , + size); +if (!sect_tx) + goto ice_destroy_tunnel_err; + sect_tx->count =CPU_TO_LE16 (1 ); + +/* copy original boost entry to update package buffer, one copy to RX +* section, another copy to the TX section +*/ +for (i =0 ; i < hw->tnl.count && i <ICE_TUNNEL_MAX_ENTRIES ; i++) +if (hw->tnl.tbl[i].valid && hw->tnl.tbl[i].in_use && + (all || hw->tnl.tbl[i].port == port)) { +ice_memcpy (sect_rx->tcam + i, + hw->tnl.tbl[i].boost_entry, +sizeof (*sect_rx->tcam), +ICE_NONDMA_TO_NONDMA ); +ice_memcpy (sect_tx->tcam + i, + hw->tnl.tbl[i].boost_entry, +sizeof (*sect_tx->tcam), +ICE_NONDMA_TO_NONDMA ); + hw->tnl.tbl[i].marked = true; + } + + status =ice_update_pkg (hw,ice_pkg_buf (bld),1 ); +if (!status) +for (i =0 ; i < hw->tnl.count && + i <ICE_TUNNEL_MAX_ENTRIES ; i++) +if (hw->tnl.tbl[i].marked) { + hw->tnl.tbl[i].port =0 ; + hw->tnl.tbl[i].in_use = false; + hw->tnl.tbl[i].marked = false; + } + +ice_destroy_tunnel_err: +ice_pkg_buf_free (hw, bld); + +return status; +} +/** * ice_find_prot_off - find prot ID and offset pair, based on prof and FV index * @hw: pointer to the hardware structure
drivers/net/ice/base/ice_flex_pipe.h +6 -0
@@ -33,6 +33,12 @@ ice_find_label_value(struct ice_seg *ice_seg, char const *name, u32 type,enum ice_status ice_get_sw_fv_list (struct ice_hw *hw,u16 *prot_ids,u8 ids_cnt,struct LIST_HEAD_TYPE *fv_list); +enum ice_status +ice_create_tunnel (struct ice_hw *hw,enum ice_tunnel_type type,u16 port); +enum ice_status ice_destroy_tunnel (struct ice_hw *hw,u16 port,bool all); +bool ice_tunnel_port_in_use (struct ice_hw *hw,u16 port,u16 *index); +bool +ice_tunnel_get_type (struct ice_hw *hw,u16 port,enum ice_tunnel_type *type);/* XLT2/VSI group functions */
Signature · 1 line
2.17.1
PATCH v3 54/69 net/ice/base: enable additional switch rules
In reply to Leyi RongAdd capability to create inner IP and inner TCP switch recipes and rules. Change UDP tunnel dummy packet to accommodate the training of these new rules.
--- drivers/net/ice/base/ice_protocol_type.h | 8 +- drivers/net/ice/base/ice_switch.c | 361 ++++++++++++----------- drivers/net/ice/base/ice_switch.h | 1 + 3 files changed, 203 insertions(+), 167 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +6 -2
@@ -35,6 +35,7 @@ enum ice_protocol_type {ICE_IPV6_IL ,ICE_IPV6_OFOS ,ICE_TCP_IL , +ICE_UDP_OF ,ICE_UDP_ILOS ,ICE_SCTP_IL , ICE_VXLAN,
@@ -112,6 +113,7 @@ enum ice_prot_id {#define ICE_IPV6_OFOS_HW 40#define ICE_IPV6_IL_HW 41#define ICE_TCP_IL_HW 49 +#define ICE_UDP_OF_HW 52#define ICE_UDP_ILOS_HW 53#define ICE_SCTP_IL_HW 96
@@ -188,8 +190,7 @@ struct ice_l4_hdr {struct ice_udp_tnl_hdr {u16 field;u16 proto_type; -u16 vni; -u16 reserved; +u32 vni;/* only use lower 24-bits */ };struct ice_nvgre {
@@ -225,6 +226,7 @@ struct ice_prot_lkup_ext {u8 n_val_words;/* create a buffer to hold max words per recipe */ u16 field_off[ICE_MAX_CHAIN_WORDS ]; +u16 field_mask[ICE_MAX_CHAIN_WORDS ];struct ice_fv_word fv_words[ICE_MAX_CHAIN_WORDS ];
@@ -235,6 +237,7 @@ struct ice_prot_lkup_ext {struct ice_pref_recipe_group {u8 n_val_pairs;/* Number of valid pairs */ struct ice_fv_word pairs[ICE_NUM_WORDS_RECIPE ]; +u16 mask[ICE_NUM_WORDS_RECIPE ]; };struct ice_recp_grp_entry {
@@ -244,6 +247,7 @@ struct ice_recp_grp_entry {u16 rid;u8 chain_idx;u16 fv_idx[ICE_NUM_WORDS_RECIPE ]; +u16 fv_mask[ICE_NUM_WORDS_RECIPE ]; struct ice_pref_recipe_group r_group; };#endif /* _ICE_PROTOCOL_TYPE_H_ */
drivers/net/ice/base/ice_switch.c +196 -165
591 lines not on this page · raw message
drivers/net/ice/base/ice_switch.h +1 -0
@@ -192,6 +192,7 @@ struct ice_sw_recipe {* recipe */ struct ice_fv_word ext_words[ICE_MAX_CHAIN_WORDS ]; +u16 word_masks[ICE_MAX_CHAIN_WORDS ];/* if this recipe is a collection of other recipe */ u8 big_recp;
Signature · 1 line
2.17.1
PATCH v3 55/69 net/ice/base: allow forward to Q groups in switch rule
In reply to Leyi RongEnable forward to Q group action in ice_add_adv_rule.
--- drivers/net/ice/base/ice_switch.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/ice/base/ice_switch.c +11 -0
@@ -5488,6 +5488,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,const u8 *pkt =NULL ;bool found = false;u32 act =0 ; +u8 q_rgn;if (!lkups_cnt)return ICE_ERR_PARAM ;
@@ -5518,6 +5519,7 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,if (!(rinfo->sw_act.fltr_act ==ICE_FWD_TO_VSI || rinfo->sw_act.fltr_act ==ICE_FWD_TO_Q || + rinfo->sw_act.fltr_act ==ICE_FWD_TO_QGRP || rinfo->sw_act.fltr_act ==ICE_DROP_PACKET ))return ICE_ERR_CFG ;
@@ -5570,6 +5572,15 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, act |= (rinfo->sw_act.fwd_id.q_id <<ICE_SINGLE_ACT_Q_INDEX_S ) &ICE_SINGLE_ACT_Q_INDEX_M ;break ; +case ICE_FWD_TO_QGRP : + q_rgn = rinfo->sw_act.qgrp_size >0 ? + (u8 )ice_ilog2 (rinfo->sw_act.qgrp_size) :0 ; + act |=ICE_SINGLE_ACT_TO_Q ; + act |= (rinfo->sw_act.fwd_id.q_id <<ICE_SINGLE_ACT_Q_INDEX_S ) & +ICE_SINGLE_ACT_Q_INDEX_M ; + act |= (q_rgn <<ICE_SINGLE_ACT_Q_REGION_S ) & +ICE_SINGLE_ACT_Q_REGION_M ; +break ;case ICE_DROP_PACKET : act |=ICE_SINGLE_ACT_VSI_FORWARDING |ICE_SINGLE_ACT_DROP |ICE_SINGLE_ACT_VALID_BIT ;
Signature · 1 line
2.17.1
PATCH v3 56/69 net/ice/base: changes for reducing ice add adv rule time
In reply to Leyi RongWhile calling ice_find_recp we were calling ice_get_recp_to_prof_map everytime we called ice_find_recp. ice_get_recp_to_prof_map is a very expensive operation and we should try to reduce the number of times we call this function. So moved it into ice_get_recp_frm_fw since we only need to have fresh recp_to_profile mapping when we we check FW to see if the recipe we are trying to add already exists in FW.
--- drivers/net/ice/base/ice_switch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_switch.c +6 -1
@@ -168,6 +168,8 @@ static ice_declare_bitmap(recipe_to_profile[ICE_MAX_NUM_RECIPES], ICE_MAX_NUM_PROFILES); static ice_declare_bitmap(available_result_ids, ICE_CHAIN_FV_INDEX_START + 1); +static void ice_get_recp_to_prof_map (struct ice_hw *hw); +/** * ice_get_recp_frm_fw - update SW bookkeeping from FW recipe entries * @hw: pointer to hardware structure
@@ -189,6 +191,10 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid)struct ice_prot_lkup_ext *lkup_exts;enum ice_status status; +/* Get recipe to profile map so that we can get the fv from +* lkups that we read for a recipe from FW. +*/ +ice_get_recp_to_prof_map (hw);/* we need a buffer big enough to accommodate all the recipes */ tmp = (struct ice_aqc_recipe_data_elem *)ice_calloc (hw,ICE_MAX_NUM_RECIPES ,sizeof (*tmp));
@@ -4355,7 +4361,6 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)struct ice_sw_recipe *recp;u16 i; -ice_get_recp_to_prof_map (hw);/* Initialize available_result_ids which tracks available result idx */ for (i =0 ; i <=ICE_CHAIN_FV_INDEX_START ; i++) ice_set_bit(ICE_CHAIN_FV_INDEX_START - i,
Signature · 1 line
2.17.1
PATCH v3 57/69 net/ice/base: deduce TSA value in the CEE mode
In reply to Leyi RongIn CEE mode, the TSA information can be derived from the reported priority value.
--- drivers/net/ice/base/ice_dcb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_dcb.c +7 -1
@@ -445,9 +445,15 @@ ice_parse_cee_pgcfg_tlv(struct ice_cee_feat_tlv *tlv,* |pg0|pg1|pg2|pg3|pg4|pg5|pg6|pg7| * --------------------------------- */ -ice_for_each_traffic_class (i) +ice_for_each_traffic_class (i) { etscfg->tcbwtable[i] = buf[offset++]; +if (etscfg->prio_table[i] ==ICE_CEE_PGID_STRICT ) + dcbcfg->etscfg.tsatable[i] =ICE_IEEE_TSA_STRICT ; +else + dcbcfg->etscfg.tsatable[i] =ICE_IEEE_TSA_ETS ; + } +/* Number of TCs supported (1 octet) */ etscfg->maxtcs = buf[offset]; }
Signature · 1 line
2.17.1
PATCH v3 58/69 net/ice/base: rework API for ice zero bitmap
In reply to Leyi RongFix ice_zero_bitmap to zero the entire storage.
--- drivers/net/ice/base/ice_bitops.h | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/net/ice/base/ice_bitops.h +6 -13
@@ -147,22 +147,15 @@ ice_test_and_set_bit(u16 nr, ice_bitmap_t *bitmap)* @bmp: bitmap to set zeros * @size: Size of the bitmaps in bits * -* This function sets bits of a bitmap to zero. +* Set all of the bits in a bitmap to zero. Note that this function assumes it +* operates on an ice_bitmap_t which was declared using ice_declare_bitmap. It +* will zero every bit in the last chunk, even if those bits are beyond the +* size. */ static inline void ice_zero_bitmap (ice_bitmap_t *bmp,u16 size) { -ice_bitmap_t mask; -u16 i; - -/* Handle all but last chunk*/ -for (i =0 ; i <BITS_TO_CHUNKS (size) -1 ; i++) - bmp[i] =0 ; -/* For the last chunk, we want to take care of not to modify bits -* outside the size boundary. ~mask take care of all the bits outside -* the boundary. -*/ - mask =LAST_CHUNK_MASK (size); - bmp[i] &= ~mask; +ice_memset (bmp,0 ,BITS_TO_CHUNKS (size) *sizeof (ice_bitmap_t), +ICE_NONDMA_MEM ); }/**
Signature · 1 line
2.17.1
PATCH v3 59/69 net/ice/base: rework API for ice cp bitmap
In reply to Leyi RongFix ice_cp_bitmap to copy the entire storage.
--- drivers/net/ice/base/ice_bitops.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/net/ice/base/ice_bitops.h +5 -12
@@ -306,21 +306,14 @@ static inline bool ice_is_any_bit_set(ice_bitmap_t *bitmap, u16 size)* @src: bitmap to copy from * @size: Size of the bitmaps in bits * -* This function copy bitmap from src to dst. +* This function copy bitmap from src to dst. Note that this function assumes +* it is operating on a bitmap declared using ice_declare_bitmap. It will copy +* the entire last chunk even if this contains bits beyond the size. */ static inline void ice_cp_bitmap (ice_bitmap_t *dst,ice_bitmap_t *src,u16 size) { -ice_bitmap_t mask; -u16 i; - -/* Handle all but last chunk*/ -for (i =0 ; i <BITS_TO_CHUNKS (size) -1 ; i++) - dst[i] = src[i]; - -/* We want to only copy bits within the size.*/ - mask =LAST_CHUNK_MASK (size); - dst[i] &= ~mask; - dst[i] |= src[i] & mask; +ice_memcpy (dst, src,BITS_TO_CHUNKS (size) *sizeof (ice_bitmap_t), +ICE_NONDMA_TO_NONDMA ); }/**
Signature · 1 line
2.17.1
PATCH v3 60/69 net/ice/base: use ice zero bitmap instead of ice memset
In reply to Leyi RongA few places in the code used ice_memset instead of ice_zero_bitmap to initialize a bitmap to zeros.
--- drivers/net/ice/base/ice_flex_pipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +2 -2
@@ -3712,7 +3712,7 @@ ice_update_fd_swap(struct ice_hw *hw, u16 prof_id, struct ice_fv_word *es)u32 mask_sel =0 ;u8 i, j, k; -ice_memset (pair_list,0 ,sizeof (pair_list),ICE_NONDMA_MEM ); +ice_zero_bitmap (pair_list,ICE_FD_SRC_DST_PAIR_COUNT );ice_init_fd_mask_regs (hw);
@@ -4488,7 +4488,7 @@ ice_adj_prof_priorities(struct ice_hw *hw, enum ice_block blk, u16 vsig,enum ice_status status;u16 idx; -ice_memset (ptgs_used,0 ,sizeof (ptgs_used),ICE_NONDMA_MEM ); +ice_zero_bitmap (ptgs_used,ICE_XLT1_CNT ); idx = vsig &ICE_VSIG_IDX_M ;/* Priority is based on the order in which the profiles are added. The
Signature · 1 line
2.17.1
PATCH v3 61/69 net/ice/base: use the specified size for ice zero bitmap
In reply to Leyi RongA couple of places in the code use a 'sizeof(bitmap) * BITS_PER_BYTE' construction to calculate the size of the bitmap when calling ice_zero_bitmap. Instead of doing this, just use the same value as in the ice_declare_bitmap declaration.
--- drivers/net/ice/base/ice_sched.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ice/base/ice_sched.c +2 -3
@@ -5259,8 +5259,7 @@ void ice_sched_replay_agg(struct ice_hw *hw) ICE_MAX_TRAFFIC_CLASS);enum ice_status status; -ice_zero_bitmap (replay_bitmap, -sizeof (replay_bitmap) *BITS_PER_BYTE ); +ice_zero_bitmap (replay_bitmap,ICE_MAX_TRAFFIC_CLASS );ice_sched_get_ena_tc_bitmap (pi, agg_info->replay_tc_bitmap, replay_bitmap);
@@ -5396,7 +5395,7 @@ ice_sched_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle)struct ice_sched_agg_info *agg_info;enum ice_status status; -ice_zero_bitmap (replay_bitmap,sizeof (replay_bitmap) *BITS_PER_BYTE ); +ice_zero_bitmap (replay_bitmap,ICE_MAX_TRAFFIC_CLASS );if (!ice_is_vsi_valid (hw, vsi_handle))return ICE_ERR_PARAM ; agg_info =ice_get_vsi_agg_info (hw, vsi_handle);
Signature · 1 line
2.17.1
PATCH v3 62/69 net/ice/base: correct NVGRE header structure
In reply to Leyi RongCorrect NVGRE header structure and its field offsets.
--- drivers/net/ice/base/ice_protocol_type.h | 5 +++-- drivers/net/ice/base/ice_switch.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/ice/base/ice_protocol_type.h +3 -2
@@ -194,8 +194,9 @@ struct ice_udp_tnl_hdr { };struct ice_nvgre { -u16 tni; -u16 flow_id; +u16 flags; +u16 protocol; +u32 tni_flow; };union ice_prot_hdr {
drivers/net/ice/base/ice_switch.c +1 -1
@@ -4310,7 +4310,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[] = { { ICE_VXLAN, { 8, 10, 12, 14 } }, { ICE_GENEVE, { 8, 10, 12, 14 } }, { ICE_VXLAN_GPE, { 0, 2, 4 } }, - { ICE_NVGRE, { 0, 2 } }, + { ICE_NVGRE, { 0, 2, 4, 6 } }, { ICE_PROTOCOL_LAST, { 0 } } };
Signature · 1 line
2.17.1
PATCH v3 63/69 net/ice/base: reduce calls to get profile associations
In reply to Leyi RongAdded refresh_required flag to determine if we need to update the recipe to profile mapping cache. This will reduce the number of calls made to refresh the profile map.
--- drivers/net/ice/base/ice_switch.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/net/ice/base/ice_switch.c +19 -6
@@ -175,13 +175,15 @@ static void ice_get_recp_to_prof_map(struct ice_hw *hw);* @hw: pointer to hardware structure * @recps: struct that we need to populate * @rid: recipe ID that we are populating +* @refresh_required: true if we should get recipe to profile mapping from FW * * This function is used to populate all the necessary entries into our * bookkeeping so that we have a current list of all the recipes that are * programmed in the firmware. */ static enum ice_status -ice_get_recp_frm_fw (struct ice_hw *hw,struct ice_sw_recipe *recps,u8 rid) +ice_get_recp_frm_fw (struct ice_hw *hw,struct ice_sw_recipe *recps,u8 rid, +bool *refresh_required) {u16 i, sub_recps, fv_word_idx =0 , result_idx =0 ;ice_declare_bitmap (r_bitmap,ICE_MAX_NUM_PROFILES );
@@ -191,10 +193,6 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid)struct ice_prot_lkup_ext *lkup_exts;enum ice_status status; -/* Get recipe to profile map so that we can get the fv from -* lkups that we read for a recipe from FW. -*/ -ice_get_recp_to_prof_map (hw);/* we need a buffer big enough to accommodate all the recipes */ tmp = (struct ice_aqc_recipe_data_elem *)ice_calloc (hw,ICE_MAX_NUM_RECIPES ,sizeof (*tmp));
@@ -206,6 +204,19 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid)/* non-zero status meaning recipe doesn't exist */ if (status) goto err_unroll; + +/* Get recipe to profile map so that we can get the fv from lkups that +* we read for a recipe from FW. Since we want to minimize the number of +* times we make this FW call, just make one call and cache the copy +* until a new recipe is added. This operation is only required the +* first time to get the changes from FW. Then to search existing +* entries we don't need to update the cache again until another recipe +* gets added. +*/ +if (*refresh_required) { +ice_get_recp_to_prof_map (hw); + *refresh_required = false; + } lkup_exts = &recps[rid].lkup_exts;/* start populating all the entries for recps[rid] based on lkups from * firmware
@@ -4358,6 +4369,7 @@ static const struct ice_protocol_entry ice_prot_id_tbl[] = {*/ static u16 ice_find_recp (struct ice_hw *hw,struct ice_prot_lkup_ext *lkup_exts) { +bool refresh_required = true;struct ice_sw_recipe *recp;u16 i;
@@ -4376,7 +4388,8 @@ static u16 ice_find_recp(struct ice_hw *hw, struct ice_prot_lkup_ext *lkup_exts)*/ if (!recp[i].recp_created)if (ice_get_recp_frm_fw (hw, - hw->switch_info->recp_list, i)) + hw->switch_info->recp_list, i, + &refresh_required))continue ;/* if number of words we are looking for match */
Signature · 1 line
2.17.1
PATCH v3 64/69 net/ice/base: fix for chained recipe switch ID index
In reply to Leyi RongFor chained recipe entry, the field vector index used to match switch ID should always be zero.
Add ICE_AQ_SW_ID_LKUP_IDX define to indicate the FV index used to extract the switch ID.
--- drivers/net/ice/base/ice_adminq_cmd.h | 1 + drivers/net/ice/base/ice_switch.c | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +1 -0
@@ -711,6 +711,7 @@ struct ice_aqc_recipe_content {#define ICE_AQ_RECIPE_ID_S 0#define ICE_AQ_RECIPE_ID_M (0x3F << ICE_AQ_RECIPE_ID_S)#define ICE_AQ_RECIPE_ID_IS_ROOT BIT(7) +#define ICE_AQ_SW_ID_LKUP_IDX 0u8 lkup_indx[5 ];#define ICE_AQ_RECIPE_LKUP_DATA_S 0#define ICE_AQ_RECIPE_LKUP_DATA_M (0x3F << ICE_AQ_RECIPE_LKUP_DATA_S)
drivers/net/ice/base/ice_switch.c +6 -5
@@ -4737,8 +4737,8 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,sizeof (buf[recps].content.lkup_indx), ICE_NONDMA_MEM); -/* All recipes use look-up field index 0 to match switch ID. */ - buf[recps].content.lkup_indx[0 ] =0 ; +/* All recipes use look-up index 0 to match switch ID. */ + buf[recps].content.lkup_indx[0 ] =ICE_AQ_SW_ID_LKUP_IDX ; buf[recps].content.mask[0 ] =CPU_TO_LE16 (ICE_AQ_SW_ID_LKUP_MASK );/* Setup lkup_indx 1..4 to INVALID/ignore and set the mask
@@ -4804,7 +4804,7 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm, buf[0 ].content.act_ctrl_fwd_priority = rm->priority; }else {struct ice_recp_grp_entry *last_chain_entry; -u16 rid, i =0 ; +u16 rid, i;/* Allocate the last recipe that will chain the outcomes of the * other recipes together
@@ -4829,8 +4829,9 @@ ice_add_sw_recipe(struct ice_hw *hw, struct ice_sw_recipe *rm,ice_memset (&buf[recps].content.lkup_indx,0 ,sizeof (buf[recps].content.lkup_indx),ICE_NONDMA_MEM ); - buf[recps].content.lkup_indx[i] = hw->port_info->sw_id; - buf[recps].content.mask[i] = +/* All recipes use look-up index 0 to match switch ID. */ + buf[recps].content.lkup_indx[0 ] =ICE_AQ_SW_ID_LKUP_IDX ; + buf[recps].content.mask[0 ] =CPU_TO_LE16 (ICE_AQ_SW_ID_LKUP_MASK );for (i =1 ; i <=ICE_NUM_WORDS_RECIPE ; i++) { buf[recps].content.lkup_indx[i] =
Signature · 1 line
2.17.1
PATCH v3 65/69 net/ice/base: update driver unloading field
In reply to Leyi RongAccording to recent specification versions, the field in the Queue Shutdown AdminQ command consisting of the "driver unloading" indication is not a 4 byte field (it is byte.bit 16.0). Change it to a byte and remove the unnecessary endian conversion.
--- drivers/net/ice/base/ice_adminq_cmd.h | 4 ++-- drivers/net/ice/base/ice_common.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ice/base/ice_adminq_cmd.h +2 -2
@@ -52,9 +52,9 @@ struct ice_aqc_driver_ver {/* Queue Shutdown (direct 0x0003) */ struct ice_aqc_q_shutdown { -__le32 driver_unloading; +u8 driver_unloading;#define ICE_AQC_DRIVER_UNLOADING BIT(0) -u8 reserved[12 ]; +u8 reserved[15 ]; };
drivers/net/ice/base/ice_common.c +1 -1
@@ -1581,7 +1581,7 @@ enum ice_status ice_aq_q_shutdown(struct ice_hw *hw, bool unloading)ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_q_shutdown);if (unloading) - cmd->driver_unloading =CPU_TO_LE32 (ICE_AQC_DRIVER_UNLOADING ); + cmd->driver_unloading =ICE_AQC_DRIVER_UNLOADING ;return ice_aq_send_cmd (hw, &desc,NULL ,0 ,NULL ); }
Signature · 1 line
2.17.1
PATCH v3 66/69 net/ice/base: fix for UDP and TCP related switch rules
In reply to Leyi RongThis patch corrects some errors in UDP and TCP switch rule programming by adding additional dummy packets.
--- drivers/net/ice/base/ice_switch.c | 156 +++++++++++++++++++++++------- 1 file changed, 123 insertions(+), 33 deletions(-)
drivers/net/ice/base/ice_switch.c +123 -33
@@ -89,7 +89,7 @@ u8 dummy_gre_packet[] = { 0, 0, 0, 0, /* ICE_MAC_OFOS 0 */ };static const -struct ice_dummy_pkt_offsets dummy_udp_tun_packet_offsets[] = { +struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = { {ICE_MAC_OFOS ,0 }, {ICE_IPV4_OFOS ,14 }, {ICE_UDP_OF ,34 },
@@ -101,7 +101,7 @@ struct ice_dummy_pkt_offsets dummy_udp_tun_packet_offsets[] = { };static const -u8 dummy_udp_tun_packet[] = { +u8 dummy_udp_tun_tcp_packet[] = {0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_OFOS 0 */ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,
@@ -138,7 +138,80 @@ u8 dummy_udp_tun_packet[] = { };static const -struct ice_dummy_pkt_offsets dummy_tcp_tun_packet_offsets[] = { +struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = { + {ICE_MAC_OFOS ,0 }, + {ICE_IPV4_OFOS ,14 }, + {ICE_UDP_OF ,34 }, + {ICE_VXLAN ,42 }, + {ICE_MAC_IL ,50 }, + {ICE_IPV4_IL ,64 }, + {ICE_UDP_ILOS ,84 }, + {ICE_PROTOCOL_LAST ,0 }, +}; + +static const +u8 dummy_udp_tun_udp_packet[] = { +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_OFOS 0 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x08 ,0x00 , + +0x45 ,0x00 ,0x00 ,0x4e ,/* ICE_IPV4_OFOS 14 */ +0x00 ,0x01 ,0x00 ,0x00 , +0x00 ,0x11 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x12 ,0xb5 ,/* ICE_UDP_OF 34 */ +0x00 ,0x3a ,0x00 ,0x00 , + +0x0c ,0x00 ,0x00 ,0x03 ,/* ICE_VXLAN 42 */ +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_IL 50 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x08 ,0x00 , + +0x45 ,0x00 ,0x00 ,0x1c ,/* ICE_IPV4_IL 64 */ +0x00 ,0x01 ,0x00 ,0x00 , +0x00 ,0x11 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_UDP_ILOS 84 */ +0x00 ,0x08 ,0x00 ,0x00 , +}; + +static const +struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = { + {ICE_MAC_OFOS ,0 }, + {ICE_IPV4_OFOS ,14 }, + {ICE_UDP_ILOS ,34 }, + {ICE_PROTOCOL_LAST ,0 }, +}; + +static const u8 +dummy_udp_packet[] = { +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_OFOS 0 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x08 ,0x00 , + +0x45 ,0x00 ,0x00 ,0x1c ,/* ICE_IPV4_OFOS 14 */ +0x00 ,0x01 ,0x00 ,0x00 , +0x00 ,0x11 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_UDP_ILOS 34 */ +0x00 ,0x08 ,0x00 ,0x00 , + +0x00 ,0x00 ,/* 2 bytes for 4 byte alignment */ +}; + +static const +struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = { {ICE_MAC_OFOS ,0 }, {ICE_IPV4_OFOS ,14 }, {ICE_TCP_IL ,34 },
@@ -146,22 +219,26 @@ struct ice_dummy_pkt_offsets dummy_tcp_tun_packet_offsets[] = { };static const u8 -dummy_tcp_tun_packet[] = {0 ,0 ,0 ,0 ,/* ICE_MAC_OFOS 0 */ -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 , -0x08 ,0 , -0x45 ,0 ,0 ,0x28 ,/* ICE_IPV4_OFOS 14 */ -0 ,0x01 ,0 ,0 , -0x40 ,0x06 ,0xF5 ,0x69 , -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 ,/* ICE_TCP_IL 34 */ -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 , -0x50 ,0x02 ,0x20 , -0 ,0x9 ,0x79 ,0 ,0 , -0 ,0 /* 2 bytes padding for 4 byte alignment*/ - }; +dummy_tcp_packet[] = { +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_OFOS 0 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x08 ,0x00 , + +0x45 ,0x00 ,0x00 ,0x28 ,/* ICE_IPV4_OFOS 14 */ +0x00 ,0x01 ,0x00 ,0x00 , +0x00 ,0x06 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_TCP_IL 34 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x50 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,/* 2 bytes for 4 byte alignment */ +};/* this is a recipe to profile bitmap association */ static ice_declare_bitmap(recipe_to_profile[ICE_MAX_NUM_RECIPES],
@@ -5195,8 +5272,16 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,u16 *pkt_len, const struct ice_dummy_pkt_offsets **offsets) { + bool tcp = false, udp = false;u16 i; +for (i =0 ; i < lkups_cnt; i++) { +if (lkups[i].type ==ICE_UDP_ILOS ) + udp = true; +else if (lkups[i].type ==ICE_TCP_IL ) + tcp = true; + } +if (tun_type ==ICE_SW_TUN_NVGRE || tun_type ==ICE_ALL_TUNNELS ) { *pkt = dummy_gre_packet; *pkt_len =sizeof (dummy_gre_packet);
@@ -5205,25 +5290,30 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, }if (tun_type ==ICE_SW_TUN_VXLAN || tun_type ==ICE_SW_TUN_GENEVE || - tun_type ==ICE_SW_TUN_VXLAN_GPE ) { - *pkt = dummy_udp_tun_packet; - *pkt_len =sizeof (dummy_udp_tun_packet); - *offsets = dummy_udp_tun_packet_offsets; + tun_type ==ICE_SW_TUN_VXLAN_GPE || tun_type ==ICE_SW_TUN_UDP ) { +if (tcp) { + *pkt = dummy_udp_tun_tcp_packet; + *pkt_len =sizeof (dummy_udp_tun_tcp_packet); + *offsets = dummy_udp_tun_tcp_packet_offsets; +return ; + } + + *pkt = dummy_udp_tun_udp_packet; + *pkt_len =sizeof (dummy_udp_tun_udp_packet); + *offsets = dummy_udp_tun_udp_packet_offsets;return ; } -for (i =0 ; i < lkups_cnt; i++) { -if (lkups[i].type ==ICE_UDP_ILOS ) { - *pkt = dummy_udp_tun_packet; - *pkt_len =sizeof (dummy_udp_tun_packet); - *offsets = dummy_udp_tun_packet_offsets; -return ; - } +if (udp) { + *pkt = dummy_udp_packet; + *pkt_len =sizeof (dummy_udp_packet); + *offsets = dummy_udp_packet_offsets; +return ; } - *pkt = dummy_tcp_tun_packet; - *pkt_len =sizeof (dummy_tcp_tun_packet); - *offsets = dummy_tcp_tun_packet_offsets; + *pkt = dummy_tcp_packet; + *pkt_len =sizeof (dummy_tcp_packet); + *offsets = dummy_tcp_packet_offsets; }/**
Signature · 1 line
2.17.1
PATCH v3 67/69 net/ice/base: changes in flow and profile removal
In reply to Leyi Rong- Add function to remove ES profile map as it is now being used in clearing and freeing HW tables.
- Locks were initially not used for releasing ES profile maps and flow profiles as the sequence is part of driver unload. Adding calls to acquire and release locks to ensure that any calls made by the VF VSI during VFR or unload do not result in memory access violations.
--- drivers/net/ice/base/ice_flex_pipe.c | 35 +++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +24 -11
@@ -2988,6 +2988,26 @@ void ice_fill_blk_tbls(struct ice_hw *hw)ice_init_sw_db (hw); } +/** +* ice_free_prof_map - free profile map +* @hw: pointer to the hardware structure +* @blk_idx: HW block index +*/ +static void ice_free_prof_map (struct ice_hw *hw,u8 blk_idx) +{ +struct ice_es *es = &hw->blk[blk_idx].es; +struct ice_prof_map *del, *tmp; + +ice_acquire_lock (&es->prof_map_lock); +LIST_FOR_EACH_ENTRY_SAFE (del, tmp, &es->prof_map, + ice_prof_map, list) { +LIST_DEL (&del->list); +ice_free (hw, del); + } +INIT_LIST_HEAD (&es->prof_map); +ice_release_lock (&es->prof_map_lock); +} +/** * ice_free_flow_profs - free flow profile entries * @hw: pointer to the hardware structure
@@ -2997,10 +3017,7 @@ static void ice_free_flow_profs(struct ice_hw *hw, u8 blk_idx) {struct ice_flow_prof *p, *tmp; -/* This call is being made as part of resource deallocation -* during unload. Lock acquire and release will not be -* necessary here. -*/ +ice_acquire_lock (&hw->fl_profs_locks[blk_idx]);LIST_FOR_EACH_ENTRY_SAFE (p, tmp, &hw->fl_profs[blk_idx], ice_flow_prof, l_entry) {struct ice_flow_entry *e, *t;
@@ -3014,6 +3031,7 @@ static void ice_free_flow_profs(struct ice_hw *hw, u8 blk_idx)ice_free (hw, p->acts);ice_free (hw, p); } +ice_release_lock (&hw->fl_profs_locks[blk_idx]);/* if driver is in reset and tables are being cleared * re-initialize the flow profile list heads
@@ -3050,17 +3068,12 @@ void ice_free_hw_tbls(struct ice_hw *hw)for (i =0 ; i <ICE_BLK_COUNT ; i++) {if (hw->blk[i].is_list_init) {struct ice_es *es = &hw->blk[i].es; -struct ice_prof_map *del, *tmp; - -LIST_FOR_EACH_ENTRY_SAFE (del, tmp, &es->prof_map, - ice_prof_map, list) { -LIST_DEL (&del->list); -ice_free (hw, del); - } +ice_free_prof_map (hw, i);ice_destroy_lock (&es->prof_map_lock);ice_free_flow_profs (hw, i);ice_destroy_lock (&hw->fl_profs_locks[i]); + hw->blk[i].is_list_init = false; }ice_free_vsig_tbl (hw, (enum ice_block )i);
Signature · 1 line
2.17.1
PATCH v3 68/69 net/ice/base: update Tx context struct
In reply to Leyi RongAdd internal usage flag, bit 91 as described in spec. Update width of internal queue state to 122 also as described in spec.
--- drivers/net/ice/base/ice_common.c | 3 ++- drivers/net/ice/base/ice_lan_tx_rx.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/ice/base/ice_common.c +2 -1
@@ -1267,6 +1267,7 @@ const struct ice_ctx_ele ice_tlan_ctx_info[] = {ICE_CTX_STORE (ice_tlan_ctx, vmvf_type,2 ,78 ),ICE_CTX_STORE (ice_tlan_ctx, src_vsi,10 ,80 ),ICE_CTX_STORE (ice_tlan_ctx, tsyn_ena,1 ,90 ), +ICE_CTX_STORE (ice_tlan_ctx, internal_usage_flag,1 ,91 ),ICE_CTX_STORE (ice_tlan_ctx, alt_vlan,1 ,92 ),ICE_CTX_STORE (ice_tlan_ctx, cpuid,8 ,93 ), ICE_CTX_STORE(ice_tlan_ctx, wb_mode, 1, 101),
@@ -1285,7 +1286,7 @@ const struct ice_ctx_ele ice_tlan_ctx_info[] = {ICE_CTX_STORE (ice_tlan_ctx, drop_ena,1 ,165 ),ICE_CTX_STORE (ice_tlan_ctx, cache_prof_idx,2 ,166 ),ICE_CTX_STORE (ice_tlan_ctx, pkt_shaper_prof_idx,3 ,168 ), -ICE_CTX_STORE (ice_tlan_ctx, int_q_state,110 ,171 ), +ICE_CTX_STORE (ice_tlan_ctx, int_q_state,122 ,171 ), { 0 } };
drivers/net/ice/base/ice_lan_tx_rx.h +1 -0
@@ -1009,6 +1009,7 @@ struct ice_tlan_ctx {#define ICE_TLAN_CTX_VMVF_TYPE_PF 2u16 src_vsi;u8 tsyn_ena; +u8 internal_usage_flag;u8 alt_vlan;u16 cpuid;/* bigger than needed, see above for reason */ u8 wb_mode;
Signature · 1 line
2.17.1
PATCH v3 69/69 net/ice/base: fixes for GRE
In reply to Leyi RongThe dummy packet for GRE had ICE_VXLAN instead of ICE_NVGRE listed in the offsets so change that to be correct. The dummy packet itself had some text to indicate VXLAN also so I changed that to just be GRE since it really wasn't VXLAN.
--- drivers/net/ice/base/ice_switch.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_switch.c +10 -4
@@ -53,13 +53,16 @@ static const u8 dummy_eth_header[DUMMY_ETH_HDR_LEN] = { 0x2, 0, 0, 0, 0, 0, sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi) + \ ((n) * sizeof(((struct ice_sw_rule_vsi_list *)0)->vsi))) -static const struct ice_dummy_pkt_offsets { +struct ice_dummy_pkt_offsets {enum ice_protocol_type type;u16 offset;/* ICE_PROTOCOL_LAST indicates end of list */ -} dummy_gre_packet_offsets[] = { +}; + +static const +struct ice_dummy_pkt_offsets dummy_gre_packet_offsets[] = { {ICE_MAC_OFOS ,0 }, {ICE_IPV4_OFOS ,14 }, - {ICE_VXLAN ,34 }, + {ICE_NVGRE ,34 }, {ICE_MAC_IL ,42 }, {ICE_IPV4_IL ,54 }, {ICE_PROTOCOL_LAST ,0 },
@@ -75,7 +78,7 @@ u8 dummy_gre_packet[] = { 0, 0, 0, 0, /* ICE_MAC_OFOS 0 */0 ,0x2F ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -0x80 ,0 ,0x65 ,0x58 ,/* ICE_VXLAN_GRE 34 */ +0x80 ,0 ,0x65 ,0x58 ,/* ICE_NVGRE 34 */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* ICE_MAC_IL 42 */ 0, 0, 0, 0,
@@ -5380,6 +5383,9 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,case ICE_SCTP_IL : len =sizeof (struct ice_sctp_hdr );break ; +case ICE_NVGRE : + len =sizeof (struct ice_nvgre ); +break ;case ICE_VXLAN :case ICE_GENEVE :case ICE_VXLAN_GPE :
Signature · 1 line
2.17.1
Quoted 9 lines
-----Original Message-----
From: Rong, Leyi
Sent: Wednesday, June 19, 2019 11:18 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [PATCH v3 00/69] shared code update
Quoted 6 lines
Main changes:
1. Advanced switch rule support.
2. Add more APIs for tunnel management.
3. Add some minor features.
4. Code clean and bug fix.
Applied to dpdk-next-net-intel with below changes
1. patch 66 and 69 fixes patch 54, so merged to patch 54 patch 64 fixes patch 06, so merged to patch 06 so totally 66 patch merged.
2. fix Camel title in patch 27, 39,
Thanks
Qi
Quoted 115 lines
---
v3:
- Drop some patches which do not used.
- Split some patches which include irrelevant code.
- Squash some patches which needs to be put together.
- Add some new patches from latest shared code release.v2:
- Split [03/49] into 2 commits.
- Split [27/49] with a standalone commit for code change inice_osdep.h.
- Split [39/48] by kind of changes.
- Remove [42/49].
- Add some new patches from latest shared code release.Leyi Rong (69):
net/ice/base: update standard extr seq to include DIR flagnet/ice/base: add API to configure MIBnet/ice/base: add another valid DCBx statenet/ice/base: add more recipe commandsnet/ice/base: add funcs to create new switch recipenet/ice/base: programming a new switch recipenet/ice/base: replay advanced rule after resetnet/ice/base: code for removing advanced rulenet/ice/base: save and post reset replay q bandwidthnet/ice/base: rollback AVF RSS configurationsnet/ice/base: move RSS replay list
net/ice/base: cache the data of set PHY cfg AQ in SWnet/ice/base: refactor HW table init functionnet/ice/base: add lock around profile map listnet/ice/base: add compatibility check for package versionnet/ice/base: add API to init FW loggingnet/ice/base: use macro instead of magic 8net/ice/base: move and redefine ice debug cq APInet/ice/base: separate out control queue lock creationnet/ice/base: added sibling head to parse nodesnet/ice/base: add and fix debuglogs
net/ice/base: forbid VSI to remove unassociated ucast filternet/ice/base: update some defines
net/ice/base: add hweight32 support
net/ice/base: call out dev/func caps when printingnet/ice/base: set the max number of TCs per port to 4net/ice/base: make FDID available for FlexDescriptornet/ice/base: use a different debug bit for FW lognet/ice/base: always set prefena when configuring a Rx queuenet/ice/base: disable Tx pacing optionnet/ice/base: delete the index for chaining other recipenet/ice/base: cleanup update link infonet/ice/base: add rd64 support
net/ice/base: track HW stat registers past rollovernet/ice/base: implement LLDP persistent settingsnet/ice/base: check new FD filter duplicate locationnet/ice/base: correct UDP/TCP PTYPE assignmentsnet/ice/base: calculate rate limit burst size correctlynet/ice/base: fix Flow Director VSI countnet/ice/base: use more efficient structuresnet/ice/base: silent semantic parser warningsnet/ice/base: fix for signed package downloadnet/ice/base: add new API to dealloc flow entrynet/ice/base: check RSS flow profile listnet/ice/base: protect list add with locknet/ice/base: fix Rx functionality for ethertype filtersnet/ice/base: introduce some new macrosnet/ice/base: new marker to mark func parameters unusednet/ice/base: code clean up
net/ice/base: cleanup ice flex pipe filesnet/ice/base: refactor VSI node sched codenet/ice/base: add some minor new definesnet/ice/base: add vxlan/generic tunnel managementnet/ice/base: enable additional switch rulesnet/ice/base: allow forward to Q groups in switch rulenet/ice/base: changes for reducing ice add adv rule timenet/ice/base: deduce TSA value in the CEE modenet/ice/base: rework API for ice zero bitmapnet/ice/base: rework API for ice cp bitmapnet/ice/base: use ice zero bitmap instead of ice memsetnet/ice/base: use the specified size for ice zero bitmapnet/ice/base: correct NVGRE header structurenet/ice/base: reduce calls to get profile associationsnet/ice/base: fix for chained recipe switch ID indexnet/ice/base: update driver unloading fieldnet/ice/base: fix for UDP and TCP related switch rulesnet/ice/base: changes in flow and profile removalnet/ice/base: update Tx context structnet/ice/base: fixes for GREdrivers/net/ice/base/ice_adminq_cmd.h | 103 +- drivers/net/ice/base/ice_bitops.h | 36 +- drivers/net/ice/base/ice_common.c | 482 +++-- drivers/net/ice/base/ice_common.h | 18 +- drivers/net/ice/base/ice_controlq.c | 247 ++- drivers/net/ice/base/ice_controlq.h | 4 +- drivers/net/ice/base/ice_dcb.c | 82 +- drivers/net/ice/base/ice_dcb.h | 12 +- drivers/net/ice/base/ice_fdir.c | 11 +- drivers/net/ice/base/ice_fdir.h | 4 - drivers/net/ice/base/ice_flex_pipe.c | 1198 +++++------ drivers/net/ice/base/ice_flex_pipe.h | 73 +- drivers/net/ice/base/ice_flex_type.h | 54 +- drivers/net/ice/base/ice_flow.c | 410 +++- drivers/net/ice/base/ice_flow.h | 22 +- drivers/net/ice/base/ice_lan_tx_rx.h | 4 +- drivers/net/ice/base/ice_nvm.c | 18 +- drivers/net/ice/base/ice_osdep.h | 23 + drivers/net/ice/base/ice_protocol_type.h | 12 +- drivers/net/ice/base/ice_sched.c | 219 +- drivers/net/ice/base/ice_sched.h | 24 +- drivers/net/ice/base/ice_switch.c | 2498 +++++++++++++++++++++- drivers/net/ice/base/ice_switch.h | 66 +- drivers/net/ice/base/ice_type.h | 80 +- drivers/net/ice/ice_ethdev.c | 4 +- 25 files changed, 4303 insertions(+), 1401 deletions(-)--
2.17.1
Quoted 20 lines · Qi Z
Quoted 9 lines
-----Original Message-----
From: Rong, Leyi
Sent: Wednesday, June 19, 2019 11:18 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [PATCH v3 00/69] shared code updateQuoted 6 lines
Main changes:
1. Advanced switch rule support.
2. Add more APIs for tunnel management.
3. Add some minor features.
4. Code clean and bug fix.Acked-by Qi Zhang <[email protected]>Applied to dpdk-next-net-intel with below changes
Quoted 7 lines
1. patch 66 and 69 fixes patch 54, so merged to patch 54 patch 64 fixes patch 06, so merged to patch 06 so totally 66 patch merged.
2. fix Camel title in patch 27, 39,Thanks
Qi
There is a 32 bits build error, can you please check?
In file included from .../dpdk/drivers/net/ice/base/ice_flow.c:6:.../dpdk/drivers/net/ice/base/ice_flow.c: In function ‘ice_flow_find_entry’:.../dpdk/drivers/net/ice/base/ice_flow.h:239:33: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
239 | #define ICE_FLOW_ENTRY_HNDL(e) ((u64)e)
| ^.../dpdk/drivers/net/ice/base/ice_flow.c:1309:17: note: in expansion of macro ‘ICE_FLOW_ENTRY_HNDL’
1309 | return found ? ICE_FLOW_ENTRY_HNDL(found) : ICE_FLOW_ENTRY_HANDLE_INVAL;
| ^~~~~~~~~~~~~~~~~~~.../dpdk/drivers/net/ice/base/ice_flow.c: In function ‘ice_flow_add_entry’:.../dpdk/drivers/net/ice/base/ice_flow.h:239:33: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
239 | #define ICE_FLOW_ENTRY_HNDL(e) ((u64)e)
| ^.../dpdk/drivers/net/ice/base/ice_flow.c:1387:13: note: in expansion of macro ‘ICE_FLOW_ENTRY_HNDL’
1387 | *entry_h = ICE_FLOW_ENTRY_HNDL(e);
| ^~~~~~~~~~~~~~~~~~~.../dpdk/drivers/net/ice/base/ice_flow.c: In function ‘ice_flow_rem_entry’:.../dpdk/drivers/net/ice/base/ice_flow.h:240:32: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
240 | #define ICE_FLOW_ENTRY_PTR(h) ((struct ice_flow_entry *)(h))
| ^.../dpdk/drivers/net/ice/base/ice_flow.c:1413:10: note: in expansion of macro ‘ICE_FLOW_ENTRY_PTR’
1413 | entry = ICE_FLOW_ENTRY_PTR(entry_h);
| ^~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
make[7]: *** [.../dpdk/mk/internal/rte.compile-pre.mk:114: ice_flow.o] Error 1 make[7]: *** Waiting for unfinished jobs....
In file included from .../dpdk/drivers/net/ice/base/ice_flex_pipe.c:8:.../dpdk/drivers/net/ice/base/ice_flex_pipe.c: In function ‘ice_free_flow_profs’:.../dpdk/drivers/net/ice/base/ice_flow.h:239:33: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
239 | #define ICE_FLOW_ENTRY_HNDL(e) ((u64)e)
| ^.../dpdk/drivers/net/ice/base/ice_flex_pipe.c:3027:27: note: in expansion of macro ‘ICE_FLOW_ENTRY_HNDL’
3027 | ice_flow_rem_entry(hw, ICE_FLOW_ENTRY_HNDL(e));
| ^~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
Quoted 35 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Friday, June 21, 2019 4:18 AM
To: Zhang, Qi Z <[email protected]>; Rong, Leyi <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v3 00/69] shared code updateQuoted 25 lines · Qi Z
Quoted 9 lines
-----Original Message-----
From: Rong, Leyi
Sent: Wednesday, June 19, 2019 11:18 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Rong, Leyi <[email protected]>
Subject: [PATCH v3 00/69] shared code updateQuoted 6 lines
Main changes:
1. Advanced switch rule support.
2. Add more APIs for tunnel management.
3. Add some minor features.
4. Code clean and bug fix.Acked-by Qi Zhang <[email protected]>Applied to dpdk-next-net-intel with below changes
1. patch 66 and 69 fixes patch 54, so merged to patch 54 patch 64 fixes patch 06, so merged to patch 06 so totally 66 patch merged.
2. fix Camel title in patch 27, 39,
Quoted 4 lines
Quoted 2 lines
Thanks
QiThere is a 32 bits build error, can you please check?
My bad, forgot to check 32 bits
The reason is some 32 bit fix in 19.05 does not synced, Minor fix on patch 40/69 and 41/69 are applied to dpdk-next-net-intel.
Thanks
Qi
Quoted 48 lines
In file included from
.../dpdk/drivers/net/ice/base/ice_flow.c:6:.../dpdk/drivers/net/ice/base/ice_flow.c: In function ‘ice_flow_find_entry’:.../dpdk/drivers/net/ice/base/ice_flow.h:239:33: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
239 | #defineICE_FLOW_ENTRY_HNDL(e)((u64)e)
| ^.../dpdk/drivers/net/ice/base/ice_flow.c:1309:17: note: in expansion of macro ‘ICE_FLOW_ENTRY_HNDL’
1309 | return found ?ICE_FLOW_ENTRY_HNDL(found):ICE_FLOW_ENTRY_HANDLE_INVAL; | ^~~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/ice/base/ice_flow.c: In function ‘ice_flow_add_entry’:.../dpdk/drivers/net/ice/base/ice_flow.h:239:33: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
239 | #defineICE_FLOW_ENTRY_HNDL(e)((u64)e)
| ^.../dpdk/drivers/net/ice/base/ice_flow.c:1387:13: note: in expansion of macro ‘ICE_FLOW_ENTRY_HNDL’1387 | *entry_h = ICE_FLOW_ENTRY_HNDL(e); | ^~~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/ice/base/ice_flow.c: In function ‘ice_flow_rem_entry’:.../dpdk/drivers/net/ice/base/ice_flow.h:240:32: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
240 | #defineICE_FLOW_ENTRY_PTR(h)((structice_flow_entry*)(h))
| ^.../dpdk/drivers/net/ice/base/ice_flow.c:1413:10: note: in expansion of macro ‘ICE_FLOW_ENTRY_PTR’1413 | entry = ICE_FLOW_ENTRY_PTR(entry_h); | ^~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
make[7]: *** [.../dpdk/mk/internal/rte.compile-pre.mk:114: ice_flow.o] Error 1
make[7]: *** Waiting for unfinished jobs....
In file included from.../dpdk/drivers/net/ice/base/ice_flex_pipe.c:8:.../dpdk/drivers/net/ice/base/ice_flex_pipe.c: In function ‘ice_free_flow_profs’:.../dpdk/drivers/net/ice/base/ice_flow.h:239:33: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
239 | #defineICE_FLOW_ENTRY_HNDL(e)((u64)e)
| ^.../dpdk/drivers/net/ice/base/ice_flex_pipe.c:3027:27: note: in expansion of macro ‘ICE_FLOW_ENTRY_HNDL’3027 | ice_flow_rem_entry(hw, ICE_FLOW_ENTRY_HNDL(e)); | ^~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors