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 9B842A054D; Tue, 7 Jun 2022 17:45:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 87ADB4021D; Tue, 7 Jun 2022 17:45:50 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2053.outbound.protection.outlook.com [40.107.223.53]) by mails.dpdk.org (Postfix) with ESMTP id AB39F40156 for ; Tue, 7 Jun 2022 17:45:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ReCWvI7k/ZiZNA/FP3ZUD43/qGA07zMXga2TI4LttICSBKsB6ckdgRAoHbMZr7W1by5I/rZRSGYyWjivJUZU4gv6zeGXm80sLs7NlInrAP3CEwFKWir8SGqvynp8rGuVrxBJ0d6IW5Uh2gyLES7g/NnqP6yqHl1VIKssVG9/sDHMxshca4/niNVX13/1BRz0GmIOSG2YuoEqBWkOMSRO3whjXwQWpU2+6hHq8RSi9SzJg0ia7PilVTQLoZJ+0ROrI0HCZTVqpHM+dsj3MlO8dmmhtGNfJyLTPP02v0YAKE4CNqw2NB/fI7v1KWGgVHy/YDHLnAp53IRsyCJhmoBkIg== 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=J73ruPlFRGxDXL/1Nip6Kf3K+GgM7PJq2FaXzUYCcDo=; b=NxX8ryrkeUa0/Df3aTQocblmJlhf6jaL27dXcKcqxpt7boJ9lkU7akyKIYasWXeexo41tz6qmmsfKMSfg4Ki7R6zAQcA2CUZgzjwk+rd8nlkf5G/Fje8m8ynaTXFea13cNHBJnuzkPitdictHnf8Vh65hWXlMxD7U9M/1Z/MZ/CRghJAuNSo1E735FRkQTgDO3t5Cx3Ij2zhPNCETlQ6n21uLJKKsrIDWxE0E0MLlTsqnuWUFL9s5DL3AMzvsan0P9YZDPNzcHcAu9Rz3rdbiwnHDRj7cJu+CsbhZvgqGtDhEoqdRbOd9NT6WSfG1Mg9ne9wbCDJjgCBnMPAdPSVeQ== 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=J73ruPlFRGxDXL/1Nip6Kf3K+GgM7PJq2FaXzUYCcDo=; b=YQKJh12XRJ48T8IitP9kO9b6iO/wgI+YTCooC+6NZkNYXpTQJzta8TyLfDBvZVykAgTIhwLtSRvbRjDM16a3Z3wjRD01K3DeyszFHqajiB5EnAtHoxP8K5DuzSwZkyS3hIfaettiD6wXgQp6kEXBYaGzDCWTgdyMcmMJXtQAM2M= Received: from SA9P221CA0023.NAMP221.PROD.OUTLOOK.COM (2603:10b6:806:25::28) by DM6PR02MB5130.namprd02.prod.outlook.com (2603:10b6:5:47::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.17; Tue, 7 Jun 2022 15:45:42 +0000 Received: from SN1NAM02FT0035.eop-nam02.prod.protection.outlook.com (2603:10b6:806:25:cafe::9c) by SA9P221CA0023.outlook.office365.com (2603:10b6:806:25::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13 via Frontend Transport; Tue, 7 Jun 2022 15:45:42 +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 SN1NAM02FT0035.mail.protection.outlook.com (10.97.4.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5314.12 via Frontend Transport; Tue, 7 Jun 2022 15:45:41 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) 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; Tue, 7 Jun 2022 16:45:40 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 7 Jun 2022 16:45:40 +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.117.191] (port=14133) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nybOm-0004e6-60; Tue, 07 Jun 2022 16:45:40 +0100 Message-ID: Date: Tue, 7 Jun 2022 16:45:39 +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 1/4] app/testpmd: fix supported RSS offload display Content-Language: en-US To: Huisong Li , , , , CC: , , References: <20220429102445.23711-1-lihuisong@huawei.com> <20220607083246.12259-1-lihuisong@huawei.com> <20220607083246.12259-2-lihuisong@huawei.com> From: Ferruh Yigit In-Reply-To: <20220607083246.12259-2-lihuisong@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a551e2f6-8294-4874-9d4d-08da489cc749 X-MS-TrafficTypeDiagnostic: DM6PR02MB5130: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: 89HV8FeXp9i0GWd6l7Bka9JKdaHsApv+dJ9cqnK0RritCnA4XHF/Uyh/MJrutlLSzlq+hywErfUZ3J0wdtZXywnOHMIYlnv4hq0q+VrkQRvdEShizfH4tsO1MYvaXhbBt2zn+/35fN5mUEgDgipPKLJsIrAXe/kGj55rQW9s0UUgubm4ShPQ/jr8RMYNbw/oyfBEff7ss9iV4OqqkdRaTWWlC1D+xKSyFCoNSTs9ysyzOj1620+Y69CXqlTLjF7vjUCW3HYd9E7d7/JcBN4c/tllpzP9Cyov+RmMAoQwCJ3+FIOfdHaSFbHn/Se9Fzrm76Us6GEiG5UoDaeduY+oOEHbNEkHsrozhHG8ueqf40droJihUIV328CcUzlR4yBnsDjPQXnF5iFYRdO0aSH6rUTIEf86pWHSrKUx4hJjvzZHINbRFkZqIvVKY7Bay3U1s9hOLoOdY3xdCXpKg/vJqPvZiuvMnKaHL/zlssDQ5TJXr7ntARvuUpUoJXG6JsIKVPFqcN8B9VBnyIGD916DT2+5AdhikhaAsqcuv6l9y3LwRHJjwKd7PCDb0CJ+ewO8uPzNB2+JuASQFqi+pg0GE7xpa+JhM4WZAzc5kEcbxNkAm//3kbYp+Abw2wBM9x3fnaY1rokdOxH5JK2EP1/dTCN6o/VIhnT8GFGsQKnWeUNgUgqizmMuy4sIeos9AZrp+bGRDLtxFTJKSPFfrGYdCXsdxFJSC6YmNsAdtrGka84= 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)(110136005)(508600001)(44832011)(5660300002)(8936002)(53546011)(26005)(40460700003)(31696002)(356005)(7636003)(36860700001)(426003)(47076005)(336012)(9786002)(2616005)(2906002)(83380400001)(8676002)(70206006)(4326008)(316002)(36756003)(82310400005)(70586007)(31686004)(54906003)(186003)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2022 15:45:41.9278 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a551e2f6-8294-4874-9d4d-08da489cc749 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: SN1NAM02FT0035.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5130 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/7/2022 9:32 AM, Huisong Li wrote: > > And rte_eth_dev_info.flow_type_rss_offloads is populated in terms of > RTE_ETH_RSS_* bits. If PMD sets RTE_ETH_RSS_L3_SRC_ONLY to > dev_info->flow_type_rss_offloads. testpmd will display "user defined 63" > when run 'show port info 0'. Because testpmd use flowtype_to_str() > to display the supported RSS offload of PMD. In fact, the function is > used to display flow type in FDIR commands. This patch uses the > RTE_ETH_RSS_* bits to display supported RSS offload of PMD. > > Fixes: b12964f621dc ("ethdev: unification of RSS offload types") > Cc: stable@dpdk.org > > Signed-off-by: Huisong Li > Signed-off-by: Ferruh Yigit > --- > app/test-pmd/config.c | 85 ++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 75 insertions(+), 10 deletions(-) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 72d2606d19..d290ca3a06 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -86,6 +86,56 @@ static const struct { > }, > }; > > +const struct rss_type_info rss_offload_table[] = { > + {"ipv4", RTE_ETH_RSS_IPV4}, > + {"ipv4-frag", RTE_ETH_RSS_FRAG_IPV4}, > + {"ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP}, > + {"ipv4-udp", RTE_ETH_RSS_NONFRAG_IPV4_UDP}, > + {"ipv4-sctp", RTE_ETH_RSS_NONFRAG_IPV4_SCTP}, > + {"ipv4-other", RTE_ETH_RSS_NONFRAG_IPV4_OTHER}, > + {"ipv6", RTE_ETH_RSS_IPV6}, > + {"ipv6-frag", RTE_ETH_RSS_FRAG_IPV6}, > + {"ipv6-tcp", RTE_ETH_RSS_NONFRAG_IPV6_TCP}, > + {"ipv6-udp", RTE_ETH_RSS_NONFRAG_IPV6_UDP}, > + {"ipv6-sctp", RTE_ETH_RSS_NONFRAG_IPV6_SCTP}, > + {"ipv6-other", RTE_ETH_RSS_NONFRAG_IPV6_OTHER}, > + {"l2_payload", RTE_ETH_RSS_L2_PAYLOAD}, > + {"ipv6-ex", RTE_ETH_RSS_IPV6_EX}, > + {"ipv6-tcp-ex", RTE_ETH_RSS_IPV6_TCP_EX}, > + {"ipv6-udp-ex", RTE_ETH_RSS_IPV6_UDP_EX}, > + {"port", RTE_ETH_RSS_PORT}, > + {"vxlan", RTE_ETH_RSS_VXLAN}, > + {"geneve", RTE_ETH_RSS_GENEVE}, > + {"nvgre", RTE_ETH_RSS_NVGRE}, > + {"gtpu", RTE_ETH_RSS_GTPU}, > + {"eth", RTE_ETH_RSS_ETH}, > + {"s-vlan", RTE_ETH_RSS_S_VLAN}, > + {"c-vlan", RTE_ETH_RSS_C_VLAN}, > + {"esp", RTE_ETH_RSS_ESP}, > + {"ah", RTE_ETH_RSS_AH}, > + {"l2tpv3", RTE_ETH_RSS_L2TPV3}, > + {"pfcp", RTE_ETH_RSS_PFCP}, > + {"pppoe", RTE_ETH_RSS_PPPOE}, > + {"ecpri", RTE_ETH_RSS_ECPRI}, > + {"mpls", RTE_ETH_RSS_MPLS}, > + {"ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM}, > + {"l4-chksum", RTE_ETH_RSS_L4_CHKSUM}, > + {"l2tpv2", RTE_ETH_RSS_L2TPV2}, > + {"l3-pre96", RTE_ETH_RSS_L3_PRE96}, > + {"l3-pre64", RTE_ETH_RSS_L3_PRE64}, > + {"l3-pre56", RTE_ETH_RSS_L3_PRE56}, > + {"l3-pre48", RTE_ETH_RSS_L3_PRE48}, > + {"l3-pre40", RTE_ETH_RSS_L3_PRE40}, > + {"l3-pre32", RTE_ETH_RSS_L3_PRE32}, > + {"l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY}, > + {"l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY}, > + {"l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY}, > + {"l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY}, > + {"l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY}, > + {"l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY}, > + {NULL, 0}, > +}; > + Hi Huisong, Why not reusing existing 'rss_type_table[]', but adding a new one? Is it to have each individual RSS type instead of grouping 'rss_type_table[]' has? If so, since command "port config all rss ..." using the grouping, I think it makes sense to have grouping. Another thing is having two different array with very similar content is easy to confuse and can cause diversion on arrays and generate bugs. As mentioned from "port config all rss ..." command, it seems it is also not using 'rss_type_table[]', but all string to RSS type matching done within the function ('cmd_config_rss_parsed()') duplicating what we have in 'rss_type_table[]'. Again this has concern to diverge between set and show functions. If you have time for it, can you make an additional patch to update 'cmd_config_rss_parsed()' to use new 'str_to_rsstypes()' function? Thanks, ferruh > const struct rss_type_info rss_type_table[] = { > { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP | > RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD | > @@ -675,6 +725,19 @@ print_dev_capabilities(uint64_t capabilities) > } > } > > +static const char * > +rss_offload_to_str(uint64_t rss_offload) > +{ > + uint16_t i; > + > + for (i = 0; rss_offload_table[i].str != NULL; i++) { > + if (rss_offload_table[i].rss_type == rss_offload) > + return rss_offload_table[i].str; > + } > + > + return NULL; > +} > + > void > port_infos_display(portid_t port_id) > { > @@ -779,19 +842,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_offload_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; 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); > + } If you go with 'rss_type_table[]', you need to change above logic as you did in your v2. > } > } > > -- > 2.33.0 >