[dpdk-dev,v3] examples/l3fwd: pass flow arguments when start app

Message ID 1508310691-34865-1-git-send-email-xiaoyun.li@intel.com (mailing list archive)
State Rejected, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Li, Xiaoyun Oct. 18, 2017, 7:11 a.m. UTC
  To make the performance can be tuning on different NICs or platforms. We
need to make the number of descriptors as arguments when starting l3fwd
application.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
v3
*Delete added Rx/Tx threshold arguments.

v2
* Modify commit log.
* Update the change in guides doc.

 doc/guides/sample_app_ug/l3_forward.rst |  6 +++
 examples/l3fwd/main.c                   | 72 ++++++++++++++++++++++++++++++++-
 2 files changed, 76 insertions(+), 2 deletions(-)
  

Comments

Jingjing Wu Oct. 24, 2017, 1:38 a.m. UTC | #1
> -----Original Message-----
> From: Li, Xiaoyun
> Sent: Wednesday, October 18, 2017 3:12 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH v3] examples/l3fwd: pass flow arguments when start app
> 
> To make the performance can be tuning on different NICs or platforms. We
> need to make the number of descriptors as arguments when starting l3fwd
> application.
> 
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>

Agree to this change.

Reviewed-by: Jingjing Wu <jingjing.wu@intel.com>
  
Thomas Monjalon Oct. 24, 2017, 9:44 p.m. UTC | #2
24/10/2017 03:38, Wu, Jingjing:
> From: Li, Xiaoyun
> > To make the performance can be tuning on different NICs or platforms. We
> > need to make the number of descriptors as arguments when starting l3fwd
> > application.
> > 
> > Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> 
> Agree to this change.
> 
> Reviewed-by: Jingjing Wu <jingjing.wu@intel.com>

As Stephen, I disagree.

I agree that it may be convenient to test performance tuning.
But it is the purpose of testpmd, not l3fwd example.

This change shows that we need to improve defaults.
I will block this patch in order to get someone working on improvements
in ethdev and drivers.
  

Patch

diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst
index 2635f40..af05744 100644
--- a/doc/guides/sample_app_ug/l3_forward.rst
+++ b/doc/guides/sample_app_ug/l3_forward.rst
@@ -101,6 +101,8 @@  The application has a number of command line options::
                              [--hash-entry-num]
                              [--ipv6]
                              [--parse-ptype]
+                             [--nb-rxd]
+                             [--nb-txd]
 
 Where,
 
@@ -129,6 +131,10 @@  Where,
 
 * ``--parse-ptype:`` Optional, set to use software to analyze packet type. Without this option, hardware will check the packet type.
 
+* ``--nb-rxd:`` Optional, specifies the number of Rx queue discriptors in decimal.
+
+* ``--nb-txd:`` Optional, specifies the number of Tx queue discriptors in decimal.
+
 For example, consider a dual processor socket platform with 8 physical cores, where cores 0-7 and 16-23 appear on socket 0,
 while cores 8-15 and 24-31 appear on socket 1.
 
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index a5e55ba..bc6c3b2 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -320,7 +320,9 @@  print_usage(const char *prgname)
 		" [--no-numa]"
 		" [--hash-entry-num]"
 		" [--ipv6]"
-		" [--parse-ptype]\n\n"
+		" [--parse-ptype]"
+		" [--nb-rxd]"
+		" [--nb-txd]\n\n"
 
 		"  -p PORTMASK: Hexadecimal bitmask of ports to configure\n"
 		"  -P : Enable promiscuous mode\n"
@@ -334,7 +336,9 @@  print_usage(const char *prgname)
 		"  --no-numa: Disable numa awareness\n"
 		"  --hash-entry-num: Specify the hash entry number in hexadecimal to be setup\n"
 		"  --ipv6: Set if running ipv6 packets\n"
-		"  --parse-ptype: Set to use software to analyze packet type\n\n",
+		"  --parse-ptype: Set to use software to analyze packet type\n"
+		"  --nb-rxd: Set number of descriptors of Rx queue\n"
+		"  --nb-txd: Set number of descriptors of Tx queue\n\n",
 		prgname);
 }
 
@@ -389,6 +393,40 @@  parse_hash_entry_number(const char *hash_entry_num)
 }
 
 static int
+parse_nb_rxd(const char *nb_rxd_c)
+{
+	char *end = NULL;
+	unsigned int nb_rxd_t;
+
+	/* parse hexadecimal string */
+	nb_rxd_t = strtoul(nb_rxd_c, &end, 10);
+	if ((nb_rxd_c[0] == '\0') || (end == NULL) || (*end != '\0'))
+		return -1;
+
+	if (nb_rxd_t == 0)
+		return -1;
+
+	return nb_rxd_t;
+}
+
+static int
+parse_nb_txd(const char *nb_txd_c)
+{
+	char *end = NULL;
+	unsigned int nb_txd_t;
+
+	/* parse hexadecimal string */
+	nb_txd_t = strtoul(nb_txd_c, &end, 10);
+	if ((nb_txd_c[0] == '\0') || (end == NULL) || (*end != '\0'))
+		return -1;
+
+	if (nb_txd_t == 0)
+		return -1;
+
+	return nb_txd_t;
+}
+
+static int
 parse_config(const char *q_arg)
 {
 	char s[256];
@@ -487,6 +525,8 @@  static const char short_options[] =
 #define CMD_LINE_OPT_ENABLE_JUMBO "enable-jumbo"
 #define CMD_LINE_OPT_HASH_ENTRY_NUM "hash-entry-num"
 #define CMD_LINE_OPT_PARSE_PTYPE "parse-ptype"
+#define CMD_LINE_OPT_NB_RXD "nb-rxd"
+#define CMD_LINE_OPT_NB_TXD "nb-txd"
 enum {
 	/* long options mapped to a short option */
 
@@ -500,6 +540,8 @@  enum {
 	CMD_LINE_OPT_ENABLE_JUMBO_NUM,
 	CMD_LINE_OPT_HASH_ENTRY_NUM_NUM,
 	CMD_LINE_OPT_PARSE_PTYPE_NUM,
+	CMD_LINE_OPT_NB_RXD_NUM,
+	CMD_LINE_OPT_NB_TXD_NUM,
 };
 
 static const struct option lgopts[] = {
@@ -510,6 +552,8 @@  static const struct option lgopts[] = {
 	{CMD_LINE_OPT_ENABLE_JUMBO, 0, 0, CMD_LINE_OPT_ENABLE_JUMBO_NUM},
 	{CMD_LINE_OPT_HASH_ENTRY_NUM, 1, 0, CMD_LINE_OPT_HASH_ENTRY_NUM_NUM},
 	{CMD_LINE_OPT_PARSE_PTYPE, 0, 0, CMD_LINE_OPT_PARSE_PTYPE_NUM},
+	{CMD_LINE_OPT_NB_RXD, 1, 0, CMD_LINE_OPT_NB_RXD_NUM},
+	{CMD_LINE_OPT_NB_TXD, 1, 0, CMD_LINE_OPT_NB_TXD_NUM},
 	{NULL, 0, 0, 0}
 };
 
@@ -554,6 +598,8 @@  parse_args(int argc, char **argv)
 	const char *str12 =
 		"L3FWD: LPM and EM are mutually exclusive, select only one";
 	const char *str13 = "L3FWD: LPM or EM none selected, default LPM on";
+	const char *str14 = "L3FWD: Invalid Rx descriptors number";
+	const char *str15 = "L3FWD: Invalid Tx descriptors number";
 
 	while ((opt = getopt_long(argc, argvopt, short_options,
 				lgopts, &option_index)) != EOF) {
@@ -652,6 +698,28 @@  parse_args(int argc, char **argv)
 			parse_ptype = 1;
 			break;
 
+		case CMD_LINE_OPT_NB_RXD_NUM:
+			ret = parse_nb_rxd(optarg);
+			if (ret > 0)
+				nb_rxd = ret;
+			else{
+				printf("%s\n", str14);
+				print_usage(prgname);
+				return -1;
+			}
+			break;
+
+		case CMD_LINE_OPT_NB_TXD_NUM:
+			ret = parse_nb_txd(optarg);
+			if (ret > 0)
+				nb_txd = ret;
+			else{
+				printf("%s\n", str15);
+				print_usage(prgname);
+				return -1;
+			}
+			break;
+
 		default:
 			print_usage(prgname);
 			return -1;