From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 03EF1A0547; Mon, 20 Jun 2022 14:37:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E0782427F3; Mon, 20 Jun 2022 14:37:32 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2082.outbound.protection.outlook.com [40.107.94.82]) by mails.dpdk.org (Postfix) with ESMTP id 16CAB40151 for ; Mon, 20 Jun 2022 14:37:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HfH2A6Y8NhYqUZ7d0flrOebnr+NBopdDUlmt8X1kHqMipSJvUpiSuSAVIOK5K1bK6TjXej00Von0njY3bZXX3VPkhEI1hbfYuvfcd/uHr4+0WOeLm5D0jGz4oZnGxn45HqIN0RZmhBgd9EmyQAA//F174sO8b9dapA2N0kB3sX1r3e0G4E/3GcOPfDPu9GEgi4tP5qXOVlsEY35c0XkeoL8+HQxUk5Lr/Nwr3ZreD/rY/Gk0AQkdYi2m9/vPmvDPKWEhIdxtc+zsli8GQtROszRWqNAmTws7sdlUi/pPU0NIRtJzIlibDCmxlY5QtogAae1e+r9CzsufiLN/t7K2RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TJrw5t5g88q3sbQbl/Vi1W25GY6wt670KaJtUccjoMk=; b=kZpbZxJkJh8vE6kRCg/h+hIWb+wi9sCc/UGs+Gp9Bdzh39xC8KFFOzvrW+aesMlBmTDXwwo/rE8fTf8cllVVz6XZpRp5GzhpxVzB2vB0kq8y3J3cQ5nsUotw0MzknfKZq9ZSsv1y7daA4sfwKuPnaloyy8vI6tpyn+2bXfRJRA1jpewZpkm4Tqq6HAdZYYIyUnFXEBq3Ge4vOJZB9ncdai6d6joLQT4duZ7oVG3uo5VRaDbr8rVcAnXvTnmVm1nCFipNE28E5sK5al5tunP41jRtVDEY8Cc0hqF/sPeKs+6rLg3pyp7gKiVKBW0QL4l8EDR8W+joakjhZ88PaFBi6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=huawei.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TJrw5t5g88q3sbQbl/Vi1W25GY6wt670KaJtUccjoMk=; b=j6gQJ7+0wByyNupbOyV6Lh4gqyla+M4Quyq5Zc7pVcdR8t0GAReVoiN3nUX0lIl5n40bzVgoCWbHW537m/Q4jp44p8aJrxssb/uj4PJmkPx8aLes6sFbXL93/b+jHBuDLOyMWxOesRE8qflCJs1VlMuSAF7bis0JEqn6bFMlFoc= Received: from SN4PR0201CA0046.namprd02.prod.outlook.com (2603:10b6:803:2e::32) by SN4PR0201MB3568.namprd02.prod.outlook.com (2603:10b6:803:47::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Mon, 20 Jun 2022 12:37:28 +0000 Received: from SN1NAM02FT0025.eop-nam02.prod.protection.outlook.com (2603:10b6:803:2e:cafe::af) by SN4PR0201CA0046.outlook.office365.com (2603:10b6:803:2e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.14 via Frontend Transport; Mon, 20 Jun 2022 12:37:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch01.xlnx.xilinx.com; pr=C Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by SN1NAM02FT0025.mail.protection.outlook.com (10.97.5.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5353.14 via Frontend Transport; Mon, 20 Jun 2022 12:37:27 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 20 Jun 2022 13:37:25 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 20 Jun 2022 13:37:25 +0100 Envelope-to: lihuisong@huawei.com, xiaoyun.li@intel.com, aman.deep.singh@intel.com, yuying.zhang@intel.com, andrew.rybchenko@oktetlabs.ru, dev@dpdk.org, thomas@monjalon.net, huangdaode@huawei.com Received: from [10.71.119.54] (port=60898) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1o3Gej-0003WI-F8; Mon, 20 Jun 2022 13:37:25 +0100 Message-ID: <4f3902a6-194e-b22f-a124-df599079e29a@xilinx.com> Date: Mon, 20 Jun 2022 13:37:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH V3 app/testpmd 3/4] app/testpmd: compact RSS types output in some commands Content-Language: en-US To: "lihuisong (C)" , , , , CC: , , References: <20220429102445.23711-1-lihuisong@huawei.com> <20220607083246.12259-1-lihuisong@huawei.com> <20220607083246.12259-4-lihuisong@huawei.com> <3120e1ce-013e-5024-6a2a-e4cf9a8f3a86@xilinx.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cba2116e-dab0-4b42-994a-08da52b9a284 X-MS-TrafficTypeDiagnostic: SN4PR0201MB3568:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BBMd36b3bWQ/3lh/0LoJPrpJudQIxNXfA4s9HwWqb7xg/P5GrAflYjog7gOCfQedfe5/bPUf2q0Cfmn0tstWsGp6z5d3hYYBuO/pkysTEePE5gaFsC4dcleC34nz/n5md4+sjdus+rW5yaxYtICJRzhZseLxraH0gZjscwUCQUtQVdv9YYVySOWq1S11IPTMIGPGAyut7bWqMn5bbTj/iCVDPe7Z6OKNKnJBKgzp4aDFIVWKv0P9GLQj87lfTSQ5RAbiswmW5GK48hEkSqiegwEyD6FNt7n9UJdrUrmkPNNjBDtslTZXtdC5+0+hY4kZ4Jo1zTqRPz4G8fgrieYnyWd5LnGl5+0FLEjIF4RCS5A9wrFg7VtJusI3aH1ex8L1UzwPhilXHA1QclTkrRAaZi6EVBWe0yaBKcr2FTlb0Qx78w9hAs26Dn2YXXTIVVC+IL+N/FRfW8Qr6B2jMOv44NdnhMewtgyBzee3pT37G7xJhJryC8FJStBWBRLPAI8VtlKuFO22eWmBvM/cZUE9UQUUIC4+me0NHqBZbFCfUCmEU0Vt/APItGy1s/Mp9kGghm26F428o+7DGcGi76TDEpODJzXfHm6XX8Q/wIfTOeuteSJVmxMvXMUsoZGDeauxAo2/lTdoRUVa7Xt2u1xOnGAVfG0KpVaIKbzq3AGXKr5nF4Z/RdQ/EiK4ZILZH8JuPbWP/3jD82Cqgd9c4cI7hNQp1ZWfycFkrGUfa9DUmBQ= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(40470700004)(36840700001)(46966006)(186003)(26005)(2906002)(47076005)(53546011)(2616005)(426003)(336012)(31696002)(82310400005)(40460700003)(356005)(7636003)(83380400001)(36860700001)(44832011)(9786002)(498600001)(316002)(54906003)(8936002)(8676002)(4326008)(36756003)(70206006)(70586007)(5660300002)(31686004)(110136005)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2022 12:37:27.2560 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cba2116e-dab0-4b42-994a-08da52b9a284 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0025.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR0201MB3568 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 6/9/2022 4:41 AM, lihuisong (C) 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. > > > 在 2022/6/7 23:46, Ferruh Yigit 写道: >> On 6/7/2022 9:32 AM, Huisong Li wrote: >> >>> >>> From: Ferruh Yigit >>> >>> 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 >>> Signed-off-by: Huisong Li >>> --- >>>   app/test-pmd/config.c | 64 ++++++++++++++++++++++++++++++++----------- >>>   1 file changed, 48 insertions(+), 16 deletions(-) >>> >>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c >>> index 9cb1211f00..209cbcc514 100644 >>> --- a/app/test-pmd/config.c >>> +++ b/app/test-pmd/config.c >>> @@ -66,6 +66,8 @@ >>> >>>   #define NS_PER_SEC 1E9 >>> >>> +#define MAX_CHAR_NUM_PER_LINE 64 >>> + >>>   static const struct { >>>          enum tx_pkt_split split; >>>          const char *name; >>> @@ -198,6 +200,8 @@ const struct rss_type_info rss_type_table[] = { >>>   static void >>>   rss_types_display(uint64_t rss_types) >>>   { >>> +       uint16_t total_len = 0; >>> +       uint16_t str_len = 0; >>>          uint16_t i; >>> >>>          if (rss_types == 0) >>> @@ -206,9 +210,18 @@ rss_types_display(uint64_t rss_types) >>>          for (i = 0; rss_type_table[i].str; i++) { >>>                  if (rss_type_table[i].rss_type == 0) >>>                          continue; >>> + >>>                  if ((rss_types & rss_type_table[i].rss_type) == >>> - rss_type_table[i].rss_type) >>> + rss_type_table[i].rss_type) { >>> +                       /* contain two blanks */ >>> +                       str_len = strlen(rss_type_table[i].str) + 2; >>> +                       if (total_len + str_len > >>> MAX_CHAR_NUM_PER_LINE) { >>> +                               printf("\n"); >>> +                               total_len = 0; >>> +                       } >>>                          printf("  %s", rss_type_table[i].str); >>> +                       total_len += str_len; >>> +               } >>>          } >>>   } >>> >>> @@ -766,6 +779,38 @@ rss_offload_to_str(uint64_t rss_offload) >>>          return NULL; >>>   } >>> >>> +static void >>> +rss_offload_types_display(uint64_t rss_offload_types) >>> +{ >>> +#define USER_DEFINED_DISPLAY_STR_LEN 23 >>> + >>> +       uint16_t total_len = 0; >>> +       uint16_t str_len = 0; >>> +       uint64_t rss_offload; >>> +       uint16_t i; >>> + >>> +       for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) { >>> +               rss_offload = RTE_BIT64(i); >>> +               if ((rss_offload_types & rss_offload) != 0) { >>> +                       const char *p = rss_offload_to_str(rss_offload); >>> + >>> +                       str_len = p ? strlen(p) : >>> USER_DEFINED_DISPLAY_STR_LEN; >>> +                       str_len += 2; /* add two blanks */ >>> +                       if (total_len + str_len >= >>> MAX_CHAR_NUM_PER_LINE) { >>> +                               total_len = 0; >>> +                               printf("\n"); >>> +                       } >>> + >>> +                       if (p) >>> +                               printf("  %s", p); >>> +                       else >>> +                               printf("  user defined 0x%"PRIx64"", >>> +                                      rss_offload); >>> +                       total_len += str_len; >>> +               } >>> +       } >>> +} >> >> If you go with 'rss_type_table[]', above function can be used for both >> 'port_infos_display()' and 'rss_types_display()', what do you think? > I just don't think it's appropriate to use this table for that. I put some more comment to other patch on why 'rss_type_table[]' can be used. >> And perhaps 'rss_offload_types_display()' can get length as parameter. > Ack. >> >>> + >>>   void >>>   port_infos_display(portid_t port_id) >>>   { >>> @@ -870,22 +915,9 @@ 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 = >>> - rss_offload_to_str(rss_offload); >>> -                               if (p) >>> -                                       printf("  %s\n", p); >>> -                               else >>> -                                       printf("  user defined >>> 0x%"PRIx64"\n", >>> -                                              rss_offload); >>> -                       } >>> -               } >>> + rss_offload_types_display(dev_info.flow_type_rss_offloads); >>> +               printf("\n"); >>>          } >>> >>>          printf("Minimum size of RX buffer: %u\n", >>> dev_info.min_rx_bufsize); >>> -- >>> 2.33.0 >>> >> >> .