[dpdk-dev,1/8] ACL: fix invalid rule wildness calculation for RTE_ACL_FIELD_TYPE_BITMASK

Message ID 1433373024-5558-2-git-send-email-konstantin.ananyev@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Ananyev, Konstantin June 3, 2015, 11:10 p.m. UTC
  Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_acl/acl_bld.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Ananyev, Konstantin June 8, 2015, 10:41 a.m. UTC | #1
Several fixes and code cleanups for the librte_acl.
New test-cases for acl UT.

Konstantin Ananyev (8):
  acl: fix invalid rule wildness calculation for bitmask field type
  acl: code cleanup - use global EAL macro, instead of creating a local
    copy
  acl: add function to check build input parameters
  acl: fix avoid unneeded trie splitting for subset of rules.
  acl: code dedup - introduce a new macro
  acl: cleanup remove unused code from acl_bld.c
  acl: fix ambiguity between ACL rules in UT.
  acl: add new test-cases into UT

 app/test-acl/main.c            |   3 +-
 app/test/test_acl.c            | 431 +++++++++++++++++++++++++++++++++++++-
 app/test/test_acl.h            |  52 ++---
 lib/librte_acl/acl_bld.c       | 455 +++++++----------------------------------
 lib/librte_acl/rte_acl.c       |   3 +-
 lib/librte_acl/rte_acl.h       |   5 +-
 lib/librte_acl/rte_acl_osdep.h |   2 -
 7 files changed, 530 insertions(+), 421 deletions(-)
  
Thomas Monjalon June 18, 2015, 4:14 p.m. UTC | #2
2015-06-08 11:41, Konstantin Ananyev:
> Several fixes and code cleanups for the librte_acl.
> New test-cases for acl UT.
> 
> Konstantin Ananyev (8):
>   acl: fix invalid rule wildness calculation for bitmask field type
>   acl: code cleanup - use global EAL macro, instead of creating a local
>     copy
>   acl: add function to check build input parameters
>   acl: fix avoid unneeded trie splitting for subset of rules.
>   acl: code dedup - introduce a new macro
>   acl: cleanup remove unused code from acl_bld.c
>   acl: fix ambiguity between ACL rules in UT.
>   acl: add new test-cases into UT

Applied, thanks
  

Patch

diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index db23b7b..e2db9bf 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;