From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1DC26A0521; Mon, 2 Nov 2020 09:23:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0168CAC91; Mon, 2 Nov 2020 09:23:16 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 557639B04 for ; Mon, 2 Nov 2020 09:23:14 +0100 (CET) IronPort-SDR: Ghoz3lT4kYMEOaTxQqdHL9jE4uRgbh2lGqfIvGmuJO6wSNUzYK68Tjc16VbsAyA/TwZTqiRAvc f9aGvFeVrqCw== X-IronPort-AV: E=McAfee;i="6000,8403,9792"; a="155839008" X-IronPort-AV: E=Sophos;i="5.77,444,1596524400"; d="scan'208";a="155839008" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 00:23:11 -0800 IronPort-SDR: 4gIv33KztuTlYXSanE8To8co2uHphlU5NZ1n66tbGOt7iYcNP86X+AXV9n32v99d4nebx4yVGS OfQUmhN+CmGQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,444,1596524400"; d="scan'208";a="336099613" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga002.jf.intel.com with ESMTP; 02 Nov 2020 00:23:10 -0800 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 2 Nov 2020 00:23:09 -0800 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 2 Nov 2020 16:23:07 +0800 Received: from shsmsx605.ccr.corp.intel.com ([10.109.6.215]) by SHSMSX605.ccr.corp.intel.com ([10.109.6.215]) with mapi id 15.01.1713.004; Mon, 2 Nov 2020 16:23:07 +0800 From: "Yan, Zhirun" To: "Cao, Yahui" , "Zhang, Qi Z" , "dev@dpdk.org" CC: "Wang, Xiao W" , "Su, Simei" , "Guo, Junfeng" Thread-Topic: [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for FDIR Thread-Index: AQHWlWHS/ve4Kwpsd0K/WN7WbCYgIqmX+kIAgBy8tPA= Date: Mon, 2 Nov 2020 08:23:07 +0000 Message-ID: References: <20200928063146.668003-1-zhirun.yan@intel.com> <20200928063146.668003-3-zhirun.yan@intel.com> <9dbce9fbf43d47868c2534530108bac3@intel.com> In-Reply-To: <9dbce9fbf43d47868c2534530108bac3@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for FDIR X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > -----Original Message----- > From: Cao, Yahui > Sent: Thursday, October 15, 2020 5:29 PM > To: Yan, Zhirun ; Zhang, Qi Z ; > dev@dpdk.org > Cc: Wang, Xiao W ; Su, Simei > ; Guo, Junfeng > Subject: RE: [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for = FDIR >=20 >=20 >=20 > > -----Original Message----- > > From: Yan, Zhirun > > Sent: Monday, September 28, 2020 2:32 PM > > To: Zhang, Qi Z ; dev@dpdk.org > > Cc: Cao, Yahui ; Wang, Xiao W > > ; Su, Simei ; Guo, Junfeng > > ; Yan, Zhirun > > Subject: [PATCH v1 2/2] net/ice: support inner/outer L2/L3 field for > > FDIR > > > > Distinguish inner/outer fields for parse pattern. So FDIR for tunnel > > can be more flexible. Enable VXLAN inner/outer L3/L4 different fields > > for FDIR. > > > > Signed-off-by: Zhirun Yan > > --- > > drivers/net/ice/ice_fdir_filter.c | 59 > > +++++++++++++++++++++++++++++-- > > 1 file changed, 56 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/ice/ice_fdir_filter.c > > b/drivers/net/ice/ice_fdir_filter.c > > index 175abcdd5..961528d17 100644 > > --- a/drivers/net/ice/ice_fdir_filter.c > > +++ b/drivers/net/ice/ice_fdir_filter.c > > @@ -56,6 +56,11 @@ > > ICE_INSET_SCTP_SRC_PORT | ICE_INSET_SCTP_DST_PORT) > > > > #define ICE_FDIR_INSET_VXLAN_IPV4 (\ > > + ICE_FDIR_INSET_ETH | \ > > + ICE_INSET_IPV4_SRC | ICE_INSET_IPV4_DST | \ > > + ICE_INSET_IPV4_TOS | \ > > + ICE_INSET_UDP_DST_PORT | \ > > + ICE_INSET_TUN_DMAC | ICE_INSET_TUN_SMAC | \ > > ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST) > > > > #define ICE_FDIR_INSET_VXLAN_IPV4_TCP (\ @@ -907,6 +912,7 @@ > > ice_fdir_input_set_parse(uint64_t inset, enum ice_flow_field *field) > > }; > > static const struct ice_inset_map ice_inset_map[] =3D { > > {ICE_INSET_DMAC, ICE_FLOW_FIELD_IDX_ETH_DA}, > > + {ICE_INSET_SMAC, ICE_FLOW_FIELD_IDX_ETH_SA}, > > {ICE_INSET_ETHERTYPE, ICE_FLOW_FIELD_IDX_ETH_TYPE}, > > {ICE_INSET_IPV4_SRC, ICE_FLOW_FIELD_IDX_IPV4_SA}, > > {ICE_INSET_IPV4_DST, ICE_FLOW_FIELD_IDX_IPV4_DA}, @@ > -1655,6 > > +1661,14 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter > *ad, > > uint32_t vtc_flow_cpu; > > uint16_t ether_type; > > enum rte_flow_item_type next_type; > > + bool is_outer_part =3D true; > > + > > + for (item =3D pattern; item->type !=3D RTE_FLOW_ITEM_TYPE_END; > item++) > > { > > + if (item->type =3D=3D RTE_FLOW_ITEM_TYPE_VXLAN) { > > + tunnel_type =3D ICE_FDIR_TUNNEL_TYPE_VXLAN; > > + break; > > + } > > + } > > > > for (item =3D pattern; item->type !=3D RTE_FLOW_ITEM_TYPE_END; > item++) { > > if (item->last) { > > @@ -1672,7 +1686,25 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > > eth_mask =3D item->mask; > > next_type =3D (item + 1)->type; > > > > - if (eth_spec && eth_mask) { > > + if (!(eth_spec && eth_mask)) > > + break; > > + > > + /* handle outer L2 fields */ > > + if (is_outer_part && tunnel_type =3D=3D > ICE_FDIR_TUNNEL_TYPE_VXLAN) { > > + if (!rte_is_zero_ether_addr(ð_mask- > >dst)) > > { > > + filter->outer_input_set |=3D > ICE_INSET_DMAC; > > + rte_memcpy(&filter- > >input.ext_data_outer.dst_mac, > > + ð_spec->dst, > > + RTE_ETHER_ADDR_LEN); > > + } > > + > > + if (!rte_is_zero_ether_addr(ð_mask- > >src)) { > > + filter->outer_input_set > |=3DICE_INSET_SMAC; > > + rte_memcpy(&filter- > >input.ext_data_outer.src_mac, > > + ð_spec->src, > > + RTE_ETHER_ADDR_LEN); > > + } > > + } else { > > if (!rte_is_zero_ether_addr(ð_mask- > >dst)) > > { > > input_set |=3D ICE_INSET_DMAC; > > rte_memcpy(&filter- > >input.ext_data.dst_mac, > > @@ -1714,7 +1746,27 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > > ipv4_spec =3D item->spec; > > ipv4_mask =3D item->mask; > > > > - if (ipv4_spec && ipv4_mask) { > > + if (!(ipv4_spec && ipv4_mask)) > > + break; > > + > [Cao, Yahui] > It seems below code has quite some duplication with code within the else > condition Can you use a pointer *input_set and *ip to point to the diffe= rent > input_set bits and input_set value, So that existing code can be reused. Yes, you are right. And I will refactor this part in V2. Thanks. > > + /* handle outer L3 fields */ > > + if (is_outer_part && tunnel_type =3D=3D > ICE_FDIR_TUNNEL_TYPE_VXLAN) { > > + if (ipv4_mask->hdr.dst_addr =3D=3D > UINT32_MAX) { > > + filter->outer_input_set |=3D > ICE_INSET_IPV4_DST; > > + filter->input.ip_outer.v4.dst_ip =3D > > + ipv4_spec->hdr.dst_addr; > > + } > > + if (ipv4_mask->hdr.src_addr =3D=3D UINT32_MAX) > { > > + filter->outer_input_set |=3D > ICE_INSET_IPV4_SRC; > > + filter->input.ip_outer.v4.src_ip =3D > > + ipv4_spec->hdr.src_addr; > > + } > > + if (ipv4_mask->hdr.type_of_service =3D=3D > UINT8_MAX) { > > + input_set |=3D ICE_INSET_IPV4_TOS; > [Cao, Yahui] > Why use input_set instead of filter->outer_input_set in the VXLAN outer > section ? >=20 Typo, will fix it in V2. Thanks. > > + filter->input.ip_outer.v4.tos =3D > > + ipv4_spec- > >hdr.type_of_service; > > + } > > + } else { > > /* Check IPv4 mask and update input set */ > > if (ipv4_mask->hdr.version_ihl || > > ipv4_mask->hdr.total_length || @@ - > 1944,6 +1996,8 @@ > > ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, > > break; > > case RTE_FLOW_ITEM_TYPE_VXLAN: > > l3 =3D RTE_FLOW_ITEM_TYPE_END; > > + is_outer_part =3D false; > > + > > vxlan_spec =3D item->spec; > > vxlan_mask =3D item->mask; > > > > @@ -1955,7 +2009,6 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > > return -rte_errno; > > } > > > > - tunnel_type =3D ICE_FDIR_TUNNEL_TYPE_VXLAN; > > break; > > case RTE_FLOW_ITEM_TYPE_GTPU: > > l3 =3D RTE_FLOW_ITEM_TYPE_END; > > -- > > 2.25.1