return ret;
}
+static int
+evt_parse_per_port_pool(struct evt_options *opt, const char *arg __rte_unused)
+{
+ opt->per_port_pool = 1;
+ return 0;
+}
+
static void
usage(char *program)
{
"\t--enable_vector : enable event vectorization.\n"
"\t--vector_size : Max vector size.\n"
"\t--vector_tmo_ns : Max vector timeout in nanoseconds\n"
+ "\t--per_port_pool : Configure unique pool per ethdev port\n"
);
printf("available tests:\n");
evt_test_dump_names();
{ EVT_ENA_VECTOR, 0, 0, 0 },
{ EVT_VECTOR_SZ, 1, 0, 0 },
{ EVT_VECTOR_TMO, 1, 0, 0 },
+ { EVT_PER_PORT_POOL, 0, 0, 0 },
{ EVT_HELP, 0, 0, 0 },
{ NULL, 0, 0, 0 }
};
{ EVT_ENA_VECTOR, evt_parse_ena_vector},
{ EVT_VECTOR_SZ, evt_parse_vector_size},
{ EVT_VECTOR_TMO, evt_parse_vector_tmo_ns},
+ { EVT_PER_PORT_POOL, evt_parse_per_port_pool},
};
for (i = 0; i < RTE_DIM(parsermap); i++) {
}
for (j = 0; j < opt->eth_queues; j++) {
- if (rte_eth_rx_queue_setup(i, j, NB_RX_DESC,
- rte_socket_id(), &rx_conf,
- t->pool) < 0) {
+ if (rte_eth_rx_queue_setup(
+ i, j, NB_RX_DESC, rte_socket_id(), &rx_conf,
+ opt->per_port_pool ? t->pool[i] :
+ t->pool[0]) < 0) {
evt_err("Failed to setup eth port [%d] rx_queue: %d.",
i, 0);
return -EINVAL;
if (data_size > opt->mbuf_sz)
opt->mbuf_sz = data_size;
}
+ if (opt->per_port_pool) {
+ char name[RTE_MEMPOOL_NAMESIZE];
+
+ snprintf(name, RTE_MEMPOOL_NAMESIZE, "%s-%d",
+ test->name, i);
+ t->pool[i] = rte_pktmbuf_pool_create(
+ name, /* mempool name */
+ opt->pool_sz, /* number of elements*/
+ 0, /* cache size*/
+ 0, opt->mbuf_sz, opt->socket_id); /* flags */
+
+ if (t->pool[i] == NULL) {
+ evt_err("failed to create mempool %s", name);
+ return -ENOMEM;
+ }
+ }
}
- t->pool = rte_pktmbuf_pool_create(test->name, /* mempool name */
+ if (!opt->per_port_pool) {
+ t->pool[0] = rte_pktmbuf_pool_create(
+ test->name, /* mempool name */
opt->pool_sz, /* number of elements*/
- 512, /* cache size*/
- 0,
- opt->mbuf_sz,
- opt->socket_id); /* flags */
-
- if (t->pool == NULL) {
- evt_err("failed to create mempool");
- return -ENOMEM;
+ 0, /* cache size*/
+ 0, opt->mbuf_sz, opt->socket_id); /* flags */
+
+ if (t->pool[0] == NULL) {
+ evt_err("failed to create mempool");
+ return -ENOMEM;
+ }
}
return 0;
void
pipeline_mempool_destroy(struct evt_test *test, struct evt_options *opt)
{
- RTE_SET_USED(opt);
struct test_pipeline *t = evt_test_priv(test);
+ int i;
- rte_mempool_free(t->pool);
+ RTE_SET_USED(opt);
+ if (opt->per_port_pool) {
+ RTE_ETH_FOREACH_DEV(i)
+ rte_mempool_free(t->pool[i]);
+ } else {
+ rte_mempool_free(t->pool[0]);
+ }
}
int