summaryrefslogtreecommitdiff
path: root/examples/l3fwd
diff options
context:
space:
mode:
authorMichal Kobylinski <michalx.kobylinski@intel.com>2016-03-09 17:57:16 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-03-09 23:05:05 +0100
commitf1f7261838b38f57fb1b3e62d1f97164439d017d (patch)
treedc9d154d184f192397c9b62e797056f7c57a6190 /examples/l3fwd
parentdc81ebbacaeb87d9dab302576ab676564c78557e (diff)
downloaddpdk-f1f7261838b38f57fb1b3e62d1f97164439d017d.zip
dpdk-f1f7261838b38f57fb1b3e62d1f97164439d017d.tar.gz
dpdk-f1f7261838b38f57fb1b3e62d1f97164439d017d.tar.xz
lpm: add a new config structure for IPv4
A new rte_lpm_config structure is used so LPM library will allocate exactly the amount of memory which is necessary to hold application’s rules. Signed-off-by: Michal Kobylinski <michalx.kobylinski@intel.com> Acked-by: David Hunt <david.hunt@intel.com>
Diffstat (limited to 'examples/l3fwd')
-rw-r--r--examples/l3fwd/l3fwd_lpm.c9
1 files changed, 7 insertions, 2 deletions
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",