{
printf("usage: %s [--interactive|-i] [--help|-h] | ["
"--coremask=COREMASK --portmask=PORTMASK --numa "
+ "--mbuf-size= | --total-num-mbufs= | "
"--eth-peers-configfile= | "
"--eth-peer=X,M:M:M:M:M:M | --nb-cores= | --nb-ports= | "
"--pkt-filter-mode= |"
printf(" --numa: enable NUMA-aware allocation of RX/TX rings and of "
" RX memory buffers (mbufs)\n");
printf(" --mbuf-size=N set the data size of mbuf to N bytes\n");
+ printf(" --total-num-mbufs=N set the number of mbufs to be allocated "
+ "in mbuf pools\n");
printf(" --max-pkt-len=N set the maximum size of packet to N bytes\n");
printf(" --pkt-filter-mode=N: set Flow director mode "
"( N: none (default mode) or signature or perfect)\n");
{ "portmask", 1, 0, 0 },
{ "numa", 0, 0, 0 },
{ "mbuf-size", 1, 0, 0 },
+ { "total-num-mbufs", 1, 0, 0 },
{ "max-pkt-len", 1, 0, 0 },
{ "pkt-filter-mode", 1, 0, 0 },
{ "pkt-filter-report-hash", 1, 0, 0 },
rte_exit(EXIT_FAILURE,
"mbuf-size should be > 0 and < 65536\n");
}
+ if (!strcmp(lgopts[opt_idx].name, "total-num-mbufs")) {
+ n = atoi(optarg);
+ if (n > 1024)
+ param_total_num_mbufs = (unsigned)n;
+ else
+ rte_exit(EXIT_FAILURE,
+ "total-num-mbufs should be > 1024\n");
+ }
if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
n = atoi(optarg);
if (n >= ETHER_MIN_LEN) {
struct fwd_engine *cur_fwd_eng = &io_fwd_engine; /**< IO mode by default. */
uint16_t mbuf_data_size = DEFAULT_MBUF_DATA_SIZE; /**< Mbuf data space size. */
+uint32_t param_total_num_mbufs = 0; /**< number of mbufs in all pools - if
+ * specified on command-line. */
/*
* Configuration of packet segments used by the "txonly" processing engine.
* If NUMA support is disabled, create a single pool of mbuf in
* socket 0 memory.
* Otherwise, create a pool of mbuf in the memory of sockets 0 and 1.
+ *
+ * Use the maximum value of nb_rxd and nb_txd here, then nb_rxd and
+ * nb_txd can be configured at run time.
*/
- nb_mbuf_per_pool = nb_rxd + (nb_lcores * mb_mempool_cache) +
- nb_txd + MAX_PKT_BURST;
+ if (param_total_num_mbufs)
+ nb_mbuf_per_pool = param_total_num_mbufs;
+ else {
+ nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + (nb_lcores * mb_mempool_cache)
+ + RTE_TEST_TX_DESC_MAX + MAX_PKT_BURST;
+ nb_mbuf_per_pool = (nb_mbuf_per_pool * nb_ports);
+ }
if (numa_support) {
- nb_mbuf_per_pool = nb_mbuf_per_pool * (nb_ports >> 1);
+ nb_mbuf_per_pool /= 2;
mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0);
mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 1);
} else {
- nb_mbuf_per_pool = (nb_mbuf_per_pool * nb_ports);
mbuf_pool_create(mbuf_data_size, nb_mbuf_per_pool, 0);
}