From patchwork Tue Jan 11 05:05:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nipun Gupta X-Patchwork-Id: 105718 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2CC4A034D; Tue, 11 Jan 2022 06:05:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26B9641168; Tue, 11 Jan 2022 06:05:44 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id BA5A540041 for ; Tue, 11 Jan 2022 06:05:42 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8A7F81A14B8; Tue, 11 Jan 2022 06:05:42 +0100 (CET) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 525581A149A; Tue, 11 Jan 2022 06:05:42 +0100 (CET) Received: from lsv03274.swis.in-blr01.nxp.com (lsv03274.swis.in-blr01.nxp.com [92.120.147.114]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 4F03B183ACDE; Tue, 11 Jan 2022 13:05:41 +0800 (+08) From: nipun.gupta@nxp.com To: dev@dpdk.org Cc: xiaoyun.li@intel.com, orika@nvidia.com, thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com, Nipun Gupta Subject: [PATCH] app/testpmd: update raw flow to take hex input Date: Tue, 11 Jan 2022 10:35:38 +0530 Message-Id: <20220111050538.12957-1-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP 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 From: Nipun Gupta This patch enables method to provide key and mask for raw rules to be provided as hexadecimal values. There is new parameter pattern_mask added to support this. Signed-off-by: Nipun Gupta Acked-by: Ferruh Yigit --- app/test-pmd/cmdline_flow.c | 15 +++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index bbe3dc0115..cfa68abc40 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -166,6 +166,7 @@ enum index { ITEM_RAW_OFFSET, ITEM_RAW_LIMIT, ITEM_RAW_PATTERN, + ITEM_RAW_PATTERN_HEX, ITEM_ETH, ITEM_ETH_DST, ITEM_ETH_SRC, @@ -1107,6 +1108,7 @@ static const enum index item_raw[] = { ITEM_RAW_OFFSET, ITEM_RAW_LIMIT, ITEM_RAW_PATTERN, + ITEM_RAW_PATTERN_HEX, ITEM_NEXT, ZERO, }; @@ -2664,6 +2666,19 @@ static const struct token token_list[] = { ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw), ITEM_RAW_PATTERN_SIZE)), }, + [ITEM_RAW_PATTERN_HEX] = { + .name = "pattern_hex", + .help = "hex string to look for", + .next = NEXT(item_raw, + NEXT_ENTRY(COMMON_HEX), + NEXT_ENTRY(ITEM_PARAM_IS, + ITEM_PARAM_SPEC, + ITEM_PARAM_MASK)), + .args = ARGS(ARGS_ENTRY(struct rte_flow_item_raw, pattern), + ARGS_ENTRY(struct rte_flow_item_raw, length), + ARGS_ENTRY_ARB(sizeof(struct rte_flow_item_raw), + ITEM_RAW_PATTERN_SIZE)), + }, [ITEM_ETH] = { .name = "eth", .help = "match Ethernet header", diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 44228cd7d2..68c216c805 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3634,6 +3634,7 @@ This section lists supported pattern items and their attributes, if any. - ``offset {integer}``: absolute or relative offset for pattern. - ``limit {unsigned}``: search area limit for start of pattern. - ``pattern {string}``: byte string to look for. + - ``pattern_hex {string}``: byte string (provided in hexadecimal) to look for. - ``eth``: match Ethernet header. @@ -5080,6 +5081,18 @@ PPPoL2TPv2oUDP RSS rules can be created by the following commands:: testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6 / end actions rss types ipv6 end queues end / end +Sample RAW rule +~~~~~~~~~~~~~~~ + +A RAW rule can be creted as following using ``pattern_hex`` key and mask. + +:: + + testpmd> flow create 0 group 0 priority 1 ingress pattern raw relative is 0 search is 0 offset + is 0 limit is 0 pattern_hex spec 00000000000000000000000000000000000000000000000000000a0a0a0a + pattern_hex mask 0000000000000000000000000000000000000000000000000000ffffffff / end actions + queue index 4 / end + BPF Functions --------------