[3/3] app/testpmd: compact RSS flow type output in port info

Message ID 20220525173736.3394787-3-ferruh.yigit@xilinx.com (mailing list archive)
State Changes Requested, archived
Delegated to: Andrew Rybchenko
Headers
Series [1/3] app/testpmd: fix displaying RSS info |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing fail Testing issues
ci/iol-abi-testing success Testing PASS

Commit Message

Ferruh Yigit May 25, 2022, 5:37 p.m. UTC
  In port info command output, 'show port info all', supported RSS flow
types printed one type per line, and although this information is not
most important part of the command it takes big part of the command
output.

Compacting the supported RSS flow type output by printing 6 (hardcoded
value) items per line, instead of one per line. Output becomes as
following:

 Supported RSS offload flow types:
   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  port  vxlan
   geneve  nvgre  mpls

Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
 app/test-pmd/config.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
  

Comments

Andrew Rybchenko May 31, 2022, 4:35 p.m. UTC | #1
On 5/25/22 20:37, Ferruh Yigit wrote:
> In port info command output, 'show port info all', supported RSS flow
> types printed one type per line, and although this information is not
> most important part of the command it takes big part of the command
> output.
> 
> Compacting the supported RSS flow type output by printing 6 (hardcoded
> value) items per line, instead of one per line. Output becomes as
> following:
> 
>   Supported RSS offload flow types:
>     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  port  vxlan
>     geneve  nvgre  mpls
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
> ---
>   app/test-pmd/config.c | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
> index 47de5b6d9458..5496ccd7f8ad 100644
> --- a/app/test-pmd/config.c
> +++ b/app/test-pmd/config.c
> @@ -805,6 +805,7 @@ port_infos_display(portid_t port_id)
>   	else {
>   		uint64_t rss_types = dev_info.flow_type_rss_offloads;
>   		uint16_t i;
> +		uint16_t len = 0;
>   
>   		printf("Supported RSS offload flow types:\n");
>   		for (i = 0; rss_types != 0; i++) {
> @@ -813,12 +814,21 @@ port_infos_display(portid_t port_id)
>   				const char *p = rsstype_to_str(rss_type);
>   
>   				if (p)
> -					printf("  %s\n", p);
> +					printf("  %s", p);
>   				else
> -					printf("  user defined 0x%"PRIx64"\n", rss_type);
> +					printf("  user defined 0x%"PRIx64, rss_type);
> +
> +				len++;
> +				/* wrap on every 6 items */
> +				if (len == 6) {

Variable name 'len' is misleading here since the first idea is
like length, not a number of items.

Also 6 sounds to be to much in the worst case scenario with 6
user defined types. Each uses at least 18 chars. So, 18 * 6 = 108.
May be printing algorithm should be a bit more sophisticated and
really track line length.

> +					printf("\n");
> +					len = 0;
> +				}
>   			}
>   			rss_types >>= 1;
>   		}
> +		if (len)
> +			printf("\n");
>   	}
>   
>   	printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);
  
lihuisong (C) June 1, 2022, 7:08 a.m. UTC | #2
在 2022/6/1 0:35, Andrew Rybchenko 写道:
> On 5/25/22 20:37, Ferruh Yigit wrote:
>> In port info command output, 'show port info all', supported RSS flow
>> types printed one type per line, and although this information is not
>> most important part of the command it takes big part of the command
>> output.
>>
>> Compacting the supported RSS flow type output by printing 6 (hardcoded
>> value) items per line, instead of one per line. Output becomes as
>> following:
>>
>>   Supported RSS offload flow types:
>>     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  port  vxlan
>>     geneve  nvgre  mpls
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
>> ---
>>   app/test-pmd/config.c | 14 ++++++++++++--
>>   1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index 47de5b6d9458..5496ccd7f8ad 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -805,6 +805,7 @@ port_infos_display(portid_t port_id)
>>       else {
>>           uint64_t rss_types = dev_info.flow_type_rss_offloads;
>>           uint16_t i;
>> +        uint16_t len = 0;
>>             printf("Supported RSS offload flow types:\n");
>>           for (i = 0; rss_types != 0; i++) {
>> @@ -813,12 +814,21 @@ port_infos_display(portid_t port_id)
>>                   const char *p = rsstype_to_str(rss_type);
>>                     if (p)
>> -                    printf("  %s\n", p);
>> +                    printf("  %s", p);
>>                   else
>> -                    printf("  user defined 0x%"PRIx64"\n", rss_type);
>> +                    printf("  user defined 0x%"PRIx64, rss_type);
>> +
>> +                len++;
>> +                /* wrap on every 6 items */
>> +                if (len == 6) {
>
> Variable name 'len' is misleading here since the first idea is
> like length, not a number of items.
>
> Also 6 sounds to be to much in the worst case scenario with 6
> user defined types. Each uses at least 18 chars. So, 18 * 6 = 108.
> May be printing algorithm should be a bit more sophisticated and
> really track line length.
ok. I will fix it in my set.
>
>> +                    printf("\n");
>> +                    len = 0;
>> +                }
>>               }
>>               rss_types >>= 1;
>>           }
>> +        if (len)
>> +            printf("\n");
>>       }
>>         printf("Minimum size of RX buffer: %u\n", 
>> dev_info.min_rx_bufsize);
>
> .
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 47de5b6d9458..5496ccd7f8ad 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -805,6 +805,7 @@  port_infos_display(portid_t port_id)
 	else {
 		uint64_t rss_types = dev_info.flow_type_rss_offloads;
 		uint16_t i;
+		uint16_t len = 0;
 
 		printf("Supported RSS offload flow types:\n");
 		for (i = 0; rss_types != 0; i++) {
@@ -813,12 +814,21 @@  port_infos_display(portid_t port_id)
 				const char *p = rsstype_to_str(rss_type);
 
 				if (p)
-					printf("  %s\n", p);
+					printf("  %s", p);
 				else
-					printf("  user defined 0x%"PRIx64"\n", rss_type);
+					printf("  user defined 0x%"PRIx64, rss_type);
+
+				len++;
+				/* wrap on every 6 items */
+				if (len == 6) {
+					printf("\n");
+					len = 0;
+				}
 			}
 			rss_types >>= 1;
 		}
+		if (len)
+			printf("\n");
 	}
 
 	printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize);