summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-10 10:23:36 +0200
committerJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-10 10:23:36 +0200
commit155c2a7183d92fc522b99d17440f1369557ea844 (patch)
treee67d77a90ae2c65e305fe05816e6820c472e97a9
parent44d6b602a1971caf3436da46125f41f23a514e80 (diff)
downloaddpdk-burst-replay-155c2a7183d92fc522b99d17440f1369557ea844.zip
dpdk-burst-replay-155c2a7183d92fc522b99d17440f1369557ea844.tar.gz
dpdk-burst-replay-155c2a7183d92fc522b99d17440f1369557ea844.tar.xz
Fix: pcap with too few packets makes rte_mempool_create to fail.
Fixed by increasing the wanted number of mbufs, even if not used.
-rw-r--r--src/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 864fbe6..7d27b82 100644
--- a/src/main.c
+++ b/src/main.c
@@ -194,6 +194,12 @@ int check_needed_memory(const struct cmd_opts* opts, const struct pcap_ctx* pcap
*/
dpdk->nb_mbuf = pcap->nb_pkts * opts->nb_pcicards;
#endif /* DPDK_RECOMMANDATIONS */
+ /*
+ If we have a pcap with very few packets, we need to allocate more mbufs
+ than necessary to avoid rte_mempool_create failure.
+ */
+ if (dpdk->nb_mbuf < (MBUF_CACHE_SZ * 2))
+ dpdk->nb_mbuf = MBUF_CACHE_SZ * 4;
printf("-> Needed number of MBUFS: %lu\n", dpdk->nb_mbuf);
/* # CALCULATE THE TOTAL NEEDED MEMORY SIZE */