From patchwork Mon Feb 12 04:53:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 35120 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 046A01B344; Mon, 12 Feb 2018 05:53:27 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 055A31B314 for ; Mon, 12 Feb 2018 05:53:23 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2018 20:53:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,500,1511856000"; d="scan'208";a="30009479" Received: from dpdk51.sh.intel.com ([10.67.110.184]) by fmsmga001.fm.intel.com with ESMTP; 11 Feb 2018 20:53:22 -0800 From: Qi Zhang To: thomas@monjalon.net Cc: dev@dpdk.org, jingjing.wu@intel.com, beilei.xing@intel.com, arybchenko@solarflare.com, konstantin.ananyev@intel.com, Qi Zhang Date: Mon, 12 Feb 2018 12:53:12 +0800 Message-Id: <20180212045314.171616-3-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180212045314.171616-1-qi.z.zhang@intel.com> References: <20180212045314.171616-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH 2/4] app/testpmd: add parameters for deferred queue setup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Add two parameters: rxq-setup: set the number of RX queues be setup before device started txq-setup: set the number of TX queues be setup before device started. Signed-off-by: Qi Zhang --- app/test-pmd/parameters.c | 29 +++++++++++++++++++++++++++++ app/test-pmd/testpmd.c | 8 ++++++-- app/test-pmd/testpmd.h | 2 ++ doc/guides/testpmd_app_ug/run_app.rst | 12 ++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 97d22b860..497259ee7 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -146,8 +146,12 @@ usage(char* progname) printf(" --rss-ip: set RSS functions to IPv4/IPv6 only .\n"); printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n"); printf(" --rxq=N: set the number of RX queues per port to N.\n"); + printf(" --rxq-setup=N: set the number of RX queues be setup before" + "device start to N.\n"); printf(" --rxd=N: set the number of descriptors in RX rings to N.\n"); printf(" --txq=N: set the number of TX queues per port to N.\n"); + printf(" --txq-setup=N: set the number of TX queues be setup before" + "device start to N.\n"); printf(" --txd=N: set the number of descriptors in TX rings to N.\n"); printf(" --burst=N: set the number of packets per burst to N.\n"); printf(" --mbcache=N: set the cache of mbuf memory pool to N.\n"); @@ -596,7 +600,9 @@ launch_args_parse(int argc, char** argv) { "rss-ip", 0, 0, 0 }, { "rss-udp", 0, 0, 0 }, { "rxq", 1, 0, 0 }, + { "rxq-setup", 1, 0, 0 }, { "txq", 1, 0, 0 }, + { "txq-setup", 1, 0, 0 }, { "rxd", 1, 0, 0 }, { "txd", 1, 0, 0 }, { "burst", 1, 0, 0 }, @@ -933,6 +939,15 @@ launch_args_parse(int argc, char** argv) " >= 0 && <= %u\n", n, get_allowed_max_nb_rxq(&pid)); } + if (!strcmp(lgopts[opt_idx].name, "rxq-setup")) { + n = atoi(optarg); + if (n >= 0 && check_nb_rxq((queueid_t)n) == 0) + nb_rxq_setup = (queueid_t) n; + else + rte_exit(EXIT_FAILURE, "rxq-setup %d invalid - must be" + " >= 0 && <= %u\n", n, + get_allowed_max_nb_rxq(&pid)); + } if (!strcmp(lgopts[opt_idx].name, "txq")) { n = atoi(optarg); if (n >= 0 && check_nb_txq((queueid_t)n) == 0) @@ -942,6 +957,15 @@ launch_args_parse(int argc, char** argv) " >= 0 && <= %u\n", n, get_allowed_max_nb_txq(&pid)); } + if (!strcmp(lgopts[opt_idx].name, "txq-setup")) { + n = atoi(optarg); + if (n >= 0 && check_nb_txq((queueid_t)n) == 0) + nb_txq_setup = (queueid_t) n; + else + rte_exit(EXIT_FAILURE, "txq-setup %d invalid - must be" + " >= 0 && <= %u\n", n, + get_allowed_max_nb_txq(&pid)); + } if (!nb_rxq && !nb_txq) { rte_exit(EXIT_FAILURE, "Either rx or tx queues should " "be non-zero\n"); @@ -1119,4 +1143,9 @@ launch_args_parse(int argc, char** argv) /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; tx_mode.offloads = tx_offloads; + + if (nb_rxq_setup > nb_rxq) + nb_rxq_setup = nb_rxq; + if (nb_txq_setup > nb_txq) + nb_txq_setup = nb_txq; } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 46dc22c94..790e7359c 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -207,6 +207,10 @@ uint8_t dcb_test = 0; */ queueid_t nb_rxq = 1; /**< Number of RX queues per port. */ queueid_t nb_txq = 1; /**< Number of TX queues per port. */ +queueid_t nb_rxq_setup = MAX_QUEUE_ID; +/**< Number of RX queues per port start when dev_start. */ +queueid_t nb_txq_setup = MAX_QUEUE_ID; +/**< Number of TX queues per port start when dev_start */ /* * Configurable number of RX/TX ring descriptors. @@ -1594,7 +1598,7 @@ start_port(portid_t pid) /* Apply Tx offloads configuration */ port->tx_conf.offloads = port->dev_conf.txmode.offloads; /* setup tx queues */ - for (qi = 0; qi < nb_txq; qi++) { + for (qi = 0; qi < nb_txq_setup; qi++) { if ((numa_support) && (txring_numa[pi] != NUMA_NO_CONFIG)) diag = rte_eth_tx_queue_setup(pi, qi, @@ -1622,7 +1626,7 @@ start_port(portid_t pid) /* Apply Rx offloads configuration */ port->rx_conf.offloads = port->dev_conf.rxmode.offloads; /* setup rx queues */ - for (qi = 0; qi < nb_rxq; qi++) { + for (qi = 0; qi < nb_rxq_setup; qi++) { if ((numa_support) && (rxring_numa[pi] != NUMA_NO_CONFIG)) { struct rte_mempool * mp = diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 153abea05..1a423eb8c 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -373,6 +373,8 @@ extern uint64_t rss_hf; extern queueid_t nb_rxq; extern queueid_t nb_txq; +extern queueid_t nb_rxq_setup; +extern queueid_t nb_txq_setup; extern uint16_t nb_rxd; extern uint16_t nb_txd; diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 1fd53958a..63dbec407 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -354,6 +354,12 @@ The commandline options are: Set the number of RX queues per port to N, where 1 <= N <= 65535. The default value is 1. +* ``--rxq-setup=N`` + + Set the number of RX queues will be setup before device started, + where 0 <= N <= 65535. The default value is rxq, if the number is + larger than rxq, it will be set to rxq automatically. + * ``--rxd=N`` Set the number of descriptors in the RX rings to N, where N > 0. @@ -364,6 +370,12 @@ The commandline options are: Set the number of TX queues per port to N, where 1 <= N <= 65535. The default value is 1. +* ``--txq-setup=N`` + + Set the number of TX queues will be setup before device started, + where 0 <= N <= 65535. The default value is rxq, if the number is + larger than txq, it will be set to txq automatically. + * ``--txd=N`` Set the number of descriptors in the TX rings to N, where N > 0.