From patchwork Thu Sep 17 16:03:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jasvinder Singh X-Patchwork-Id: 7058 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 3D3005A03; Thu, 17 Sep 2015 18:03:27 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 7340858CB for ; Thu, 17 Sep 2015 18:03:25 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 17 Sep 2015 09:03:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,548,1437462000"; d="scan'208";a="791818217" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 17 Sep 2015 09:03:23 -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 t8HG3N2T008051; Thu, 17 Sep 2015 17:03:23 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t8HG3MT1010078; Thu, 17 Sep 2015 17:03:22 +0100 Received: (from jasvinde@localhost) by sivswdev02.ir.intel.com with id t8HG3MHk010073; Thu, 17 Sep 2015 17:03:22 +0100 From: Jasvinder Singh To: dev@dpdk.org Date: Thu, 17 Sep 2015 17:03:19 +0100 Message-Id: <1442505802-10034-2-git-send-email-jasvinder.singh@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1442505802-10034-1-git-send-email-jasvinder.singh@intel.com> References: <1442505802-10034-1-git-send-email-jasvinder.singh@intel.com> Subject: [dpdk-dev] [PATCH v2 1/4] librte_table: modify LPM table parameter structure 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" This patch relates to ABI change proposed for librte_table (lpm table). A new parameter to hold the table name has been added to the LPM table parameter structures rte_table_lpm_params and rte_table_lpm_ipv6_params. Signed-off-by: Jasvinder Singh --- lib/librte_table/rte_table_lpm.c | 8 ++++++-- lib/librte_table/rte_table_lpm.h | 3 +++ lib/librte_table/rte_table_lpm_ipv6.c | 8 ++++++-- lib/librte_table/rte_table_lpm_ipv6.h | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/librte_table/rte_table_lpm.c b/lib/librte_table/rte_table_lpm.c index b218d64..849d899 100644 --- a/lib/librte_table/rte_table_lpm.c +++ b/lib/librte_table/rte_table_lpm.c @@ -103,7 +103,11 @@ rte_table_lpm_create(void *params, int socket_id, uint32_t entry_size) __func__); return NULL; } - + if (p->name == NULL) { + RTE_LOG(ERR, TABLE, "%s: Table name is NULL\n", + __func__); + return NULL; + } entry_size = RTE_ALIGN(entry_size, sizeof(uint64_t)); /* Memory allocation */ @@ -119,7 +123,7 @@ rte_table_lpm_create(void *params, int socket_id, uint32_t entry_size) } /* LPM low-level table creation */ - lpm->lpm = rte_lpm_create("LPM", socket_id, p->n_rules, 0); + lpm->lpm = rte_lpm_create(p->name, socket_id, p->n_rules, 0); if (lpm->lpm == NULL) { rte_free(lpm); RTE_LOG(ERR, TABLE, "Unable to create low-level LPM table\n"); diff --git a/lib/librte_table/rte_table_lpm.h b/lib/librte_table/rte_table_lpm.h index c08c958..06e8410 100644 --- a/lib/librte_table/rte_table_lpm.h +++ b/lib/librte_table/rte_table_lpm.h @@ -77,6 +77,9 @@ extern "C" { /** LPM table parameters */ struct rte_table_lpm_params { + /** Table name */ + const char *name; + /** Maximum number of LPM rules (i.e. IP routes) */ uint32_t n_rules; diff --git a/lib/librte_table/rte_table_lpm_ipv6.c b/lib/librte_table/rte_table_lpm_ipv6.c index ff4a9c2..e9bc6a7 100644 --- a/lib/librte_table/rte_table_lpm_ipv6.c +++ b/lib/librte_table/rte_table_lpm_ipv6.c @@ -109,7 +109,11 @@ rte_table_lpm_ipv6_create(void *params, int socket_id, uint32_t entry_size) __func__); return NULL; } - + if (p->name == NULL) { + RTE_LOG(ERR, TABLE, "%s: Table name is NULL\n", + __func__); + return NULL; + } entry_size = RTE_ALIGN(entry_size, sizeof(uint64_t)); /* Memory allocation */ @@ -128,7 +132,7 @@ rte_table_lpm_ipv6_create(void *params, int socket_id, uint32_t entry_size) lpm6_config.max_rules = p->n_rules; lpm6_config.number_tbl8s = p->number_tbl8s; lpm6_config.flags = 0; - lpm->lpm = rte_lpm6_create("LPM IPv6", socket_id, &lpm6_config); + lpm->lpm = rte_lpm6_create(p->name, socket_id, &lpm6_config); if (lpm->lpm == NULL) { rte_free(lpm); RTE_LOG(ERR, TABLE, diff --git a/lib/librte_table/rte_table_lpm_ipv6.h b/lib/librte_table/rte_table_lpm_ipv6.h index 91fb0d8..43aea39 100644 --- a/lib/librte_table/rte_table_lpm_ipv6.h +++ b/lib/librte_table/rte_table_lpm_ipv6.h @@ -79,6 +79,9 @@ extern "C" { /** LPM table parameters */ struct rte_table_lpm_ipv6_params { + /** Table name */ + const char *name; + /** Maximum number of LPM rules (i.e. IP routes) */ uint32_t n_rules;