From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50130A0A0E; Thu, 29 Apr 2021 02:38:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86D39412C4; Thu, 29 Apr 2021 02:38:14 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 2A234412D7 for ; Thu, 29 Apr 2021 02:38:11 +0200 (CEST) IronPort-SDR: D2yeXgiw7UK/VyBLi9z9IPHVUYlKDqOMwT3yPfBtvXdS7EAMrEOGCbTp8lXYq6FYTQF3huRBxZ uKWGz7nBSrkA== X-IronPort-AV: E=McAfee;i="6200,9189,9968"; a="196444585" X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="196444585" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2021 17:38:10 -0700 IronPort-SDR: K8pfICW1b972PD3nrWS448BuDdFn65khkwbxj/uxbw/0bYsGQNT5mr9oqvXyhK85Mx2OUM0bc0 uMcipZ+PsEXg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,258,1613462400"; d="scan'208";a="423790823" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga008.fm.intel.com with ESMTP; 28 Apr 2021 17:38:09 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, Qi Zhang , Ting Xu , Jeff Guo Date: Thu, 29 Apr 2021 08:41:43 +0800 Message-Id: <20210429004143.2921260-7-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210429004143.2921260-1-qi.z.zhang@intel.com> References: <20210429004143.2921260-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 6/6] net/ice/base: support IP fragment RSS and FDIR X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add support for IP fragment RSS hash and FDIR function. Separate IP fragment and IP other packet types. The patch also update the release date in README. Signed-off-by: Ting Xu Signed-off-by: Jeff Guo Signed-off-by: Qi Zhang --- drivers/net/ice/base/README | 2 +- drivers/net/ice/base/ice_fdir.c | 49 ++++++++++++++++++++++++++++++- drivers/net/ice/base/ice_fdir.h | 4 +++ drivers/net/ice/base/ice_flow.c | 51 ++++++++++++++++++++++++++++++++- drivers/net/ice/base/ice_flow.h | 9 ++++-- drivers/net/ice/base/ice_type.h | 1 + 6 files changed, 110 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/base/README b/drivers/net/ice/base/README index 7d32e58a52..87a1cebfac 100644 --- a/drivers/net/ice/base/README +++ b/drivers/net/ice/base/README @@ -6,7 +6,7 @@ IntelĀ® ICE driver ================== This directory contains source code of FreeBSD ice driver of version -2021.01.20 released by the team which develops +2021.04.29 released by the team which develops basic drivers for any ice NIC. The directory of base/ contains the original source package. This driver is valid for the product(s) listed below diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c index f6a6ff3831..180508243d 100644 --- a/drivers/net/ice/base/ice_fdir.c +++ b/drivers/net/ice/base/ice_fdir.c @@ -518,6 +518,25 @@ static const u8 ice_fdir_ipv4_udp_ecpri_tp0_pkt[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; +static const u8 ice_fdir_ipv6_frag_pkt[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2C, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3B, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +static const u8 ice_fdir_ipv4_frag_pkt[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00, + 0x00, 0x14, 0x00, 0x00, 0x20, 0x00, 0x40, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 +}; + static const u8 ice_fdir_tcpv6_pkt[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00, @@ -716,6 +735,16 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = { sizeof(ice_fdir_ipv4_pkt), ice_fdir_ipv4_pkt, sizeof(ice_fdir_ip4_tun_pkt), ice_fdir_ip4_tun_pkt, }, + { + ICE_FLTR_PTYPE_FRAG_IPV4, + sizeof(ice_fdir_ipv4_frag_pkt), ice_fdir_ipv4_frag_pkt, + sizeof(ice_fdir_ipv4_frag_pkt), ice_fdir_ipv4_frag_pkt, + }, + { + ICE_FLTR_PTYPE_FRAG_IPV6, + sizeof(ice_fdir_ipv6_frag_pkt), ice_fdir_ipv6_frag_pkt, + sizeof(ice_fdir_ipv6_frag_pkt), ice_fdir_ipv6_frag_pkt, + }, { ICE_FLTR_PTYPE_NONF_IPV4_GTPU, sizeof(ice_fdir_ipv4_gtpu4_pkt), @@ -1808,6 +1837,23 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input, input->ip.v6.proto); ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac); break; + case ICE_FLTR_PTYPE_FRAG_IPV4: + ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET, + input->ip.v4.src_ip); + ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET, + input->ip.v4.dst_ip); + ice_pkt_insert_u8(loc, ICE_IPV4_TOS_OFFSET, input->ip.v4.tos); + ice_pkt_insert_u16(loc, ICE_IPV4_ID_OFFSET, + input->ip.v4.packet_id); + ice_pkt_insert_u8(loc, ICE_IPV4_TTL_OFFSET, input->ip.v4.ttl); + ice_pkt_insert_u8(loc, ICE_IPV4_PROTO_OFFSET, + input->ip.v4.proto); + ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac); + break; + case ICE_FLTR_PTYPE_FRAG_IPV6: + ice_pkt_insert_u32(loc, ICE_IPV6_ID_OFFSET, + input->ip.v6.packet_id); + break; default: return ICE_ERR_PARAM; } @@ -1838,7 +1884,8 @@ ice_fdir_get_prgm_pkt(struct ice_fdir_fltr *input, u8 *pkt, bool frag) */ bool ice_fdir_has_frag(enum ice_fltr_ptype flow) { - if (flow == ICE_FLTR_PTYPE_NONF_IPV4_OTHER) + if (flow == ICE_FLTR_PTYPE_FRAG_IPV4 || + flow == ICE_FLTR_PTYPE_FRAG_IPV6) return true; else return false; diff --git a/drivers/net/ice/base/ice_fdir.h b/drivers/net/ice/base/ice_fdir.h index b679a8a1bd..0ebf7f326c 100644 --- a/drivers/net/ice/base/ice_fdir.h +++ b/drivers/net/ice/base/ice_fdir.h @@ -42,10 +42,12 @@ #define ICE_MAC_ETHTYPE_OFFSET 12 #define ICE_IPV4_TOS_OFFSET 15 +#define ICE_IPV4_ID_OFFSET 18 #define ICE_IPV4_TTL_OFFSET 22 #define ICE_IPV6_TC_OFFSET 14 #define ICE_IPV6_HLIM_OFFSET 21 #define ICE_IPV6_PROTO_OFFSET 20 +#define ICE_IPV6_ID_OFFSET 58 /* For TUN inner (without inner MAC) */ #define ICE_IPV4_NO_MAC_TOS_OFFSET 1 #define ICE_IPV4_NO_MAC_TTL_OFFSET 8 @@ -158,6 +160,7 @@ struct ice_fdir_v4 { u8 ip_ver; u8 proto; u8 ttl; + __be16 packet_id; }; #define ICE_IPV6_ADDR_LEN_AS_U32 4 @@ -172,6 +175,7 @@ struct ice_fdir_v6 { u8 tc; u8 proto; u8 hlim; + __be32 packet_id; }; struct ice_fdir_udp_gtp { diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c index 6dba9e7b84..d6242744cd 100644 --- a/drivers/net/ice/base/ice_flow.c +++ b/drivers/net/ice/base/ice_flow.c @@ -13,6 +13,8 @@ #define ICE_FLOW_FLD_SZ_IPV6_PRE32_ADDR 4 #define ICE_FLOW_FLD_SZ_IPV6_PRE48_ADDR 6 #define ICE_FLOW_FLD_SZ_IPV6_PRE64_ADDR 8 +#define ICE_FLOW_FLD_SZ_IPV4_ID 2 +#define ICE_FLOW_FLD_SZ_IPV6_ID 4 #define ICE_FLOW_FLD_SZ_IP_DSCP 1 #define ICE_FLOW_FLD_SZ_IP_TTL 1 #define ICE_FLOW_FLD_SZ_IP_PROT 1 @@ -96,6 +98,12 @@ struct ice_flow_field_info ice_flds_info[ICE_FLOW_FIELD_IDX_MAX] = { ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_IPV6, 8, ICE_FLOW_FLD_SZ_IPV6_ADDR), /* ICE_FLOW_FIELD_IDX_IPV6_DA */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_IPV6, 24, ICE_FLOW_FLD_SZ_IPV6_ADDR), + /* ICE_FLOW_FIELD_IDX_IPV4_FRAG */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_IPV_FRAG, 4, + ICE_FLOW_FLD_SZ_IPV4_ID), + /* ICE_FLOW_FIELD_IDX_IPV6_FRAG */ + ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_IPV_FRAG, 4, + ICE_FLOW_FLD_SZ_IPV6_ID), /* ICE_FLOW_FIELD_IDX_IPV6_PRE32_SA */ ICE_FLOW_FLD_INFO(ICE_FLOW_SEG_HDR_IPV6, 8, ICE_FLOW_FLD_SZ_IPV6_PRE32_ADDR), @@ -747,6 +755,28 @@ static const u32 ice_ptypes_ppp[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; +static const u32 ice_ptypes_ipv4_frag[] = { + 0x00400000, 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, 0x00000000, 0x00000000, +}; + +static const u32 ice_ptypes_ipv6_frag[] = { + 0x00000000, 0x00000000, 0x01000000, 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, +}; + /* Manage parameters and info. used during the creation of a flow profile */ struct ice_flow_prof_params { enum ice_block blk; @@ -922,6 +952,16 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params) (const ice_bitmap_t *)ice_ptypes_ipv6_ofos_all; ice_and_bitmap(params->ptypes, params->ptypes, src, ICE_FLOW_PTYPE_MAX); + } else if ((hdrs & ICE_FLOW_SEG_HDR_IPV4) && + (hdrs & ICE_FLOW_SEG_HDR_IPV_FRAG)) { + src = (const ice_bitmap_t *)ice_ptypes_ipv4_frag; + ice_and_bitmap(params->ptypes, params->ptypes, src, + ICE_FLOW_PTYPE_MAX); + } else if ((hdrs & ICE_FLOW_SEG_HDR_IPV6) && + (hdrs & ICE_FLOW_SEG_HDR_IPV_FRAG)) { + src = (const ice_bitmap_t *)ice_ptypes_ipv6_frag; + ice_and_bitmap(params->ptypes, params->ptypes, src, + ICE_FLOW_PTYPE_MAX); } else if ((hdrs & ICE_FLOW_SEG_HDR_IPV4) && !(hdrs & ICE_FLOW_SEG_HDRS_L4_MASK_NO_OTHER)) { src = !i ? (const ice_bitmap_t *)ice_ptypes_ipv4_ofos_no_l4 : @@ -1210,6 +1250,9 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params, case ICE_FLOW_FIELD_IDX_IPV4_DA: prot_id = seg == 0 ? ICE_PROT_IPV4_OF_OR_S : ICE_PROT_IPV4_IL; break; + case ICE_FLOW_FIELD_IDX_IPV4_ID: + prot_id = ICE_PROT_IPV4_OF_OR_S; + break; case ICE_FLOW_FIELD_IDX_IPV6_SA: case ICE_FLOW_FIELD_IDX_IPV6_DA: case ICE_FLOW_FIELD_IDX_IPV6_PRE32_SA: @@ -1220,6 +1263,9 @@ ice_flow_xtract_fld(struct ice_hw *hw, struct ice_flow_prof_params *params, case ICE_FLOW_FIELD_IDX_IPV6_PRE64_DA: prot_id = seg == 0 ? ICE_PROT_IPV6_OF_OR_S : ICE_PROT_IPV6_IL; break; + case ICE_FLOW_FIELD_IDX_IPV6_ID: + prot_id = ICE_PROT_IPV6_FRAG; + break; case ICE_FLOW_FIELD_IDX_TCP_SRC_PORT: case ICE_FLOW_FIELD_IDX_TCP_DST_PORT: case ICE_FLOW_FIELD_IDX_TCP_FLAGS: @@ -3429,13 +3475,16 @@ ice_flow_set_rss_seg_info(struct ice_flow_seg_info *segs, u8 seg_cnt, /* set outer most header */ if (cfg->hdr_type == ICE_RSS_INNER_HEADERS_W_OUTER_IPV4) segs[ICE_RSS_OUTER_HEADERS].hdrs |= ICE_FLOW_SEG_HDR_IPV4 | + ICE_FLOW_SEG_HDR_IPV_FRAG | ICE_FLOW_SEG_HDR_IPV_OTHER; else if (cfg->hdr_type == ICE_RSS_INNER_HEADERS_W_OUTER_IPV6) segs[ICE_RSS_OUTER_HEADERS].hdrs |= ICE_FLOW_SEG_HDR_IPV6 | + ICE_FLOW_SEG_HDR_IPV_FRAG | ICE_FLOW_SEG_HDR_IPV_OTHER; if (seg->hdrs & ~ICE_FLOW_RSS_SEG_HDR_VAL_MASKS & - ~ICE_FLOW_RSS_HDRS_INNER_MASK & ~ICE_FLOW_SEG_HDR_IPV_OTHER) + ~ICE_FLOW_RSS_HDRS_INNER_MASK & ~ICE_FLOW_SEG_HDR_IPV_OTHER & + ~ICE_FLOW_SEG_HDR_IPV_FRAG) return ICE_ERR_PARAM; val = (u64)(seg->hdrs & ICE_FLOW_RSS_SEG_HDR_L3_MASKS); diff --git a/drivers/net/ice/base/ice_flow.h b/drivers/net/ice/base/ice_flow.h index 448e06028a..878c79d19e 100644 --- a/drivers/net/ice/base/ice_flow.h +++ b/drivers/net/ice/base/ice_flow.h @@ -186,11 +186,12 @@ enum ice_flow_seg_hdr { ICE_FLOW_SEG_HDR_ECPRI_TP0 = 0x04000000, ICE_FLOW_SEG_HDR_UDP_ECPRI_TP0 = 0x08000000, ICE_FLOW_SEG_HDR_L2TPV2 = 0x10000000, - ICE_FLOW_SEG_HDR_PPP = 0x40000000, + ICE_FLOW_SEG_HDR_PPP = 0x20000000, /* The following is an additive bit for ICE_FLOW_SEG_HDR_IPV4 and - * ICE_FLOW_SEG_HDR_IPV6 which include the IPV4 other PTYPEs + * ICE_FLOW_SEG_HDR_IPV6. */ - ICE_FLOW_SEG_HDR_IPV_OTHER = 0x20000000, + ICE_FLOW_SEG_HDR_IPV_FRAG = 0x40000000, + ICE_FLOW_SEG_HDR_IPV_OTHER = 0x80000000, }; /* These segements all have the same PTYPES, but are otherwise distinguished by @@ -227,6 +228,8 @@ enum ice_flow_field { ICE_FLOW_FIELD_IDX_IPV4_DA, ICE_FLOW_FIELD_IDX_IPV6_SA, ICE_FLOW_FIELD_IDX_IPV6_DA, + ICE_FLOW_FIELD_IDX_IPV4_ID, + ICE_FLOW_FIELD_IDX_IPV6_ID, ICE_FLOW_FIELD_IDX_IPV6_PRE32_SA, ICE_FLOW_FIELD_IDX_IPV6_PRE32_DA, ICE_FLOW_FIELD_IDX_IPV6_PRE48_SA, diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index f64f215528..ce508a02e5 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -347,6 +347,7 @@ enum ice_fltr_ptype { ICE_FLTR_PTYPE_NONF_ECPRI_TP0, ICE_FLTR_PTYPE_NONF_IPV4_UDP_ECPRI_TP0, ICE_FLTR_PTYPE_FRAG_IPV4, + ICE_FLTR_PTYPE_FRAG_IPV6, ICE_FLTR_PTYPE_NONF_IPV6_UDP, ICE_FLTR_PTYPE_NONF_IPV6_TCP, ICE_FLTR_PTYPE_NONF_IPV6_SCTP, -- 2.26.2