[dpdk-dev] app/testpmd: port info prints dynamically mapped flow types

Message ID 1504283001-54863-1-git-send-email-kirill.rybalchenko@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Rybalchenko, Kirill Sept. 1, 2017, 4:23 p.m. UTC
  Port info command prints information about all supported flow types,
including dynamically mapped ones.

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
 app/test-pmd/config.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
  

Comments

Jingjing Wu Sept. 7, 2017, 8:26 a.m. UTC | #1
> -----Original Message-----
> From: Rybalchenko, Kirill
> Sent: Saturday, September 2, 2017 12:23 AM
> To: dev@dpdk.org
> Cc: Rybalchenko, Kirill <kirill.rybalchenko@intel.com>; Chilikin, Andrey
> <andrey.chilikin@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Subject: [PATCH] app/testpmd: port info prints dynamically mapped flow types
> 
> Port info command prints information about all supported flow types,
> including dynamically mapped ones.
> 
> Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
Reviewed-by: Jingjing Wu <jingjing.wu@intel.com>
  
Ferruh Yigit Sept. 20, 2017, 11:19 a.m. UTC | #2
On 9/1/2017 5:23 PM, Kirill Rybalchenko wrote:
> Port info command prints information about all supported flow types,
> including dynamically mapped ones.
> 
> Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
> ---
>  app/test-pmd/config.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 3ae3e1c..bd5de92 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -498,12 +498,15 @@ port_infos_display(portid_t port_id)
>  		char *p;
>  
>  		printf("Supported flow types:\n");
> -		for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < RTE_ETH_FLOW_MAX;
> -								i++) {
> +		for (i = RTE_ETH_FLOW_UNKNOWN + 1;
> +		     i < sizeof(dev_info.flow_type_rss_offloads) * 8; i++) {

What do you think using "CHAR_BIT" instead of "8" to stress the intention?

If you are OK to send new version, please keep JingJing's Review tag.

>  			if (!(dev_info.flow_type_rss_offloads & (1ULL << i)))
>  				continue;
>  			p = flowtype_to_str(i);
> -			printf("  %s\n", (p ? p : "unknown"));
> +			if (p)
> +				printf("  %s\n", p);
> +			else
> +				printf("  user defined %d\n", i);
>  		}
>  	}
>  
>
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3ae3e1c..bd5de92 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -498,12 +498,15 @@  port_infos_display(portid_t port_id)
 		char *p;
 
 		printf("Supported flow types:\n");
-		for (i = RTE_ETH_FLOW_UNKNOWN + 1; i < RTE_ETH_FLOW_MAX;
-								i++) {
+		for (i = RTE_ETH_FLOW_UNKNOWN + 1;
+		     i < sizeof(dev_info.flow_type_rss_offloads) * 8; i++) {
 			if (!(dev_info.flow_type_rss_offloads & (1ULL << i)))
 				continue;
 			p = flowtype_to_str(i);
-			printf("  %s\n", (p ? p : "unknown"));
+			if (p)
+				printf("  %s\n", p);
+			else
+				printf("  user defined %d\n", i);
 		}
 	}