summaryrefslogtreecommitdiff
path: root/lib/librte_acl
diff options
context:
space:
mode:
authorKonstantin Ananyev <konstantin.ananyev@intel.com>2015-06-08 11:41:23 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-06-18 17:57:28 +0200
commitfaea1ce70c77ee5ec95fe7c2fb79265fd5b3dcb1 (patch)
tree465ff495afacc86bba9fccd5880f34d4f3b96387 /lib/librte_acl
parent5f4cd47309d68e974ddb5c521297c57e487ac288 (diff)
downloaddpdk-faea1ce70c77ee5ec95fe7c2fb79265fd5b3dcb1.zip
dpdk-faea1ce70c77ee5ec95fe7c2fb79265fd5b3dcb1.tar.gz
dpdk-faea1ce70c77ee5ec95fe7c2fb79265fd5b3dcb1.tar.xz
acl: fix invalid rule wildness calculation for bitmask field type
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Diffstat (limited to 'lib/librte_acl')
-rw-r--r--lib/librte_acl/acl_bld.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index 3801843..aee6ed5 100644
--- a/lib/librte_acl/acl_bld.c
+++ b/lib/librte_acl/acl_bld.c
@@ -1362,6 +1362,9 @@ acl_calc_wildness(struct rte_acl_build_rule *head,
for (n = 0; n < config->num_fields; n++) {
double wild = 0;
+ uint64_t msk_val =
+ RTE_LEN2MASK(CHAR_BIT * config->defs[n].size,
+ typeof(msk_val));
double size = CHAR_BIT * config->defs[n].size;
int field_index = config->defs[n].field_index;
const struct rte_acl_field *fld = rule->f->field +
@@ -1369,8 +1372,8 @@ acl_calc_wildness(struct rte_acl_build_rule *head,
switch (rule->config->defs[n].type) {
case RTE_ACL_FIELD_TYPE_BITMASK:
- wild = (size - __builtin_popcount(
- fld->mask_range.u8)) /
+ wild = (size - __builtin_popcountll(
+ fld->mask_range.u64 & msk_val)) /
size;
break;