From patchwork Mon Jun 20 10:10:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Jastrzebski X-Patchwork-Id: 14025 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 8C421961E; Mon, 20 Jun 2016 12:10:44 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0811F8E74 for ; Mon, 20 Jun 2016 12:10:42 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 20 Jun 2016 03:10:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,497,1459839600"; d="scan'208";a="979520905" Received: from unknown (HELO Sent) ([10.103.103.195]) by orsmga001.jf.intel.com with SMTP; 20 Jun 2016 03:10:40 -0700 Received: by Sent (sSMTP sendmail emulation); Mon, 20 Jun 2016 12:10:39 +0200 From: Michal Jastrzebski To: dev@dpdk.org Cc: Michal Kobylinski Date: Mon, 20 Jun 2016 12:10:24 +0200 Message-Id: <1466417424-3148-1-git-send-email-michalx.k.jastrzebski@intel.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Michal Kobylinski 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 Acked-by: Cristian Dumitrescu --- examples/ip_pipeline/pipeline/pipeline_routing_be.h | 2 +- lib/librte_table/rte_table_lpm.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/ip_pipeline/pipeline/pipeline_routing_be.h b/examples/ip_pipeline/pipeline/pipeline_routing_be.h index 1276342..ea50896 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing_be.h +++ b/examples/ip_pipeline/pipeline/pipeline_routing_be.h @@ -42,7 +42,7 @@ * Pipeline argument parsing */ #ifndef PIPELINE_ROUTING_N_ROUTES_DEFAULT -#define PIPELINE_ROUTING_N_ROUTES_DEFAULT 4096 +#define PIPELINE_ROUTING_N_ROUTES_DEFAULT 65536 #endif enum pipeline_routing_encap { diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c index cdeb0f5..f2eaed5 100644 --- a/lib/librte_table/rte_table_lpm.c +++ b/lib/librte_table/rte_table_lpm.c @@ -44,7 +44,7 @@ #include "rte_table_lpm.h" -#define RTE_TABLE_LPM_MAX_NEXT_HOPS 256 +#define RTE_TABLE_LPM_MAX_NEXT_HOPS 65536 #ifdef RTE_TABLE_STATS_COLLECT @@ -74,7 +74,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 +188,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 +242,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__);