From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <kananye1@ecsmtp.ir.intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id B8C6E5A7E
 for <dev@dpdk.org>; Mon, 12 Jan 2015 20:16:37 +0100 (CET)
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by fmsmga101.fm.intel.com with ESMTP; 12 Jan 2015 11:16:36 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="511102605"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by orsmga003.jf.intel.com with ESMTP; 12 Jan 2015 11:10:31 -0800
Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com
 [10.237.217.46])
 by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id
 t0CJGZpk008615; Mon, 12 Jan 2015 19:16:35 GMT
Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1])
 by sivswdev02.ir.intel.com with ESMTP id t0CJGZ34017221;
 Mon, 12 Jan 2015 19:16:35 GMT
Received: (from kananye1@localhost)
 by sivswdev02.ir.intel.com with  id t0CJGZiv017217;
 Mon, 12 Jan 2015 19:16:35 GMT
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Date: Mon, 12 Jan 2015 19:16:07 +0000
Message-Id: <1421090181-17150-4-git-send-email-konstantin.ananyev@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1421090181-17150-1-git-send-email-konstantin.ananyev@intel.com>
References: <1421090181-17150-1-git-send-email-konstantin.ananyev@intel.com>
Subject: [dpdk-dev] [PATCH v2 03/17] librte_acl: make data_indexes long
	enough to survive idle transitions.
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 12 Jan 2015 19:16:38 -0000

Make data_indexes long enough to survive idle transitions.
That allows to simplify match processing code.
Also fix incorrect size calculations for data indexes.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_acl/acl_bld.c | 5 +++--
 lib/librte_acl/acl_run.h | 4 ----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c
index d6e0c45..c5a674a 100644
--- a/lib/librte_acl/acl_bld.c
+++ b/lib/librte_acl/acl_bld.c
@@ -1948,7 +1948,7 @@ acl_set_data_indexes(struct rte_acl_ctx *ctx)
 		memcpy(ctx->data_indexes + ofs, ctx->trie[i].data_index,
 			n * sizeof(ctx->data_indexes[0]));
 		ctx->trie[i].data_index = ctx->data_indexes + ofs;
-		ofs += n;
+		ofs += RTE_ACL_MAX_FIELDS;
 	}
 }
 
@@ -1988,7 +1988,8 @@ rte_acl_build(struct rte_acl_ctx *ctx, const struct rte_acl_config *cfg)
 		/* allocate and fill run-time  structures. */
 		rc = rte_acl_gen(ctx, bcx.tries, bcx.bld_tries,
 				bcx.num_tries, bcx.cfg.num_categories,
-				RTE_ACL_IPV4VLAN_NUM * RTE_DIM(bcx.tries),
+				RTE_ACL_MAX_FIELDS * RTE_DIM(bcx.tries) *
+				sizeof(ctx->data_indexes[0]),
 				bcx.num_build_rules);
 		if (rc == 0) {
 
diff --git a/lib/librte_acl/acl_run.h b/lib/librte_acl/acl_run.h
index c191053..4c843c1 100644
--- a/lib/librte_acl/acl_run.h
+++ b/lib/librte_acl/acl_run.h
@@ -256,10 +256,6 @@ acl_match_check(uint64_t transition, int slot,
 
 		/* Fill the slot with the next trie or idle trie */
 		transition = acl_start_next_trie(flows, parms, slot, ctx);
-
-	} else if (transition == ctx->idle) {
-		/* reset indirection table for idle slots */
-		parms[slot].data_index = idle;
 	}
 
 	return transition;
-- 
1.8.5.3