From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A436C41DCD; Mon, 6 Mar 2023 17:25:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3803440EDF; Mon, 6 Mar 2023 17:25:35 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 5D59140EDB for ; Mon, 6 Mar 2023 17:25:33 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 065B212FC; Mon, 6 Mar 2023 08:26:16 -0800 (PST) Received: from ampere-altra-2-1.usa.Arm.com (ampere-altra-2-1.usa.arm.com [10.118.91.158]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6E4C53F67D; Mon, 6 Mar 2023 08:25:32 -0800 (PST) From: Kamalakshitha Aligeri To: jerinj@marvell.com, thomas@monjalon.net, david.marchand@redhat.com, sean.morrissey@intel.com, konstantin.ananyev@huawei.com, Ruifeng.Wang@arm.com, Honnappa.Nagarahalli@arm.com Cc: dev@dpdk.org, nd@arm.com Subject: [PATCH v2 1/3] examples/l3fwd: validate ptype only for type of traffic sent Date: Mon, 6 Mar 2023 16:25:05 +0000 Message-Id: <20230306162507.38898-1-kamalakshitha.aligeri@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221114212533.2871770-1-kamalakshitha.aligeri@arm.com> References: <20221114212533.2871770-1-kamalakshitha.aligeri@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The check_ptype function is not considering the ptype of the incoming traffic. --parse-ptype flag must be provided only when the NIC does not support parsing the ptype of the incoming traffic Suggested-by: Nathan Brown Signed-off-by: Kamalakshitha Aligeri Reviewed-by: Ruifeng Wang Reviewed-by: Nathan Brown Reviewed-by: Feifei Wang --- examples/l3fwd/l3fwd_em.c | 8 +++++--- examples/l3fwd/l3fwd_lpm.c | 13 +++++++------ examples/l3fwd/main.c | 5 ++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index a203dc9e46..682ad343d7 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -507,12 +507,14 @@ em_check_ptype(int portid) } } - if (ptype_l3_ipv4_ext == 0) + if (!ipv6 && !ptype_l3_ipv4_ext) { printf("port %d cannot parse RTE_PTYPE_L3_IPV4_EXT\n", portid); - if (ptype_l3_ipv6_ext == 0) + return 0; + } + if (ipv6 && !ptype_l3_ipv6_ext) { printf("port %d cannot parse RTE_PTYPE_L3_IPV6_EXT\n", portid); - if (!ptype_l3_ipv4_ext || !ptype_l3_ipv6_ext) return 0; + } if (ptype_l4_tcp == 0) printf("port %d cannot parse RTE_PTYPE_L4_TCP\n", portid); diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 22d7f61a42..1ac78281f9 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -667,16 +667,17 @@ lpm_check_ptype(int portid) ptype_l3_ipv6 = 1; } - if (ptype_l3_ipv4 == 0) + if (!ipv6 && !ptype_l3_ipv4) { printf("port %d cannot parse RTE_PTYPE_L3_IPV4\n", portid); + return 0; + } - if (ptype_l3_ipv6 == 0) + if (ipv6 && !ptype_l3_ipv6) { printf("port %d cannot parse RTE_PTYPE_L3_IPV6\n", portid); + return 0; + } - if (ptype_l3_ipv4 && ptype_l3_ipv6) - return 1; - - return 0; + return 1; } diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 5198ff30dd..71a3018036 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -964,12 +964,11 @@ parse_args(int argc, char **argv) } /* - * ipv6 and hash flags are valid only for - * exact match, reset them to default for + * hash flag is valid only for + * exact match, reset it to default for * longest-prefix match. */ if (lookup_mode == L3FWD_LOOKUP_LPM) { - ipv6 = 0; hash_entry_number = HASH_ENTRY_NUMBER_DEFAULT; } -- 2.25.1