From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 2FCD32C66 for ; Tue, 8 Mar 2016 21:56:48 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 08 Mar 2016 12:56:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,558,1449561600"; d="scan'208";a="932498635" Received: from gklab-246-018.igk.intel.com (HELO stargo) ([10.217.246.18]) by fmsmga002.fm.intel.com with SMTP; 08 Mar 2016 12:56:47 -0800 Received: by stargo (sSMTP sendmail emulation); Tue, 08 Mar 2016 22:02:15 +0100 From: Michal Kobylinski To: dev@dpdk.org Date: Tue, 8 Mar 2016 21:57:28 +0100 Message-Id: <1457470648-26415-3-git-send-email-michalx.kobylinski@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1457470648-26415-1-git-send-email-michalx.kobylinski@intel.com> References: <1457470648-26415-1-git-send-email-michalx.kobylinski@intel.com> Subject: [dpdk-dev] [PATCH 2/2] examples: update to use new rte_lpm_config for ipv4 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, 08 Mar 2016 20:56:48 -0000 Signed-off-by: Michal Kobylinski Acked-by: David Hunt --- examples/ip_fragmentation/main.c | 7 ++++++- examples/ip_reassembly/main.c | 7 ++++++- examples/l3fwd-power/main.c | 10 ++++++++-- examples/l3fwd-vf/main.c | 10 ++++++++-- examples/l3fwd/l3fwd_lpm.c | 9 +++++++-- examples/load_balancer/init.c | 8 ++++++-- examples/performance-thread/l3fwd-thread/main.c | 8 ++++++-- 7 files changed, 47 insertions(+), 12 deletions(-) diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 0302b2c..8021702 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -721,6 +721,7 @@ init_mem(void) struct rte_mempool *mp; struct rte_lpm *lpm; struct rte_lpm6 *lpm6; + struct rte_lpm_config lpm_config; int socket; unsigned lcore_id; @@ -768,7 +769,11 @@ init_mem(void) RTE_LOG(INFO, IP_FRAG, "Creating LPM table on socket %i\n", socket); snprintf(buf, sizeof(buf), "IP_FRAG_LPM_%i", socket); - lpm = rte_lpm_create(buf, socket, LPM_MAX_RULES, 0); + lpm_config.max_rules = LPM_MAX_RULES; + lpm_config.number_tbl8s = 256; + lpm_config.flags = 0; + + lpm = rte_lpm_create(buf, socket, &lpm_config); if (lpm == NULL) { RTE_LOG(ERR, IP_FRAG, "Cannot create LPM table\n"); return -1; diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 6f48748..19ec46c 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -927,6 +927,7 @@ init_mem(void) char buf[PATH_MAX]; struct rte_lpm *lpm; struct rte_lpm6 *lpm6; + struct rte_lpm_config lpm_config; int socket; unsigned lcore_id; @@ -946,7 +947,11 @@ init_mem(void) RTE_LOG(INFO, IP_RSMBL, "Creating LPM table on socket %i\n", socket); snprintf(buf, sizeof(buf), "IP_RSMBL_LPM_%i", socket); - lpm = rte_lpm_create(buf, socket, LPM_MAX_RULES, 0); + lpm_config.max_rules = LPM_MAX_RULES; + lpm_config.number_tbl8s = 256; + lpm_config.flags = 0; + + lpm = rte_lpm_create(buf, socket, &lpm_config); if (lpm == NULL) { RTE_LOG(ERR, IP_RSMBL, "Cannot create LPM table\n"); return -1; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index a478583..f8a2f1b 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -1430,9 +1430,15 @@ setup_lpm(int socketid) char s[64]; /* create the LPM table */ + struct rte_lpm_config lpm_ipv4_config; + + lpm_ipv4_config.max_rules = IPV4_L3FWD_LPM_MAX_RULES; + lpm_ipv4_config.number_tbl8s = 256; + lpm_ipv4_config.flags = 0; + snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid); - ipv4_l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid, - IPV4_L3FWD_LPM_MAX_RULES, 0); + ipv4_l3fwd_lookup_struct[socketid] = + rte_lpm_create(s, socketid, &lpm_ipv4_config); if (ipv4_l3fwd_lookup_struct[socketid] == NULL) rte_exit(EXIT_FAILURE, "Unable to create the l3fwd LPM table" " on socket %d\n", socketid); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 193c3ab..034c22a 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -869,10 +869,16 @@ setup_lpm(int socketid) int ret; char s[64]; + struct rte_lpm_config lpm_ipv4_config; + + lpm_ipv4_config.max_rules = L3FWD_LPM_MAX_RULES; + lpm_ipv4_config.number_tbl8s = 256; + lpm_ipv4_config.flags = 0; + /* create the LPM table */ snprintf(s, sizeof(s), "L3FWD_LPM_%d", socketid); - l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid, - L3FWD_LPM_MAX_RULES, 0); + l3fwd_lookup_struct[socketid] = + rte_lpm_create(s, socketid, &lpm_ipv4_config); if (l3fwd_lookup_struct[socketid] == NULL) rte_exit(EXIT_FAILURE, "Unable to create the l3fwd LPM table" " on socket %d\n", socketid); diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index e0ed3c4..a354797 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -98,6 +98,7 @@ static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = { (sizeof(ipv6_l3fwd_lpm_route_array) / sizeof(ipv6_l3fwd_lpm_route_array[0])) #define IPV4_L3FWD_LPM_MAX_RULES 1024 +#define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8) #define IPV6_L3FWD_LPM_MAX_RULES 1024 #define IPV6_L3FWD_LPM_NUMBER_TBL8S (1 << 16) @@ -203,14 +204,18 @@ void setup_lpm(const int socketid) { struct rte_lpm6_config config; + struct rte_lpm_config config_ipv4; unsigned i; int ret; char s[64]; /* create the LPM table */ + config_ipv4.max_rules = IPV4_L3FWD_LPM_MAX_RULES; + config_ipv4.number_tbl8s = IPV4_L3FWD_LPM_NUMBER_TBL8S; + config_ipv4.flags = 0; snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid); - ipv4_l3fwd_lpm_lookup_struct[socketid] = rte_lpm_create(s, socketid, - IPV4_L3FWD_LPM_MAX_RULES, 0); + ipv4_l3fwd_lpm_lookup_struct[socketid] = + rte_lpm_create(s, socketid, &config_ipv4); if (ipv4_l3fwd_lpm_lookup_struct[socketid] == NULL) rte_exit(EXIT_FAILURE, "Unable to create the l3fwd LPM table on socket %d\n", diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 5a56078..a96d778 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -160,13 +160,17 @@ app_init_lpm_tables(void) continue; } + struct rte_lpm_config lpm_config; + + lpm_config.max_rules = APP_MAX_LPM_RULES; + lpm_config.number_tbl8s = 256; + lpm_config.flags = 0; snprintf(name, sizeof(name), "lpm_table_%u", socket); printf("Creating the LPM table for socket %u ...\n", socket); app.lpm_tables[socket] = rte_lpm_create( name, socket, - APP_MAX_LPM_RULES, - 0); + &lpm_config); if (app.lpm_tables[socket] == NULL) { rte_panic("Unable to create LPM table on socket %u\n", socket); } diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index f1381f2..e68f7cb 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -3249,14 +3249,18 @@ static void setup_lpm(int socketid) { struct rte_lpm6_config config; + struct rte_lpm_config lpm_ipv4_config; unsigned i; int ret; char s[64]; /* create the LPM table */ snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid); - ipv4_l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid, - IPV4_L3FWD_LPM_MAX_RULES, 0); + lpm_ipv4_config.max_rules = IPV4_L3FWD_LPM_MAX_RULES; + lpm_ipv4_config.number_tbl8s = 256; + lpm_ipv4_config.flags = 0; + ipv4_l3fwd_lookup_struct[socketid] = + rte_lpm_create(s, socketid, &lpm_ipv4_config); if (ipv4_l3fwd_lookup_struct[socketid] == NULL) rte_exit(EXIT_FAILURE, "Unable to create the l3fwd LPM table" " on socket %d\n", socketid); -- 1.9.1