[dpdk-dev] [PATCH 2/2] examples: update to use new rte_lpm_config for ipv4
Michal Kobylinski
michalx.kobylinski at intel.com
Tue Mar 8 21:57:28 CET 2016
Signed-off-by: Michal Kobylinski <michalx.kobylinski at intel.com>
Acked-by: David Hunt <david.hunt at intel.com>
---
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
More information about the dev
mailing list