net/ice/base: fix inner TCP and UDP support for GRE
PATCH 1/6 net/ice/base: fix inner TCP and UDP support for GRE
The dummy packets for GRE were set up for IP, but not inner TCP or UDP. There are some applications that want to be able to parse on those inner L4 headers so add them to the dummy packets.
Also, the GRE dummy packet was formatted differently from the other dummy packets so change the formatting to match all the other dummy packets.
--- drivers/net/ice/base/ice_switch.c | 123 ++++++++++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 26 deletions(-)
drivers/net/ice/base/ice_switch.c +97 -26
@@ -59,38 +59,95 @@ struct ice_dummy_pkt_offsets { };static const -struct ice_dummy_pkt_offsets dummy_gre_packet_offsets[] = { +struct ice_dummy_pkt_offsets dummy_gre_tcp_packet_offsets[] = { {ICE_MAC_OFOS ,0 }, {ICE_ETYPE_OL ,12 }, {ICE_IPV4_OFOS ,14 }, {ICE_NVGRE ,34 }, {ICE_MAC_IL ,42 }, {ICE_IPV4_IL ,56 }, + {ICE_TCP_IL ,76 }, {ICE_PROTOCOL_LAST ,0 }, };static const -u8 dummy_gre_packet[] = {0 ,0 ,0 ,0 ,/* ICE_MAC_OFOS 0 */ -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 , -0x08 ,0 ,/* ICE_ETYPE_OL 12 */ -0x45 ,0 ,0 ,0x3E ,/* ICE_IPV4_OFOS 14 */ -0 ,0 ,0 ,0 , -0 ,0x2F ,0 ,0 , -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 , -0x80 ,0 ,0x65 ,0x58 ,/* ICE_NVGRE 34 */ -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 ,/* ICE_MAC_IL 42 */ -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 , -0x08 ,0 , -0x45 ,0 ,0 ,0x14 ,/* ICE_IPV4_IL 54 */ -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 , -0 ,0 ,0 ,0 - }; +u8 dummy_gre_tcp_packet[] = { +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_OFOS 0 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x08 ,0x00 ,/* ICE_ETYPE_OL 12 */ + +0x45 ,0x00 ,0x00 ,0x3E ,/* ICE_IPV4_OFOS 14 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x2F ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x80 ,0x00 ,0x65 ,0x58 ,/* ICE_NVGRE 34 */ +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_IL 42 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x08 ,0x00 , + +0x45 ,0x00 ,0x00 ,0x14 ,/* ICE_IPV4_IL 56 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_TCP_IL 76 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x50 ,0x02 ,0x20 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 +}; + +static const +struct ice_dummy_pkt_offsets dummy_gre_udp_packet_offsets[] = { + {ICE_MAC_OFOS ,0 }, + {ICE_ETYPE_OL ,12 }, + {ICE_IPV4_OFOS ,14 }, + {ICE_NVGRE ,34 }, + {ICE_MAC_IL ,42 }, + {ICE_IPV4_IL ,56 }, + {ICE_UDP_ILOS ,76 }, + {ICE_PROTOCOL_LAST ,0 }, +}; + +static const +u8 dummy_gre_udp_packet[] = { +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_OFOS 0 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x08 ,0x00 ,/* ICE_ETYPE_OL 12 */ + +0x45 ,0x00 ,0x00 ,0x3E ,/* ICE_IPV4_OFOS 14 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x2F ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x80 ,0x00 ,0x65 ,0x58 ,/* ICE_NVGRE 34 */ +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_MAC_IL 42 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x08 ,0x00 , + +0x45 ,0x00 ,0x00 ,0x14 ,/* ICE_IPV4_IL 56 */ +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , +0x00 ,0x00 ,0x00 ,0x00 , + +0x00 ,0x00 ,0x00 ,0x00 ,/* ICE_UDP_ILOS 76 */ +0x00 ,0x08 ,0x00 ,0x00 , +};static const struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {
@@ -5369,10 +5426,24 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, ipv6 = true; } -if (tun_type ==ICE_SW_TUN_NVGRE || tun_type ==ICE_ALL_TUNNELS ) { - *pkt = dummy_gre_packet; - *pkt_len =sizeof (dummy_gre_packet); - *offsets = dummy_gre_packet_offsets; +if (tun_type ==ICE_ALL_TUNNELS ) { + *pkt = dummy_gre_udp_packet; + *pkt_len =sizeof (dummy_gre_udp_packet); + *offsets = dummy_gre_udp_packet_offsets; +return ; + } + +if (tun_type ==ICE_SW_TUN_NVGRE ) { +if (tcp) { + *pkt = dummy_gre_tcp_packet; + *pkt_len =sizeof (dummy_gre_tcp_packet); + *offsets = dummy_gre_tcp_packet_offsets; +return ; + } + + *pkt = dummy_gre_udp_packet; + *pkt_len =sizeof (dummy_gre_udp_packet); + *offsets = dummy_gre_udp_packet_offsets;return ; }
Signature · 1 line
2.13.6
PATCH 2/6 net/ice/base: fix resource leak
We don't free s_rule if ice_aq_sw_rules() returns a non-zero status. If it returned a zero status, s_rule would be freed right after, so this implies it should be freed within the scope of the function regardless.
--- drivers/net/ice/base/ice_switch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_switch.c +3 -2
@@ -2787,12 +2787,13 @@ ice_remove_rule_internal(struct ice_hw *hw, u8 recp_id, status =ice_aq_sw_rules (hw, s_rule,ICE_SW_RULE_RX_TX_NO_HDR_SIZE ,1 , ice_aqc_opc_remove_sw_rules,NULL ); -if (status) - goto exit;/* Remove a book keeping from the list */ ice_free (hw, s_rule); +if (status) + goto exit; +LIST_DEL (&list_elem->list_entry);ice_free (hw, list_elem); }
Signature · 1 line
2.13.6
PATCH 3/6 net/ice/base: fix ptype variable size
In reply to Qi ZhangChange ptype variable to correctly be 16-bits in ice_prof_map structure.
--- drivers/net/ice/base/ice_flex_pipe.c | 3 ++- drivers/net/ice/base/ice_flex_type.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ice/base/ice_flex_pipe.c +2 -1
@@ -4376,7 +4376,8 @@ ice_add_prof_to_lst(struct ice_hw *hw, enum ice_block blk, p->tcam[i].prof_id = map->prof_id; p->tcam[i].tcam_idx =ICE_INVALID_TCAM ; -ice_ptg_find_ptype (hw, blk, map->ptype[i], &ptg); +if (ice_ptg_find_ptype (hw, blk, map->ptype[i], &ptg)) +return ICE_ERR_CFG ; p->tcam[i].ptg = ptg; }
drivers/net/ice/base/ice_flex_type.h +1 -1
@@ -526,7 +526,7 @@ struct ice_prof_map {u64 context;u8 prof_id;u8 ptype_count; -u8 ptype[ICE_MAX_PTYPE_PER_PROFILE ]; +u16 ptype[ICE_MAX_PTYPE_PER_PROFILE ]; };#define ICE_INVALID_TCAM 0xFFFF
Signature · 1 line
2.13.6
PATCH 4/6 net/ice/base: use macro instead of function name
In reply to Qi Zhanguse __func__ instead of function name in ice_debug calls.
--- drivers/net/ice/base/ice_common.c | 2 +- drivers/net/ice/base/ice_controlq.c | 2 +- drivers/net/ice/base/ice_flex_pipe.c | 12 ++++++------ drivers/net/ice/base/ice_nvm.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/ice/base/ice_common.c +1 -1
@@ -42,7 +42,7 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw) {enum ice_status status =ICE_SUCCESS ; -ice_debug (hw,ICE_DBG_TRACE ,"ice_set_mac_type\n" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);if (hw->vendor_id ==ICE_INTEL_VENDOR_ID ) {switch (hw->device_id) {
drivers/net/ice/base/ice_controlq.c +1 -1
@@ -722,7 +722,7 @@ static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)*/ void ice_shutdown_all_ctrlq (struct ice_hw *hw) { -ice_debug (hw,ICE_DBG_TRACE ,"ice_shutdown_all_ctrlq\n" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);/* Shutdown FW admin queue */ ice_shutdown_ctrlq (hw,ICE_CTL_Q_ADMIN );/* Shutdown PF-VF Mailbox */
drivers/net/ice/base/ice_flex_pipe.c +6 -6
@@ -706,7 +706,7 @@ ice_acquire_global_cfg_lock(struct ice_hw *hw, {enum ice_status status; -ice_debug (hw,ICE_DBG_TRACE ,"ice_acquire_global_cfg_lock" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__); status =ice_acquire_res (hw,ICE_GLOBAL_CFG_LOCK_RES_ID , access,ICE_GLOBAL_CFG_LOCK_TIMEOUT );
@@ -739,7 +739,7 @@ static void ice_release_global_cfg_lock(struct ice_hw *hw)enum ice_status ice_acquire_change_lock (struct ice_hw *hw,enum ice_aq_res_access_type access) { -ice_debug (hw,ICE_DBG_TRACE ,"ice_acquire_change_lock" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);return ice_acquire_res (hw,ICE_CHANGE_LOCK_RES_ID , access,ICE_CHANGE_LOCK_TIMEOUT );
@@ -753,7 +753,7 @@ ice_acquire_change_lock(struct ice_hw *hw, enum ice_aq_res_access_type access)*/ void ice_release_change_lock (struct ice_hw *hw) { -ice_debug (hw,ICE_DBG_TRACE ,"ice_release_change_lock" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);ice_release_res (hw,ICE_CHANGE_LOCK_RES_ID ); }
@@ -779,7 +779,7 @@ ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,struct ice_aq_desc desc;enum ice_status status; -ice_debug (hw,ICE_DBG_TRACE ,"ice_aq_download_pkg" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);if (error_offset) *error_offset =0 ;
@@ -830,7 +830,7 @@ ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf, u16 buf_size,struct ice_aq_desc desc;enum ice_status status; -ice_debug (hw,ICE_DBG_TRACE ,"ice_aq_update_pkg" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);if (error_offset) *error_offset =0 ;
@@ -1018,7 +1018,7 @@ ice_aq_get_pkg_info_list(struct ice_hw *hw, {struct ice_aq_desc desc; -ice_debug (hw,ICE_DBG_TRACE ,"ice_aq_get_pkg_info_list" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);ice_fill_dflt_direct_cmd_desc (&desc, ice_aqc_opc_get_pkg_info_list);return ice_aq_send_cmd (hw, &desc, pkg_info, buf_size, cd);
drivers/net/ice/base/ice_nvm.c +2 -2
@@ -202,7 +202,7 @@ ice_read_sr_buf_aq(struct ice_hw *hw, u16 offset, u16 *words, u16 *data)static enum ice_status ice_acquire_nvm (struct ice_hw *hw,enum ice_aq_res_access_type access) { -ice_debug (hw,ICE_DBG_TRACE ,"ice_acquire_nvm\n" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);if (hw->nvm.blank_nvm_mode)return ICE_SUCCESS ;
@@ -218,7 +218,7 @@ ice_acquire_nvm(struct ice_hw *hw, enum ice_aq_res_access_type access)*/ static void ice_release_nvm (struct ice_hw *hw) { -ice_debug (hw,ICE_DBG_TRACE ,"ice_release_nvm\n" ); +ice_debug (hw,ICE_DBG_TRACE ,"%s\n" , __func__);if (hw->nvm.blank_nvm_mode)return ;
Signature · 1 line
2.13.6
PATCH 5/6 net/ice/base: cleanup hardware register macros
In reply to Qi ZhangCleanup hardware registers macros in ice_auto_generator.h.
--- drivers/net/ice/base/ice_common.c | 3 - drivers/net/ice/base/ice_hw_autogen.h | 943 ++++++++++------------------------ 2 files changed, 274 insertions(+), 672 deletions(-)
drivers/net/ice/base/ice_common.c +0 -3
@@ -1019,9 +1019,6 @@ enum ice_status ice_check_reset(struct ice_hw *hw)* or EMPR has occurred. The grst delay value is in 100ms units. * Add 1sec for outstanding AQ commands that can take a long time. */ -#define GLGEN_RSTCTL 0x000B8180/* Reset Source: POR */ -#define GLGEN_RSTCTL_GRSTDEL_S 0 -#define GLGEN_RSTCTL_GRSTDEL_M MAKEMASK(0x3F, GLGEN_RSTCTL_GRSTDEL_S) grst_delay = ((rd32 (hw,GLGEN_RSTCTL ) &GLGEN_RSTCTL_GRSTDEL_M ) >>GLGEN_RSTCTL_GRSTDEL_S ) +10 ;
drivers/net/ice/base/ice_hw_autogen.h +274 -669
1,625 lines not on this page · raw message
Signature · 1 line
2.13.6
PATCH 6/6 net/ice/base: fix for and/or bitmap routines
In reply to Qi ZhangThere was an issue with ice_and_bitmap and ice_or_bitmap when dealing with bit array sizes that are not even multiples of 32, where some of relevant bits in the highest 32 bits were being cleared. This patch fixes those problems.
--- drivers/net/ice/base/ice_bitops.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ice/base/ice_bitops.h +2 -4
@@ -191,8 +191,7 @@ ice_and_bitmap(ice_bitmap_t *dst, const ice_bitmap_t *bmp1,* size value alone. */ mask =LAST_CHUNK_MASK (size); - dst[i] &= ~mask; - dst[i] |= (bmp1[i] & bmp2[i]) & mask; + dst[i] = (dst[i] & ~mask) | ((bmp1[i] & bmp2[i]) & mask); res |= dst[i] & mask;return res !=0 ;
@@ -226,8 +225,7 @@ ice_or_bitmap(ice_bitmap_t *dst, const ice_bitmap_t *bmp1,* within the specified size. */ mask =LAST_CHUNK_MASK (size); - dst[i] &= ~mask; - dst[i] |= (bmp1[i] | bmp2[i]) & mask; + dst[i] = (dst[i] & ~mask) | ((bmp1[i] | bmp2[i]) & mask); }/**
Signature · 1 line
2.13.6