path: root/examples/l3fwd-acl
diff options
authorKonstantin Ananyev <>2015-01-20 18:41:05 +0000
committerThomas Monjalon <>2015-01-28 17:11:26 +0100
commit62945e029e86bba5fb833e969c3c22f84d58c1cb (patch)
tree42830f5a52626b436bac11a2ce59e3ad439af6c9 /examples/l3fwd-acl
parenta0e3310e7a4f92622f7d86369c8f8e3c389edf18 (diff)
acl: introduce config parameter for performance/space trade-off
If at build phase we don't make any trie splitting, then temporary build structures and resulting RT structure might be much bigger than current. >From other side - having just one trie instead of multiple can speedup search quite significantly. >From my measurements on rule-sets with ~10K rules: RT table up to 8 times bigger, classify() up to 80% faster than current implementation. To make it possible for the user to decide about performance/space trade-off - new parameter for build config structure (max_size) is introduced. Setting it to the value greater than zero, instructs rte_acl_build() to: - make sure that size of RT table wouldn't exceed given value. - attempt to minimise number of tries in the table. Setting it to zero maintains current behaviour. That introduces a minor change in the public API, but I think the possible performance gain is too big to ignore it. Signed-off-by: Konstantin Ananyev <> Acked-by: Neil Horman <>
Diffstat (limited to 'examples/l3fwd-acl')
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index 022ccab..f1f7601 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -1178,8 +1178,9 @@ setup_acl(struct rte_acl_rule *route_base,
rte_exit(EXIT_FAILURE, "add rules failed\n");
/* Perform builds */
- acl_build_param.num_categories = DEFAULT_MAX_CATEGORIES;
+ memset(&acl_build_param, 0, sizeof(acl_build_param));
+ acl_build_param.num_categories = DEFAULT_MAX_CATEGORIES;
acl_build_param.num_fields = dim;
memcpy(&acl_build_param.defs, ipv6 ? ipv6_defs : ipv4_defs,
ipv6 ? sizeof(ipv6_defs) : sizeof(ipv4_defs));