DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
To: jerinj@marvell.com, thomas@monjalon.net, david.marchand@redhat.com
Cc: dev@dpdk.org, nd@arm.com,
	Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>,
	Nathan Brown <nathan.brown@arm.com>,
	Ruifeng Wang <ruifeng.wang@arm.com>,
	Feifei Wang <feifei.wang2@arm.com>
Subject: [PATCH 1/3] examples/l3fwd: validate ptype only for type of traffic sent
Date: Mon, 14 Nov 2022 21:25:31 +0000	[thread overview]
Message-ID: <20221114212533.2871770-1-kamalakshitha.aligeri@arm.com> (raw)

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 <nathan.brown@arm.com>
Signed-off-by: Kamalakshitha Aligeri <kamalakshitha.aligeri@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Nathan Brown <nathan.brown@arm.com>
Reviewed-by: Feifei Wang <feifei.wang2@arm.com>
---
 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.17.1


             reply	other threads:[~2022-11-14 21:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 21:25 Kamalakshitha Aligeri [this message]
2022-11-14 21:25 ` [PATCH 2/3] examples/l3fwd: removed hash entry number Kamalakshitha Aligeri
2023-03-03  6:37   ` Ruifeng Wang
2022-11-14 21:25 ` [PATCH 3/3] doc/l3fwd: lpm supports IPv4 and IPv6 forwarding Kamalakshitha Aligeri
2023-03-02 10:11   ` Ruifeng Wang
2023-02-08 17:45 ` [PATCH 1/3] examples/l3fwd: validate ptype only for type of traffic sent Kamalakshitha Aligeri
2023-03-06 16:25 ` [PATCH v2 " Kamalakshitha Aligeri
2023-03-06 16:25   ` [PATCH v2 2/3] examples/l3fwd: removed hash entry number Kamalakshitha Aligeri
2023-03-07  1:33     ` Ruifeng Wang
2023-03-07  9:41     ` Konstantin Ananyev
2023-03-06 16:25   ` [PATCH v2 3/3] doc/l3fwd: lpm supports IPv4 and IPv6 forwarding Kamalakshitha Aligeri
2023-03-07  9:42     ` Konstantin Ananyev
2023-03-20 13:17   ` [PATCH v2 1/3] examples/l3fwd: validate ptype only for type of traffic sent Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221114212533.2871770-1-kamalakshitha.aligeri@arm.com \
    --to=kamalakshitha.aligeri@arm.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=feifei.wang2@arm.com \
    --cc=jerinj@marvell.com \
    --cc=nathan.brown@arm.com \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).