From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2A6991B5E0 for ; Wed, 18 Oct 2017 09:14:23 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Oct 2017 00:14:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,394,1503385200"; d="scan'208";a="1207047389" Received: from dpdk-lixiaoyun.sh.intel.com ([10.67.110.162]) by fmsmga001.fm.intel.com with ESMTP; 18 Oct 2017 00:14:22 -0700 From: Xiaoyun Li To: jingjing.wu@intel.com Cc: dev@dpdk.org, Xiaoyun Li Date: Wed, 18 Oct 2017 15:11:31 +0800 Message-Id: <1508310691-34865-1-git-send-email-xiaoyun.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506736748-50515-1-git-send-email-xiaoyun.li@intel.com> References: <1506736748-50515-1-git-send-email-xiaoyun.li@intel.com> Subject: [dpdk-dev] [PATCH v3] examples/l3fwd: pass flow arguments when start app 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: , X-List-Received-Date: Wed, 18 Oct 2017 07:14:24 -0000 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 --- 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