From: Intel Date: Mon, 22 Jul 2013 22:00:00 +0000 (+0200) Subject: examples/qos_sched: add --msz for mempool size X-Git-Tag: spdx-start~11167 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e93b24a3da57166218598d116bd3a2df7865974a;p=dpdk.git examples/qos_sched: add --msz for mempool size Signed-off-by: Intel --- diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index c9cfdb24b3..b28729fd26 100755 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -85,6 +85,7 @@ static const char usage[] = " QoS enqueue size (default value is %u) \n" " C = QoS dequeue size (default value is %u) \n" " D = Worker lcore write burst size to NIC TX (default value is %u) \n" + " --msz M : Mempool size (in number of mbufs) for each pfc (default %u) \n" " --rth \"A, B, C\" : RX queue threshold parameters \n" " A = RX prefetch threshold (default value is %u) \n" " B = RX host threshold (default value is %u) \n" @@ -102,7 +103,8 @@ app_usage(const char *prgname) { printf(usage, prgname, app_master_core, APP_RX_DESC_DEFAULT, APP_RING_SIZE, APP_TX_DESC_DEFAULT, - MAX_PKT_RX_BURST, PKT_ENQUEUE, PKT_DEQUEUE, MAX_PKT_TX_BURST, + MAX_PKT_RX_BURST, PKT_ENQUEUE, PKT_DEQUEUE, + MAX_PKT_TX_BURST, NB_MBUF, RX_PTHRESH, RX_HTHRESH, RX_WTHRESH, TX_PTHRESH, TX_HTHRESH, TX_WTHRESH ); @@ -336,6 +338,7 @@ app_parse_args(int argc, char **argv) { "mst", 1, 0, 0 }, { "rsz", 1, 0, 0 }, { "bsz", 1, 0, 0 }, + { "msz", 1, 0, 0 }, { "rth", 1, 0, 0 }, { "tth", 1, 0, 0 }, { "cfg", 1, 0, 0 }, @@ -388,6 +391,14 @@ app_parse_args(int argc, char **argv) } break; } + if (str_is(optname, "msz")) { + mp_size = atoi(optarg); + if (mp_size <= 0) { + RTE_LOG(ERR, APP, "Invalid mempool size %s\n", optarg); + return -1; + } + break; + } if (str_is(optname, "rth")) { ret = app_parse_rth_conf(optarg); if (ret) { diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index 7c40fd8a63..b2e7b7175f 100755 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -81,6 +81,7 @@ struct ring_thresh tx_thresh = { uint32_t nb_pfc; const char *cfg_profile = NULL; +int mp_size = NB_MBUF; struct flow_conf qos_conf[MAX_DATA_STREAMS]; static const struct rte_eth_conf port_conf = { @@ -343,7 +344,7 @@ int app_init(void) /* create the mbuf pools for each RX Port */ rte_snprintf(pool_name, MAX_NAME_LEN, "mbuf_pool%u", i); - qos_conf[i].mbuf_pool = rte_mempool_create(pool_name, NB_MBUF, MBUF_SIZE, + qos_conf[i].mbuf_pool = rte_mempool_create(pool_name, mp_size, MBUF_SIZE, burst_conf.rx_burst * 4, sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, NULL, @@ -365,7 +366,7 @@ int app_init(void) rte_get_timer_hz()); RTE_LOG(INFO, APP, "Ring sizes: NIC RX = %u, Mempool = %d SW queue = %u," - "NIC TX = %u\n", ring_conf.rx_size, NB_MBUF, ring_conf.ring_size, + "NIC TX = %u\n", ring_conf.rx_size, mp_size, ring_conf.ring_size, ring_conf.tx_size); RTE_LOG(INFO, APP, "Burst sizes: RX read = %hu, RX write = %hu,\n" diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h index 243064c51d..20ed590f5f 100755 --- a/examples/qos_sched/main.h +++ b/examples/qos_sched/main.h @@ -57,7 +57,7 @@ extern "C" { #define MBUF_SIZE (1528 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define APP_RING_SIZE (8*1024) -#define NB_MBUF (64*1024*32) +#define NB_MBUF (2*1024*1024) #define MAX_PKT_RX_BURST 64 #define PKT_ENQUEUE 64 @@ -159,6 +159,7 @@ struct ring_thresh extern uint32_t nb_pfc; extern const char *cfg_profile; +extern int mp_size; extern struct flow_conf qos_conf[]; extern int app_pipe_to_profile[MAX_SCHED_SUBPORTS][MAX_SCHED_PIPES];