[v5,39/40] app/proc-info: support querying RSS hash algorithm

Message ID 20231011092805.693171-40-haijie1@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series support setting and querying RSS algorithms |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jie Hai Oct. 11, 2023, 9:28 a.m. UTC
  Display RSS hash algorithm with command show-port as below.
  - RSS info
	  -- hash algorithm : toeplitz

Signed-off-by: Jie Hai <haijie1@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
---
 app/proc-info/main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Comments

fengchengwen Oct. 12, 2023, 2:05 a.m. UTC | #1
Suggest add one new API for get hash_algo_name. e.g. rte_eth_get_rss_algo_name()

On 2023/10/11 17:28, Jie Hai wrote:
> Display RSS hash algorithm with command show-port as below.
>   - RSS info
> 	  -- hash algorithm : toeplitz
> 
> Signed-off-by: Jie Hai <haijie1@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
> ---
>  app/proc-info/main.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
> index e98352118db1..43f264848a6f 100644
> --- a/app/proc-info/main.c
> +++ b/app/proc-info/main.c
> @@ -153,6 +153,14 @@ static struct desc_param rx_desc_param;
>  static struct desc_param tx_desc_param;
>  
>  #define RSS_HASH_KEY_SIZE 64
> +static const char * const rss_hash_algos[] = {
> +	[RTE_ETH_HASH_FUNCTION_SIMPLE_XOR] = "simple_xor",
> +	[RTE_ETH_HASH_FUNCTION_TOEPLITZ] = "toeplitz",
> +	[RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ] = "symmetric_toeplitz",
> +	[RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT] = "symmetric_toeplitz_sort",
> +	[RTE_ETH_HASH_FUNCTION_DEFAULT] = "default",
> +	[RTE_ETH_HASH_FUNCTION_MAX] = "unknown"
> +};
>  
>  /* display usage */
>  static void
> @@ -1186,6 +1194,8 @@ show_port(void)
>  				printf("%02x", rss_conf.rss_key[k]);
>  			printf("\n\t  -- hash function : 0x%"PRIx64"\n",
>  					rss_conf.rss_hf);
> +			printf("\t  -- hash algorithm : %s\n",
> +				rss_hash_algos[rss_conf.algorithm]);
>  		}
>  
>  #ifdef RTE_LIB_SECURITY
>
  
Jie Hai Oct. 12, 2023, 3:51 a.m. UTC | #2
On 2023/10/12 10:05, fengchengwen wrote:
> Suggest add one new API for get hash_algo_name. e.g. rte_eth_get_rss_algo_name()
> 
Thanks, that's better for reuse, will change it in next version.
> On 2023/10/11 17:28, Jie Hai wrote:
>> Display RSS hash algorithm with command show-port as below.
>>    - RSS info
>> 	  -- hash algorithm : toeplitz
>>
>> Signed-off-by: Jie Hai <haijie1@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
>> ---
>>   app/proc-info/main.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/app/proc-info/main.c b/app/proc-info/main.c
>> index e98352118db1..43f264848a6f 100644
>> --- a/app/proc-info/main.c
>> +++ b/app/proc-info/main.c
>> @@ -153,6 +153,14 @@ static struct desc_param rx_desc_param;
>>   static struct desc_param tx_desc_param;
>>   
>>   #define RSS_HASH_KEY_SIZE 64
>> +static const char * const rss_hash_algos[] = {
>> +	[RTE_ETH_HASH_FUNCTION_SIMPLE_XOR] = "simple_xor",
>> +	[RTE_ETH_HASH_FUNCTION_TOEPLITZ] = "toeplitz",
>> +	[RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ] = "symmetric_toeplitz",
>> +	[RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT] = "symmetric_toeplitz_sort",
>> +	[RTE_ETH_HASH_FUNCTION_DEFAULT] = "default",
>> +	[RTE_ETH_HASH_FUNCTION_MAX] = "unknown"
>> +};
>>   
>>   /* display usage */
>>   static void
>> @@ -1186,6 +1194,8 @@ show_port(void)
>>   				printf("%02x", rss_conf.rss_key[k]);
>>   			printf("\n\t  -- hash function : 0x%"PRIx64"\n",
>>   					rss_conf.rss_hf);
>> +			printf("\t  -- hash algorithm : %s\n",
>> +				rss_hash_algos[rss_conf.algorithm]);
>>   		}
>>   
>>   #ifdef RTE_LIB_SECURITY
>>
> .
  

Patch

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index e98352118db1..43f264848a6f 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -153,6 +153,14 @@  static struct desc_param rx_desc_param;
 static struct desc_param tx_desc_param;
 
 #define RSS_HASH_KEY_SIZE 64
+static const char * const rss_hash_algos[] = {
+	[RTE_ETH_HASH_FUNCTION_SIMPLE_XOR] = "simple_xor",
+	[RTE_ETH_HASH_FUNCTION_TOEPLITZ] = "toeplitz",
+	[RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ] = "symmetric_toeplitz",
+	[RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT] = "symmetric_toeplitz_sort",
+	[RTE_ETH_HASH_FUNCTION_DEFAULT] = "default",
+	[RTE_ETH_HASH_FUNCTION_MAX] = "unknown"
+};
 
 /* display usage */
 static void
@@ -1186,6 +1194,8 @@  show_port(void)
 				printf("%02x", rss_conf.rss_key[k]);
 			printf("\n\t  -- hash function : 0x%"PRIx64"\n",
 					rss_conf.rss_hf);
+			printf("\t  -- hash algorithm : %s\n",
+				rss_hash_algos[rss_conf.algorithm]);
 		}
 
 #ifdef RTE_LIB_SECURITY