app/testpmd: fixed get RSS conf

Message ID 20181221130145.182446-1-qiming.yang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: fixed get RSS conf |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Qiming Yang Dec. 21, 2018, 1:01 p.m. UTC
  I40e do not allow to get rss hena only, need to get rss
key meanwhile.

Fixes: 16321de09396 ("ethdev: allow to get RSS hash functions and key")
Cc: stable@dpdk.org

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 app/test-pmd/config.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Dec. 21, 2018, 2:25 p.m. UTC | #1
On 12/21/2018 1:01 PM, Qiming Yang wrote:
> I40e do not allow to get rss hena only, need to get rss
> key meanwhile.

i40e_get_rss_key() returns error if 'rss_conf.rss_key' is NULL, this patch is
fixing the error case.

But instead of fixing this in application level, it can be better to fix in
driver level. Because 'rte_eth_dev_rss_hash_conf_get()' API doesn't dictate
'rss_conf.rss_key' to be not NULL, so any other application can cause same problem.

Possible solution can be to have an interim 'key' buffer in
'i40e_dev_rss_hash_conf_get()' and copy it to 'rss_conf.rss_key' if it is not NULL.

> 
> Fixes: 16321de09396 ("ethdev: allow to get RSS hash functions and key")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  app/test-pmd/config.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index b9e5dd9..482c4f5 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1764,8 +1764,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
>  		return;
>  	}
>  
> -	/* Get RSS hash key if asked to display it */
> -	rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
> +	rss_conf.rss_key = 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) {
> @@ -1793,6 +1792,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
>  			printf("%s ", rss_type_table[i].str);
>  	}
>  	printf("\n");
> +
> +	/* Get RSS hash key if asked to display it */
>  	if (!show_rss_key)
>  		return;
>  	printf("RSS key:\n");
>
  
Qiming Yang Dec. 24, 2018, 7:26 a.m. UTC | #2
Thanks Ferruh, will fix in driver level and then send v2 later.

-----Original Message-----
From: Yigit, Ferruh 
Sent: Friday, December 21, 2018 10:26 PM
To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
Cc: stable@dpdk.org
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fixed get RSS conf

On 12/21/2018 1:01 PM, Qiming Yang wrote:
> I40e do not allow to get rss hena only, need to get rss key meanwhile.

i40e_get_rss_key() returns error if 'rss_conf.rss_key' is NULL, this patch is fixing the error case.

But instead of fixing this in application level, it can be better to fix in driver level. Because 'rte_eth_dev_rss_hash_conf_get()' API doesn't dictate 'rss_conf.rss_key' to be not NULL, so any other application can cause same problem.

Possible solution can be to have an interim 'key' buffer in 'i40e_dev_rss_hash_conf_get()' and copy it to 'rss_conf.rss_key' if it is not NULL.

> 
> Fixes: 16321de09396 ("ethdev: allow to get RSS hash functions and 
> key")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
>  app/test-pmd/config.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 
> b9e5dd9..482c4f5 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -1764,8 +1764,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
>  		return;
>  	}
>  
> -	/* Get RSS hash key if asked to display it */
> -	rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
> +	rss_conf.rss_key = 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) {
> @@ -1793,6 +1792,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
>  			printf("%s ", rss_type_table[i].str);
>  	}
>  	printf("\n");
> +
> +	/* Get RSS hash key if asked to display it */
>  	if (!show_rss_key)
>  		return;
>  	printf("RSS key:\n");
>
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index b9e5dd9..482c4f5 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1764,8 +1764,7 @@  port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 		return;
 	}
 
-	/* Get RSS hash key if asked to display it */
-	rss_conf.rss_key = (show_rss_key) ? rss_key : NULL;
+	rss_conf.rss_key = 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) {
@@ -1793,6 +1792,8 @@  port_rss_hash_conf_show(portid_t port_id, int show_rss_key)
 			printf("%s ", rss_type_table[i].str);
 	}
 	printf("\n");
+
+	/* Get RSS hash key if asked to display it */
 	if (!show_rss_key)
 		return;
 	printf("RSS key:\n");