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 803698032 for ; Thu, 4 Dec 2014 15:24:15 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 04 Dec 2014 06:24:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,515,1413270000"; d="scan'208";a="632657970" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 04 Dec 2014 06:24:13 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id sB4EOCtk011968; Thu, 4 Dec 2014 14:24:12 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id sB4EOCDb032612; Thu, 4 Dec 2014 14:24:12 GMT Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id sB4EOCqI032607; Thu, 4 Dec 2014 14:24:12 GMT From: Bruce Richardson To: dev@dpdk.org Date: Thu, 4 Dec 2014 14:24:12 +0000 Message-Id: <1417703052-32575-1-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] table: fix table_array for incomplete bitmask 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: Thu, 04 Dec 2014 14:24:16 -0000 When a lookup was done on a table_array structure with an incomplete bitmask, the results was always zero hits. This was because the pkts_mask value was cleared as we process each entry, and the result was assigned at the end of the loop, when pkts_mask was zero. Changing the assignment to occur at the start, before the pkts_mask gets cleared, fixes this issue. Signed-off-by: Bruce Richardson --- lib/librte_table/rte_table_array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_table/rte_table_array.c b/lib/librte_table/rte_table_array.c index 0b1d42a..4d3c05e 100644 --- a/lib/librte_table/rte_table_array.c +++ b/lib/librte_table/rte_table_array.c @@ -164,6 +164,8 @@ rte_table_array_lookup( { struct rte_table_array *t = (struct rte_table_array *) table; + *lookup_hit_mask = pkts_mask; + if ((pkts_mask & (pkts_mask + 1)) == 0) { uint64_t n_pkts = __builtin_popcountll(pkts_mask); uint32_t i; @@ -190,8 +192,6 @@ rte_table_array_lookup( } } - *lookup_hit_mask = pkts_mask; - return 0; } -- 1.9.3