From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id C66F93DC for ; Thu, 9 Mar 2017 12:54:02 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2017 03:54:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,268,1486454400"; d="scan'208";a="234117511" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga004.fm.intel.com with ESMTP; 09 Mar 2017 03:54:00 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.173]) by IRSMSX151.ger.corp.intel.com ([169.254.4.20]) with mapi id 14.03.0248.002; Thu, 9 Mar 2017 11:53:59 +0000 From: "Iremonger, Bernard" To: "Xing, Beilei" , "Wu, Jingjing" CC: "Zhang, Helin" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 3/3] net/i40e: enable cloud filter for MPLS Thread-Index: AQHSlAMQDbiN85wi7ESErf4QfgOBcqGMYTvAgAAKZYCAAAGDoA== Date: Thu, 9 Mar 2017 11:53:58 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C224D33038@IRSMSX108.ger.corp.intel.com> References: <1488534236-29904-1-git-send-email-beilei.xing@intel.com> <1488534236-29904-4-git-send-email-beilei.xing@intel.com> <8CEF83825BEC744B83065625E567D7C224D32FF4@IRSMSX108.ger.corp.intel.com> <94479800C636CB44BD422CB454846E01315A813C@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <94479800C636CB44BD422CB454846E01315A813C@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTRmYTI0ZDYtMWYwMi00NTk5LTk1NzktMWExNmZiYThkMmZiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImE4aVhDdk9qSVRKblJwcFdZVU5OWFVuV1V3aUZxWldXTVRERGJYVjB0elE9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 3/3] net/i40e: enable cloud filter for MPLS 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: , X-List-Received-Date: Thu, 09 Mar 2017 11:54:03 -0000 Hi Beilei, > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Beilei Xing > > > Sent: Friday, March 3, 2017 9:44 AM > > > To: Wu, Jingjing > > > Cc: Zhang, Helin ; dev@dpdk.org > > > Subject: [dpdk-dev] [PATCH 3/3] net/i40e: enable cloud filter for > > > MPLS > > > > > > This patch enables MPLSoUDP and MPLSoGRE cloud filter with replace > > > cloud filter. > > > > > > Signed-off-by: Beilei Xing > > > --- > > > drivers/net/i40e/i40e_ethdev.c | 44 +++++++++++++++-- > > > drivers/net/i40e/i40e_ethdev.h | 9 +++- > > > drivers/net/i40e/i40e_flow.c | 108 > > > +++++++++++++++++++++++++++++++++++++---- > > > 3 files changed, 144 insertions(+), 17 deletions(-) > > > > > > diff --git a/drivers/net/i40e/i40e_ethdev.c > > > b/drivers/net/i40e/i40e_ethdev.c index 91bfd73..6044daf 100644 > > > --- a/drivers/net/i40e/i40e_ethdev.c > > > +++ b/drivers/net/i40e/i40e_ethdev.c > > > @@ -1286,6 +1286,9 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) > > > if (ret < 0) > > > goto err_init_fdir_filter_list; > > > > > > + i40e_replace_mpls_l1_filter(pf); > > > + i40e_replace_mpls_cloud_filter(pf); > > > + > > > return 0; > > > > > > err_init_fdir_filter_list: > > > @@ -6941,6 +6944,7 @@ i40e_dev_consistent_tunnel_filter_set(struct > > > i40e_pf *pf, > > > struct i40e_tunnel_rule *tunnel_rule =3D &pf->tunnel; > > > struct i40e_tunnel_filter *tunnel, *node; > > > struct i40e_tunnel_filter check_filter; /* Check if filter exists > > > */ > > > + uint32_t teid_le; > > > bool big_buffer =3D 0; > > > > > > cld_filter =3D rte_zmalloc("tunnel_filter", @@ -6989,6 +6993,28 @@ > > > i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, > > > case I40E_TUNNEL_TYPE_IP_IN_GRE: > > > tun_type =3D I40E_AQC_ADD_CLOUD_TNL_TYPE_IP; > > > break; > > > + case I40E_TUNNEL_TYPE_MPLSoUDP: > > > + teid_le =3D rte_cpu_to_le_32(tunnel_filter->tenant_id); > > > + pfilter- > > > >general_fields[I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD0] =3D > > > + teid_le >> 4; > > > + pfilter- > > > >general_fields[I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD1] =3D > > > + (teid_le & 0xF) << 12; > > > + pfilter- > > > >general_fields[I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD2] =3D > > > + 0x40; > > > + big_buffer =3D 1; > > > + tun_type =3D I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoUDP; > > > + break; > > > + case I40E_TUNNEL_TYPE_MPLSoGRE: > > > + teid_le =3D rte_cpu_to_le_32(tunnel_filter->tenant_id); > > > + pfilter- > > > >general_fields[I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD0] =3D > > > + teid_le >> 4; > > > + pfilter- > > > >general_fields[I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD1] =3D > > > + (teid_le & 0xF) << 12; > > > + pfilter- > > > >general_fields[I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD2] =3D > > > + 0x0; > > > + big_buffer =3D 1; > > > + tun_type =3D I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoGRE; > > > + break; > > > default: > > > /* Other tunnel types is not supported. */ > > > PMD_DRV_LOG(ERR, "tunnel type is not supported."); @@ - > > > 6996,11 +7022,19 @@ i40e_dev_consistent_tunnel_filter_set(struct > > > i40e_pf *pf, > > > return -EINVAL; > > > } > > > > > > - val =3D i40e_dev_get_filter_type(tunnel_filter->filter_type, > > > - &pfilter->element.flags); > > > - if (val < 0) { > > > - rte_free(cld_filter); > > > - return -EINVAL; > > > + if (tunnel_filter->tunnel_type =3D=3D I40E_TUNNEL_TYPE_MPLSoUDP) > > > + pfilter->element.flags =3D > > > + I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoUDP; > > > + else if (tunnel_filter->tunnel_type =3D=3D > > > I40E_TUNNEL_TYPE_MPLSoGRE) > > > + pfilter->element.flags =3D > > > + I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoGRE; > > > + else { > > > + val =3D i40e_dev_get_filter_type(tunnel_filter->filter_type, > > > + &pfilter->element.flags); > > > + if (val < 0) { > > > + rte_free(cld_filter); > > > + return -EINVAL; > > > + } > > > } > > > > > > pfilter->element.flags |=3D rte_cpu_to_le_16( diff --git > > > a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h > > > index dd9d709..f305baa 100644 > > > --- a/drivers/net/i40e/i40e_ethdev.h > > > +++ b/drivers/net/i40e/i40e_ethdev.h > > > @@ -499,8 +499,11 @@ struct i40e_ethertype_rule { > > > /* Tunnel filter number HW supports */ #define > > > I40E_MAX_TUNNEL_FILTER_NUM 400 > > > > > > -#define I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoUDP 0x11 -#define > > > I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoGRE 0x12 > > > +#define I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoUDP 8 #define > > > +I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoGRE 9 #define > > > +I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoUDP 0x11 #define > > > +I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoGRE 0x12 #define > > > +I40E_AQC_ADD_L1_FILTER_TEID_MPLS 0x11 > > > > > > enum i40e_tunnel_iptype { > > > I40E_TUNNEL_IPTYPE_IPV4, > > > @@ -963,6 +966,8 @@ enum i40e_status_code > > > i40e_aq_remove_cloud_filters_big_buffer( > > > enum i40e_status_code i40e_aq_replace_cloud_filters(struct i40e_hw > > *hw, > > > struct i40e_aqc_replace_cloud_filters_cmd *filters, > > > struct i40e_aqc_replace_cloud_filters_cmd_buf > > > *cmd_buf); > > > +int i40e_replace_mpls_l1_filter(struct i40e_pf *pf); int > > > +i40e_replace_mpls_cloud_filter(struct i40e_pf *pf); > > > > > > #define I40E_DEV_TO_PCI(eth_dev) \ > > > RTE_DEV_TO_PCI((eth_dev)->device) > > > diff --git a/drivers/net/i40e/i40e_flow.c > > > b/drivers/net/i40e/i40e_flow.c index 9ca3189..6bb2046 100644 > > > --- a/drivers/net/i40e/i40e_flow.c > > > +++ b/drivers/net/i40e/i40e_flow.c > > > @@ -1953,16 +1953,10 @@ i40e_flow_destroy_tunnel_filter(struct > > > i40e_pf *pf, > > > filter->input.general_fields, > > > sizeof(cld_filter.general_fields)); > > > > > > - if (((filter->input.flags & > > > - (I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoUDP << > > > - I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)) =3D=3D > > > - (I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoUDP << > > > - I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)) || > > > - ((filter->input.flags & > > > - (I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoGRE << > > > - I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT)) =3D=3D > > > - (I40E_AQC_ADD_CLOUD_TNL_TYPE_MPLSoGRE << > > > - I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT))) > > > + if ((filter->input.flags & > > > I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoUDP) =3D=3D > > > + I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoUDP || > > > + (filter->input.flags & > > > I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoGRE) =3D=3D > > > + I40E_AQC_ADD_CLOUD_FILTER_TEID_MPLSoGRE) > > > big_buffer =3D 1; > > > > > > if (big_buffer) > > > @@ -2255,3 +2249,97 @@ i40e_status_code > > > i40e_aq_replace_cloud_filters(struct i40e_hw *hw, > > > > > > return status; > > > } > > > + > > > +int > > > +i40e_replace_mpls_l1_filter(struct i40e_pf *pf) { > > > + struct i40e_aqc_replace_cloud_filters_cmd filter_replace; > > > + struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf; > > > + struct i40e_hw *hw =3D I40E_PF_TO_HW(pf); > > > + int ret; > > > + > > > + memset(&filter_replace, 0, > > > + sizeof(struct i40e_aqc_replace_cloud_filters_cmd)); > > > + memset(&filter_replace_buf, 0, > > > + sizeof(struct i40e_aqc_replace_cloud_filters_cmd_buf)); > > > + > > > + /* create L1 filter */ > > > + filter_replace.old_filter_type =3D > > > + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IMAC; > > > > I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IMAC =3D 12 (0x0C) Should > the > > old_filter_type macro be I40E_AQC_ADD_CLOUD_FILTER_IIP =3D 0x0C ? >=20 > No, I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IMAC is L1 filter, but the > I40E_AQC_ADD_CLOUD_FILTER_IIP is cloud filter. > We should replace L1 filter here. The I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IMAC macro (value 12) is an index = into the Field Vector, it is not a filter type macro. Should a filter type macro be used to set filter_replace.old_filter_type ? Regards, Bernard =20