From patchwork Wed Oct 13 20:16:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rashmi Shetty X-Patchwork-Id: 101510 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8487EA0C55; Wed, 13 Oct 2021 22:16:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 501EA41125; Wed, 13 Oct 2021 22:16:17 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 531D0410FA for ; Wed, 13 Oct 2021 22:16:15 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="250949153" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="250949153" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 13:16:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="491626391" Received: from txanpdk02.an.intel.com ([10.123.117.76]) by orsmga008.jf.intel.com with ESMTP; 13 Oct 2021 13:16:13 -0700 From: Rashmi Shetty To: dev@dpdk.org Cc: jerinj@marvell.com, harry.van.haaren@intel.com, pravin.pathak@intel.com, Rashmi Shetty Date: Wed, 13 Oct 2021 15:16:02 -0500 Message-Id: <20211013201602.113694-1-rashmi.shetty@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211012210532.78287-1-rashmi.shetty@intel.com> References: <20211012210532.78287-1-rashmi.shetty@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2] app/test-eventdev: add burst enqueue support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit introduces a new command line option prod_enq_burst_sz to set burst size for eventdev enqueue at producer in perf_queue test. The newly added function perf_producer_burst is called when prod_enq_burst_sz is greater than 1. Signed-off-by: Rashmi Shetty --- app/test-eventdev/evt_common.h | 1 + app/test-eventdev/evt_main.c | 2 +- app/test-eventdev/evt_options.c | 14 +++++ app/test-eventdev/evt_options.h | 1 + app/test-eventdev/test_perf_common.c | 81 +++++++++++++++++++++++++++- app/test-eventdev/test_perf_common.h | 1 + 6 files changed, 97 insertions(+), 3 deletions(-) diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h index 28afb114b3..f466434459 100644 --- a/app/test-eventdev/evt_common.h +++ b/app/test-eventdev/evt_common.h @@ -64,6 +64,7 @@ struct evt_options { uint32_t nb_flows; uint32_t tx_first; uint32_t max_pkt_sz; + uint32_t prod_enq_burst_sz; uint32_t deq_tmo_nsec; uint32_t q_priority:1; uint32_t fwd_latency:1; diff --git a/app/test-eventdev/evt_main.c b/app/test-eventdev/evt_main.c index a8d304bab3..3534aabca7 100644 --- a/app/test-eventdev/evt_main.c +++ b/app/test-eventdev/evt_main.c @@ -95,7 +95,7 @@ main(int argc, char **argv) /* Parse the command line arguments */ ret = evt_options_parse(&opt, argc, argv); if (ret) { - evt_err("parsing on or more user options failed"); + evt_err("parsing one or more user options failed"); goto error; } diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c index b0bcbc6c96..753a7dbd7d 100644 --- a/app/test-eventdev/evt_options.c +++ b/app/test-eventdev/evt_options.c @@ -26,6 +26,7 @@ evt_options_default(struct evt_options *opt) opt->nb_flows = 1024; opt->socket_id = SOCKET_ID_ANY; opt->pool_sz = 16 * 1024; + opt->prod_enq_burst_sz = 1; opt->wkr_deq_dep = 16; opt->nb_pkts = (1ULL << 26); /* do ~64M packets */ opt->nb_timers = 1E8; @@ -304,6 +305,16 @@ evt_parse_per_port_pool(struct evt_options *opt, const char *arg __rte_unused) return 0; } +static int +evt_parse_prod_enq_burst_sz(struct evt_options *opt, const char *arg) +{ + int ret; + + ret = parser_read_uint32(&(opt->prod_enq_burst_sz), arg); + + return ret; +} + static void usage(char *program) { @@ -336,6 +347,7 @@ usage(char *program) "\t--expiry_nsec : event timer expiry ns.\n" "\t--mbuf_sz : packet mbuf size.\n" "\t--max_pkt_sz : max packet size.\n" + "\t--prod_enq_burst_sz : producer enqueue burst size.\n" "\t--nb_eth_queues : number of ethernet Rx queues.\n" "\t--enable_vector : enable event vectorization.\n" "\t--vector_size : Max vector size.\n" @@ -412,6 +424,7 @@ static struct option lgopts[] = { { EVT_EXPIRY_NSEC, 1, 0, 0 }, { EVT_MBUF_SZ, 1, 0, 0 }, { EVT_MAX_PKT_SZ, 1, 0, 0 }, + { EVT_PROD_ENQ_BURST_SZ, 1, 0, 0 }, { EVT_NB_ETH_QUEUES, 1, 0, 0 }, { EVT_ENA_VECTOR, 0, 0, 0 }, { EVT_VECTOR_SZ, 1, 0, 0 }, @@ -451,6 +464,7 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt) { EVT_EXPIRY_NSEC, evt_parse_expiry_nsec}, { EVT_MBUF_SZ, evt_parse_mbuf_sz}, { EVT_MAX_PKT_SZ, evt_parse_max_pkt_sz}, + { EVT_PROD_ENQ_BURST_SZ, evt_parse_prod_enq_burst_sz}, { EVT_NB_ETH_QUEUES, evt_parse_eth_queues}, { EVT_ENA_VECTOR, evt_parse_ena_vector}, { EVT_VECTOR_SZ, evt_parse_vector_size}, diff --git a/app/test-eventdev/evt_options.h b/app/test-eventdev/evt_options.h index 6436200b40..413d7092f0 100644 --- a/app/test-eventdev/evt_options.h +++ b/app/test-eventdev/evt_options.h @@ -42,6 +42,7 @@ #define EVT_EXPIRY_NSEC ("expiry_nsec") #define EVT_MBUF_SZ ("mbuf_sz") #define EVT_MAX_PKT_SZ ("max_pkt_sz") +#define EVT_PROD_ENQ_BURST_SZ ("prod_enq_burst_sz") #define EVT_NB_ETH_QUEUES ("nb_eth_queues") #define EVT_ENA_VECTOR ("enable_vector") #define EVT_VECTOR_SZ ("vector_size") diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index cc100650c2..e0d9f05ecd 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -77,6 +77,70 @@ perf_producer(void *arg) return 0; } +static inline int +perf_producer_burst(void *arg) +{ + uint32_t i; + uint64_t timestamp; + struct rte_event_dev_info dev_info; + struct prod_data *p = arg; + struct test_perf *t = p->t; + struct evt_options *opt = t->opt; + const uint8_t dev_id = p->dev_id; + const uint8_t port = p->port_id; + struct rte_mempool *pool = t->pool; + const uint64_t nb_pkts = t->nb_pkts; + const uint32_t nb_flows = t->nb_flows; + uint32_t flow_counter = 0; + uint16_t enq = 0; + uint64_t count = 0; + struct perf_elt *m[MAX_PROD_ENQ_BURST_SIZE + 1] = {NULL}; + struct rte_event ev[MAX_PROD_ENQ_BURST_SIZE + 1]; + uint32_t burst_size = opt->prod_enq_burst_sz; + + rte_event_dev_info_get(dev_id, &dev_info); + if (dev_info.max_event_port_enqueue_depth < burst_size) + burst_size = dev_info.max_event_port_enqueue_depth; + + if (opt->verbose_level > 1) + printf("%s(): lcore %d dev_id %d port=%d queue %d\n", __func__, + rte_lcore_id(), dev_id, port, p->queue_id); + + for (i = 0; i < burst_size; i++) { + ev[i].op = RTE_EVENT_OP_NEW; + ev[i].queue_id = p->queue_id; + ev[i].sched_type = t->opt->sched_type_list[0]; + ev[i].priority = RTE_EVENT_DEV_PRIORITY_NORMAL; + ev[i].event_type = RTE_EVENT_TYPE_CPU; + ev[i].sub_event_type = 0; /* stage 0 */ + } + + while (count < nb_pkts && t->done == false) { + if (rte_mempool_get_bulk(pool, (void **)m, burst_size) < 0) + continue; + timestamp = rte_get_timer_cycles(); + for (i = 0; i < burst_size; i++) { + ev[i].flow_id = flow_counter++ % nb_flows; + ev[i].event_ptr = m[i]; + m[i]->timestamp = timestamp; + } + enq = rte_event_enqueue_burst(dev_id, port, ev, burst_size); + while (enq < burst_size) { + enq += rte_event_enqueue_burst(dev_id, port, + ev + enq, + burst_size - enq); + if (t->done) + break; + rte_pause(); + timestamp = rte_get_timer_cycles(); + for (i = enq; i < burst_size; i++) + m[i]->timestamp = timestamp; + } + count += burst_size; + } + return 0; +} + static inline int perf_event_timer_producer(void *arg) { @@ -212,9 +276,21 @@ perf_producer_wrapper(void *arg) { struct prod_data *p = arg; struct test_perf *t = p->t; - /* Launch the producer function only in case of synthetic producer. */ - if (t->opt->prod_type == EVT_PROD_TYPE_SYNT) + bool burst = evt_has_burst_mode(p->dev_id); + + /* In case of synthetic producer, launch perf_producer or + * perf_producer_burst depending on producer enqueue burst size + */ + if (t->opt->prod_type == EVT_PROD_TYPE_SYNT && + t->opt->prod_enq_burst_sz == 1) return perf_producer(arg); + else if (t->opt->prod_type == EVT_PROD_TYPE_SYNT && + t->opt->prod_enq_burst_sz > 1) { + if (!burst) + evt_err("This event device does not support burst mode"); + else + return perf_producer_burst(arg); + } else if (t->opt->prod_type == EVT_PROD_TYPE_EVENT_TIMER_ADPTR && !t->opt->timdev_use_burst) return perf_event_timer_producer(arg); @@ -635,6 +711,7 @@ perf_opt_dump(struct evt_options *opt, uint8_t nb_queues) evt_dump_queue_priority(opt); evt_dump_sched_type_list(opt); evt_dump_producer_type(opt); + evt_dump("prod_enq_burst_sz", "%d", opt->prod_enq_burst_sz); } void diff --git a/app/test-eventdev/test_perf_common.h b/app/test-eventdev/test_perf_common.h index 9785dc3e23..14dcf80429 100644 --- a/app/test-eventdev/test_perf_common.h +++ b/app/test-eventdev/test_perf_common.h @@ -71,6 +71,7 @@ struct perf_elt { } __rte_cache_aligned; #define BURST_SIZE 16 +#define MAX_PROD_ENQ_BURST_SIZE 128 #define PERF_WORKER_INIT\ struct worker_data *w = arg;\