acl: forbid rule with priority zero

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: dc276b5780 ("acl: new library")
Cc: stable@dpdk.org

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit is contained in:
Konstantin Ananyev 2018-08-24 17:47:06 +01:00 committed by Thomas Monjalon
parent 23f1c42459
commit 5394547798
2 changed files with 13 additions and 7 deletions

View File

@ -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) \

View File

@ -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,
}