From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id DA327AB06 for ; Mon, 9 Jun 2014 18:11:12 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 09 Jun 2014 09:11:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.98,1003,1392192000"; d="scan'208";a="552725920" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2014 09:11:21 -0700 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 s59GBL7T011608; Mon, 9 Jun 2014 17:11:21 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s59GBLxT018797; Mon, 9 Jun 2014 17:11:21 +0100 Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with id s59GBKCS018786; Mon, 9 Jun 2014 17:11:20 +0100 From: Konstantin Ananyev To: dev@dpdk.org Date: Mon, 9 Jun 2014 17:11:17 +0100 Message-Id: <1402330277-18481-1-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.0.7 To: dev@dpdk.org Subject: [dpdk-dev] [PATCH] fix for rte_acl: when all rules are wildcards rte_classify() will not work correclty X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jun 2014 16:11:13 -0000 To reproduce the problem: $ cat rule1 @0.0.0.0/0 0.0.0.0/0 0 : 65535 0 : 65535 0x00/0x00 $ cat trace1 0xc80a0001 0x640a0001 11 101 6 $ testacl -n 1 -c 0x1 -- --rulesf=rule1 --tracef=trace1 Note that rte_acl_classify_scalar() still works correctly for that case. The problem is that in some cases we don't check for matches after acl_start_next_trie(). Signed-off-by: Konstantin Ananyev Tested-by: Waterman Cao --- lib/librte_acl/acl_run.c | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/librte_acl/acl_run.c b/lib/librte_acl/acl_run.c index d08d7ea..79e6e76 100644 --- a/lib/librte_acl/acl_run.c +++ b/lib/librte_acl/acl_run.c @@ -401,8 +401,9 @@ acl_match_check_x2(int slot, const struct rte_acl_ctx *ctx, struct parms *parms, xmm_t temp; temp = MM_AND(match_mask, *indicies); - if (!MM_TESTZ(temp, temp)) { + while (!MM_TESTZ(temp, temp)) { acl_process_matches(indicies, slot, ctx, parms, flows); + temp = MM_AND(match_mask, *indicies); } } @@ -419,12 +420,17 @@ acl_match_check_x4(int slot, const struct rte_acl_ctx *ctx, struct parms *parms, /* put low 32 bits of each transition into one register */ temp = (xmm_t)MM_SHUFFLEPS((__m128)*indicies1, (__m128)*indicies2, 0x88); - /* test for match node */ temp = MM_AND(match_mask, temp); - if (!MM_TESTZ(temp, temp)) { + + while (!MM_TESTZ(temp, temp)) { acl_process_matches(indicies1, slot, ctx, parms, flows); acl_process_matches(indicies2, slot + 2, ctx, parms, flows); + + temp = (xmm_t)MM_SHUFFLEPS((__m128)*indicies1, + (__m128)*indicies2, + 0x88); + temp = MM_AND(match_mask, temp); } } @@ -599,6 +605,12 @@ search_sse_8(const struct rte_acl_ctx *ctx, const uint8_t **data, indicies3 = MM_LOADU((xmm_t *) &index_array[4]); indicies4 = MM_LOADU((xmm_t *) &index_array[6]); + /* Check for any matches. */ + acl_match_check_x4(0, ctx, parms, &flows, + &indicies1, &indicies2, mm_match_mask.m); + acl_match_check_x4(4, ctx, parms, &flows, + &indicies3, &indicies4, mm_match_mask.m); + while (flows.started > 0) { /* Gather 4 bytes of input data for each stream. */ @@ -659,7 +671,6 @@ search_sse_8(const struct rte_acl_ctx *ctx, const uint8_t **data, flows.trans, &indicies3, &indicies4); /* Check for any matches. */ - acl_match_check_x4(0, ctx, parms, &flows, &indicies1, &indicies2, mm_match_mask.m); acl_match_check_x4(4, ctx, parms, &flows, @@ -692,6 +703,10 @@ search_sse_4(const struct rte_acl_ctx *ctx, const uint8_t **data, indicies1 = MM_LOADU((xmm_t *) &index_array[0]); indicies2 = MM_LOADU((xmm_t *) &index_array[2]); + /* Check for any matches. */ + acl_match_check_x4(0, ctx, parms, &flows, + &indicies1, &indicies2, mm_match_mask.m); + while (flows.started > 0) { /* Gather 4 bytes of input data for each stream. */ @@ -722,7 +737,6 @@ search_sse_4(const struct rte_acl_ctx *ctx, const uint8_t **data, flows.trans, &indicies1, &indicies2); /* Check for any matches. */ - acl_match_check_x4(0, ctx, parms, &flows, &indicies1, &indicies2, mm_match_mask.m); } @@ -776,6 +790,9 @@ search_sse_2(const struct rte_acl_ctx *ctx, const uint8_t **data, indicies = MM_LOADU((xmm_t *) &index_array[0]); + /* Check for any matches. */ + acl_match_check_x2(0, ctx, parms, &flows, &indicies, mm_match_mask64.m); + while (flows.started > 0) { /* Gather 4 bytes of input data for each stream. */ -- 1.7.7.6