All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Laatz <kevin.laatz@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
	fengchengwen@huawei.com, conor.walsh@intel.com,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	Kevin Laatz <kevin.laatz@intel.com>
Subject: [dpdk-dev] [PATCH v5 3/8] examples/ioat: add cmd line option to control max frame size
Date: Tue, 26 Oct 2021 13:14:27 +0000	[thread overview]
Message-ID: <20211026131432.2734145-4-kevin.laatz@intel.com> (raw)
In-Reply-To: <20211026131432.2734145-1-kevin.laatz@intel.com>

From: Konstantin Ananyev <konstantin.ananyev@intel.com>

Add command line option for setting the max frame size.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
---
 doc/guides/sample_app_ug/ioat.rst |  4 +++-
 examples/ioat/ioatfwd.c           | 23 +++++++++++++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/doc/guides/sample_app_ug/ioat.rst b/doc/guides/sample_app_ug/ioat.rst
index 404ca2e19a..127129dd4b 100644
--- a/doc/guides/sample_app_ug/ioat.rst
+++ b/doc/guides/sample_app_ug/ioat.rst
@@ -46,7 +46,7 @@ The application requires a number of command line options:
 .. code-block:: console
 
     ./<build_dir>/examples/dpdk-ioat [EAL options] -- [-p MASK] [-q NQ] [-s RS] [-c <sw|hw>]
-        [--[no-]mac-updating] [-b BS]
+        [--[no-]mac-updating] [-b BS] [-f FS]
 
 where,
 
@@ -66,6 +66,8 @@ where,
 
 *   b BS: set the DMA batch size
 
+*   f FS: set the max frame size
+
 The application can be launched in various configurations depending on
 provided parameters. The app can use up to 2 lcores: one of them receives
 incoming traffic and makes a copy of each packet. The second lcore then
diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index 887cdf30ec..2d02444fc7 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -25,6 +25,7 @@
 #define CMD_LINE_OPT_COPY_TYPE "copy-type"
 #define CMD_LINE_OPT_RING_SIZE "ring-size"
 #define CMD_LINE_OPT_BATCH_SIZE "dma-batch-size"
+#define CMD_LINE_OPT_FRAME_SIZE "max-frame-size"
 
 /* configurable number of RX/TX ring descriptors */
 #define RX_DEFAULT_RINGSIZE 1024
@@ -104,6 +105,7 @@ static uint16_t nb_txd = TX_DEFAULT_RINGSIZE;
 static volatile bool force_quit;
 
 static uint32_t ioat_batch_sz = MAX_PKT_BURST;
+static uint32_t max_frame_size = RTE_ETHER_MAX_LEN;
 
 /* ethernet addresses of ports */
 static struct rte_ether_addr ioat_ports_eth_addr[RTE_MAX_ETHPORTS];
@@ -604,6 +606,7 @@ ioat_usage(const char *prgname)
 {
 	printf("%s [EAL options] -- -p PORTMASK [-q NQ]\n"
 		"  -b --dma-batch-size: number of requests per DMA batch\n"
+		"  -f --max-frame-size: max frame size\n"
 		"  -p --portmask: hexadecimal bitmask of ports to configure\n"
 		"  -q NQ: number of RX queues per port (default is 1)\n"
 		"  --[no-]mac-updating: Enable or disable MAC addresses updating (enabled by default)\n"
@@ -647,6 +650,7 @@ ioat_parse_args(int argc, char **argv, unsigned int nb_ports)
 	static const char short_options[] =
 		"b:"  /* dma batch size */
 		"c:"  /* copy type (sw|hw) */
+		"f:"  /* max frame size */
 		"p:"  /* portmask */
 		"q:"  /* number of RX queues per port */
 		"s:"  /* ring size */
@@ -660,6 +664,7 @@ ioat_parse_args(int argc, char **argv, unsigned int nb_ports)
 		{CMD_LINE_OPT_COPY_TYPE, required_argument, NULL, 'c'},
 		{CMD_LINE_OPT_RING_SIZE, required_argument, NULL, 's'},
 		{CMD_LINE_OPT_BATCH_SIZE, required_argument, NULL, 'b'},
+		{CMD_LINE_OPT_FRAME_SIZE, required_argument, NULL, 'f'},
 		{NULL, 0, 0, 0}
 	};
 
@@ -684,6 +689,15 @@ ioat_parse_args(int argc, char **argv, unsigned int nb_ports)
 				return -1;
 			}
 			break;
+		case 'f':
+			max_frame_size = atoi(optarg);
+			if (max_frame_size > RTE_ETHER_MAX_JUMBO_FRAME_LEN) {
+				printf("Invalid max frame size, %s.\n", optarg);
+				ioat_usage(prgname);
+				return -1;
+			}
+			break;
+
 		/* portmask */
 		case 'p':
 			ioat_enabled_port_mask = ioat_parse_portmask(optarg);
@@ -879,6 +893,9 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 	struct rte_eth_dev_info dev_info;
 	int ret, i;
 
+	if (max_frame_size > local_port_conf.rxmode.mtu)
+		local_port_conf.rxmode.mtu = max_frame_size;
+
 	/* Skip ports that are not enabled */
 	if ((ioat_enabled_port_mask & (1 << portid)) == 0) {
 		printf("Skipping disabled port %u\n", portid);
@@ -989,6 +1006,7 @@ main(int argc, char **argv)
 	uint16_t nb_ports, portid;
 	uint32_t i;
 	unsigned int nb_mbufs;
+	size_t sz;
 
 	/* Init EAL. 8< */
 	ret = rte_eal_init(argc, argv);
@@ -1018,9 +1036,10 @@ main(int argc, char **argv)
 		MIN_POOL_SIZE);
 
 	/* Create the mbuf pool */
+	sz = max_frame_size + RTE_PKTMBUF_HEADROOM;
+	sz = RTE_MAX(sz, (size_t)RTE_MBUF_DEFAULT_BUF_SIZE);
 	ioat_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", nb_mbufs,
-		MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE,
-		rte_socket_id());
+		MEMPOOL_CACHE_SIZE, 0, sz, rte_socket_id());
 	if (ioat_pktmbuf_pool == NULL)
 		rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n");
 	/* >8 End of allocates mempool to hold the mbufs. */
-- 
2.30.2


  parent reply	other threads:[~2021-10-26 13:15 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 17:27 [dpdk-dev] [PATCH 0/6] port ioatfwd app to dmadev Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 1/6] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 2/6] examples/ioat: add cmd-line option to control DMA batch size Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 3/6] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 4/6] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 5/6] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-10 17:27 ` [dpdk-dev] [PATCH 6/6] examples/ioat: rename application to dmafwd Kevin Laatz
2021-09-17 16:41 ` [dpdk-dev] [PATCH v2 0/6] port ioatfwd app to dmadev Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 1/6] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-23 15:33       ` Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 2/6] examples/ioat: add cmd-line option to control DMA batch size Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 3/6] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-20 11:24     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 4/6] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-24  4:00     ` fengchengwen
2021-09-24  8:40       ` Kevin Laatz
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 5/6] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-17 16:41   ` [dpdk-dev] [PATCH v2 6/6] examples/ioat: rename application to dmafwd Kevin Laatz
2021-09-20 11:25     ` Conor Walsh
2021-09-23 13:53   ` [dpdk-dev] [PATCH v2 0/6] port ioatfwd app to dmadev fengchengwen
2021-09-23 14:00     ` Kevin Laatz
2021-09-28 16:29 ` [dpdk-dev] [PATCH v3 0/8] " Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 3/8] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 4/8] examples/ioat: add cmd line option to control stats print interval Kevin Laatz
2021-09-29 10:32     ` Conor Walsh
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-09-29 10:33     ` Conor Walsh
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-09-28 16:29   ` [dpdk-dev] [PATCH v3 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-14  9:53 ` [dpdk-dev] [PATCH v4 0/8] port ioatfwd app to dmadev Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 3/8] examples/ioat: add cmd line option to control max frame size Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 4/8] examples/ioat: add cmd line option to control stats print interval Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-10-14  9:53   ` [dpdk-dev] [PATCH v4 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-22 19:48   ` [dpdk-dev] [PATCH v4 0/8] port ioatfwd app to dmadev Thomas Monjalon
2021-10-25 19:59     ` Kevin Laatz
2021-10-26  0:56   ` fengchengwen
2021-10-26 11:46     ` Kevin Laatz
2021-10-26 13:14 ` [dpdk-dev] [PATCH v5 " Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 1/8] examples/ioat: always use same lcore for both DMA requests enqueue and dequeue Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 2/8] examples/ioat: add cmd line option to control DMA batch size Kevin Laatz
2021-10-26 13:14   ` Kevin Laatz [this message]
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 4/8] examples/ioat: add cmd line option to control stats print interval Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 5/8] examples/ioat: add signal-triggered device dumps Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 6/8] examples/ioat: port application to dmadev APIs Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 7/8] examples/ioat: update naming to match change to dmadev Kevin Laatz
2021-10-26 13:14   ` [dpdk-dev] [PATCH v5 8/8] examples/ioat: rename application to dmafwd Kevin Laatz
2021-10-27 13:23   ` [dpdk-dev] [PATCH v5 0/8] port ioatfwd app to dmadev Thomas Monjalon
2021-10-27 13:35     ` Kevin Laatz
2021-10-27 14:07       ` Thomas Monjalon
2021-10-27 14:14         ` Kevin Laatz
2021-10-27 14:54   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211026131432.2734145-4-kevin.laatz@intel.com \
    --to=kevin.laatz@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=conor.walsh@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.