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 EE423A04B5; Wed, 4 Dec 2019 15:15:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 57EA61BE84; Wed, 4 Dec 2019 15:15:07 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3F5284C99 for ; Wed, 4 Dec 2019 15:15:06 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 06:15:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,277,1571727600"; d="scan'208";a="208822038" Received: from silpixa00399483.ir.intel.com (HELO silpixa00399483.ger.corp.intel.com) ([10.237.223.172]) by fmsmga008.fm.intel.com with ESMTP; 04 Dec 2019 06:15:02 -0800 From: Rory Sexton To: dev@dpdk.org Cc: qi.z.zhang@intel.com, beilei.xing@intel.com, rory.sexton@intel.com, adrien.mazarguil@6wind.com, Dariusz Jagus Date: Wed, 4 Dec 2019 14:10:54 +0000 Message-Id: <20191204141055.3647-1-rory.sexton@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] ethdev: add L2TPv3 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" - RTE_FLOW_ITEM_TYPE_L2TPV3: matches a L2TPv3 header Signed-off-by: Rory Sexton Signed-off-by: Dariusz Jagus --- app/test-pmd/cmdline_flow.c | 28 +++++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 8 ++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 4 +++ lib/librte_ethdev/rte_flow.c | 1 + lib/librte_ethdev/rte_flow.h | 27 ++++++++++++++++++++ 5 files changed, 68 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 99dade7d8..a7fe7a7a8 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -213,6 +213,8 @@ enum index { ITEM_TAG, ITEM_TAG_DATA, ITEM_TAG_INDEX, + ITEM_L2TPV3, + ITEM_L2TPV3_SESSION_ID, /* Validate/create actions. */ ACTIONS, @@ -746,6 +748,7 @@ static const enum index next_item[] = { ITEM_PPPOE_PROTO_ID, ITEM_HIGIG2, ITEM_TAG, + ITEM_L2TPV3, END_SET, ZERO, }; @@ -1030,6 +1033,12 @@ static const enum index item_tag[] = { ZERO, }; +static const enum index item_l2tpv3[] = { + ITEM_L2TPV3_SESSION_ID, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -2593,6 +2602,21 @@ static const struct token token_list[] = { NEXT_ENTRY(ITEM_PARAM_IS)), .args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)), }, + [ITEM_L2TPV3] = { + .name = "l2tpv3", + .help = "match L2TPv3 header", + .priv = PRIV_ITEM(L2TPV3, sizeof(struct rte_flow_item_l2tpv3)), + .next = NEXT(item_l2tpv3), + .call = parse_vc, + }, + [ITEM_L2TPV3_SESSION_ID] = { + .name = "session_id", + .help = "session identifier", + .next = NEXT(item_l2tpv3, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv3, + session_id)), + }, + /* Validate/create actions. */ [ACTIONS] = { .name = "actions", @@ -6238,6 +6262,10 @@ flow_item_default_mask(const struct rte_flow_item *item) break; case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: mask = &rte_flow_item_pppoe_proto_id_mask; + break; + case RTE_FLOW_ITEM_TYPE_L2TPV3: + mask = &rte_flow_item_l2tpv3_mask; + break; default: break; } diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index a254c81ef..c7ddb38c5 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -1336,6 +1336,14 @@ Broadcom switches. - Default ``mask`` matches classification and vlan. +Item: ``L2TPV3`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Matches a L2TPv3 header. + +- ``session_id``: L2TPv3 session identifier. +- Default ``mask`` matches session_id only. + Actions ~~~~~~~ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 73ef0b41d..a48e77619 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3954,6 +3954,10 @@ This section lists supported pattern items and their attributes, if any. - ``proto_id {unsigned}``: PPP protocol identifier. +- ``l2tpv3``: match L2TPv3 header. + + - ``session_id {unsigned}``: L2TPv3 session identifier. + Actions list ^^^^^^^^^^^^ diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index 87a3e8c4c..fcda73320 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -93,6 +93,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)), MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)), MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)), + MK_FLOW_ITEM(L2TPV3, sizeof(struct rte_flow_item_l2tpv3)), }; /** Generate flow_action[] entry. */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 452d359a1..5ee055c28 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -510,6 +510,16 @@ enum rte_flow_item_type { * See struct rte_flow_item_tag. */ RTE_FLOW_ITEM_TYPE_TAG, + + /* + * Matches a L2TPv3 header. + * + * Configure flow for L2TPv3 packets. + * + * See struct rte_flow_item_l2tpv3. + */ + RTE_FLOW_ITEM_TYPE_L2TPV3, + }; /** @@ -1373,6 +1383,23 @@ static const struct rte_flow_item_tag rte_flow_item_tag_mask = { }; #endif +/** + * RTE_FLOW_ITEM_TYPE_L2TPV3. + * + * Matches a L2TPv3 header. + */ +struct rte_flow_item_l2tpv3 { + rte_be32_t session_id; /**< Session ID. */ +}; + +/** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3. */ +#ifndef __cplusplus +static const struct rte_flow_item_l2tpv3 rte_flow_item_l2tpv3_mask = { + .session_id = RTE_BE32(UINT32_MAX), +}; +#endif + + /** * @warning * @b EXPERIMENTAL: this structure may change without prior notice -- 2.17.1 -------------------------------------------------------------- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.