All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyun Li <xiaoyun.li@intel.com>
To: jingjing.wu@intel.com
Cc: dev@dpdk.org, Xiaoyun Li <xiaoyun.li@intel.com>
Subject: [PATCH v3] examples/l3fwd: pass flow arguments when start app
Date: Wed, 18 Oct 2017 15:11:31 +0800	[thread overview]
Message-ID: <1508310691-34865-1-git-send-email-xiaoyun.li@intel.com> (raw)
In-Reply-To: <1506736748-50515-1-git-send-email-xiaoyun.li@intel.com>

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(-)

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;
-- 
2.7.4

  parent reply	other threads:[~2017-10-18  7:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28  2:31 [PATCH] examples/l3fwd: pass flow arguments when starting l3fwd Xiaoyun Li
2017-09-30  1:59 ` [PATCH v2] examples/l3fwd: pass flow arguments when start app Xiaoyun Li
2017-10-01 17:24   ` Stephen Hemminger
2017-10-05  8:35     ` Wu, Jingjing
2017-10-10  7:57       ` Wu, Jingjing
2017-10-18  7:11   ` Xiaoyun Li [this message]
2017-10-24  1:38     ` [PATCH v3] " Wu, Jingjing
2017-10-24 21:44       ` Thomas Monjalon

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=1508310691-34865-1-git-send-email-xiaoyun.li@intel.com \
    --to=xiaoyun.li@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@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.