summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-01-30 14:45:01 +0100
committerJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-01-30 14:55:34 +0100
commit44d6b602a1971caf3436da46125f41f23a514e80 (patch)
treefad0f2f4e35bac372ca25e2a98f12c3709993c5a
parentb8b81e28b75e59854c547caccb9dc386503b6b7c (diff)
downloaddpdk-burst-replay-wip-big-mempool-allocation.zip
dpdk-burst-replay-wip-big-mempool-allocation.tar.gz
dpdk-burst-replay-wip-big-mempool-allocation.tar.xz
Do not calculate anymore the needed number of mbufs respecting the DPDK suggestion [1]. Thiswip-big-mempool-allocation
will reduce (sometimes drastically) the memory needed. [1]: "The optimum size (in terms of memory usage) for a mempool is when n is a power of two minus one": http://doc.dpdk.org/api/rte__mempool_8h.html#a503f2f889043a48ca9995878846db2fd
-rw-r--r--src/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 036ec62..864fbe6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -177,6 +177,7 @@ int check_needed_memory(const struct cmd_opts* opts, const struct pcap_ctx* pcap
printf("-> Needed MBUF size: %lu\n", dpdk->mbuf_sz);
/* # CALCULATE THE NEEDED NUMBER OF MBUFS */
+#ifdef DPDK_RECOMMANDATIONS
/* For number of pkts to be allocated on the mempool, DPDK says: */
/* The optimum size (in terms of memory usage) for a mempool is when n is a
power of two minus one: n = (2^q - 1). */
@@ -185,6 +186,14 @@ int check_needed_memory(const struct cmd_opts* opts, const struct pcap_ctx* pcap
"(nb pkts * nb ports)");
#endif /* DEBUG */
dpdk->nb_mbuf = get_next_power_of_2(pcap->nb_pkts * opts->nb_pcicards) - 1;
+#else /* !DPDK_RECOMMANDATIONS */
+ /*
+ Some tests shown that the perf are not so much impacted when allocating the
+ exact number of wanted mbufs. I keep it simple for now to reduce the needed
+ memory on large pcap.
+ */
+ dpdk->nb_mbuf = pcap->nb_pkts * opts->nb_pcicards;
+#endif /* DPDK_RECOMMANDATIONS */
printf("-> Needed number of MBUFS: %lu\n", dpdk->nb_mbuf);
/* # CALCULATE THE TOTAL NEEDED MEMORY SIZE */