patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'app/testpmd: fix RSS hash key size' has been queued to stable release 16.07.2
Date: Wed,  2 Nov 2016 18:21:03 +0800	[thread overview]
Message-ID: <1478082097-16957-7-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1478082097-16957-1-git-send-email-yuanhan.liu@linux.intel.com>

Hi,

FYI, your patch has been queued to stable release 16.07.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 11/06/16.
So please shout if anyone has objections.

Thanks.

	--yliu

---
>From cc6ea094c0be57a26799237cb870fdd96fb99590 Mon Sep 17 00:00:00 2001
From: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Date: Fri, 5 Aug 2016 16:34:51 +0100
Subject: [PATCH] app/testpmd: fix RSS hash key size

[ upstream commit 0f6f219e7919c988675f4695485334530af0a6ca ]

RSS hash-key-size is retrieved from device configuration instead of
using a fixed size of 40 bytes.

Fixes: f79959ea1504 ("app/testpmd: allow to configure RSS hash key")

Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 app/test-pmd/cmdline.c | 27 ++++++++++++++++++++-------
 app/test-pmd/config.c  | 18 +++++++++++++++---
 app/test-pmd/testpmd.h |  6 ++++++
 3 files changed, 41 insertions(+), 10 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 17d238f..f119675 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1608,7 +1608,6 @@ struct cmd_config_rss_hash_key {
 	cmdline_fixed_string_t key;
 };
 
-#define RSS_HASH_KEY_LENGTH 40
 static uint8_t
 hexa_digit_to_value(char hexa_digit)
 {
@@ -1644,16 +1643,29 @@ cmd_config_rss_hash_key_parsed(void *parsed_result,
 	uint8_t xdgt0;
 	uint8_t xdgt1;
 	int i;
+	struct rte_eth_dev_info dev_info;
+	uint8_t hash_key_size;
+	uint32_t key_len;
 
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(res->port_id, &dev_info);
+	if (dev_info.hash_key_size > 0 &&
+			dev_info.hash_key_size <= sizeof(hash_key))
+		hash_key_size = dev_info.hash_key_size;
+	else {
+		printf("dev_info did not provide a valid hash key size\n");
+		return;
+	}
 	/* Check the length of the RSS hash key */
-	if (strlen(res->key) != (RSS_HASH_KEY_LENGTH * 2)) {
+	key_len = strlen(res->key);
+	if (key_len != (hash_key_size * 2)) {
 		printf("key length: %d invalid - key must be a string of %d"
-		       "hexa-decimal numbers\n", (int) strlen(res->key),
-		       RSS_HASH_KEY_LENGTH * 2);
+			   " hexa-decimal numbers\n",
+			   (int) key_len, hash_key_size * 2);
 		return;
 	}
 	/* Translate RSS hash key into binary representation */
-	for (i = 0; i < RSS_HASH_KEY_LENGTH; i++) {
+	for (i = 0; i < hash_key_size; i++) {
 		xdgt0 = parse_and_check_key_hexa_digit(res->key, (i * 2));
 		if (xdgt0 == 0xFF)
 			return;
@@ -1663,7 +1675,7 @@ cmd_config_rss_hash_key_parsed(void *parsed_result,
 		hash_key[i] = (uint8_t) ((xdgt0 * 16) + xdgt1);
 	}
 	port_rss_hash_key_update(res->port_id, res->rss_type, hash_key,
-				 RSS_HASH_KEY_LENGTH);
+			hash_key_size);
 }
 
 cmdline_parse_token_string_t cmd_config_rss_hash_key_port =
@@ -1692,7 +1704,8 @@ cmdline_parse_inst_t cmd_config_rss_hash_key = {
 		"port config X rss-hash-key ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|"
 		"ipv4-sctp|ipv4-other|ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|"
 		"ipv6-sctp|ipv6-other|l2-payload|"
-		"ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex 80 hexa digits\n",
+		"ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex "
+		"<string of hexa digits (variable length, NIC dependent)>\n",
 	.tokens = {
 		(void *)&cmd_config_rss_hash_key_port,
 		(void *)&cmd_config_rss_hash_key_config,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index bfcbff9..44ba91e 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1012,14 +1012,26 @@ void
 port_rss_hash_conf_show(portid_t port_id, char rss_info[], int show_rss_key)
 {
 	struct rte_eth_rss_conf rss_conf;
-	uint8_t rss_key[10 * 4] = "";
+	uint8_t rss_key[RSS_HASH_KEY_LENGTH];
 	uint64_t rss_hf;
 	uint8_t i;
 	int diag;
+	struct rte_eth_dev_info dev_info;
+	uint8_t hash_key_size;
 
 	if (port_id_is_invalid(port_id, ENABLED_WARN))
 		return;
 
+	memset(&dev_info, 0, sizeof(dev_info));
+	rte_eth_dev_info_get(port_id, &dev_info);
+	if (dev_info.hash_key_size > 0 &&
+			dev_info.hash_key_size <= sizeof(rss_key))
+		hash_key_size = dev_info.hash_key_size;
+	else {
+		printf("dev_info did not provide a valid hash key size\n");
+		return;
+	}
+
 	rss_conf.rss_hf = 0;
 	for (i = 0; i < RTE_DIM(rss_type_table); i++) {
 		if (!strcmp(rss_info, rss_type_table[i].str))
@@ -1028,7 +1040,7 @@ port_rss_hash_conf_show(portid_t port_id, char rss_info[], int show_rss_key)
 
 	/* Get RSS hash key if asked to display it */
 	rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
-	rss_conf.rss_key_len = sizeof(rss_key);
+	rss_conf.rss_key_len = hash_key_size;
 	diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf);
 	if (diag != 0) {
 		switch (diag) {
@@ -1058,7 +1070,7 @@ port_rss_hash_conf_show(portid_t port_id, char rss_info[], int show_rss_key)
 	if (!show_rss_key)
 		return;
 	printf("RSS key:\n");
-	for (i = 0; i < sizeof(rss_key); i++)
+	for (i = 0; i < hash_key_size; i++)
 		printf("%02X", rss_key[i]);
 	printf("\n");
 }
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 2b281cc..74bf5cb 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -45,6 +45,12 @@
 #define RTE_PORT_HANDLING       (uint16_t)3
 
 /*
+ * It is used to allocate the memory for hash key.
+ * The hash key size is NIC dependent.
+ */
+#define RSS_HASH_KEY_LENGTH 64
+
+/*
  * Default size of the mbuf data buffer to receive standard 1518-byte
  * Ethernet frames in a mono-segment memory buffer.
  */
-- 
1.9.0

  parent reply	other threads:[~2016-11-02 10:20 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 10:20 [dpdk-stable] patch 'examples/ipsec-secgw: check SP only when setup' " Yuanhan Liu
2016-11-02 10:20 ` [dpdk-stable] patch 'pdump: fix created directory permissions' " Yuanhan Liu
2016-11-02 10:20 ` [dpdk-stable] patch 'app/procinfo: free xstats memory upon failure' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'examples/ip_pipeline: fix plugin loading' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'examples/qos_sched: fix dequeue from ring' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'app/test: fix hash multiwriter sequence' " Yuanhan Liu
2016-11-02 10:21 ` Yuanhan Liu [this message]
2016-11-02 10:21 ` [dpdk-stable] patch 'app/testpmd: fix DCB configuration' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'lpm: fix freeing unused sub-table on rule delete' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/bonding: validate speed after link up' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/thunderx: fix Tx checksum handling' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/enic: fix flow director' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/enic: fix crash with removed flow director filters' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/bnx2x: fix maximum PF queues' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/bnx2x: fix socket id for slowpath memory' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/ena: improve safety of string handling' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/bnxt: ensure entry length is unsigned' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/i40e: do not use VSI before NULL check' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/bnxt: fix bit shift size' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/mlx5: fix Rx function selection' " Yuanhan Liu
2016-11-02 12:44   ` Nélio Laranjeiro
2016-11-02 10:21 ` [dpdk-stable] patch 'net/ring: fix ring device creation via devargs' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/fm10k: fix Rx checksum flags' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'examples/tep_term: fix L4 length' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'examples/tep_term: fix packet length with multi-segments' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'app/testpmd: fix PF/VF check of flow director' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'mempool: fix search of maximum contiguous pages' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'ethdev: prevent duplicate event callback' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/bnx2x: fix build with icc' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/mlx5: fix hash key size retrieval' " Yuanhan Liu
2016-11-02 12:45   ` Nélio Laranjeiro
2016-11-02 10:21 ` [dpdk-stable] patch 'net/ixgbe: fix flow director mask' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'app/testpmd: " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'app/testpmd: fix flow director endianness' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/enic: revert truncated packets counter fix' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/ixgbe: fix out of order Rx read' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/fm10k: " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/mlx5: fix link status report' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/fm10k: fix VF Tx queue initialization' " Yuanhan Liu
     [not found]   ` <8E8F16D832DEA44EAC8E3A3C70D1E0C737AB8DBD@CRSMSX101.amr.corp.intel.com>
2016-12-06  1:44     ` Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/qede/base: fix 32-bit build' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/i40e: fix hash filter on X722' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'net/i40e: fix Rx hang when disable LLDP' " Yuanhan Liu
2016-11-02 10:21 ` [dpdk-stable] patch 'vhost: fix Windows VM hang' " Yuanhan Liu

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=1478082097-16957-7-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=mohammad.abdul.awal@intel.com \
    --cc=stable@dpdk.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).