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 9219CA058A; Wed, 25 Mar 2020 07:44:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 69D361B75C; Wed, 25 Mar 2020 07:44:29 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id BAE601C029; Wed, 25 Mar 2020 07:44:25 +0100 (CET) IronPort-SDR: 9MW3G1fqeuruJzizwDz8SAoz1z4tJWGvqb20woWIaYVgjWm3WpBwKzEh+juQL5Fl1YZLuPsftr UrA4erzW71kQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2020 23:44:24 -0700 IronPort-SDR: mS7Qot58Ew06Z3u0IK+c9TOhaK3kTlSJGxpVWXKaRx5GGsy8396Uo33ADa1Ov4lhAaYGJ7JZ8y X+obWM69Xfxw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,303,1580803200"; d="scan'208";a="265429817" Received: from intel.sh.intel.com ([10.239.255.136]) by orsmga002.jf.intel.com with ESMTP; 24 Mar 2020 23:44:21 -0700 From: Junyu Jiang To: dev@dpdk.org Cc: Qiming Yang , Ferruh Yigit , Junyu Jiang , stable@dpdk.org Date: Wed, 25 Mar 2020 06:32:48 +0000 Message-Id: <20200325063248.28484-3-junyux.jiang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200325063248.28484-1-junyux.jiang@intel.com> References: <20200303091621.30114-1-junyux.jiang@intel.com> <20200325063248.28484-1-junyux.jiang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/2] examples/vmdq: fix RSS configuration 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" In order that all queues of pools can receive packets, add enable-rss argument to change rss configuration. Fixes: 6bb97df521aa ("examples/vmdq: new app") Cc: stable@dpdk.org Signed-off-by: Junyu Jiang Acked-by: Xiaoyun Li --- doc/guides/sample_app_ug/vmdq_forwarding.rst | 6 +-- examples/vmdq/main.c | 39 +++++++++++++++++--- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/doc/guides/sample_app_ug/vmdq_forwarding.rst b/doc/guides/sample_app_ug/vmdq_forwarding.rst index df23043d6..658d6742d 100644 --- a/doc/guides/sample_app_ug/vmdq_forwarding.rst +++ b/doc/guides/sample_app_ug/vmdq_forwarding.rst @@ -26,13 +26,13 @@ The IntelĀ® 82599 10 Gigabit Ethernet Controller NIC also supports the splitting While the IntelĀ® X710 or XL710 Ethernet Controller NICs support many configurations of VMDQ pools of 4 or 8 queues each. And queues numbers for each VMDQ pool can be changed by setting CONFIG_RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM in config/common_* file. -The nb-pools parameter can be passed on the command line, after the EAL parameters: +The nb-pools and enable-rss parameters can be passed on the command line, after the EAL parameters: .. code-block:: console - ./build/vmdq_app [EAL options] -- -p PORTMASK --nb-pools NP + ./build/vmdq_app [EAL options] -- -p PORTMASK --nb-pools NP --enable-rss -where, NP can be 8, 16 or 32. +where, NP can be 8, 16 or 32, rss is disabled by default. In Linux* user space, the application can display statistics with the number of packets received on each queue. To have the application display the statistics, send a SIGHUP signal to the running application process. diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 011110920..98032e6a3 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -59,6 +59,7 @@ static uint32_t enabled_port_mask; /* number of pools (if user does not specify any, 8 by default */ static uint32_t num_queues = 8; static uint32_t num_pools = 8; +static uint8_t rss_enable; /* empty vmdq configuration structure. Filled in programatically */ static const struct rte_eth_conf vmdq_conf_default = { @@ -143,6 +144,13 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools) (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf))); (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf))); + if (rss_enable) { + eth_conf->rxmode.mq_mode = ETH_MQ_RX_VMDQ_RSS; + eth_conf->rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP | + ETH_RSS_UDP | + ETH_RSS_TCP | + ETH_RSS_SCTP; + } return 0; } @@ -164,6 +172,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) uint16_t q; uint16_t queues_per_pool; uint32_t max_nb_pools; + uint64_t rss_hf_tmp; /* * The max pool number from dev_info will be used to validate the pool @@ -209,6 +218,17 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) if (!rte_eth_dev_is_valid_port(port)) return -1; + rss_hf_tmp = port_conf.rx_adv_conf.rss_conf.rss_hf; + port_conf.rx_adv_conf.rss_conf.rss_hf &= + dev_info.flow_type_rss_offloads; + if (port_conf.rx_adv_conf.rss_conf.rss_hf != rss_hf_tmp) { + printf("Port %u modified RSS hash function based on hardware support," + "requested:%#"PRIx64" configured:%#"PRIx64"\n", + port, + rss_hf_tmp, + port_conf.rx_adv_conf.rss_conf.rss_hf); + } + /* * Though in this example, we only receive packets from the first queue * of each pool and send packets through first rte_lcore_count() tx @@ -363,7 +383,8 @@ static void vmdq_usage(const char *prgname) { printf("%s [EAL options] -- -p PORTMASK]\n" - " --nb-pools NP: number of pools\n", + " --nb-pools NP: number of pools\n" + " --enable-rss: enable RSS (disabled by default)\n", prgname); } @@ -377,6 +398,7 @@ vmdq_parse_args(int argc, char **argv) const char *prgname = argv[0]; static struct option long_option[] = { {"nb-pools", required_argument, NULL, 0}, + {"enable-rss", 0, NULL, 0}, {NULL, 0, 0, 0} }; @@ -394,11 +416,18 @@ vmdq_parse_args(int argc, char **argv) } break; case 0: - if (vmdq_parse_num_pools(optarg) == -1) { - printf("invalid number of pools\n"); - vmdq_usage(prgname); - return -1; + if (!strcmp(long_option[option_index].name, + "nb-pools")) { + if (vmdq_parse_num_pools(optarg) == -1) { + printf("invalid number of pools\n"); + vmdq_usage(prgname); + return -1; + } } + + if (!strcmp(long_option[option_index].name, + "enable-rss")) + rss_enable = 1; break; default: -- 2.17.1