DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 4/8] ACL: fix rebuilding a trie for subset of rules
Date: Thu,  4 Jun 2015 00:10:20 +0100	[thread overview]
Message-ID: <1433373024-5558-5-git-send-email-konstantin.ananyev@intel.com> (raw)
In-Reply-To: <1433373024-5558-1-git-send-email-konstantin.ananyev@intel.com>

When rebuilding a trie for limited rule-set,
don't try to split the rule-set even further.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_acl/acl_bld.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index 8315d84..4bcf637 100644
--- a/lib/librte_acl/acl_bld.c
+++ b/lib/librte_acl/acl_bld.c
@@ -97,6 +97,7 @@ struct acl_build_context {
 	struct rte_acl_build_rule *build_rules;
 	struct rte_acl_config     cfg;
 	int32_t                   node_max;
+	int32_t                   cur_node_max;
 	uint32_t                  node;
 	uint32_t                  num_nodes;
 	uint32_t                  category_mask;
@@ -1337,7 +1338,7 @@ build_trie(struct acl_build_context *context, struct rte_acl_build_rule *head,
 			return NULL;
 
 		node_count = context->num_nodes - node_count;
-		if (node_count > context->node_max) {
+		if (node_count > context->cur_node_max) {
 			*last = prev;
 			return trie;
 		}
@@ -1536,7 +1537,7 @@ acl_build_index(const struct rte_acl_config *config, uint32_t *data_index)
 static struct rte_acl_build_rule *
 build_one_trie(struct acl_build_context *context,
 	struct rte_acl_build_rule *rule_sets[RTE_ACL_MAX_TRIES],
-	uint32_t n)
+	uint32_t n, int32_t node_max)
 {
 	struct rte_acl_build_rule *last;
 	struct rte_acl_config *config;
@@ -1553,6 +1554,8 @@ build_one_trie(struct acl_build_context *context,
 		context->data_indexes[n]);
 	context->tries[n].data_index = context->data_indexes[n];
 
+	context->cur_node_max = node_max;
+
 	context->bld_tries[n].trie = build_trie(context, rule_sets[n],
 		&last, &context->tries[n].count);
 
@@ -1587,7 +1590,7 @@ acl_build_tries(struct acl_build_context *context,
 
 		num_tries = n + 1;
 
-		last = build_one_trie(context, rule_sets, n);
+		last = build_one_trie(context, rule_sets, n, context->node_max);
 		if (context->bld_tries[n].trie == NULL) {
 			RTE_LOG(ERR, ACL, "Build of %u-th trie failed\n", n);
 			return -ENOMEM;
@@ -1618,8 +1621,11 @@ acl_build_tries(struct acl_build_context *context,
 				head = head->next)
 			head->config = config;
 
-		/* Rebuild the trie for the reduced rule-set. */
-		last = build_one_trie(context, rule_sets, n);
+		/*
+		 * Rebuild the trie for the reduced rule-set.
+		 * Don't try to split it any further.
+		 */
+		last = build_one_trie(context, rule_sets, n, INT32_MAX);
 		if (context->bld_tries[n].trie == NULL || last != NULL) {
 			RTE_LOG(ERR, ACL, "Build of %u-th trie failed\n", n);
 			return -ENOMEM;
-- 
1.8.5.3

  parent reply	other threads:[~2015-06-03 23:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 23:10 [dpdk-dev] [PATCH 0/8] ACL: various fixes and cleanups Konstantin Ananyev
2015-06-03 23:10 ` [dpdk-dev] [PATCH 1/8] ACL: fix invalid rule wildness calculation for RTE_ACL_FIELD_TYPE_BITMASK Konstantin Ananyev
2015-06-08 10:41   ` [dpdk-dev] [PATCHv2 0/8] acl: various fixes and cleanups Konstantin Ananyev
2015-06-08 10:41     ` [dpdk-dev] [PATCHv2 1/8] acl: fix invalid rule wildness calculation for bitmask field type Konstantin Ananyev
2015-06-08 10:41     ` [dpdk-dev] [PATCHv2 2/8] acl: code cleanup - use global EAL macro, instead of creating a local copy Konstantin Ananyev
2015-06-08 10:41     ` [dpdk-dev] [PATCHv2 3/8] acl: add function to check build input parameters Konstantin Ananyev
2015-06-08 10:41     ` [dpdk-dev] [PATCHv2 4/8] acl: fix avoid unneeded trie splitting for subset of rules Konstantin Ananyev
2015-06-08 10:41     ` [dpdk-dev] [PATCHv2 5/8] acl: code dedup - introduce a new macro Konstantin Ananyev
2015-06-08 10:41     ` [dpdk-dev] [PATCHv2 6/8] acl: cleanup remove unused code from acl_bld.c Konstantin Ananyev
2015-06-08 10:41     ` [dpdk-dev] [PATCHv2 7/8] acl: fix ambiguity between ACL rules in UT Konstantin Ananyev
2015-06-08 10:41     ` [dpdk-dev] [PATCHv2 8/8] acl: add new test-cases into UT Konstantin Ananyev
2015-06-18 16:14     ` [dpdk-dev] [PATCHv2 0/8] acl: various fixes and cleanups Thomas Monjalon
2015-06-03 23:10 ` [dpdk-dev] [PATCH 2/8] ACL: code cleanup - use global RTE_LEN2MASK macro Konstantin Ananyev
2015-06-03 23:10 ` [dpdk-dev] [PATCH 3/8] ACL: add function to check rte_acl_build() input parameters Konstantin Ananyev
2015-06-03 23:10 ` Konstantin Ananyev [this message]
2015-06-03 23:10 ` [dpdk-dev] [PATCH 5/8] ACL: introduce RTE_ACL_MASKLEN_TO_BITMASK macro Konstantin Ananyev
2015-06-03 23:10 ` [dpdk-dev] [PATCH 6/8] ACL: cleanup remove unused code from acl_bld.c Konstantin Ananyev
2015-06-03 23:10 ` [dpdk-dev] [PATCH 7/8] ACL: fix remove ambiguity between rules at UT Konstantin Ananyev
2015-06-03 23:10 ` [dpdk-dev] [PATCH 8/8] ACL: add new test-cases into UT Konstantin Ananyev
2015-06-04  9:27 ` [dpdk-dev] [PATCH 0/8] ACL: various fixes and cleanups Thomas Monjalon
2015-06-04 10:20   ` Ananyev, Konstantin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433373024-5558-5-git-send-email-konstantin.ananyev@intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).