From patchwork Wed Feb 23 06:09:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 108121 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 15050A034C; Wed, 23 Feb 2022 07:09:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 898E940E5A; Wed, 23 Feb 2022 07:09:48 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 4979A40DF6 for ; Wed, 23 Feb 2022 07:09:47 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ACDD8106F; Tue, 22 Feb 2022 22:09:46 -0800 (PST) Received: from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com [10.118.13.211]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A1A233F66F; Tue, 22 Feb 2022 22:09:46 -0800 (PST) From: Honnappa Nagarahalli To: dev@dpdk.org, honnappa.nagarahalli@arm.com, lijuan.tu@intel.com, juraj.linkes@pantheon.tech, ohilyard@iol.unh.edu, david.marchand@redhat.com, thomas@monjalon.net, jerinj@marvell.com, bruce.richardson@intel.com, stephen@networkplumber.org, bluca@debian.org, ktraynor@redhat.com, christian.ehrhardt@canonical.com, xuemingl@nvidia.com Cc: kathleen.capella@arm.com, nd@arm.com, Ruifeng Wang Subject: [PATCH v3 1/2] examples/l3fwd: use single set of variables throughout the code Date: Wed, 23 Feb 2022 00:09:30 -0600 Message-Id: <20220223060931.2661907-1-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220202060403.118301-1-honnappa.nagarahalli@arm.com> References: <20220202060403.118301-1-honnappa.nagarahalli@arm.com> MIME-Version: 1.0 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 nb_rxd and nb_txd are used in polling mode and event mode of operation. nb_rxd and nb_txd are already global in polling mode but are not visible to event mode code. Make them visible to all parts of the application. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Kathleen Capella Reviewed-by: Ruifeng Wang Acked-by: Bruce Richardson Signed-off-by: Honnappa Nagarahalli Reviewed-by: Kathleen Capella Reviewed-by: Ruifeng Wang Acked-by: Bruce Richardson Tested-by: Yingya Han < yingyax.han@intel.com> --- DTS test cases require changing the RX and TX queue depths. Currently, this is achieved by patching the DPDK code. This patch set provides a mechanism to configure the queue depths while launching the application. With this change DTS test cases do not need to modify the DPDK code. v2 - Single parse function, additional validation on input (Stephen) v2 - Fixed typo (Ruifeng) and adjusted the commit msg (Kathleen). examples/l3fwd/l3fwd.h | 4 ++++ examples/l3fwd/l3fwd_event.c | 2 -- examples/l3fwd/main.c | 5 ++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 38ca19133c..4ccdb28b4a 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -81,6 +81,10 @@ struct lcore_conf { extern volatile bool force_quit; +/* RX and TX queue depths */ +extern uint16_t nb_rxd; +extern uint16_t nb_txd; + /* ethernet addresses of ports */ extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; diff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c index dd9eafa9b9..7a401290f8 100644 --- a/examples/l3fwd/l3fwd_event.c +++ b/examples/l3fwd/l3fwd_event.c @@ -43,8 +43,6 @@ l3fwd_eth_dev_port_setup(struct rte_eth_conf *port_conf) { struct l3fwd_event_resources *evt_rsrc = l3fwd_get_eventdev_rsrc(); uint16_t nb_ports = rte_eth_dev_count_avail(); - uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; - uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; unsigned int nb_lcores = rte_lcore_count(); struct rte_eth_conf local_port_conf; struct rte_eth_dev_info dev_info; diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index eb68ffc5aa..acd186ab7d 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -53,9 +53,8 @@ #define MAX_LCORE_PARAMS 1024 -/* Static global variables used within this file. */ -static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; -static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; +uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; +uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /**< Ports set in promiscuous mode off by default. */ static int promiscuous_on; From patchwork Wed Feb 23 06:09:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Honnappa Nagarahalli X-Patchwork-Id: 108122 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB7DDA034C; Wed, 23 Feb 2022 07:09:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CAD34114E; Wed, 23 Feb 2022 07:09:49 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 5A15440E5A for ; Wed, 23 Feb 2022 07:09:47 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B3A9F139F; Tue, 22 Feb 2022 22:09:46 -0800 (PST) Received: from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com [10.118.13.211]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AA26A3F882; Tue, 22 Feb 2022 22:09:46 -0800 (PST) From: Honnappa Nagarahalli To: dev@dpdk.org, honnappa.nagarahalli@arm.com, lijuan.tu@intel.com, juraj.linkes@pantheon.tech, ohilyard@iol.unh.edu, david.marchand@redhat.com, thomas@monjalon.net, jerinj@marvell.com, bruce.richardson@intel.com, stephen@networkplumber.org, bluca@debian.org, ktraynor@redhat.com, christian.ehrhardt@canonical.com, xuemingl@nvidia.com Cc: kathleen.capella@arm.com, nd@arm.com, Ruifeng Wang Subject: [PATCH v3 2/2] examples/l3fwd: make RX and TX queue size configurable Date: Wed, 23 Feb 2022 00:09:31 -0600 Message-Id: <20220223060931.2661907-2-honnappa.nagarahalli@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223060931.2661907-1-honnappa.nagarahalli@arm.com> References: <20220202060403.118301-1-honnappa.nagarahalli@arm.com> <20220223060931.2661907-1-honnappa.nagarahalli@arm.com> MIME-Version: 1.0 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 Make RX and TX queue sizes configurable from the command line. This helps DTS write better test cases. Signed-off-by: Honnappa Nagarahalli Reviewed-by: Kathleen Capella Reviewed-by: Ruifeng Wang Acked-by: Bruce Richardson --- examples/l3fwd/main.c | 54 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index acd186ab7d..3a0e15109b 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -341,6 +341,8 @@ print_usage(const char *prgname) " [-P]" " [--lookup]" " --config (port,queue,lcore)[,(port,queue,lcore)]" + " [--rx-queue-size NPKTS]" + " [--tx-queue-size NPKTS]" " [--eth-dest=X,MM:MM:MM:MM:MM:MM]" " [--max-pkt-len PKTLEN]" " [--no-numa]" @@ -360,6 +362,10 @@ print_usage(const char *prgname) " Default: lpm\n" " Accepted: em (Exact Match), lpm (Longest Prefix Match), fib (Forwarding Information Base)\n" " --config (port,queue,lcore): Rx queue configuration\n" + " --rx-queue-size NPKTS: Rx queue size in decimal\n" + " Default: %d\n" + " --tx-queue-size NPKTS: Tx queue size in decimal\n" + " Default: %d\n" " --eth-dest=X,MM:MM:MM:MM:MM:MM: Ethernet destination for port X\n" " --max-pkt-len PKTLEN: maximum packet length in decimal (64-9600)\n" " --no-numa: Disable numa awareness\n" @@ -381,7 +387,7 @@ print_usage(const char *prgname) " --event-vector-tmo: Max timeout to form vector in nanoseconds if event vectorization is enabled\n" " -E : Enable exact match, legacy flag please use --lookup=em instead\n" " -L : Enable longest prefix match, legacy flag please use --lookup=lpm instead\n\n", - prgname); + prgname, RTE_TEST_RX_DESC_DEFAULT, RTE_TEST_TX_DESC_DEFAULT); } static int @@ -524,6 +530,38 @@ parse_mode(const char *optarg) evt_rsrc->enabled = true; } +static void +parse_queue_size(const char *queue_size_arg, uint16_t *queue_size, int rx) +{ + char *end = NULL; + unsigned long value; + + /* parse decimal string */ + value = strtoul(queue_size_arg, &end, 10); + if ((queue_size_arg[0] == '\0') || (end == NULL) || + (*end != '\0') || (value == 0)) { + if (rx == 1) + rte_exit(EXIT_FAILURE, "Invalid rx-queue-size\n"); + else + rte_exit(EXIT_FAILURE, "Invalid tx-queue-size\n"); + + return; + } + + if (value > UINT16_MAX) { + if (rx == 1) + rte_exit(EXIT_FAILURE, "rx-queue-size %lu > %d\n", + value, UINT16_MAX); + else + rte_exit(EXIT_FAILURE, "tx-queue-size %lu > %d\n", + value, UINT16_MAX); + + return; + } + + *queue_size = value; +} + static void parse_eventq_sched(const char *optarg) { @@ -581,6 +619,8 @@ static const char short_options[] = ; #define CMD_LINE_OPT_CONFIG "config" +#define CMD_LINE_OPT_RX_QUEUE_SIZE "rx-queue-size" +#define CMD_LINE_OPT_TX_QUEUE_SIZE "tx-queue-size" #define CMD_LINE_OPT_ETH_DEST "eth-dest" #define CMD_LINE_OPT_NO_NUMA "no-numa" #define CMD_LINE_OPT_IPV6 "ipv6" @@ -603,6 +643,8 @@ enum { * conflict with short options */ CMD_LINE_OPT_MIN_NUM = 256, CMD_LINE_OPT_CONFIG_NUM, + CMD_LINE_OPT_RX_QUEUE_SIZE_NUM, + CMD_LINE_OPT_TX_QUEUE_SIZE_NUM, CMD_LINE_OPT_ETH_DEST_NUM, CMD_LINE_OPT_NO_NUMA_NUM, CMD_LINE_OPT_IPV6_NUM, @@ -621,6 +663,8 @@ enum { static const struct option lgopts[] = { {CMD_LINE_OPT_CONFIG, 1, 0, CMD_LINE_OPT_CONFIG_NUM}, + {CMD_LINE_OPT_RX_QUEUE_SIZE, 1, 0, CMD_LINE_OPT_RX_QUEUE_SIZE_NUM}, + {CMD_LINE_OPT_TX_QUEUE_SIZE, 1, 0, CMD_LINE_OPT_TX_QUEUE_SIZE_NUM}, {CMD_LINE_OPT_ETH_DEST, 1, 0, CMD_LINE_OPT_ETH_DEST_NUM}, {CMD_LINE_OPT_NO_NUMA, 0, 0, CMD_LINE_OPT_NO_NUMA_NUM}, {CMD_LINE_OPT_IPV6, 0, 0, CMD_LINE_OPT_IPV6_NUM}, @@ -714,6 +758,14 @@ parse_args(int argc, char **argv) lcore_params = 1; break; + case CMD_LINE_OPT_RX_QUEUE_SIZE_NUM: + parse_queue_size(optarg, &nb_rxd, 1); + break; + + case CMD_LINE_OPT_TX_QUEUE_SIZE_NUM: + parse_queue_size(optarg, &nb_txd, 0); + break; + case CMD_LINE_OPT_ETH_DEST_NUM: parse_eth_dest(optarg); break;