From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28C8BA00C5; Thu, 7 May 2020 02:52:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 77D9D1DAE9; Thu, 7 May 2020 02:52:07 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id CF5F31DAE7 for ; Thu, 7 May 2020 02:52:05 +0200 (CEST) From: Xiaoyu Min To: ferruh.yigit@intel.com, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic Cc: dev@dpdk.org Date: Thu, 7 May 2020 03:51:59 +0300 Message-Id: <7610a1501291e224dce3cf7e00c968e24b5c9289.1588812049.git.jackmin@mellanox.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3] app/testpmd: add cmdline option to set Rx mq mode 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" One new cmdline option `--rx-mq-mode` is added in order to have the possibility to check whether PMD handle the mq mode correctly or not. The reason is some NICs need to do different settings based on different RX mq mode, i.e RSS or not. With this support in testpmd, the above scenario can be tested easily. Signed-off-by: Xiaoyu Min --- app/test-pmd/parameters.c | 15 +++++++++++++++ app/test-pmd/testpmd.c | 17 ++++++++++++++--- app/test-pmd/testpmd.h | 2 ++ doc/guides/rel_notes/release_20_05.rst | 4 ++++ doc/guides/testpmd_app_ug/run_app.rst | 7 +++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 30c1753c32..9f80fe898f 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -212,6 +212,8 @@ usage(char* progname) printf(" --noisy-lkup-num-writes=N: do N random reads and writes per packet\n"); printf(" --no-iova-contig: mempool memory can be IOVA non contiguous. " "valid only with --mp-alloc=anon\n"); + printf(" --rx-mq-mode=0xX: hexadecimal bitmask of RX mq mode can be " + "enabled\n"); } #ifdef RTE_LIBRTE_CMDLINE @@ -670,6 +672,7 @@ launch_args_parse(int argc, char** argv) { "noisy-lkup-num-reads", 1, 0, 0 }, { "noisy-lkup-num-reads-writes", 1, 0, 0 }, { "no-iova-contig", 0, 0, 0 }, + { "rx-mq-mode", 1, 0, 0 }, { 0, 0, 0, 0 }, }; @@ -1363,6 +1366,18 @@ launch_args_parse(int argc, char** argv) } if (!strcmp(lgopts[opt_idx].name, "no-iova-contig")) mempool_flags = MEMPOOL_F_NO_IOVA_CONTIG; + + if (!strcmp(lgopts[opt_idx].name, "rx-mq-mode")) { + char *end = NULL; + n = strtoul(optarg, &end, 16); + if (n >= 0 && n <= ETH_MQ_RX_VMDQ_DCB_RSS) + rx_mq_mode = (enum rte_eth_rx_mq_mode)n; + else + rte_exit(EXIT_FAILURE, + "rx-mq-mode must be >= 0 and " + " <= %d\n", + ETH_MQ_RX_VMDQ_DCB_RSS); + } break; case 'h': usage(argv[0]); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 99bacddbfd..808cfae463 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -482,6 +482,11 @@ uint8_t bitrate_enabled; struct gro_status gro_ports[RTE_MAX_ETHPORTS]; uint8_t gro_flush_cycles = GRO_DEFAULT_FLUSH_CYCLES; +/* + * hexadecimal bitmask of RX mq mode can be enabled. + */ +enum rte_eth_rx_mq_mode rx_mq_mode = ETH_MQ_RX_VMDQ_DCB_RSS; + /* Forward function declarations */ static void setup_attached_port(portid_t pi); static void map_port_queue_stats_mapping_registers(portid_t pi, @@ -3337,7 +3342,9 @@ init_port_config(void) if (port->dcb_flag == 0) { if( port->dev_conf.rx_adv_conf.rss_conf.rss_hf != 0) - port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_RSS; + port->dev_conf.rxmode.mq_mode = + (enum rte_eth_rx_mq_mode) + (rx_mq_mode & ETH_MQ_RX_RSS); else port->dev_conf.rxmode.mq_mode = ETH_MQ_RX_NONE; } @@ -3438,7 +3445,9 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf, } /* set DCB mode of RX and TX of multiple queues */ - eth_conf->rxmode.mq_mode = ETH_MQ_RX_VMDQ_DCB; + eth_conf->rxmode.mq_mode = + (enum rte_eth_rx_mq_mode) + (rx_mq_mode & ETH_MQ_RX_VMDQ_DCB); eth_conf->txmode.mq_mode = ETH_MQ_TX_VMDQ_DCB; } else { struct rte_eth_dcb_rx_conf *rx_conf = @@ -3458,7 +3467,9 @@ get_eth_dcb_conf(portid_t pid, struct rte_eth_conf *eth_conf, tx_conf->dcb_tc[i] = i % num_tcs; } - eth_conf->rxmode.mq_mode = ETH_MQ_RX_DCB_RSS; + eth_conf->rxmode.mq_mode = + (enum rte_eth_rx_mq_mode) + (rx_mq_mode & ETH_MQ_RX_DCB_RSS); eth_conf->rx_adv_conf.rss_conf = rss_conf; eth_conf->txmode.mq_mode = ETH_MQ_TX_DCB; } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 7ff4c5dba3..e47d1a40f4 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -602,6 +602,8 @@ struct mplsoudp_decap_conf { }; extern struct mplsoudp_decap_conf mplsoudp_decap_conf; +extern enum rte_eth_rx_mq_mode rx_mq_mode; + static inline unsigned int lcore_num(void) { diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 777d36e582..c94d84a14c 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -216,6 +216,10 @@ New Features * Added IPsec inbound load-distribution support for ipsec-secgw application using NIC load distribution feature(Flow Director). +* **Updated testpmd application.** + + * Added a new cmdline option ``--rx-mq-mode`` which can be used to test PMD's + behaviour on handling Rx mq mode. Removed Items ------------- diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 727ef52b8f..d586f2e35d 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -481,3 +481,10 @@ The command line options are: Enable to create mempool which is not IOVA contiguous. Valid only with --mp-alloc=anon. The default value is 0. + +* ``--rx-mq-mode`` + + Set the hexadecimal bitmask of RX multi queue mode which can be enabled. + The default value is 0x7:: + + ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG | ETH_MQ_RX_VMDQ_FLAG -- 2.26.2