app/eventdev: support burst enqueue

Introduce 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 <rashmi.shetty@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Rashmi Shetty 2021-10-15 10:18:53 -05:00 committed by Jerin Jacob
parent c0900d3344
commit 20841a2551
7 changed files with 117 additions and 6 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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},

View File

@ -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")

View File

@ -77,6 +77,71 @@ 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];
struct rte_event ev[MAX_PROD_ENQ_BURST_SIZE + 1];
uint32_t burst_size = opt->prod_enq_burst_sz;
memset(m, 0, sizeof(*m) * (MAX_PROD_ENQ_BURST_SIZE + 1));
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 +277,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 +712,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

View File

@ -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;\

View File

@ -155,9 +155,15 @@ The following are the application command-line options:
* ``--max_pkt_sz``
Set max packet mbuf size. Can be used configure Rx/Tx scatter gather.
Set max packet mbuf size. Can be used to configure Rx/Tx scatter gather.
Only applicable for `pipeline_atq` and `pipeline_queue` tests.
* ``--prod_enq_burst_sz``
Set producer enqueue burst size. Can be used to configure the number of
events the producer(s) will enqueue as a burst to the event device.
Only applicable for `perf_queue` test.
* ``--nb_eth_queues``
Configure multiple Rx queues per each ethernet port.
@ -374,8 +380,9 @@ The user can choose the number of workers, the number of producers and number of
stages through the ``--wlcores``, ``--plcores`` and the ``--stlist`` application
command line arguments respectively.
The producer(s) injects the events to eventdev based the first stage sched type
list requested by the user through ``--stlist`` the command line argument.
The producer(s) injects the events to eventdev based on the first stage sched type
list requested by the user through ``--stlist`` command line argument. It can
inject a burst of events using ``--prod_enq_burst_sz`` command line argument.
Based on the number of stages to process(selected through ``--stlist``),
The application forwards the event to next upstream queue and terminates when it
@ -413,6 +420,7 @@ Supported application command line options are following::
--prod_type_ethdev
--prod_type_timerdev_burst
--prod_type_timerdev
--prod_enq_burst_sz
--timer_tick_nsec
--max_tmo_nsec
--expiry_nsec
@ -430,6 +438,14 @@ Example command to run perf queue test:
sudo <build_dir>/app/dpdk-test-eventdev -c 0xf -s 0x1 --vdev=event_sw0 -- \
--test=perf_queue --plcores=2 --wlcore=3 --stlist=p --nb_pkts=0
Example command to run perf queue test with producer enqueuing a burst of events:
.. code-block:: console
sudo <build_dir>/app/dpdk-test-eventdev -c 0xf -s 0x1 --vdev=event_sw0 -- \
--test=perf_queue --plcores=2 --wlcore=3 --stlist=p --nb_pkts=0 \
--prod_enq_burst_sz=32
Example command to run perf queue test with ethernet ports:
.. code-block:: console