aboutsummaryrefslogtreecommitdiffstats
path: root/examples/udpfwd/parse.c
diff options
context:
space:
mode:
authorMohammad Abdul Awal <mohammad.abdul.awal@intel.com>2016-09-10 11:24:16 +0100
committerMohammad Abdul Awal <mohammad.abdul.awal@intel.com>2016-09-15 09:50:32 +0100
commit258f299a2a152acab4ce497673eb293c5da15f73 (patch)
tree5dce0223129b7997602441e52a6d463727dea273 /examples/udpfwd/parse.c
parente57f675d4de058f99819dd2d228656533961f38a (diff)
udpfw: dynamic allocation of netbe_* structures
This patch allows dynamic allocation of memory for the appliation. The solves the problem of allocating large amount of static memory which caused accessing the momory locations outside of 32-bit address-space duing compile-time. Change-Id: If8031ba846e4ed339d8ce8ebe4fd69325f098d17 Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Diffstat (limited to 'examples/udpfwd/parse.c')
-rw-r--r--examples/udpfwd/parse.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/udpfwd/parse.c b/examples/udpfwd/parse.c
index cc8c0b2..09c4a96 100644
--- a/examples/udpfwd/parse.c
+++ b/examples/udpfwd/parse.c
@@ -201,7 +201,7 @@ int
parse_netbe_arg(struct netbe_port *prt, const char *arg)
{
int32_t rc;
- uint32_t i, j;
+ uint32_t i, j, nc;
static const char *keys_man[] = {
"port",
@@ -237,10 +237,17 @@ parse_netbe_arg(struct netbe_port *prt, const char *arg)
return rc;
prt->id = val[0].u64;
+
+ for (i = 0, nc = 0; i < RTE_MAX_LCORE; i++)
+ nc += CPU_ISSET(i, &val[1].cpuset);
+ prt->lcore = rte_zmalloc(NULL, nc * sizeof(prt->lcore[0]),
+ RTE_CACHE_LINE_SIZE);
+ prt->nb_lcore = nc;
+
for (i = 0, j = 0; i < RTE_MAX_LCORE; i++)
if (CPU_ISSET(i, &val[1].cpuset))
prt->lcore[j++] = i;
- prt->nb_lcore = j;
+
prt->mtu = val[2].u64;
prt->rx_offload = val[3].u64;
prt->tx_offload = val[4].u64;