examples/eventdev: add mempool size configuration
authorPavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Wed, 10 Jan 2018 11:10:11 +0000 (16:40 +0530)
committerJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 19 Jan 2018 15:09:56 +0000 (16:09 +0100)
Add option to configure the mempool size at run time instead of
hardcoding it to 16384 * num_ports.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
examples/eventdev_pipeline_sw_pmd/main.c
examples/eventdev_pipeline_sw_pmd/pipeline_common.h

index 81ba340..2422c18 100644 (file)
@@ -116,6 +116,7 @@ static struct option long_options[] = {
        {"sched-mask", required_argument, 0, 'e'},
        {"cq-depth", required_argument, 0, 'c'},
        {"work-cycles", required_argument, 0, 'W'},
+       {"mempool-size", required_argument, 0, 'm'},
        {"queue-priority", no_argument, 0, 'P'},
        {"parallel", no_argument, 0, 'p'},
        {"ordered", no_argument, 0, 'o'},
@@ -145,6 +146,7 @@ usage(void)
                "  -p, --parallel               Use parallel scheduling\n"
                "  -q, --quiet                  Minimize printed output\n"
                "  -a, --use-atq                Use all type queues\n"
+               "  -m, --mempool-size=N         Dictate the mempool size\n"
                "  -D, --dump                   Print detailed statistics before exit"
                "\n";
        fprintf(stderr, "%s", usage_str);
@@ -165,7 +167,7 @@ parse_app_args(int argc, char **argv)
        int i;
 
        for (;;) {
-               c = getopt_long(argc, argv, "r:t:e:c:w:n:f:s:paoPqDW:",
+               c = getopt_long(argc, argv, "r:t:e:c:w:n:f:s:m:paoPqDW:",
                                long_options, &option_index);
                if (c == -1)
                        break;
@@ -225,6 +227,9 @@ parse_app_args(int argc, char **argv)
                        popcnt = __builtin_popcountll(sched_lcore_mask);
                        fdata->sched_single = (popcnt == 1);
                        break;
+               case 'm':
+                       cdata.num_mbuf = (uint64_t)atol(optarg);
+                       break;
                default:
                        usage();
                }
@@ -339,8 +344,11 @@ init_ports(unsigned int num_ports)
        uint8_t portid;
        unsigned int i;
 
+       if (!cdata.num_mbuf)
+               cdata.num_mbuf = 16384 * num_ports;
+
        struct rte_mempool *mp = rte_pktmbuf_pool_create("packet_pool",
-                       /* mbufs */ 16384 * num_ports,
+                       /* mbufs */ cdata.num_mbuf,
                        /* cache_size */ 512,
                        /* priv_size*/ 0,
                        /* data_room_size */ RTE_MBUF_DEFAULT_BUF_SIZE,
index 6655303..9703396 100644 (file)
@@ -70,6 +70,7 @@ struct config_data {
        unsigned int active_cores;
        unsigned int num_workers;
        int64_t num_packets;
+       uint64_t num_mbuf;
        unsigned int num_fids;
        int queue_type;
        int worker_cycles;