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 53B1EA04FD; Mon, 30 May 2022 12:43:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E90542B8B; Mon, 30 May 2022 12:43:12 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2056.outbound.protection.outlook.com [40.107.212.56]) by mails.dpdk.org (Postfix) with ESMTP id 620A9400D6; Mon, 30 May 2022 12:43:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZOe03UAayZ3PmCL1bacEzsByC3OcWP8mgWvK5WlenuktG6CDDN5Rkg6450OhLvW/XIAfsLeKmQ0Q+rM+dyk5sQqr3mb9A2NTp0Yfn2Ct5uFWh1oEnBCf7gtjNYOFOjSSvDCLjctUqT3boYBTbkc7Fv/h8KUp3tdlhIFOuFwrQLuDIkdrYfPIOSofv9cOSu8HmQ0nCJKsdjdFiW7285P7FYS87TS6tbtK8OMoNgx3O70qV/AhgAmWzEOhPRr0YkWRy2zayxIqbC7nadx17ip13aCt7z9gv+Otik7vllxvLOvjiQSqpd1sFAwU/n9+/lBrW4TfclP1iTdNNT7WFMh63g== 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=2m5+ENEduu2am7q+A7V17ndvexn1tzM7hAKVaAtgav4=; b=Ze/EQX77Nf+GAoNdXNsOeHLz7T+dnj3SByCSsI9YSf3ELkFLuSRh/uu/6z70EwVWZpzLklrI2XX0Ftk8C+jVcJp2kNxB+ypPvwyX0pQYNXQwYiuKK4zOI1p/U+dLErCWdthLCcSYVYZachwUm9fNxOg+Kppc1TVx177iiaRwQR+mChvL3cweRRQaz0A2If0T2fdmKlSU/uQW7IfFITH6SJLY/7J90z36NkPOV0D+PEvffHOTdBTzZXA2/WyWaqolig2zqLqZ50rJlkvTwMTrT0lhd+qPir8YYRH7lD9ZpBN5pyLu6iKu5Irf3J6k7PwI8fU+I5kMN3NuDvjTVpETNw== 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=2m5+ENEduu2am7q+A7V17ndvexn1tzM7hAKVaAtgav4=; b=oArSWxigN0J03dNOn5GUF1nHcU+shqcTafhPyeLuWBknWA+otZEnFVHTXloF10QVrMlEt4LLQXR1br/sY8cfTbcbAItAzMOJkNuYQ+3TkVbCo4GmhPotAVLKMSLAkOoZ+rg98fvklGyijwR3infL88Sm5iQjYrMsTDFOobcN/vY= Received: from BN8PR15CA0003.namprd15.prod.outlook.com (2603:10b6:408:c0::16) by BYAPR02MB4536.namprd02.prod.outlook.com (2603:10b6:a03:55::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.16; Mon, 30 May 2022 10:43:08 +0000 Received: from BN1NAM02FT062.eop-nam02.prod.protection.outlook.com (2603:10b6:408:c0:cafe::41) by BN8PR15CA0003.outlook.office365.com (2603:10b6:408:c0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.19 via Frontend Transport; Mon, 30 May 2022 10:43:08 +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 BN1NAM02FT062.mail.protection.outlook.com (10.13.2.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5293.13 via Frontend Transport; Mon, 30 May 2022 10:43:08 +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, 30 May 2022 11:43:07 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 30 May 2022 11:43:07 +0100 Envelope-to: lihuisong@huawei.com, xiaoyun.li@intel.com, aman.deep.singh@intel.com, yuying.zhang@intel.com, helin.zhang@intel.com, jingjing.wu@intel.com, thomas.monjalon@6wind.com, dev@dpdk.org, thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, stable@dpdk.org Received: from [10.71.118.169] (port=58633) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nvcra-0004MI-Lv; Mon, 30 May 2022 11:43:06 +0100 Message-ID: <242f8a69-81d9-1795-fcf3-94358dae590d@xilinx.com> Date: Mon, 30 May 2022 11:43:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 1/3] app/testpmd: fix displaying RSS info Content-Language: en-US To: "lihuisong (C)" , Xiaoyun Li , Aman Singh , Yuying Zhang , Helin Zhang , Jingjing Wu , Thomas Monjalon CC: , Thomas Monjalon , Andrew Rybchenko , References: <20220525173736.3394787-1-ferruh.yigit@xilinx.com> <3110523f-72e6-20be-4510-be579722ffbd@huawei.com> From: Ferruh Yigit In-Reply-To: <3110523f-72e6-20be-4510-be579722ffbd@huawei.com> 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: 1ba27103-8e42-4c06-5d2f-08da42292f6f X-MS-TrafficTypeDiagnostic: BYAPR02MB4536: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: Vp08Q/PfAu4p7Dsd4mwB/FK5z9znRhcQyrf046mxGRR3Bhc2BZGWkthKc8Ko/3fUKqt2KbeThmfpZZ/HAQW8ia/em6jFxl+8zTY790xoB6/XLEwk7A3wODI7ywyp9NNDnQjE34dJkfJ5P52qDLYofAoagTRQrG+7slkjM8xXpNFzPRU+TPdCSjkhzOs7xbOvpffi8LHMYAvbPRUHAP0Pzd75fKtX0qsUUJSorJtJy45+9lMKUCaudoasMPPwWDVO0waoPeWOwlEYGIZTcAfewTFYbjnlXwESZEsVOnIUkVpmrVghRNgyhd8IBr0D1OgTyo3vj0s+sGiXUWTqhDD6fyndom2bFXmk1wbameVwQPq9qSMV3OfMdQLsywRMkvsaKpIkIJGNsRQZXiLutCVYzi3uIyDtIRPOgf0NyoSm/QxC0EMAPtAxNxA54nTSifhhbGiHNav0/V7JTuqhmJquoFiG5cKYBQJOioo4FUwAPxLCeD+dMMdV7KAp0LfbO8mO7U/+Lu8W0oVMpEXJhiS8eamt0bfONC3qWigw8AYU90P1KzzhEB9xJntdwYIRXBUNs/lIZSB1nc9e9UI6lrfiKj+o+MbGnXcQ9ss27+v9A+mQGS3bBHGkx7MhhmsXuxmo7A9iny/brAzdbVn4fsjb5/jNoCw6wnhpa/Z9s80xozfPl6SR8J50IGA0q7q7KmeKbqXUTZGjy5Du++EzmIlzKi3WMYERcJmtawqKg1Bmy0w= 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:(13230001)(4636009)(36840700001)(46966006)(40470700004)(5660300002)(44832011)(40460700003)(83380400001)(356005)(7416002)(31696002)(2906002)(336012)(426003)(6666004)(8936002)(47076005)(508600001)(186003)(9786002)(36860700001)(110136005)(2616005)(316002)(54906003)(82310400005)(8676002)(53546011)(70586007)(70206006)(4326008)(7636003)(36756003)(26005)(31686004)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2022 10:43:08.1547 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ba27103-8e42-4c06-5d2f-08da42292f6f 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: BN1NAM02FT062.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4536 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 5/27/2022 3:30 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/5/26 1:37, Ferruh Yigit 写道: >> When supported RSS offload flow types are printed via 'show port info #' >> command, flow names are get from flow type array which is wrong and >> causing some RSS flow types not being displayed. >> >> Instead RSS flow type array should be used. Also helper functions added >> and existing code updated to use helpers. >> >> Fixes: b12964f621dc ("ethdev: unification of RSS offload types") >> Cc: stable@dpdk.org >> >> Signed-off-by: Ferruh Yigit >> --- >> Cc: helin.zhang@intel.com >> >> Note: >> In ethdev, flow type macros 'RTE_ETH_FLOW_*' and RSS type macros >> 'RTE_ETH_RSS_*' are related, buy they seems diverged a little, may need >> to check that too. >> --- >>   app/test-pmd/config.c | 92 ++++++++++++++++++++++++++++++------------- >>   1 file changed, 64 insertions(+), 28 deletions(-) >> >> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c >> index 72d2606d19d5..c353d224ef06 100644 >> --- a/app/test-pmd/config.c >> +++ b/app/test-pmd/config.c >> @@ -147,6 +147,32 @@ const struct rss_type_info rss_type_table[] = { >>       { NULL, 0 }, >>   }; >> >> +static const char * >> +rsstype_to_str(uint64_t rss_type) >> +{ >> +     int i; >> + >> +     for (i = 0; rss_type_table[i].str != NULL; i++) { >> +             if (rss_type_table[i].rss_type == rss_type) >> +                     return rss_type_table[i].str; >> +     } >> + >> +     return NULL; >> +} >> + >> +static uint64_t >> +str_to_rsstype(const char *str) >> +{ >> +     int i; >> + >> +     for (i = 0; rss_type_table[i].str != NULL; i++) { >> +             if (!strcmp(rss_type_table[i].str, str)) >> +                     return rss_type_table[i].rss_type; >> +     } >> + >> +     return 0; >> +} >> + >>   static const struct { >>       enum rte_eth_fec_mode mode; >>       const char *name; >> @@ -779,19 +805,21 @@ 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_types = dev_info.flow_type_rss_offloads; >>               uint16_t i; >> -             char *p; >> >>               printf("Supported RSS offload flow types:\n"); >> -             for (i = RTE_ETH_FLOW_UNKNOWN + 1; >> -                  i < sizeof(dev_info.flow_type_rss_offloads) * >> CHAR_BIT; i++) { >> -                     if (!(dev_info.flow_type_rss_offloads & (1ULL << >> i))) >> -                             continue; >> -                     p = flowtype_to_str(i); >> -                     if (p) >> -                             printf("  %s\n", p); >> -                     else >> -                             printf("  user defined %d\n", i); >> +             for (i = 0; rss_types != 0; i++) { >> +                     if (rss_types & 1) { >> +                             uint64_t rss_type = 1ULL << i; >> +                             const char *p = rsstype_to_str(rss_type); >> + >> +                             if (p) >> +                                     printf("  %s\n", p); >> +                             else >> +                                     printf("  user defined >> 0x%"PRIx64"\n", rss_type); >> +                     } >> +                     rss_types >>= 1; >>               } >>       } >> >> @@ -1547,6 +1575,7 @@ port_flow_complain(struct rte_flow_error *error) >>   static void >>   rss_config_display(struct rte_flow_action_rss *rss_conf) >>   { >> +     uint64_t rss_types; >>       uint8_t i; >> >>       if (rss_conf == NULL) { >> @@ -1582,16 +1611,23 @@ rss_config_display(struct rte_flow_action_rss >> *rss_conf) >>       } >> >>       printf(" types:\n"); >> -     if (rss_conf->types == 0) { >> +     rss_types = rss_conf->types; >> +     if (rss_types == 0) { >>               printf("  none\n"); >>               return; >>       } >> -     for (i = 0; rss_type_table[i].str; i++) { >> -             if ((rss_conf->types & >> -                 rss_type_table[i].rss_type) == >> -                 rss_type_table[i].rss_type && >> -                 rss_type_table[i].rss_type != 0) >> -                     printf("  %s\n", rss_type_table[i].str); >> + >> +     for (i = 0; rss_types != 0; i++) { >> +             if (rss_types & 1) { >> +                     uint64_t rss_type = 1ULL << i; >> +                     const char *p = rsstype_to_str(rss_type); > It seems that we can't use one bit to get rss type name. > Because part of name in rss_type_table[] consist of multiple bits. > Maybe it's better to use the original method to display RSS type name. > Right, it doesn't cover 'all' case, but thinking twice how useful 'all' case is, it doesn't really cover all options, and for user it is hard to know which functions are set when it displays 'all'. What about to remove 'all' item from 'rss_type_table[]'? > On the other hand, RSS type name are printed in many places as this > patch modified. > It is recommended that you encapsulate a funcion to display RSS type. Yes but each are formatting slightly different, so to let various formatting possible, common function returns string instead of printing them. As 3/3 of this set does some formatting. >> + >> +                     if (p) >> +                             printf("  %s\n", p); >> +                     else >> +                             printf("  user defined 0x%"PRIx64"\n", >> rss_type); >> +             } >> +             rss_types >>= 1; >>       } >>   } >> >> @@ -3823,11 +3859,16 @@ port_rss_hash_conf_show(portid_t port_id, int >> show_rss_key) >>               return; >>       } >>       printf("RSS functions:\n "); >> -     for (i = 0; rss_type_table[i].str; i++) { >> -             if (rss_type_table[i].rss_type == 0) >> -                     continue; >> -             if ((rss_hf & rss_type_table[i].rss_type) == >> rss_type_table[i].rss_type) >> -                     printf("%s ", rss_type_table[i].str); >> +     for (i = 0; rss_hf != 0; i++) { >> +             if (rss_hf & 1) { >> +                     uint64_t rss_type = 1ULL << i; >> +                     const char *p = rsstype_to_str(rss_type); >> +                     if (p) >> +                             printf("%s ", p); >> +                     else >> +                             printf("0x%"PRIx64" ", rss_type); >> +             } >> +             rss_hf >>= 1; >>       } >>       printf("\n"); >>       if (!show_rss_key) >> @@ -3844,15 +3885,10 @@ port_rss_hash_key_update(portid_t port_id, >> char rss_type[], uint8_t *hash_key, >>   { >>       struct rte_eth_rss_conf rss_conf; >>       int diag; >> -     unsigned int i; >> >>       rss_conf.rss_key = NULL; >>       rss_conf.rss_key_len = 0; >> -     rss_conf.rss_hf = 0; >> -     for (i = 0; rss_type_table[i].str; i++) { >> -             if (!strcmp(rss_type_table[i].str, rss_type)) >> -                     rss_conf.rss_hf = rss_type_table[i].rss_type; >> -     } >> +     rss_conf.rss_hf = str_to_rsstype(rss_type); >>       diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf); >>       if (diag == 0) { >>               rss_conf.rss_key = hash_key;