[PATCH V5 5/7] app/testpmd: compact RSS types output in some commands
lihuisong (C)
lihuisong at huawei.com
Sat Jun 25 04:13:55 CEST 2022
在 2022/6/24 22:04, Ferruh Yigit 写道:
> On 6/24/2022 8:23 AM, Huisong Li wrote:
>> CAUTION: This message has originated from an External Source. Please
>> use proper judgment and caution when opening attachments, clicking
>> links, or responding to this email.
>>
>>
>> From: Ferruh Yigit <ferruh.yigit at xilinx.com>
>>
>> In port info command output, 'show port info all', supported RSS offload
>> 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.
>>
>> In port RSS hash and flow RSS command output, 'show port 0 rss-hash',
>> and 'flow query 0 0 rss', all enabled RSS types are printed on one line.
>> If there are many types, the print will be very long.
>>
>> Compacting these RSS offloads and types output by fixing the length
>> of the
>> character string printed on each line, instead of one per line or one
>> line.
>> Output becomes as following:
>>
>> Supported RSS offload flow types:
>> ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other
>> ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other
>> l4-dst-only l4-src-only l3-dst-only l3-src-only
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit at xilinx.com>
>> Signed-off-by: Huisong Li <lihuisong at huawei.com>
>> ---
>> app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++-----------
>> app/test-pmd/testpmd.h | 2 ++
>> 2 files changed, 52 insertions(+), 18 deletions(-)
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
>> index a0a5f12c71..b3cb68003c 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -699,6 +699,38 @@ rsstypes_to_str(uint64_t rss_type)
>> return NULL;
>> }
>>
>> +static void
>> +rss_offload_types_display(uint64_t offload_types, uint16_t
>> char_num_per_line)
>> +{
>> + uint16_t unknown_offload_str_len;
>> + uint16_t total_len = 0;
>> + uint16_t str_len = 0;
>> + uint64_t rss_offload;
>> + uint16_t i;
>> +
>> + for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) {
>> + rss_offload = RTE_BIT64(i);
>> + if ((offload_types & rss_offload) != 0) {
>> + const char *p = rsstypes_to_str(rss_offload);
>> +
>> + unknown_offload_str_len =
>> + strlen("unknown_offload(BIT())") + (i
>> / 10 + 1);
>> + str_len = p ? strlen(p) :
>> unknown_offload_str_len;
>> + str_len += 2; /* add two spaces */
>> + if (total_len + str_len >= char_num_per_line) {
>> + total_len = 0;
>> + printf("\n");
>> + }
>> +
>> + if (p)
>> + printf(" %s", p);
>> + else
>> + printf(" unknown_offload(BIT(%u))", i);
>> + total_len += str_len;
>> + }
>> + }
>> +}
>> +
>> void
>> port_infos_display(portid_t port_id)
>> {
>> @@ -803,21 +835,10 @@ port_infos_display(portid_t port_id)
>> if (!dev_info.flow_type_rss_offloads)
>> printf("No RSS offload flow type is supported.\n");
>> else {
>> - uint64_t rss_offload_types =
>> dev_info.flow_type_rss_offloads;
>> - uint16_t i;
>> -
>> printf("Supported RSS offload flow types:\n");
>> - for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT;
>> i++) {
>> - uint64_t rss_offload = RTE_BIT64(i);
>> - if ((rss_offload_types & rss_offload) != 0) {
>> - const char *p =
>> rsstypes_to_str(rss_offload);
>> - if (p)
>> - printf(" %s\n", p);
>> - else
>> - printf("
>> unknown_offload(BIT(%u))\n",
>> - i);
>> - }
>> - }
>> + rss_offload_types_display(dev_info.flow_type_rss_offloads,
>> + TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE);
>> + printf("\n");
>
> Why 'rss_types_display()' is not reused, but new function
> 'rss_offload_types_display()' created?
As mentioned in the 1/7 patch reply, there are different purposes.
> .
More information about the dev
mailing list