DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>
Subject: [dpdk-dev] [PATCH] acl: fix invalid results for rule with zero priority
Date: Fri, 24 Aug 2018 17:47:06 +0100	[thread overview]
Message-ID: <1535129226-25510-1-git-send-email-konstantin.ananyev@intel.com> (raw)

If user specifies priority=0 for some of ACL rules
that can cause rte_acl_classify to return wrong results.
The reason is that priority zero is used internally for no-match nodes.
See more details at: https://bugs.dpdk.org/show_bug.cgi?id=79.
The simplest way to overcome the issue is just not allow zero
to be a valid priority for the rule.

Fixes: dc276b5780c2 ("acl: new library")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_acl/rte_acl.h |  2 +-
 test/test/test_acl.h     | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/lib/librte_acl/rte_acl.h b/lib/librte_acl/rte_acl.h
index 34c3b9c6a..aa22e70c6 100644
--- a/lib/librte_acl/rte_acl.h
+++ b/lib/librte_acl/rte_acl.h
@@ -88,7 +88,7 @@ enum {
 	RTE_ACL_TYPE_SHIFT = 29,
 	RTE_ACL_MAX_INDEX = RTE_LEN2MASK(RTE_ACL_TYPE_SHIFT, uint32_t),
 	RTE_ACL_MAX_PRIORITY = RTE_ACL_MAX_INDEX,
-	RTE_ACL_MIN_PRIORITY = 0,
+	RTE_ACL_MIN_PRIORITY = 1,
 };
 
 #define	RTE_ACL_MASKLEN_TO_BITMASK(v, s)	\
diff --git a/test/test/test_acl.h b/test/test/test_acl.h
index c4811c8f5..bbb0447a8 100644
--- a/test/test/test_acl.h
+++ b/test/test/test_acl.h
@@ -80,34 +80,40 @@ enum {
 struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = {
 		/* test src and dst address */
 		{
-				.data = {.userdata = 1, .category_mask = 1},
+				.data = {.userdata = 1, .category_mask = 1,
+					.priority = 1},
 				.src_addr = IPv4(10,0,0,0),
 				.src_mask_len = 24,
 		},
 		{
-				.data = {.userdata = 2, .category_mask = 1},
+				.data = {.userdata = 2, .category_mask = 1,
+					.priority = 1},
 				.dst_addr = IPv4(10,0,0,0),
 				.dst_mask_len = 24,
 		},
 		/* test src and dst ports */
 		{
-				.data = {.userdata = 3, .category_mask = 1},
+				.data = {.userdata = 3, .category_mask = 1,
+					.priority = 1},
 				.dst_port_low = 100,
 				.dst_port_high = 100,
 		},
 		{
-				.data = {.userdata = 4, .category_mask = 1},
+				.data = {.userdata = 4, .category_mask = 1,
+					.priority = 1},
 				.src_port_low = 100,
 				.src_port_high = 100,
 		},
 		/* test proto */
 		{
-				.data = {.userdata = 5, .category_mask = 1},
+				.data = {.userdata = 5, .category_mask = 1,
+					.priority = 1},
 				.proto = 0xf,
 				.proto_mask = 0xf
 		},
 		{
-				.data = {.userdata = 6, .category_mask = 1},
+				.data = {.userdata = 6, .category_mask = 1,
+					.priority = 1},
 				.dst_port_low = 0xf,
 				.dst_port_high = 0xf,
 		}
-- 
2.13.6

             reply	other threads:[~2018-08-24 16:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 16:47 Konstantin Ananyev [this message]
2018-09-16  9:56 ` Thomas Monjalon
2018-09-25 12:22   ` Luca Boccassi
2018-09-25 12:57     ` Thomas Monjalon
2018-09-25 14:34     ` Ananyev, Konstantin
2018-10-03 16:18       ` Luca Boccassi

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=1535129226-25510-1-git-send-email-konstantin.ananyev@intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@dpdk.org \
    /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).