From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id ADE418D35 for ; Tue, 21 Jun 2016 14:57:43 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 21 Jun 2016 05:57:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,504,1459839600"; d="scan'208";a="1006643788" Received: from gklab-246-020.igk.intel.com (HELO Sent) ([10.217.246.20]) by fmsmga002.fm.intel.com with SMTP; 21 Jun 2016 05:57:15 -0700 Received: by Sent (sSMTP sendmail emulation); Tue, 21 Jun 2016 14:27:49 +0200 From: Michal Kobylinski To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, Michal Kobylinski Date: Tue, 21 Jun 2016 14:27:46 +0200 Message-Id: <1466512066-8130-1-git-send-email-michalx.kobylinski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466417424-3148-1-git-send-email-michalx.k.jastrzebski@intel.com> References: <1466417424-3148-1-git-send-email-michalx.k.jastrzebski@intel.com> Subject: [dpdk-dev] [PATCH v2] lib/table: fix wrong type of nht field 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: Tue, 21 Jun 2016 12:57:44 -0000 Change type of nht field from uint32_t to uint8_t and increase max of next hops. Fixes: dc81ebbacaeb ("lpm: extend IPv4 next hop field") Signed-off-by: Michal Kobylinski --- v2: - removed changing from file: pipeline_routing_be.h - changed macro: RTE_TABLE_LPM_MAX_NEXT_HOP lib/librte_table/rte_table_lpm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c index cdeb0f5..598b79f 100644 --- a/lib/librte_table/rte_table_lpm.c +++ b/lib/librte_table/rte_table_lpm.c @@ -44,7 +44,9 @@ #include "rte_table_lpm.h" -#define RTE_TABLE_LPM_MAX_NEXT_HOPS 256 +#ifndef RTE_TABLE_LPM_MAX_NEXT_HOPS +#define RTE_TABLE_LPM_MAX_NEXT_HOPS 65536 +#endif #ifdef RTE_TABLE_STATS_COLLECT @@ -74,7 +76,7 @@ struct rte_table_lpm { /* Next Hop Table (NHT) */ uint32_t nht_users[RTE_TABLE_LPM_MAX_NEXT_HOPS]; - uint32_t nht[0] __rte_cache_aligned; + uint8_t nht[0] __rte_cache_aligned; }; static void * @@ -188,7 +190,7 @@ nht_find_existing(struct rte_table_lpm *lpm, void *entry, uint32_t *pos) uint32_t i; for (i = 0; i < RTE_TABLE_LPM_MAX_NEXT_HOPS; i++) { - uint32_t *nht_entry = &lpm->nht[i * lpm->entry_size]; + uint8_t *nht_entry = &lpm->nht[i * lpm->entry_size]; if ((lpm->nht_users[i] > 0) && (memcmp(nht_entry, entry, lpm->entry_unique_size) == 0)) { @@ -242,7 +244,7 @@ rte_table_lpm_entry_add( /* Find existing or free NHT entry */ if (nht_find_existing(lpm, entry, &nht_pos) == 0) { - uint32_t *nht_entry; + uint8_t *nht_entry; if (nht_find_free(lpm, &nht_pos) == 0) { RTE_LOG(ERR, TABLE, "%s: NHT full\n", __func__); -- 1.9.1