From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 143607EDC for ; Fri, 24 Aug 2018 18:47:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Aug 2018 09:47:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,283,1531810800"; d="scan'208";a="67869912" Received: from sivswdev02.ir.intel.com (HELO localhost.localdomain) ([10.237.217.46]) by orsmga008.jf.intel.com with ESMTP; 24 Aug 2018 09:47:22 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: Konstantin Ananyev Date: Fri, 24 Aug 2018 17:47:06 +0100 Message-Id: <1535129226-25510-1-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] acl: fix invalid results for rule with zero priority 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: , X-List-Received-Date: Fri, 24 Aug 2018 16:47:24 -0000 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 --- 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