All of lore.kernel.org
 help / color / mirror / Atom feed
From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Cc: John McNamara <john.mcnamara@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Shreyansh Jain <shreyansh.jain@nxp.com>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: [PATCH v5 4/4] testpmd: make use of per-PMD TxRx parameters
Date: Fri,  6 Apr 2018 15:50:02 +0100	[thread overview]
Message-ID: <20180406145002.27480-5-remy.horton@intel.com> (raw)
In-Reply-To: <20180406145002.27480-1-remy.horton@intel.com>

The optimal values of several transmission & reception related
parameters, such as burst sizes, descriptor ring sizes, and number
of queues, varies between different network interface devices. This
patch allows testpmd to make use of per-PMD tuned parameter values.

Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 app/test-pmd/cmdline.c    | 31 ++++++++++++++++++++++++++++---
 app/test-pmd/parameters.c | 38 +++++++++++++++++++++++++++++++++-----
 app/test-pmd/testpmd.c    |  5 +++--
 3 files changed, 64 insertions(+), 10 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 40b31ad..0914425 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -2599,6 +2599,8 @@ cmd_config_burst_parsed(void *parsed_result,
 			__attribute__((unused)) void *data)
 {
 	struct cmd_config_burst *res = parsed_result;
+	struct rte_eth_dev_info dev_info;
+	uint16_t rec_nb_pkts;
 
 	if (!all_ports_stopped()) {
 		printf("Please stop all ports first\n");
@@ -2606,11 +2608,34 @@ cmd_config_burst_parsed(void *parsed_result,
 	}
 
 	if (!strcmp(res->name, "burst")) {
-		if (res->value < 1 || res->value > MAX_PKT_BURST) {
+		if (res->value == 0) {
+			/* If user gives a value of zero, query the PMD for
+			 * its recommended Rx burst size. Testpmd uses a single
+			 * size for all ports, so assume all ports are the same
+			 * NIC model and use the values from Port 0.
+			 */
+			rte_eth_dev_info_get(0, &dev_info);
+			rec_nb_pkts = dev_info.default_rxportconf.burst_size;
+
+			if (rec_nb_pkts == 0) {
+				printf("PMD does not recommend a burst size.\n"
+					"User provided value must be between"
+					" 1 and %d\n", MAX_PKT_BURST);
+				return;
+			} else if (rec_nb_pkts > MAX_PKT_BURST) {
+				printf("PMD recommended burst size of %d"
+					" exceeds maximum value of %d\n",
+					rec_nb_pkts, MAX_PKT_BURST);
+				return;
+			}
+			printf("Using PMD-provided burst value of %d\n",
+				rec_nb_pkts);
+			nb_pkt_per_burst = rec_nb_pkts;
+		} else if (res->value > MAX_PKT_BURST) {
 			printf("burst must be >= 1 && <= %d\n", MAX_PKT_BURST);
 			return;
-		}
-		nb_pkt_per_burst = res->value;
+		} else
+			nb_pkt_per_burst = res->value;
 	} else {
 		printf("Unknown parameter\n");
 		return;
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 2192bdc..cb6a229 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -544,6 +544,8 @@ launch_args_parse(int argc, char** argv)
 	/* Default offloads for all ports. */
 	uint64_t rx_offloads = rx_mode.offloads;
 	uint64_t tx_offloads = tx_mode.offloads;
+	struct rte_eth_dev_info dev_info;
+	uint16_t rec_nb_pkts;
 
 	static struct option lgopts[] = {
 		{ "help",			0, 0, 0 },
@@ -947,12 +949,38 @@ launch_args_parse(int argc, char** argv)
 			}
 			if (!strcmp(lgopts[opt_idx].name, "burst")) {
 				n = atoi(optarg);
-				if ((n >= 1) && (n <= MAX_PKT_BURST))
-					nb_pkt_per_burst = (uint16_t) n;
-				else
+				if (n == 0) {
+					/* A burst size of zero means that the
+					 * PMD should be queried for
+					 * recommended Rx burst size. Since
+					 * testpmd uses a single size for all
+					 * ports, port 0 is queried for the
+					 * value, on the assumption that all
+					 * ports are of the same NIC model.
+					 */
+					rte_eth_dev_info_get(0, &dev_info);
+					rec_nb_pkts = dev_info
+						.default_rxportconf.burst_size;
+
+					if (rec_nb_pkts == 0)
+						rte_exit(EXIT_FAILURE,
+							"PMD does not recommend a burst size. "
+							"Provided value must be between "
+							"1 and %d\n", MAX_PKT_BURST);
+					else if (rec_nb_pkts > MAX_PKT_BURST)
+						rte_exit(EXIT_FAILURE,
+							"PMD recommended burst size of %d"
+							" exceeds maximum value of %d\n",
+							rec_nb_pkts, MAX_PKT_BURST);
+					printf("Using PMD-provided burst value of %d\n",
+						rec_nb_pkts);
+					nb_pkt_per_burst = rec_nb_pkts;
+				} else if (n > MAX_PKT_BURST)
 					rte_exit(EXIT_FAILURE,
-						 "burst must >= 1 and <= %d]",
-						 MAX_PKT_BURST);
+						"burst must be between1 and %d\n",
+						MAX_PKT_BURST);
+				else
+					nb_pkt_per_burst = (uint16_t) n;
 			}
 			if (!strcmp(lgopts[opt_idx].name, "mbcache")) {
 				n = atoi(optarg);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 4c0e258..82eb197 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -210,9 +210,10 @@ queueid_t nb_txq = 1; /**< Number of TX queues per port. */
 
 /*
  * Configurable number of RX/TX ring descriptors.
+ * Defaults are supplied by drivers via ethdev.
  */
-#define RTE_TEST_RX_DESC_DEFAULT 1024
-#define RTE_TEST_TX_DESC_DEFAULT 1024
+#define RTE_TEST_RX_DESC_DEFAULT 0
+#define RTE_TEST_TX_DESC_DEFAULT 0
 uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; /**< Number of RX descriptors. */
 uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /**< Number of TX descriptors. */
 
-- 
2.9.5

  parent reply	other threads:[~2018-04-06 14:50 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 12:08 [RFC PATCH v1 0/4] ethdev: add per-PMD tuning of RxTx parmeters Remy Horton
2018-03-07 12:08 ` [RFC PATCH v1 1/4] ethdev: add support for PMD-tuned Tx/Rx parameters Remy Horton
2018-03-14 12:28   ` Shreyansh Jain
2018-03-14 14:09     ` Remy Horton
2018-03-14 14:43   ` Ferruh Yigit
2018-03-14 15:10     ` Shreyansh Jain
2018-03-15  9:02       ` Remy Horton
2018-03-14 15:48     ` Remy Horton
2018-03-14 16:42       ` Ferruh Yigit
2018-03-14 17:23         ` Shreyansh Jain
2018-03-14 17:52           ` Ferruh Yigit
2018-03-14 18:53             ` Ananyev, Konstantin
2018-03-14 21:02               ` Ferruh Yigit
2018-03-14 21:36                 ` Bruce Richardson
2018-03-15 13:57                   ` Ferruh Yigit
2018-03-15 14:39                     ` Bruce Richardson
2018-03-15 14:57                       ` Ferruh Yigit
2018-03-16 13:54                         ` Shreyansh Jain
2018-03-16 14:18                           ` Bruce Richardson
2018-03-16 15:36                           ` Remy Horton
2018-03-20 15:03                             ` Ferruh Yigit
2018-03-21 10:14                               ` Remy Horton
2018-03-21 13:56                                 ` Ferruh Yigit
2018-03-20 14:54                           ` Ferruh Yigit
2018-03-21  6:51                             ` Shreyansh Jain
2018-03-21 10:02                               ` Ferruh Yigit
2018-03-21 10:45                                 ` Shreyansh Jain
2018-03-15 12:51                 ` Ananyev, Konstantin
2018-03-15 13:57                   ` Ferruh Yigit
2018-03-15 14:42                     ` Bruce Richardson
2018-03-07 12:08 ` [RFC PATCH v1 2/4] net/e1000: add TxRx tuning parameters Remy Horton
2018-03-07 12:08 ` [RFC PATCH v1 3/4] net/i40e: " Remy Horton
2018-03-07 12:08 ` [RFC PATCH v1 4/4] testpmd: make use of per-PMD TxRx parameters Remy Horton
2018-03-21 14:27 ` [PATCH v2 0/4] ethdev: add per-PMD tuning of RxTx parmeters Remy Horton
2018-03-21 14:27   ` [PATCH v2 1/4] ethdev: add support for PMD-tuned Tx/Rx parameters Remy Horton
2018-03-28  7:11     ` Shreyansh Jain
2018-03-30 15:40     ` Thomas Monjalon
2018-03-30 15:57       ` Thomas Monjalon
2018-03-31  0:46     ` Thomas Monjalon
2018-03-21 14:27   ` [PATCH v2 2/4] net/e1000: add TxRx tuning parameters Remy Horton
2018-03-21 14:27   ` [PATCH v2 3/4] net/i40e: " Remy Horton
2018-03-21 14:27   ` [PATCH v2 4/4] testpmd: make use of per-PMD TxRx parameters Remy Horton
2018-03-28  7:18     ` Shreyansh Jain
2018-04-03 11:00       ` Remy Horton
2018-03-31  0:01     ` Thomas Monjalon
2018-04-03  8:49       ` Remy Horton
2018-03-27 18:43   ` [PATCH v2 0/4] ethdev: add per-PMD tuning of RxTx parmeters Ferruh Yigit
2018-03-30 10:34     ` Ferruh Yigit
2018-03-31  0:05       ` Thomas Monjalon
2018-04-04 17:17   ` [PATCH v3 " Remy Horton
2018-04-04 17:17     ` [PATCH v3 1/4] ethdev: add support for PMD-tuned Tx/Rx parameters Remy Horton
2018-04-04 18:56       ` De Lara Guarch, Pablo
2018-04-05 10:16         ` Thomas Monjalon
2018-04-04 17:17     ` [PATCH v3 2/4] net/e1000: add TxRx tuning parameters Remy Horton
2018-04-04 17:17     ` [PATCH v3 3/4] net/i40e: " Remy Horton
2018-04-04 17:17     ` [PATCH v3 4/4] testpmd: make use of per-PMD TxRx parameters Remy Horton
2018-04-06 14:49     ` [PATCH v5 0/4] ethdev: add per-PMD tuning of RxTx parmeters Remy Horton
2018-04-06 14:49       ` [PATCH v5 1/4] ethdev: add support for PMD-tuned Tx/Rx parameters Remy Horton
2018-04-06 14:50       ` [PATCH v5 2/4] net/e1000: add TxRx tuning parameters Remy Horton
2018-04-06 14:50       ` [PATCH v5 3/4] net/i40e: " Remy Horton
2018-04-06 14:50       ` Remy Horton [this message]
2018-04-09 12:55         ` [PATCH v5 4/4] testpmd: make use of per-PMD TxRx parameters Shreyansh Jain
2018-04-09 14:38           ` Remy Horton
2018-04-10  4:18             ` Shreyansh Jain
2018-04-10  6:09               ` Remy Horton
2018-04-10  6:39                 ` Shreyansh Jain
2018-04-06 17:01       ` [PATCH v5 0/4] ethdev: add per-PMD tuning of RxTx parmeters Ferruh Yigit
2018-04-10  9:43       ` [PATCH v6 " Remy Horton
2018-04-10  9:43         ` [PATCH v6 1/4] ethdev: add support for PMD-tuned Tx/Rx parameters Remy Horton
2018-04-10  9:43         ` [PATCH v6 2/4] net/e1000: add TxRx tuning parameters Remy Horton
2018-04-10  9:43         ` [PATCH v6 3/4] net/i40e: " Remy Horton
2018-04-10  9:43         ` [PATCH v6 4/4] testpmd: make use of per-PMD TxRx parameters Remy Horton
2018-04-10 12:57         ` [PATCH v6 0/4] ethdev: add per-PMD tuning of RxTx parmeters Thomas Monjalon
2018-04-10 18:56         ` Ferruh Yigit

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=20180406145002.27480-5-remy.horton@intel.com \
    --to=remy.horton@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=shreyansh.jain@nxp.com \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.com \
    /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.