From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0E918A0547; Tue, 26 Oct 2021 15:15:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCAC54111C; Tue, 26 Oct 2021 15:15:40 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id EEC0E4111B for ; Tue, 26 Oct 2021 15:15:38 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10148"; a="293360835" X-IronPort-AV: E=Sophos;i="5.87,184,1631602800"; d="scan'208";a="293360835" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 06:14:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,184,1631602800"; d="scan'208";a="497331623" Received: from silpixa00401122.ir.intel.com ([10.55.128.10]) by orsmga008.jf.intel.com with ESMTP; 26 Oct 2021 06:14:44 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: thomas@monjalon.net, bruce.richardson@intel.com, fengchengwen@huawei.com, conor.walsh@intel.com, Konstantin Ananyev , Kevin Laatz Date: Tue, 26 Oct 2021 13:14:27 +0000 Message-Id: <20211026131432.2734145-4-kevin.laatz@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211026131432.2734145-1-kevin.laatz@intel.com> References: <20210910172737.2561156-1-kevin.laatz@intel.com> <20211026131432.2734145-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 3/8] examples/ioat: add cmd line option to control max frame size 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" From: Konstantin Ananyev Add command line option for setting the max frame size. Signed-off-by: Konstantin Ananyev Signed-off-by: Kevin Laatz Reviewed-by: Conor Walsh --- 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 .//examples/dpdk-ioat [EAL options] -- [-p MASK] [-q NQ] [-s RS] [-c ] - [--[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