DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/test-eventdev: add options to set mbuf and pkt size
@ 2019-09-22  5:12 pbhagavatula
  2019-09-23  7:34 ` Jerin Jacob
  2019-09-30 16:48 ` [dpdk-dev] [PATCH v2] " pbhagavatula
  0 siblings, 2 replies; 5+ messages in thread
From: pbhagavatula @ 2019-09-22  5:12 UTC (permalink / raw)
  To: jerinj; +Cc: dev, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add options to set mbuf size and max packet size which allow the user to
enable jumbo frames and Rx/Tx scatter gather.
Packet mbuf size can be modified by using `--mbuf_sz=N`.
Max packet size can be modified by using `--max_pkt_sz=N`.
These options are only applicable `pipeline_atq` and `pipeline_queue`
tests.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 app/test-eventdev/evt_common.h           | 30 ++++++++++---------
 app/test-eventdev/evt_options.c          | 28 ++++++++++++++++-
 app/test-eventdev/evt_options.h          |  2 ++
 app/test-eventdev/test_pipeline_common.c | 38 ++++++++++++++++++++++--
 4 files changed, 80 insertions(+), 18 deletions(-)

diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
index 1c3522ff4..f9d7378d3 100644
--- a/app/test-eventdev/evt_common.h
+++ b/app/test-eventdev/evt_common.h
@@ -47,28 +47,30 @@ struct evt_options {
 	char test_name[EVT_TEST_NAME_MAX_LEN];
 	bool plcores[RTE_MAX_LCORE];
 	bool wlcores[RTE_MAX_LCORE];
-	uint8_t sched_type_list[EVT_MAX_STAGES];
-	uint32_t nb_flows;
-	int socket_id;
 	int pool_sz;
+	int socket_id;
 	int nb_stages;
 	int verbose_level;
-	uint64_t nb_pkts;
+	uint8_t dev_id;
+	uint8_t timdev_cnt;
 	uint8_t nb_timer_adptrs;
-	uint64_t nb_timers;
-	uint64_t timer_tick_nsec;
-	uint64_t optm_timer_tick_nsec;
-	uint64_t max_tmo_nsec;
-	uint64_t expiry_nsec;
+	uint8_t timdev_use_burst;
+	uint8_t sched_type_list[EVT_MAX_STAGES];
+	uint16_t mbuf_sz;
 	uint16_t wkr_deq_dep;
-	uint8_t dev_id;
+	uint32_t nb_flows;
 	uint32_t tx_first;
-	uint32_t fwd_latency:1;
-	uint32_t q_priority:1;
+	uint32_t max_pkt_sz;
 	uint32_t deq_tmo_nsec;
+	uint32_t q_priority:1;
+	uint32_t fwd_latency:1;
+	uint64_t nb_pkts;
+	uint64_t nb_timers;
+	uint64_t expiry_nsec;
+	uint64_t max_tmo_nsec;
+	uint64_t timer_tick_nsec;
+	uint64_t optm_timer_tick_nsec;
 	enum evt_prod_type prod_type;
-	uint8_t timdev_use_burst;
-	uint8_t timdev_cnt;
 };
 
 static inline bool
diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
index 46c074fea..c60b61a90 100644
--- a/app/test-eventdev/evt_options.c
+++ b/app/test-eventdev/evt_options.c
@@ -233,6 +233,26 @@ evt_parse_work_lcores(struct evt_options *opt, const char *corelist)
 	return ret;
 }
 
+static int
+evt_parse_mbuf_sz(struct evt_options *opt, const char *arg)
+{
+	int ret;
+
+	ret = parser_read_uint16(&(opt->mbuf_sz), arg);
+
+	return ret;
+}
+
+static int
+evt_parse_max_pkt_sz(struct evt_options *opt, const char *arg)
+{
+	int ret;
+
+	ret = parser_read_uint32(&(opt->max_pkt_sz), arg);
+
+	return ret;
+}
+
 static void
 usage(char *program)
 {
@@ -262,7 +282,9 @@ usage(char *program)
 		"\t--nb_timer_adptrs  : number of timer adapters to use.\n"
 		"\t--timer_tick_nsec  : timer tick interval in ns.\n"
 		"\t--max_tmo_nsec     : max timeout interval in ns.\n"
-		"\t--expiry_nsec        : event timer expiry ns.\n"
+		"\t--expiry_nsec      : event timer expiry ns.\n"
+		"\t--mbuf_sz          : packet mbuf size.\n"
+		"\t--max_pkt_sz       : max packet size.\n"
 		);
 	printf("available tests:\n");
 	evt_test_dump_names();
@@ -332,6 +354,8 @@ static struct option lgopts[] = {
 	{ EVT_TIMER_TICK_NSEC,     1, 0, 0 },
 	{ EVT_MAX_TMO_NSEC,        1, 0, 0 },
 	{ EVT_EXPIRY_NSEC,         1, 0, 0 },
+	{ EVT_MBUF_SZ,             1, 0, 0 },
+	{ EVT_MAX_PKT_SZ,          1, 0, 0 },
 	{ EVT_HELP,                0, 0, 0 },
 	{ NULL,                    0, 0, 0 }
 };
@@ -364,6 +388,8 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt)
 		{ EVT_TIMER_TICK_NSEC, evt_parse_timer_tick_nsec},
 		{ EVT_MAX_TMO_NSEC, evt_parse_max_tmo_nsec},
 		{ EVT_EXPIRY_NSEC, evt_parse_expiry_nsec},
+		{ EVT_MBUF_SZ, evt_parse_mbuf_sz},
+		{ EVT_MAX_PKT_SZ, evt_parse_max_pkt_sz},
 	};
 
 	for (i = 0; i < RTE_DIM(parsermap); i++) {
diff --git a/app/test-eventdev/evt_options.h b/app/test-eventdev/evt_options.h
index 845d3199a..cb1d3760d 100644
--- a/app/test-eventdev/evt_options.h
+++ b/app/test-eventdev/evt_options.h
@@ -40,6 +40,8 @@
 #define EVT_TIMER_TICK_NSEC      ("timer_tick_nsec")
 #define EVT_MAX_TMO_NSEC         ("max_tmo_nsec")
 #define EVT_EXPIRY_NSEC          ("expiry_nsec")
+#define EVT_MBUF_SZ              ("mbuf_sz")
+#define EVT_MAX_PKT_SZ           ("max_pkt_sz")
 #define EVT_HELP                 ("help")
 
 void evt_options_default(struct evt_options *opt);
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 16c49b860..497cb667d 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -165,7 +165,6 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 	struct rte_eth_conf port_conf = {
 		.rxmode = {
 			.mq_mode = ETH_MQ_RX_RSS,
-			.max_rx_pkt_len = RTE_ETHER_MAX_LEN,
 		},
 		.rx_adv_conf = {
 			.rss_conf = {
@@ -175,12 +174,21 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 		},
 	};
 
-	RTE_SET_USED(opt);
 	if (!rte_eth_dev_count_avail()) {
 		evt_err("No ethernet ports found.");
 		return -ENODEV;
 	}
 
+	if (opt->max_pkt_sz < RTE_ETHER_MIN_LEN) {
+		evt_err("max_pkt_sz can not be less than %d",
+			RTE_ETHER_MIN_LEN);
+		return -EINVAL;
+	}
+
+	port_conf.rxmode.max_rx_pkt_len = opt->max_pkt_sz;
+	if (opt->max_pkt_sz > RTE_ETHER_MAX_LEN)
+		port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+
 	t->internal_port = 1;
 	RTE_ETH_FOREACH_DEV(i) {
 		struct rte_eth_dev_info dev_info;
@@ -404,12 +412,36 @@ int
 pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
 {
 	struct test_pipeline *t = evt_test_priv(test);
+	int i;
+
+	if (!opt->mbuf_sz)
+		opt->mbuf_sz = RTE_MBUF_DEFAULT_BUF_SIZE;
+
+	if (!opt->max_pkt_sz)
+		opt->max_pkt_sz = RTE_ETHER_MAX_LEN;
+
+	RTE_ETH_FOREACH_DEV(i) {
+		struct rte_eth_dev_info dev_info;
+		uint16_t data_size = 0;
+
+		memset(&dev_info, 0, sizeof(dev_info));
+		rte_eth_dev_info_get(i, &dev_info);
+		if (dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
+				dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
+			data_size = opt->max_pkt_sz /
+				dev_info.rx_desc_lim.nb_mtu_seg_max;
+			data_size += RTE_PKTMBUF_HEADROOM;
+
+			if (data_size  > opt->mbuf_sz)
+				opt->mbuf_sz = data_size;
+		}
+	}
 
 	t->pool = rte_pktmbuf_pool_create(test->name, /* mempool name */
 			opt->pool_sz, /* number of elements*/
 			512, /* cache size*/
 			0,
-			RTE_MBUF_DEFAULT_BUF_SIZE,
+			opt->mbuf_sz,
 			opt->socket_id); /* flags */
 
 	if (t->pool == NULL) {
-- 
2.22.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] app/test-eventdev: add options to set mbuf and pkt size
  2019-09-22  5:12 [dpdk-dev] [PATCH] app/test-eventdev: add options to set mbuf and pkt size pbhagavatula
@ 2019-09-23  7:34 ` Jerin Jacob
  2019-09-30 16:48 ` [dpdk-dev] [PATCH v2] " pbhagavatula
  1 sibling, 0 replies; 5+ messages in thread
From: Jerin Jacob @ 2019-09-23  7:34 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: Jerin Jacob, dev

On Sun, Sep 22, 2019 at 10:42 AM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Add options to set mbuf size and max packet size which allow the user to
> enable jumbo frames and Rx/Tx scatter gather.
> Packet mbuf size can be modified by using `--mbuf_sz=N`.
> Max packet size can be modified by using `--max_pkt_sz=N`.
> These options are only applicable `pipeline_atq` and `pipeline_queue`
> tests.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
>  app/test-eventdev/evt_common.h           | 30 ++++++++++---------
>  app/test-eventdev/evt_options.c          | 28 ++++++++++++++++-
>  app/test-eventdev/evt_options.h          |  2 ++
>  app/test-eventdev/test_pipeline_common.c | 38 ++++++++++++++++++++++--


doc/guides/tools/testeventdev.rst doc update is mising.


>  4 files changed, 80 insertions(+), 18 deletions(-)
>
> diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
> index 1c3522ff4..f9d7378d3 100644
> --- a/app/test-eventdev/evt_common.h
> +++ b/app/test-eventdev/evt_common.h
> @@ -47,28 +47,30 @@ struct evt_options {

>         uint32_t deq_tmo_nsec;
> +       uint32_t q_priority:1;
> +       uint32_t fwd_latency:1;
> +       uint64_t nb_pkts;
> +       uint64_t nb_timers;
> +       uint64_t expiry_nsec;
> +       uint64_t max_tmo_nsec;
> +       uint64_t timer_tick_nsec;
> +       uint64_t optm_timer_tick_nsec;
>         enum evt_prod_type prod_type;
> -       uint8_t timdev_use_burst;
> -       uint8_t timdev_cnt;
>  };

Please add the reason for restructuring in git commit.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] app/test-eventdev: add options to set mbuf and pkt size
  2019-09-22  5:12 [dpdk-dev] [PATCH] app/test-eventdev: add options to set mbuf and pkt size pbhagavatula
  2019-09-23  7:34 ` Jerin Jacob
@ 2019-09-30 16:48 ` pbhagavatula
  2019-10-02 15:19   ` Jerin Jacob
  1 sibling, 1 reply; 5+ messages in thread
From: pbhagavatula @ 2019-09-30 16:48 UTC (permalink / raw)
  To: jerinj, John McNamara, Marko Kovacevic; +Cc: dev, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add options to set mbuf size and max packet size which allow the user to
enable jumbo frames and Rx/Tx scatter gather.
Arrange `struct evt_options` based on ascending order of data type to
make it more readable.

Packet mbuf size can be modified by using `--mbuf_sz=N`.
Max packet size can be modified by using `--max_pkt_sz=N`.
These options are only applicable `pipeline_atq` and `pipeline_queue`
tests.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---

 v2 Changes:
 - Update doc/guides/tools/testeventdev.rst.
 - Justify changes to struct evt_options.

 app/test-eventdev/evt_common.h           | 30 ++++++++++---------
 app/test-eventdev/evt_options.c          | 28 ++++++++++++++++-
 app/test-eventdev/evt_options.h          |  2 ++
 app/test-eventdev/test_pipeline_common.c | 38 ++++++++++++++++++++++--
 doc/guides/tools/testeventdev.rst        | 10 +++++++
 5 files changed, 90 insertions(+), 18 deletions(-)

diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
index 1c3522ff4..f9d7378d3 100644
--- a/app/test-eventdev/evt_common.h
+++ b/app/test-eventdev/evt_common.h
@@ -47,28 +47,30 @@ struct evt_options {
 	char test_name[EVT_TEST_NAME_MAX_LEN];
 	bool plcores[RTE_MAX_LCORE];
 	bool wlcores[RTE_MAX_LCORE];
-	uint8_t sched_type_list[EVT_MAX_STAGES];
-	uint32_t nb_flows;
-	int socket_id;
 	int pool_sz;
+	int socket_id;
 	int nb_stages;
 	int verbose_level;
-	uint64_t nb_pkts;
+	uint8_t dev_id;
+	uint8_t timdev_cnt;
 	uint8_t nb_timer_adptrs;
-	uint64_t nb_timers;
-	uint64_t timer_tick_nsec;
-	uint64_t optm_timer_tick_nsec;
-	uint64_t max_tmo_nsec;
-	uint64_t expiry_nsec;
+	uint8_t timdev_use_burst;
+	uint8_t sched_type_list[EVT_MAX_STAGES];
+	uint16_t mbuf_sz;
 	uint16_t wkr_deq_dep;
-	uint8_t dev_id;
+	uint32_t nb_flows;
 	uint32_t tx_first;
-	uint32_t fwd_latency:1;
-	uint32_t q_priority:1;
+	uint32_t max_pkt_sz;
 	uint32_t deq_tmo_nsec;
+	uint32_t q_priority:1;
+	uint32_t fwd_latency:1;
+	uint64_t nb_pkts;
+	uint64_t nb_timers;
+	uint64_t expiry_nsec;
+	uint64_t max_tmo_nsec;
+	uint64_t timer_tick_nsec;
+	uint64_t optm_timer_tick_nsec;
 	enum evt_prod_type prod_type;
-	uint8_t timdev_use_burst;
-	uint8_t timdev_cnt;
 };

 static inline bool
diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
index 46c074fea..c60b61a90 100644
--- a/app/test-eventdev/evt_options.c
+++ b/app/test-eventdev/evt_options.c
@@ -233,6 +233,26 @@ evt_parse_work_lcores(struct evt_options *opt, const char *corelist)
 	return ret;
 }

+static int
+evt_parse_mbuf_sz(struct evt_options *opt, const char *arg)
+{
+	int ret;
+
+	ret = parser_read_uint16(&(opt->mbuf_sz), arg);
+
+	return ret;
+}
+
+static int
+evt_parse_max_pkt_sz(struct evt_options *opt, const char *arg)
+{
+	int ret;
+
+	ret = parser_read_uint32(&(opt->max_pkt_sz), arg);
+
+	return ret;
+}
+
 static void
 usage(char *program)
 {
@@ -262,7 +282,9 @@ usage(char *program)
 		"\t--nb_timer_adptrs  : number of timer adapters to use.\n"
 		"\t--timer_tick_nsec  : timer tick interval in ns.\n"
 		"\t--max_tmo_nsec     : max timeout interval in ns.\n"
-		"\t--expiry_nsec        : event timer expiry ns.\n"
+		"\t--expiry_nsec      : event timer expiry ns.\n"
+		"\t--mbuf_sz          : packet mbuf size.\n"
+		"\t--max_pkt_sz       : max packet size.\n"
 		);
 	printf("available tests:\n");
 	evt_test_dump_names();
@@ -332,6 +354,8 @@ static struct option lgopts[] = {
 	{ EVT_TIMER_TICK_NSEC,     1, 0, 0 },
 	{ EVT_MAX_TMO_NSEC,        1, 0, 0 },
 	{ EVT_EXPIRY_NSEC,         1, 0, 0 },
+	{ EVT_MBUF_SZ,             1, 0, 0 },
+	{ EVT_MAX_PKT_SZ,          1, 0, 0 },
 	{ EVT_HELP,                0, 0, 0 },
 	{ NULL,                    0, 0, 0 }
 };
@@ -364,6 +388,8 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt)
 		{ EVT_TIMER_TICK_NSEC, evt_parse_timer_tick_nsec},
 		{ EVT_MAX_TMO_NSEC, evt_parse_max_tmo_nsec},
 		{ EVT_EXPIRY_NSEC, evt_parse_expiry_nsec},
+		{ EVT_MBUF_SZ, evt_parse_mbuf_sz},
+		{ EVT_MAX_PKT_SZ, evt_parse_max_pkt_sz},
 	};

 	for (i = 0; i < RTE_DIM(parsermap); i++) {
diff --git a/app/test-eventdev/evt_options.h b/app/test-eventdev/evt_options.h
index 845d3199a..cb1d3760d 100644
--- a/app/test-eventdev/evt_options.h
+++ b/app/test-eventdev/evt_options.h
@@ -40,6 +40,8 @@
 #define EVT_TIMER_TICK_NSEC      ("timer_tick_nsec")
 #define EVT_MAX_TMO_NSEC         ("max_tmo_nsec")
 #define EVT_EXPIRY_NSEC          ("expiry_nsec")
+#define EVT_MBUF_SZ              ("mbuf_sz")
+#define EVT_MAX_PKT_SZ           ("max_pkt_sz")
 #define EVT_HELP                 ("help")

 void evt_options_default(struct evt_options *opt);
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 16c49b860..497cb667d 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -165,7 +165,6 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 	struct rte_eth_conf port_conf = {
 		.rxmode = {
 			.mq_mode = ETH_MQ_RX_RSS,
-			.max_rx_pkt_len = RTE_ETHER_MAX_LEN,
 		},
 		.rx_adv_conf = {
 			.rss_conf = {
@@ -175,12 +174,21 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
 		},
 	};

-	RTE_SET_USED(opt);
 	if (!rte_eth_dev_count_avail()) {
 		evt_err("No ethernet ports found.");
 		return -ENODEV;
 	}

+	if (opt->max_pkt_sz < RTE_ETHER_MIN_LEN) {
+		evt_err("max_pkt_sz can not be less than %d",
+			RTE_ETHER_MIN_LEN);
+		return -EINVAL;
+	}
+
+	port_conf.rxmode.max_rx_pkt_len = opt->max_pkt_sz;
+	if (opt->max_pkt_sz > RTE_ETHER_MAX_LEN)
+		port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+
 	t->internal_port = 1;
 	RTE_ETH_FOREACH_DEV(i) {
 		struct rte_eth_dev_info dev_info;
@@ -404,12 +412,36 @@ int
 pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
 {
 	struct test_pipeline *t = evt_test_priv(test);
+	int i;
+
+	if (!opt->mbuf_sz)
+		opt->mbuf_sz = RTE_MBUF_DEFAULT_BUF_SIZE;
+
+	if (!opt->max_pkt_sz)
+		opt->max_pkt_sz = RTE_ETHER_MAX_LEN;
+
+	RTE_ETH_FOREACH_DEV(i) {
+		struct rte_eth_dev_info dev_info;
+		uint16_t data_size = 0;
+
+		memset(&dev_info, 0, sizeof(dev_info));
+		rte_eth_dev_info_get(i, &dev_info);
+		if (dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
+				dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
+			data_size = opt->max_pkt_sz /
+				dev_info.rx_desc_lim.nb_mtu_seg_max;
+			data_size += RTE_PKTMBUF_HEADROOM;
+
+			if (data_size  > opt->mbuf_sz)
+				opt->mbuf_sz = data_size;
+		}
+	}

 	t->pool = rte_pktmbuf_pool_create(test->name, /* mempool name */
 			opt->pool_sz, /* number of elements*/
 			512, /* cache size*/
 			0,
-			RTE_MBUF_DEFAULT_BUF_SIZE,
+			opt->mbuf_sz,
 			opt->socket_id); /* flags */

 	if (t->pool == NULL) {
diff --git a/doc/guides/tools/testeventdev.rst b/doc/guides/tools/testeventdev.rst
index db5c4378b..2ed67a634 100644
--- a/doc/guides/tools/testeventdev.rst
+++ b/doc/guides/tools/testeventdev.rst
@@ -161,6 +161,16 @@ The following are the application command-line options:
        timeout is out of the supported range of event device it will be
        adjusted to the highest/lowest supported dequeue timeout supported.

+* ``--mbuf_sz``
+
+       Set packet mbuf size. Can be used to configure Jumbo Frames. Only
+       applicable for `pipeline_atq` and `pipeline_queue` tests.
+
+* ``--max_pkt_sz``
+
+       Set max packet mbuf size. Can be used configure Rx/Tx scatter gather.
+       Only applicable for `pipeline_atq` and `pipeline_queue` tests.
+

 Eventdev Tests
 --------------
--
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/test-eventdev: add options to set mbuf and pkt size
  2019-09-30 16:48 ` [dpdk-dev] [PATCH v2] " pbhagavatula
@ 2019-10-02 15:19   ` Jerin Jacob
  2019-10-03  3:32     ` Jerin Jacob
  0 siblings, 1 reply; 5+ messages in thread
From: Jerin Jacob @ 2019-10-02 15:19 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: Jerin Jacob, John McNamara, Marko Kovacevic, dpdk-dev

On Mon, Sep 30, 2019 at 10:18 PM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Add options to set mbuf size and max packet size which allow the user to
> enable jumbo frames and Rx/Tx scatter gather.
> Arrange `struct evt_options` based on ascending order of data type to
> make it more readable.
>
> Packet mbuf size can be modified by using `--mbuf_sz=N`.
> Max packet size can be modified by using `--max_pkt_sz=N`.
> These options are only applicable `pipeline_atq` and `pipeline_queue`
> tests.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>


> ---
>
>  v2 Changes:
>  - Update doc/guides/tools/testeventdev.rst.
>  - Justify changes to struct evt_options.
>
>  app/test-eventdev/evt_common.h           | 30 ++++++++++---------
>  app/test-eventdev/evt_options.c          | 28 ++++++++++++++++-
>  app/test-eventdev/evt_options.h          |  2 ++
>  app/test-eventdev/test_pipeline_common.c | 38 ++++++++++++++++++++++--
>  doc/guides/tools/testeventdev.rst        | 10 +++++++
>  5 files changed, 90 insertions(+), 18 deletions(-)
>
> diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
> index 1c3522ff4..f9d7378d3 100644
> --- a/app/test-eventdev/evt_common.h
> +++ b/app/test-eventdev/evt_common.h
> @@ -47,28 +47,30 @@ struct evt_options {
>         char test_name[EVT_TEST_NAME_MAX_LEN];
>         bool plcores[RTE_MAX_LCORE];
>         bool wlcores[RTE_MAX_LCORE];
> -       uint8_t sched_type_list[EVT_MAX_STAGES];
> -       uint32_t nb_flows;
> -       int socket_id;
>         int pool_sz;
> +       int socket_id;
>         int nb_stages;
>         int verbose_level;
> -       uint64_t nb_pkts;
> +       uint8_t dev_id;
> +       uint8_t timdev_cnt;
>         uint8_t nb_timer_adptrs;
> -       uint64_t nb_timers;
> -       uint64_t timer_tick_nsec;
> -       uint64_t optm_timer_tick_nsec;
> -       uint64_t max_tmo_nsec;
> -       uint64_t expiry_nsec;
> +       uint8_t timdev_use_burst;
> +       uint8_t sched_type_list[EVT_MAX_STAGES];
> +       uint16_t mbuf_sz;
>         uint16_t wkr_deq_dep;
> -       uint8_t dev_id;
> +       uint32_t nb_flows;
>         uint32_t tx_first;
> -       uint32_t fwd_latency:1;
> -       uint32_t q_priority:1;
> +       uint32_t max_pkt_sz;
>         uint32_t deq_tmo_nsec;
> +       uint32_t q_priority:1;
> +       uint32_t fwd_latency:1;
> +       uint64_t nb_pkts;
> +       uint64_t nb_timers;
> +       uint64_t expiry_nsec;
> +       uint64_t max_tmo_nsec;
> +       uint64_t timer_tick_nsec;
> +       uint64_t optm_timer_tick_nsec;
>         enum evt_prod_type prod_type;
> -       uint8_t timdev_use_burst;
> -       uint8_t timdev_cnt;
>  };
>
>  static inline bool
> diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
> index 46c074fea..c60b61a90 100644
> --- a/app/test-eventdev/evt_options.c
> +++ b/app/test-eventdev/evt_options.c
> @@ -233,6 +233,26 @@ evt_parse_work_lcores(struct evt_options *opt, const char *corelist)
>         return ret;
>  }
>
> +static int
> +evt_parse_mbuf_sz(struct evt_options *opt, const char *arg)
> +{
> +       int ret;
> +
> +       ret = parser_read_uint16(&(opt->mbuf_sz), arg);
> +
> +       return ret;
> +}
> +
> +static int
> +evt_parse_max_pkt_sz(struct evt_options *opt, const char *arg)
> +{
> +       int ret;
> +
> +       ret = parser_read_uint32(&(opt->max_pkt_sz), arg);
> +
> +       return ret;
> +}
> +
>  static void
>  usage(char *program)
>  {
> @@ -262,7 +282,9 @@ usage(char *program)
>                 "\t--nb_timer_adptrs  : number of timer adapters to use.\n"
>                 "\t--timer_tick_nsec  : timer tick interval in ns.\n"
>                 "\t--max_tmo_nsec     : max timeout interval in ns.\n"
> -               "\t--expiry_nsec        : event timer expiry ns.\n"
> +               "\t--expiry_nsec      : event timer expiry ns.\n"
> +               "\t--mbuf_sz          : packet mbuf size.\n"
> +               "\t--max_pkt_sz       : max packet size.\n"
>                 );
>         printf("available tests:\n");
>         evt_test_dump_names();
> @@ -332,6 +354,8 @@ static struct option lgopts[] = {
>         { EVT_TIMER_TICK_NSEC,     1, 0, 0 },
>         { EVT_MAX_TMO_NSEC,        1, 0, 0 },
>         { EVT_EXPIRY_NSEC,         1, 0, 0 },
> +       { EVT_MBUF_SZ,             1, 0, 0 },
> +       { EVT_MAX_PKT_SZ,          1, 0, 0 },
>         { EVT_HELP,                0, 0, 0 },
>         { NULL,                    0, 0, 0 }
>  };
> @@ -364,6 +388,8 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt)
>                 { EVT_TIMER_TICK_NSEC, evt_parse_timer_tick_nsec},
>                 { EVT_MAX_TMO_NSEC, evt_parse_max_tmo_nsec},
>                 { EVT_EXPIRY_NSEC, evt_parse_expiry_nsec},
> +               { EVT_MBUF_SZ, evt_parse_mbuf_sz},
> +               { EVT_MAX_PKT_SZ, evt_parse_max_pkt_sz},
>         };
>
>         for (i = 0; i < RTE_DIM(parsermap); i++) {
> diff --git a/app/test-eventdev/evt_options.h b/app/test-eventdev/evt_options.h
> index 845d3199a..cb1d3760d 100644
> --- a/app/test-eventdev/evt_options.h
> +++ b/app/test-eventdev/evt_options.h
> @@ -40,6 +40,8 @@
>  #define EVT_TIMER_TICK_NSEC      ("timer_tick_nsec")
>  #define EVT_MAX_TMO_NSEC         ("max_tmo_nsec")
>  #define EVT_EXPIRY_NSEC          ("expiry_nsec")
> +#define EVT_MBUF_SZ              ("mbuf_sz")
> +#define EVT_MAX_PKT_SZ           ("max_pkt_sz")
>  #define EVT_HELP                 ("help")
>
>  void evt_options_default(struct evt_options *opt);
> diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
> index 16c49b860..497cb667d 100644
> --- a/app/test-eventdev/test_pipeline_common.c
> +++ b/app/test-eventdev/test_pipeline_common.c
> @@ -165,7 +165,6 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
>         struct rte_eth_conf port_conf = {
>                 .rxmode = {
>                         .mq_mode = ETH_MQ_RX_RSS,
> -                       .max_rx_pkt_len = RTE_ETHER_MAX_LEN,
>                 },
>                 .rx_adv_conf = {
>                         .rss_conf = {
> @@ -175,12 +174,21 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
>                 },
>         };
>
> -       RTE_SET_USED(opt);
>         if (!rte_eth_dev_count_avail()) {
>                 evt_err("No ethernet ports found.");
>                 return -ENODEV;
>         }
>
> +       if (opt->max_pkt_sz < RTE_ETHER_MIN_LEN) {
> +               evt_err("max_pkt_sz can not be less than %d",
> +                       RTE_ETHER_MIN_LEN);
> +               return -EINVAL;
> +       }
> +
> +       port_conf.rxmode.max_rx_pkt_len = opt->max_pkt_sz;
> +       if (opt->max_pkt_sz > RTE_ETHER_MAX_LEN)
> +               port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> +
>         t->internal_port = 1;
>         RTE_ETH_FOREACH_DEV(i) {
>                 struct rte_eth_dev_info dev_info;
> @@ -404,12 +412,36 @@ int
>  pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
>  {
>         struct test_pipeline *t = evt_test_priv(test);
> +       int i;
> +
> +       if (!opt->mbuf_sz)
> +               opt->mbuf_sz = RTE_MBUF_DEFAULT_BUF_SIZE;
> +
> +       if (!opt->max_pkt_sz)
> +               opt->max_pkt_sz = RTE_ETHER_MAX_LEN;
> +
> +       RTE_ETH_FOREACH_DEV(i) {
> +               struct rte_eth_dev_info dev_info;
> +               uint16_t data_size = 0;
> +
> +               memset(&dev_info, 0, sizeof(dev_info));
> +               rte_eth_dev_info_get(i, &dev_info);
> +               if (dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
> +                               dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
> +                       data_size = opt->max_pkt_sz /
> +                               dev_info.rx_desc_lim.nb_mtu_seg_max;
> +                       data_size += RTE_PKTMBUF_HEADROOM;
> +
> +                       if (data_size  > opt->mbuf_sz)
> +                               opt->mbuf_sz = data_size;
> +               }
> +       }
>
>         t->pool = rte_pktmbuf_pool_create(test->name, /* mempool name */
>                         opt->pool_sz, /* number of elements*/
>                         512, /* cache size*/
>                         0,
> -                       RTE_MBUF_DEFAULT_BUF_SIZE,
> +                       opt->mbuf_sz,
>                         opt->socket_id); /* flags */
>
>         if (t->pool == NULL) {
> diff --git a/doc/guides/tools/testeventdev.rst b/doc/guides/tools/testeventdev.rst
> index db5c4378b..2ed67a634 100644
> --- a/doc/guides/tools/testeventdev.rst
> +++ b/doc/guides/tools/testeventdev.rst
> @@ -161,6 +161,16 @@ The following are the application command-line options:
>         timeout is out of the supported range of event device it will be
>         adjusted to the highest/lowest supported dequeue timeout supported.
>
> +* ``--mbuf_sz``
> +
> +       Set packet mbuf size. Can be used to configure Jumbo Frames. Only
> +       applicable for `pipeline_atq` and `pipeline_queue` tests.
> +
> +* ``--max_pkt_sz``
> +
> +       Set max packet mbuf size. Can be used configure Rx/Tx scatter gather.
> +       Only applicable for `pipeline_atq` and `pipeline_queue` tests.
> +
>
>  Eventdev Tests
>  --------------
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] app/test-eventdev: add options to set mbuf and pkt size
  2019-10-02 15:19   ` Jerin Jacob
@ 2019-10-03  3:32     ` Jerin Jacob
  0 siblings, 0 replies; 5+ messages in thread
From: Jerin Jacob @ 2019-10-03  3:32 UTC (permalink / raw)
  To: Pavan Nikhilesh; +Cc: Jerin Jacob, John McNamara, Marko Kovacevic, dpdk-dev

On Wed, Oct 2, 2019 at 8:49 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Mon, Sep 30, 2019 at 10:18 PM <pbhagavatula@marvell.com> wrote:
> >
> > From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> >
> > Add options to set mbuf size and max packet size which allow the user to
> > enable jumbo frames and Rx/Tx scatter gather.
> > Arrange `struct evt_options` based on ascending order of data type to
> > make it more readable.
> >
> > Packet mbuf size can be modified by using `--mbuf_sz=N`.
> > Max packet size can be modified by using `--max_pkt_sz=N`.
> > These options are only applicable `pipeline_atq` and `pipeline_queue`
> > tests.
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-eventdev/master. Thanks.


>
>
> > ---
> >
> >  v2 Changes:
> >  - Update doc/guides/tools/testeventdev.rst.
> >  - Justify changes to struct evt_options.
> >
> >  app/test-eventdev/evt_common.h           | 30 ++++++++++---------
> >  app/test-eventdev/evt_options.c          | 28 ++++++++++++++++-
> >  app/test-eventdev/evt_options.h          |  2 ++
> >  app/test-eventdev/test_pipeline_common.c | 38 ++++++++++++++++++++++--
> >  doc/guides/tools/testeventdev.rst        | 10 +++++++
> >  5 files changed, 90 insertions(+), 18 deletions(-)
> >
> > diff --git a/app/test-eventdev/evt_common.h b/app/test-eventdev/evt_common.h
> > index 1c3522ff4..f9d7378d3 100644
> > --- a/app/test-eventdev/evt_common.h
> > +++ b/app/test-eventdev/evt_common.h
> > @@ -47,28 +47,30 @@ struct evt_options {
> >         char test_name[EVT_TEST_NAME_MAX_LEN];
> >         bool plcores[RTE_MAX_LCORE];
> >         bool wlcores[RTE_MAX_LCORE];
> > -       uint8_t sched_type_list[EVT_MAX_STAGES];
> > -       uint32_t nb_flows;
> > -       int socket_id;
> >         int pool_sz;
> > +       int socket_id;
> >         int nb_stages;
> >         int verbose_level;
> > -       uint64_t nb_pkts;
> > +       uint8_t dev_id;
> > +       uint8_t timdev_cnt;
> >         uint8_t nb_timer_adptrs;
> > -       uint64_t nb_timers;
> > -       uint64_t timer_tick_nsec;
> > -       uint64_t optm_timer_tick_nsec;
> > -       uint64_t max_tmo_nsec;
> > -       uint64_t expiry_nsec;
> > +       uint8_t timdev_use_burst;
> > +       uint8_t sched_type_list[EVT_MAX_STAGES];
> > +       uint16_t mbuf_sz;
> >         uint16_t wkr_deq_dep;
> > -       uint8_t dev_id;
> > +       uint32_t nb_flows;
> >         uint32_t tx_first;
> > -       uint32_t fwd_latency:1;
> > -       uint32_t q_priority:1;
> > +       uint32_t max_pkt_sz;
> >         uint32_t deq_tmo_nsec;
> > +       uint32_t q_priority:1;
> > +       uint32_t fwd_latency:1;
> > +       uint64_t nb_pkts;
> > +       uint64_t nb_timers;
> > +       uint64_t expiry_nsec;
> > +       uint64_t max_tmo_nsec;
> > +       uint64_t timer_tick_nsec;
> > +       uint64_t optm_timer_tick_nsec;
> >         enum evt_prod_type prod_type;
> > -       uint8_t timdev_use_burst;
> > -       uint8_t timdev_cnt;
> >  };
> >
> >  static inline bool
> > diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c
> > index 46c074fea..c60b61a90 100644
> > --- a/app/test-eventdev/evt_options.c
> > +++ b/app/test-eventdev/evt_options.c
> > @@ -233,6 +233,26 @@ evt_parse_work_lcores(struct evt_options *opt, const char *corelist)
> >         return ret;
> >  }
> >
> > +static int
> > +evt_parse_mbuf_sz(struct evt_options *opt, const char *arg)
> > +{
> > +       int ret;
> > +
> > +       ret = parser_read_uint16(&(opt->mbuf_sz), arg);
> > +
> > +       return ret;
> > +}
> > +
> > +static int
> > +evt_parse_max_pkt_sz(struct evt_options *opt, const char *arg)
> > +{
> > +       int ret;
> > +
> > +       ret = parser_read_uint32(&(opt->max_pkt_sz), arg);
> > +
> > +       return ret;
> > +}
> > +
> >  static void
> >  usage(char *program)
> >  {
> > @@ -262,7 +282,9 @@ usage(char *program)
> >                 "\t--nb_timer_adptrs  : number of timer adapters to use.\n"
> >                 "\t--timer_tick_nsec  : timer tick interval in ns.\n"
> >                 "\t--max_tmo_nsec     : max timeout interval in ns.\n"
> > -               "\t--expiry_nsec        : event timer expiry ns.\n"
> > +               "\t--expiry_nsec      : event timer expiry ns.\n"
> > +               "\t--mbuf_sz          : packet mbuf size.\n"
> > +               "\t--max_pkt_sz       : max packet size.\n"
> >                 );
> >         printf("available tests:\n");
> >         evt_test_dump_names();
> > @@ -332,6 +354,8 @@ static struct option lgopts[] = {
> >         { EVT_TIMER_TICK_NSEC,     1, 0, 0 },
> >         { EVT_MAX_TMO_NSEC,        1, 0, 0 },
> >         { EVT_EXPIRY_NSEC,         1, 0, 0 },
> > +       { EVT_MBUF_SZ,             1, 0, 0 },
> > +       { EVT_MAX_PKT_SZ,          1, 0, 0 },
> >         { EVT_HELP,                0, 0, 0 },
> >         { NULL,                    0, 0, 0 }
> >  };
> > @@ -364,6 +388,8 @@ evt_opts_parse_long(int opt_idx, struct evt_options *opt)
> >                 { EVT_TIMER_TICK_NSEC, evt_parse_timer_tick_nsec},
> >                 { EVT_MAX_TMO_NSEC, evt_parse_max_tmo_nsec},
> >                 { EVT_EXPIRY_NSEC, evt_parse_expiry_nsec},
> > +               { EVT_MBUF_SZ, evt_parse_mbuf_sz},
> > +               { EVT_MAX_PKT_SZ, evt_parse_max_pkt_sz},
> >         };
> >
> >         for (i = 0; i < RTE_DIM(parsermap); i++) {
> > diff --git a/app/test-eventdev/evt_options.h b/app/test-eventdev/evt_options.h
> > index 845d3199a..cb1d3760d 100644
> > --- a/app/test-eventdev/evt_options.h
> > +++ b/app/test-eventdev/evt_options.h
> > @@ -40,6 +40,8 @@
> >  #define EVT_TIMER_TICK_NSEC      ("timer_tick_nsec")
> >  #define EVT_MAX_TMO_NSEC         ("max_tmo_nsec")
> >  #define EVT_EXPIRY_NSEC          ("expiry_nsec")
> > +#define EVT_MBUF_SZ              ("mbuf_sz")
> > +#define EVT_MAX_PKT_SZ           ("max_pkt_sz")
> >  #define EVT_HELP                 ("help")
> >
> >  void evt_options_default(struct evt_options *opt);
> > diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
> > index 16c49b860..497cb667d 100644
> > --- a/app/test-eventdev/test_pipeline_common.c
> > +++ b/app/test-eventdev/test_pipeline_common.c
> > @@ -165,7 +165,6 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
> >         struct rte_eth_conf port_conf = {
> >                 .rxmode = {
> >                         .mq_mode = ETH_MQ_RX_RSS,
> > -                       .max_rx_pkt_len = RTE_ETHER_MAX_LEN,
> >                 },
> >                 .rx_adv_conf = {
> >                         .rss_conf = {
> > @@ -175,12 +174,21 @@ pipeline_ethdev_setup(struct evt_test *test, struct evt_options *opt)
> >                 },
> >         };
> >
> > -       RTE_SET_USED(opt);
> >         if (!rte_eth_dev_count_avail()) {
> >                 evt_err("No ethernet ports found.");
> >                 return -ENODEV;
> >         }
> >
> > +       if (opt->max_pkt_sz < RTE_ETHER_MIN_LEN) {
> > +               evt_err("max_pkt_sz can not be less than %d",
> > +                       RTE_ETHER_MIN_LEN);
> > +               return -EINVAL;
> > +       }
> > +
> > +       port_conf.rxmode.max_rx_pkt_len = opt->max_pkt_sz;
> > +       if (opt->max_pkt_sz > RTE_ETHER_MAX_LEN)
> > +               port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
> > +
> >         t->internal_port = 1;
> >         RTE_ETH_FOREACH_DEV(i) {
> >                 struct rte_eth_dev_info dev_info;
> > @@ -404,12 +412,36 @@ int
> >  pipeline_mempool_setup(struct evt_test *test, struct evt_options *opt)
> >  {
> >         struct test_pipeline *t = evt_test_priv(test);
> > +       int i;
> > +
> > +       if (!opt->mbuf_sz)
> > +               opt->mbuf_sz = RTE_MBUF_DEFAULT_BUF_SIZE;
> > +
> > +       if (!opt->max_pkt_sz)
> > +               opt->max_pkt_sz = RTE_ETHER_MAX_LEN;
> > +
> > +       RTE_ETH_FOREACH_DEV(i) {
> > +               struct rte_eth_dev_info dev_info;
> > +               uint16_t data_size = 0;
> > +
> > +               memset(&dev_info, 0, sizeof(dev_info));
> > +               rte_eth_dev_info_get(i, &dev_info);
> > +               if (dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
> > +                               dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
> > +                       data_size = opt->max_pkt_sz /
> > +                               dev_info.rx_desc_lim.nb_mtu_seg_max;
> > +                       data_size += RTE_PKTMBUF_HEADROOM;
> > +
> > +                       if (data_size  > opt->mbuf_sz)
> > +                               opt->mbuf_sz = data_size;
> > +               }
> > +       }
> >
> >         t->pool = rte_pktmbuf_pool_create(test->name, /* mempool name */
> >                         opt->pool_sz, /* number of elements*/
> >                         512, /* cache size*/
> >                         0,
> > -                       RTE_MBUF_DEFAULT_BUF_SIZE,
> > +                       opt->mbuf_sz,
> >                         opt->socket_id); /* flags */
> >
> >         if (t->pool == NULL) {
> > diff --git a/doc/guides/tools/testeventdev.rst b/doc/guides/tools/testeventdev.rst
> > index db5c4378b..2ed67a634 100644
> > --- a/doc/guides/tools/testeventdev.rst
> > +++ b/doc/guides/tools/testeventdev.rst
> > @@ -161,6 +161,16 @@ The following are the application command-line options:
> >         timeout is out of the supported range of event device it will be
> >         adjusted to the highest/lowest supported dequeue timeout supported.
> >
> > +* ``--mbuf_sz``
> > +
> > +       Set packet mbuf size. Can be used to configure Jumbo Frames. Only
> > +       applicable for `pipeline_atq` and `pipeline_queue` tests.
> > +
> > +* ``--max_pkt_sz``
> > +
> > +       Set max packet mbuf size. Can be used configure Rx/Tx scatter gather.
> > +       Only applicable for `pipeline_atq` and `pipeline_queue` tests.
> > +
> >
> >  Eventdev Tests
> >  --------------
> > --
> > 2.17.1
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-03  3:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-22  5:12 [dpdk-dev] [PATCH] app/test-eventdev: add options to set mbuf and pkt size pbhagavatula
2019-09-23  7:34 ` Jerin Jacob
2019-09-30 16:48 ` [dpdk-dev] [PATCH v2] " pbhagavatula
2019-10-02 15:19   ` Jerin Jacob
2019-10-03  3:32     ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).