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 AD54FA056A; Fri, 6 Mar 2020 07:48:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8C50E1BFD2; Fri, 6 Mar 2020 07:48:53 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id DD5E21BFCF for ; Fri, 6 Mar 2020 07:48:51 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2020 22:48:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,521,1574150400"; d="scan'208";a="229970540" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by orsmga007.jf.intel.com with ESMTP; 05 Mar 2020 22:48:49 -0800 Received: from irsmsx604.ger.corp.intel.com (163.33.146.137) by IRSMSX109.ger.corp.intel.com (163.33.3.23) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 6 Mar 2020 06:48:48 +0000 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by IRSMSX604.ger.corp.intel.com (163.33.146.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 6 Mar 2020 06:48:47 +0000 Received: from shsmsx602.ccr.corp.intel.com ([10.109.6.142]) by SHSMSX602.ccr.corp.intel.com ([10.109.6.142]) with mapi id 15.01.1713.004; Fri, 6 Mar 2020 14:48:46 +0800 From: "Zhang, Xiao" To: Ori Kam , "dev@dpdk.org" CC: "arybchenko@solarflare.com" , "Yigit, Ferruh" Thread-Topic: [dpdk-dev] ethdev: add PFCP header to flow API Thread-Index: AQHV56OelYd99UNoSEm8BeJCN9RY8ag2G6wAgAUbT9A= Date: Fri, 6 Mar 2020 06:48:46 +0000 Message-ID: <06d3e00ea27f4d0e901cd0c744db5480@intel.com> References: <1582171324-70188-1-git-send-email-xiao.zhang@intel.com> In-Reply-To: Accept-Language: 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] ethdev: add PFCP header to flow API 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: Ori Kam [mailto:orika@mellanox.com] > Sent: Tuesday, March 3, 2020 4:49 PM > To: Zhang, Xiao ; dev@dpdk.org > Cc: arybchenko@solarflare.com; Yigit, Ferruh > Subject: RE: [dpdk-dev] ethdev: add PFCP header to flow API >=20 > Hi Xiao, >=20 > Sorry for delayed response. >=20 > Thanks, > Ori >=20 > > -----Original Message----- > > From: dev On Behalf Of Xiao Zhang > > Sent: Thursday, February 20, 2020 6:02 AM > > To: dev@dpdk.org > > Cc: arybchenko@solarflare.com; ferruh.yigit@intel.com; Xiao Zhang > > > > Subject: [dpdk-dev] ethdev: add PFCP header to flow API > > > > This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API > > to match a PFCP header. > > Add sample PFCP rules for testpmd guide. Since Session Endpoint > > Identifier (SEID) only will be present in PFCP Session header and PFCP > > Session headers shall be identified when the S field is equal to 1, > > when create rules for PFCP Session header with certain SEID the S > > field need be set 1. > > > > Signed-off-by: Xiao Zhang > > --- > > app/test-pmd/cmdline_flow.c | 37 > > +++++++++++++++++++++++++++++ > > doc/guides/prog_guide/rte_flow.rst | 11 +++++++++ > > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 20 ++++++++++++++++ > > lib/librte_ethdev/rte_flow.c | 1 + > > lib/librte_ethdev/rte_flow.h | 31 +++++++++++++++++++++= +++ > > 5 files changed, 100 insertions(+) > > > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > > index c2cc4c5..0b735cd 100644 > > --- a/app/test-pmd/cmdline_flow.c > > +++ b/app/test-pmd/cmdline_flow.c > > @@ -220,6 +220,9 @@ enum index { > > ITEM_L2TPV3OIP_SESSION_ID, > > ITEM_ESP, > > ITEM_ESP_SPI, > > + ITEM_PFCP, > > + ITEM_PFCP_S_FIELD, > > + ITEM_PFCP_SEID, > > > > /* Validate/create actions. */ > > ACTIONS, > > @@ -768,6 +771,7 @@ static const enum index next_item[] =3D { > > ITEM_TAG, > > ITEM_L2TPV3OIP, > > ITEM_ESP, > > + ITEM_PFCP, > > END_SET, > > ZERO, > > }; > > @@ -1046,6 +1050,13 @@ static const enum index item_esp[] =3D { > > ZERO, > > }; > > > > +static const enum index item_pfcp[] =3D { > > + ITEM_PFCP_S_FIELD, > > + ITEM_PFCP_SEID, > > + ITEM_NEXT, > > + ZERO, > > +}; > > + > > static const enum index next_set_raw[] =3D { > > SET_RAW_INDEX, > > ITEM_ETH, > > @@ -2699,6 +2710,26 @@ static const struct token token_list[] =3D { > > .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_esp, > > hdr.spi)), > > }, > > + [ITEM_PFCP] =3D { > > + .name =3D "pfcp", > > + .help =3D "match pfcp header", > > + .priv =3D PRIV_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)), > > + .next =3D NEXT(item_pfcp), > > + .call =3D parse_vc, > > + }, > > + [ITEM_PFCP_S_FIELD] =3D { > > + .name =3D "s_field", > > + .help =3D "S field", > > + .next =3D NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED), > > item_param), > > + .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp, > > + s_field)), > > + }, > > + [ITEM_PFCP_SEID] =3D { > > + .name =3D "seid", > > + .help =3D "session endpoint identifier", > > + .next =3D NEXT(item_pfcp, NEXT_ENTRY(UNSIGNED), > > item_param), > > + .args =3D ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pfcp, > > seid)), > > + }, > > /* Validate/create actions. */ > > [ACTIONS] =3D { > > .name =3D "actions", > > @@ -6444,6 +6475,9 @@ flow_item_default_mask(const struct > > rte_flow_item > > *item) > > case RTE_FLOW_ITEM_TYPE_ESP: > > mask =3D &rte_flow_item_esp_mask; > > break; > > + case RTE_FLOW_ITEM_TYPE_PFCP: > > + mask =3D &rte_flow_item_pfcp_mask; > > + break; > > default: > > break; > > } > > @@ -6541,6 +6575,9 @@ cmd_set_raw_parsed(const struct buffer *in) > > size =3D sizeof(struct rte_flow_item_esp); > > proto =3D 0x32; > > break; > > + case RTE_FLOW_ITEM_TYPE_PFCP: > > + size =3D sizeof(struct rte_flow_item_pfcp); > > + break; > > default: > > printf("Error - Not supported item\n"); > > *total_size =3D 0; > > diff --git a/doc/guides/prog_guide/rte_flow.rst > > b/doc/guides/prog_guide/rte_flow.rst > > index 371819e..2851cee 100644 > > --- a/doc/guides/prog_guide/rte_flow.rst > > +++ b/doc/guides/prog_guide/rte_flow.rst > > @@ -1344,6 +1344,17 @@ Matches a L2TPv3 over IP header. > > - ``session_id``: L2TPv3 over IP session identifier. > > - Default ``mask`` matches session_id only. > > > > +Item: ``PFCP`` > > +^^^^^^^^^^^^ > > + > > +Matches a PFCP Header. > > + > > +- ``s_field``: S field. > > +- ``msg_type``: message type. > > +- ``msg_len``: message length. > > +- ``seid``: session endpoint identifier. > > +- Default ``mask`` matches s_field and seid. > > + > > Actions > > ~~~~~~~ > > > > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > index 5103ff9..3d05d5f 100644 > > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > @@ -3987,6 +3987,11 @@ This section lists supported pattern items and > > their attributes, if any. > > > > - ``session_id {unsigned}``: L2TPv3 over IP session identifier. > > > > +- ``pfcp``: match PFCP header. > > + > > + - ``s_field {unsigned}``: S field. > > + - ``seid {unsigned}``: session endpoint identifier. > > + > > Actions list > > ^^^^^^^^^^^^ > > > > @@ -4822,6 +4827,21 @@ ESP rules can be created by the following > > commands:: > > testpmd> flow create 0 ingress pattern eth / ipv6 / udp / esp spi is = 1 / end > > actions queue index 3 / end > > > > +Sample PFCP rules > > +~~~~~~~~~~~~~~~~ > > + > > +PFCP rules can be created by the following commands(s_field need to > > +be 1 if seid is set):: > > + > > + testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is > > + testpmd> 0 / end > > + actions queue index 3 / end > > + testpmd> flow create 0 ingress pattern eth / ipv4 / pfcp s_field is > > + testpmd> 1 > > + seid is 1 / end actions queue index 3 / end > > + testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is > > + testpmd> 0 / end > > + actions queue index 3 / end > > + testpmd> flow create 0 ingress pattern eth / ipv6 / pfcp s_field is > > + testpmd> 1 > > + seid is 1 / end actions queue index 3 / end > > + > > BPF Functions > > -------------- > > > > diff --git a/lib/librte_ethdev/rte_flow.c > > b/lib/librte_ethdev/rte_flow.c index 885a7ff..a5ac1c7 100644 > > --- a/lib/librte_ethdev/rte_flow.c > > +++ b/lib/librte_ethdev/rte_flow.c > > @@ -94,6 +94,7 @@ static const struct rte_flow_desc_data > > rte_flow_desc_item[] =3D { > > MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)), > > MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)), > > MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)), > > + MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)), > > }; > > > > /** Generate flow_action[] entry. */ > > diff --git a/lib/librte_ethdev/rte_flow.h > > b/lib/librte_ethdev/rte_flow.h index 5625dc4..9addf1c 100644 > > --- a/lib/librte_ethdev/rte_flow.h > > +++ b/lib/librte_ethdev/rte_flow.h > > @@ -520,6 +520,13 @@ enum rte_flow_item_type { > > */ > > RTE_FLOW_ITEM_TYPE_L2TPV3OIP, > > > > + /** > > + * Matches PFCP Header. > > + * See struct rte_flow_item_pfcp. > > + * > > + */ > > + RTE_FLOW_ITEM_TYPE_PFCP, > > + > > }; > > > > /** > > @@ -1509,6 +1516,30 @@ static const struct rte_flow_item_ah > > rte_flow_item_ah_mask =3D { #endif > > > > /** > > + * @warning > > + * @b EXPERIMENTAL: this structure may change without prior notice > > + * > > + * RTE_FLOW_ITEM_TYPE_PFCP > > + * > > + * Match PFCP Header > > + * > > + */ > > +struct rte_flow_item_pfcp { > > + uint8_t s_field; > > + uint8_t msg_type; > > + uint16_t msg_len; > > + uint64_t seid; > > +}; >=20 > I think this should be in BE format. Yes, I changed the type to BE format in v2 patch. Thanks for reviewing. >=20 > > + > > +/** Default mask for RTE_FLOW_ITEM_TYPE_PFCP. */ #ifndef __cplusplus > > +static const struct rte_flow_item_pfcp rte_flow_item_pfcp_mask =3D { > > + .s_field =3D 0x01, > > + .seid =3D 0xffffffffffffffff, > > +}; > > +#endif > > + > > +/** > > * Matching pattern item definition. > > * > > * A pattern is formed by stacking items starting from the lowest > > protocol > > -- > > 2.7.4