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 A7FAE428F8 for ; Sun, 9 Apr 2023 17:32:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9796D40A80; Sun, 9 Apr 2023 17:32:20 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by mails.dpdk.org (Postfix) with ESMTP id 26ED840A80 for ; Sun, 9 Apr 2023 17:32:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VYFmby1YgO3yTGcmh6i1YRJO08vZp0L1yhOdEFZWunf75waHJDEMEJhHzVkK3D6ss/CFGtCLrtdbdLEKGYTK5TOykQzDUVOkRdUyg3l498pdZ7kRpeJnoHoFTn4IVWGoC/rugGtneXqQGVJNagLy974N9MLvIQl2pOx4L4UF6yzgLtqkCcWhYPzGrJ6kQxbXZFzfajVSyfEyjAQWyh/K/+PewJ4IXZZo7/8QaZNyYVnSILU04cVl34NfKIVowxfidLeQFmn/YGWirFqMHStvg/qJKp11DZiewOMtGcK6xxjOZoUB+OoF7ZMK0ZeM5LHqOf3KxT0mxvkvH+FoJQozQQ== 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=BdDzsbawiWI2k9Gw4zJo1ecmU0APPl35OUEkXRUmnkk=; b=B95fUxLt1iHh+NzUTh3LeLjNXZF6Z0JTdalm76RmTjlvFt3gC/ewz7JN8CEfMxC/DguqGuP97PW4Eb4uukHb+j5fFzh+wM6nkm89+i/EqiO/naar4k7Y1Pb3X5ttxFWlPhHcahQGpxcFjegeSA1Iil8RxE2Y83+/NhdXHLXFkUa8pK5zpj5csrtvw51o0KSyXgb5tfV/CGtXgqVnd6WC6K3m31NY69dY0+VMb/TJ0vpieERSAv2pWrBg+NZIDlt+C5l07f9HuAAbQYjdLG8o8PiLLbRbvlpWm+Fv2yTKUZb1gSUbjkv3y9vtYAjdhFWlwc+Vdkf+ITS93gmIGK4WpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BdDzsbawiWI2k9Gw4zJo1ecmU0APPl35OUEkXRUmnkk=; b=uiFFDaw8MGtDx5zZWKiKfDXKqd/dNzsTSkD+6ou7tl0QETOZhyvD19yTEEO5AZZv8OPInjfbBiiu3uGLnDP6n5LmWyCn1GjuHK1MRLaHnPZ+k3uWoDJ4M8+ST7LxbP+Gc12KGXE2QNQWPA+ouBy6sLncLBnm1beb503z1yo32Pnu/ktyPGoi7FxeKIHGd8jSzjJLpraNfWiEdQbbqnwN6vdIJR2GDvQ9zA2+bgIhrWzphn6p56lD1VK9Kcecc/Q9F15yGwRjw1l5le02XktJE79tjLohN49MuHvFUKEJT0EwhwrQuKQE5yARZxlKGr5R43Z8O/dVsc61twN9uBReIA== Received: from MW4PR04CA0280.namprd04.prod.outlook.com (2603:10b6:303:89::15) by PH0PR12MB8050.namprd12.prod.outlook.com (2603:10b6:510:26e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Sun, 9 Apr 2023 15:32:16 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:89:cafe::58) by MW4PR04CA0280.outlook.office365.com (2603:10b6:303:89::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.35 via Frontend Transport; Sun, 9 Apr 2023 15:32:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.25 via Frontend Transport; Sun, 9 Apr 2023 15:32:15 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sun, 9 Apr 2023 08:32:08 -0700 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sun, 9 Apr 2023 08:32:06 -0700 From: Xueming Li To: Huisong Li CC: Dongdong Liu , dpdk stable Subject: patch 'net/hns3: use hardware config to report hash types' has been queued to stable release 22.11.2 Date: Sun, 9 Apr 2023 23:24:23 +0800 Message-ID: <20230409152529.5308-76-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230409152529.5308-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230409152529.5308-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT009:EE_|PH0PR12MB8050:EE_ X-MS-Office365-Filtering-Correlation-Id: 695fb88f-92ea-4356-00a6-08db390f992d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CUJU1WTa/U3sS2Cg2YagmmzucKhRP/p4hU77z97GoSYxjgK6KlcrdcMrOjhesYAjJuuXGqjJPUbyGKnNt/RLxm1bomsa0+dWCoQMLZ5mG4A0ZLrpys/iPVf+FuVuQpri6onFNXMCl0ptZnMUB7DseOc+j9/ycN0SmZnw1C6fC6jttnbgwIybhUPiXoAyRXHUglgH2fRvG4aU9EiY6RoZcf5Ps+SzPQae56aaDqwZ1CjndJJFrE8FJTB2rdaSnEyjvS5IK61yAml6P2K906RwS+/APNvuvcsX8X+n4dtsZwC3xdkmW5YlOVQ/uRwlRk6nKdk/r9VR79rPymzbhTeHTj3eX0CDxlc6l+rxsAeh01zjU4SRldrO+zomO+TMqxYDn5bDTH0Bs4YSYV76T3UbMOtc6eEFIwsjh2aFVONFMGHZU2VYTZ/Jl5mmipYWG/BAjpTnXYU+TDeqNFKBsfd8Q4YhNgYP/GHPlQRwAycM2T/S4WPv8p3vW1y3q3EmmrzUIRYXO2ZRsuT0sJr2Rl4+edbnEzpgZE2mvnur4uCBiCPvqRL0N+hJcoS0yXrQWatuRf7FXIHzLPg4MYo+uCIPY6eoLPR8mZ1tzqIV6yi0LVbHFgVxHymxykgSCfzg/dDFDErW17VC6iJXkyE0HHxEuGW26oOPUHwLL5gZveMc/+nNbIsOH5e2QkA71hI+udArk93jdOxD8mPgDEFUqvhsF1tSB5BN1EORLLrEEErJarUE7Gcwm4PGxmgjYJwD524Zq1NVYMlNk5ZbkgHp1CnI4g9TmcjcOnK9z9LK8x/dPZdeNPH7U2sgTU47tsBolbVEex1c9VMWNKIwYUh0rpWMuQ== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(55016003)(6666004)(8936002)(7696005)(40480700001)(30864003)(40460700003)(966005)(5660300002)(86362001)(70586007)(70206006)(8676002)(6916009)(4326008)(478600001)(316002)(82310400005)(36860700001)(82740400003)(7636003)(356005)(54906003)(2906002)(53546011)(1076003)(26005)(2616005)(83380400001)(47076005)(426003)(336012)(41300700001)(36756003)(186003)(16526019)(6286002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2023 15:32:15.9275 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 695fb88f-92ea-4356-00a6-08db390f992d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8050 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 04/11/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/dbcf64d12eeb6b91087a6bad81636c5faddf0d66 Thanks. Xueming Li --- >From dbcf64d12eeb6b91087a6bad81636c5faddf0d66 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Fri, 10 Mar 2023 17:35:06 +0800 Subject: [PATCH] net/hns3: use hardware config to report hash types Cc: Xueming Li [ upstream commit 406b25c7ffd2d84b1e09665872f69755c75e7d89 ] Use the configuration in hardware to report hash types instead of data maintained in software. Fixes: c37ca66f2b27 ("net/hns3: support RSS") Signed-off-by: Huisong Li Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rss.c | 260 ++++++++++++++++++++++++++++-------- drivers/net/hns3/hns3_rss.h | 1 + 2 files changed, 208 insertions(+), 53 deletions(-) diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c index a8ea5150ab..9addc00a67 100644 --- a/drivers/net/hns3/hns3_rss.c +++ b/drivers/net/hns3/hns3_rss.c @@ -70,6 +70,17 @@ enum hns3_tuple_field { HNS3_RSS_FIELD_IPV6_FRAG_IP_S }; +#define HNS3_RSS_TUPLE_IPV4_TCP_M GENMASK(3, 0) +#define HNS3_RSS_TUPLE_IPV4_UDP_M GENMASK(11, 8) +#define HNS3_RSS_TUPLE_IPV4_SCTP_M GENMASK(20, 16) +#define HNS3_RSS_TUPLE_IPV4_NONF_M GENMASK(25, 24) +#define HNS3_RSS_TUPLE_IPV4_FLAG_M GENMASK(27, 26) +#define HNS3_RSS_TUPLE_IPV6_TCP_M GENMASK(35, 32) +#define HNS3_RSS_TUPLE_IPV6_UDP_M GENMASK(43, 40) +#define HNS3_RSS_TUPLE_IPV6_SCTP_M GENMASK(52, 48) +#define HNS3_RSS_TUPLE_IPV6_NONF_M GENMASK(57, 56) +#define HNS3_RSS_TUPLE_IPV6_FLAG_M GENMASK(59, 58) + enum hns3_rss_tuple_type { HNS3_RSS_IP_TUPLE, HNS3_RSS_IP_L4_TUPLE, @@ -79,200 +90,249 @@ static const struct { uint64_t rss_types; uint16_t tuple_type; uint64_t rss_field; + uint64_t tuple_mask; } hns3_set_tuple_table[] = { /* IPV4-FRAG */ { RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S), + HNS3_RSS_TUPLE_IPV4_FLAG_M }, { RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D), + HNS3_RSS_TUPLE_IPV4_FLAG_M }, { RTE_ETH_RSS_FRAG_IPV4, HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D), + HNS3_RSS_TUPLE_IPV4_FLAG_M }, /* IPV4 */ { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S), + HNS3_RSS_TUPLE_IPV4_NONF_M }, { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D), + HNS3_RSS_TUPLE_IPV4_NONF_M }, { RTE_ETH_RSS_IPV4, HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D), + HNS3_RSS_TUPLE_IPV4_NONF_M }, /* IPV4-OTHER */ { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S), + HNS3_RSS_TUPLE_IPV4_NONF_M }, { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_DST_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D), + HNS3_RSS_TUPLE_IPV4_NONF_M }, { RTE_ETH_RSS_NONFRAG_IPV4_OTHER, HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D), + HNS3_RSS_TUPLE_IPV4_NONF_M }, /* IPV4-TCP */ { RTE_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N_SCTP_VER) }, + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER), + HNS3_RSS_TUPLE_IPV4_SCTP_M }, /* IPV6-FRAG */ { RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S), + HNS3_RSS_TUPLE_IPV6_FLAG_M }, { RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D), + HNS3_RSS_TUPLE_IPV6_FLAG_M }, { RTE_ETH_RSS_FRAG_IPV6, HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D), + HNS3_RSS_TUPLE_IPV6_FLAG_M }, /* IPV6 */ { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S), + HNS3_RSS_TUPLE_IPV6_NONF_M }, { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D), + HNS3_RSS_TUPLE_IPV6_NONF_M }, { RTE_ETH_RSS_IPV6, HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D), + HNS3_RSS_TUPLE_IPV6_NONF_M }, /* IPV6-OTHER */ { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S), + HNS3_RSS_TUPLE_IPV6_NONF_M }, { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_DST_ONLY, HNS3_RSS_IP_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D), + HNS3_RSS_TUPLE_IPV6_NONF_M }, { RTE_ETH_RSS_NONFRAG_IPV6_OTHER, HNS3_RSS_IP_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D), + HNS3_RSS_TUPLE_IPV6_NONF_M }, /* IPV6-TCP */ { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L3_SRC_ONLY, HNS3_RSS_IP_L4_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_S), + HNS3_RSS_TUPLE_IPV6_TCP_M }, { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L3_DST_ONLY, HNS3_RSS_IP_L4_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_D)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S_FIELD_IPV6_SCTP_EN_IP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D), + HNS3_RSS_TUPLE_IPV6_SCTP_M }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_SRC_ONLY, HNS3_RSS_IP_L4_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S), + HNS3_RSS_TUPLE_IPV6_SCTP_M }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_DST_ONLY, HNS3_RSS_IP_L4_TUPLE, - BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D), + HNS3_RSS_TUPLE_IPV6_SCTP_M }, { RTE_ETH_RSS_NONFRAG_IPV6_SCTP, HNS3_RSS_IP_L4_TUPLE, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) | BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) | - BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) }, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER), + HNS3_RSS_TUPLE_IPV6_SCTP_M }, }; /* @@ -576,6 +636,96 @@ set_tuple_fail: return ret; } +int +hns3_get_rss_tuple_field(struct hns3_hw *hw, uint64_t *tuple_fields) +{ + struct hns3_rss_input_tuple_cmd *req; + struct hns3_cmd_desc desc; + int ret; + + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, true); + req = (struct hns3_rss_input_tuple_cmd *)desc.data; + ret = hns3_cmd_send(hw, &desc, 1); + if (ret != 0) { + hns3_err(hw, "fail to get RSS hash tuple fields from firmware, ret = %d", + ret); + return ret; + } + + *tuple_fields = rte_le_to_cpu_64(req->tuple_field); + + return 0; +} + +static uint64_t +hns3_rss_tuple_fields_to_rss_hf(struct hns3_hw *hw, uint64_t tuple_fields) +{ + uint64_t ipv6_sctp_l4_mask = + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S); + uint64_t rss_hf = 0; + uint64_t tuple_mask; + uint32_t i; + + for (i = 0; i < RTE_DIM(hns3_set_tuple_table); i++) { + tuple_mask = hns3_set_tuple_table[i].tuple_mask; + /* + * The RSS hash of the packet type is disabled if its tuples is + * zero. + */ + if ((tuple_fields & tuple_mask) == 0) + continue; + + /* + * Some hardware don't support to use src/dst port fields to + * hash for IPV6-SCTP packet. + */ + if ((hns3_set_tuple_table[i].rss_types & + RTE_ETH_RSS_NONFRAG_IPV6_SCTP) && + !hw->rss_info.ipv6_sctp_offload_supported) + tuple_mask &= ~ipv6_sctp_l4_mask; + + /* + * The framework (ethdev ops) or driver (rte flow API) ensure + * that both L3_SRC/DST_ONLY and L4_SRC/DST_ONLY cannot be set + * to driver at the same time. But if user doesn't specify + * anything L3/L4_SRC/DST_ONLY, driver enables all tuple fields. + * In this case, driver should not report L3/L4_SRC/DST_ONLY. + */ + if ((tuple_fields & tuple_mask) == tuple_mask) { + /* Skip the item enabled part tuples. */ + if ((tuple_fields & hns3_set_tuple_table[i].rss_field) != + tuple_mask) + continue; + + rss_hf |= hns3_set_tuple_table[i].rss_types; + continue; + } + + /* Match the item enabled part tuples.*/ + if ((tuple_fields & hns3_set_tuple_table[i].rss_field) == + hns3_set_tuple_table[i].rss_field) + rss_hf |= hns3_set_tuple_table[i].rss_types; + } + + return rss_hf; +} + +static int +hns3_rss_hash_get_rss_hf(struct hns3_hw *hw, uint64_t *rss_hf) +{ + uint64_t tuple_fields; + int ret; + + ret = hns3_get_rss_tuple_field(hw, &tuple_fields); + if (ret != 0) + return ret; + + *rss_hf = hns3_rss_tuple_fields_to_rss_hf(hw, tuple_fields); + + return 0; +} + /* * Get rss key and rss_hf types set of RSS hash configuration. * @param dev @@ -591,28 +741,32 @@ hns3_dev_rss_hash_conf_get(struct rte_eth_dev *dev, { struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; - struct hns3_rss_conf *rss_cfg = &hw->rss_info; uint8_t hash_algo; int ret; rte_spinlock_lock(&hw->lock); - rss_conf->rss_hf = rss_cfg->conf.types; + ret = hns3_rss_hash_get_rss_hf(hw, &rss_conf->rss_hf); + if (ret != 0) { + hns3_err(hw, "obtain hash tuples failed, ret = %d", ret); + goto out; + } /* Get the RSS Key required by the user */ if (rss_conf->rss_key && rss_conf->rss_key_len >= hw->rss_key_size) { ret = hns3_rss_get_algo_key(hw, &hash_algo, rss_conf->rss_key, hw->rss_key_size); if (ret != 0) { - rte_spinlock_unlock(&hw->lock); hns3_err(hw, "obtain hash algo and key failed, ret = %d", ret); - return ret; + goto out; } rss_conf->rss_key_len = hw->rss_key_size; } + +out: rte_spinlock_unlock(&hw->lock); - return 0; + return ret; } /* diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h index be0141f602..17473e70e2 100644 --- a/drivers/net/hns3/hns3_rss.h +++ b/drivers/net/hns3/hns3_rss.h @@ -110,6 +110,7 @@ int hns3_rss_reset_indir_table(struct hns3_hw *hw); int hns3_config_rss(struct hns3_adapter *hns); void hns3_rss_uninit(struct hns3_adapter *hns); int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf); +int hns3_get_rss_tuple_field(struct hns3_hw *hw, uint64_t *tuple_fields); int hns3_rss_set_algo_key(struct hns3_hw *hw, uint8_t hash_algo, const uint8_t *key, uint8_t key_len); int hns3_rss_get_algo_key(struct hns3_hw *hw, uint8_t *hash_algo, -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-04-09 21:45:40.703016900 +0800 +++ 0075-net-hns3-use-hardware-config-to-report-hash-types.patch 2023-04-09 21:45:38.689042200 +0800 @@ -1 +1 @@ -From 406b25c7ffd2d84b1e09665872f69755c75e7d89 Mon Sep 17 00:00:00 2001 +From dbcf64d12eeb6b91087a6bad81636c5faddf0d66 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 406b25c7ffd2d84b1e09665872f69755c75e7d89 ] @@ -10 +12,0 @@ -Cc: stable@dpdk.org