summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-19 16:48:49 +0200
committerJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-19 16:48:49 +0200
commitb5b1be0279d2f00fde09c50ac18b9c9b9d351848 (patch)
tree42f0834204c9fd54de3758d037d3085e58eccee6
parent1dba5c7779bca87317c21bc33c21b7d9c733f91c (diff)
downloaddpdk-burst-replay-b5b1be0279d2f00fde09c50ac18b9c9b9d351848.zip
dpdk-burst-replay-b5b1be0279d2f00fde09c50ac18b9c9b9d351848.tar.gz
dpdk-burst-replay-b5b1be0279d2f00fde09c50ac18b9c9b9d351848.tar.xz
Make it works for big pcap files with DPDK >= 18.05.
Add also an error message if you try to allocate more memory than RTE_MAX_MEM_MB_PER_LIST.
-rw-r--r--src/dpdk.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/dpdk.c b/src/dpdk.c
index 955763b..6d52dfa 100644
--- a/src/dpdk.c
+++ b/src/dpdk.c
@@ -62,29 +62,36 @@ char** fill_eal_args(const struct cmd_opts* opts, const struct cpus_bindings* cp
const struct dpdk_ctx* dpdk, int* eal_args_ac)
{
char buf_coremask[30];
- char socket_mem_arg[32];
char** eal_args;
- int i, cpt, mempool;
+ int i, cpt;
+#if API_OLDEST_THAN(18, 05)
+ char socket_mem_arg[32];
+ int mempool;
+#endif /* API_OLDEST_THAN(18, 05) */
if (!opts || !cpus || !dpdk)
return (NULL);
- mempool = dpdk->pool_sz * 1024;
/* Set EAL init parameters */
snprintf(buf_coremask, 20, "0x%lx", cpus->coremask);
+#if API_OLDEST_THAN(18, 05)
+ mempool = dpdk->pool_sz * 1024;
if (cpus->numacores == 1)
snprintf(socket_mem_arg, sizeof(socket_mem_arg), "--socket-mem=%i", mempool);
else if (cpus->numacore == 0)
snprintf(socket_mem_arg, sizeof(socket_mem_arg), "--socket-mem=%i,0", mempool);
else
snprintf(socket_mem_arg, sizeof(socket_mem_arg), "--socket-mem=0,%i", mempool);
+#endif /* API_OLDEST_THAN(18, 05) */
char *pre_eal_args[] = {
"./dpdk-replay",
"-c", strdup(buf_coremask),
"-n", "1", /* NUM MEM CHANNELS */
"--proc-type", "auto",
"--file-prefix", "dpdkreplay_",
+#if API_OLDEST_THAN(18, 11)
strdup(socket_mem_arg),
+#endif /* API_OLDEST_THAN(18, 11) */
NULL
};
/* fill pci whitelist args */
@@ -230,8 +237,16 @@ int init_dpdk_eal_mempool(const struct cmd_opts* opts,
cpus->numacore,
0);
if (dpdk->pktmbuf_pool == NULL) {
- fprintf(stderr, "DPDK: RTE Mempool creation failed\n");
- return (1);
+ fprintf(stderr, "DPDK: RTE Mempool creation failed (%s)\n",
+ rte_strerror(rte_errno));
+ if (rte_errno == ENOMEM
+ && (dpdk->nb_mbuf * dpdk->mbuf_sz /1024/1024) > RTE_MAX_MEM_MB_PER_LIST)
+ fprintf(stderr, "Your version of DPDK was configured to use at maximum"
+ " %u Mo, or you try to allocate ~%lu Mo.\n"
+ "Try to recompile DPDK by setting CONFIG_RTE_MAX_MEM_MB_PER_LIST"
+ " according to your needs.\n", RTE_MAX_MEM_MB_PER_LIST,
+ dpdk->nb_mbuf * dpdk->mbuf_sz /1024/1024);
+ return (rte_errno);
}
return (0);
}