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 01FAE43E57 for ; Sat, 13 Apr 2024 14:52:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F0F394069D; Sat, 13 Apr 2024 14:52:15 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by mails.dpdk.org (Postfix) with ESMTP id EA868402E1 for ; Sat, 13 Apr 2024 14:52:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IcC810VLU254cBUIZWDQNvnkotd7XpTbXixpD3EEHmtghetv82NkqhqH9CKrQr7HmVUE7vaor72+1eBXMWsuJQqilz1ZoNahUmTg8NXcj5jY+Xs9mtfVxaNFaUlwr3lwvi2hX4tXwG7TSujvpMszwhyVztK70z1MCiVLnBuTplRatqAzFQpMfVYPZyxT2BNQuWgv6s7i2vcGTvGDqG6q9pjRn8vCc4vmjUHfliRz735wtBi7puqzZ9eFhJIblXTQo6wWGklWUZSCjeEtx5AYdk7m5/8bE8obdPY4dCPi4V0YzIc+5K9e79JqZpRwsX3CRA5JWhIFLDeMp/AGI5yH+w== 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=OT9j5bwKNvQcrnwx4UzZo6Ey49IfRR/s7P47KE8e5Ik=; b=khMn3cAx3vYfY+XSa3qBGWSieiy0+xKQna+WMAkmDRyGqa9ET+iig+/Vw26i84tIEjUzun9dzAWYdUreGa4hzqbfeelBvctwAfDsk6LNAr/MCgTjqfESUiHzs6DE3QSNnHXjd1iEbWTru4z2yK3lhCbCStObJ9A/mWJIYsLeU2uIsG4GJ0ZxBbLbCiwjTr6VUm2UE4LNZWK3AhXWGyWEY7y2g7+JSsgviJAYEpelQx1LWai+TLPbMkbQH56N/0Cuiq45sjTfT1y26ed6Ne6UHillnHh0GBQTVnrszxtQHb8IO8QMQ1A15pqo/MhgW8wH3LhpcVSQGAQC6J6SxJTQ+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=networkplumber.org 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 (0) 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=OT9j5bwKNvQcrnwx4UzZo6Ey49IfRR/s7P47KE8e5Ik=; b=jhRBbrBUmj+kdUU44aNrwr5Z+IETfVqlvNahxtW1x0IipS3H7DYUn2Y+yc0mGcBYw6JTFcgsscI083+LFwFNzmu8JR+O+v0oUOa3UYJkFK9IqOGSdma9gH5LFWPR5VGK9ry6OAZeBXcVt/uOksJoUipiwkGUbCrdP9vtEp682tmX6FH39E23G2AmaqV0uoAyZELdddxDsBCRZwbrWU0s8jNj6RXG/jS+8DKVaBQwh1ee3TqzKwbetQFeL1YSuvTydd1fpTLfVk6bkuC2e/Zrfqm1TB0AlewCqE4HJcJ1XpAm6nzFMIcRH2V7dW80gbwPjLFav7EInot+3UpxHucNhQ== Received: from BL1PR13CA0339.namprd13.prod.outlook.com (2603:10b6:208:2c6::14) by SJ2PR12MB7893.namprd12.prod.outlook.com (2603:10b6:a03:4cc::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Sat, 13 Apr 2024 12:52:08 +0000 Received: from BL02EPF00021F6D.namprd02.prod.outlook.com (2603:10b6:208:2c6:cafe::4b) by BL1PR13CA0339.outlook.office365.com (2603:10b6:208:2c6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7495.16 via Frontend Transport; Sat, 13 Apr 2024 12:52:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF00021F6D.mail.protection.outlook.com (10.167.249.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Sat, 13 Apr 2024 12:52:07 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sat, 13 Apr 2024 05:51:54 -0700 Received: from nvidia.com (10.126.231.35) 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.1258.12; Sat, 13 Apr 2024 05:51:53 -0700 From: Xueming Li To: Stephen Hemminger CC: dpdk stable Subject: patch 'net/tap: fix traffic control handle calculation' has been queued to stable release 23.11.1 Date: Sat, 13 Apr 2024 20:48:20 +0800 Message-ID: <20240413125005.725659-20-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240413125005.725659-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> <20240413125005.725659-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6D:EE_|SJ2PR12MB7893:EE_ X-MS-Office365-Filtering-Correlation-Id: 87b536ac-0e27-4648-b1b0-08dc5bb88708 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OzvOefzATk4ewGfJ2eaZZ6sHCY5ecWmRcXasKRPEMHWHB8VzDBezSrTxwS9s6xAmSxCAc/ue1Lq9i2D8vfuLq3tHOzkLp5Z/z1Re7Hv8xGH2fAhMVM2NAn0doNkqQOdBVR9D6qNG2Kxv1bL+8GWfFduZSwQisSJbolq68fse4JZkGa/GLK1DeZe5XzU9mXKlDZGMW67mFo5slWzyAnfd3VuUTwW5GzoDxxhkMWB04RVZgNyROlXko1uS3ua5vS/4FauFNSNmzC70FzsE59RfNxn8/b0hhQJSKr7dWx67mrZGXdR6VgMnngFQO45QDD+EDgEI4ukc4zdEykawtrZvRq/JLKhcOZBA/ehJ0iNkaM5dBPebNL67+737WAgX0uMhXMvKeqJ8ifq+wzNrrmRnV+ExguJUSdTPJ5F5RusCSMGSkKcCtPoZGWTDORcA2+Vb6f58MsUAhxdMap5MqdIR7yS7+pLNlxn48mUzDqdtDBjY2AosYYGKqePGXvvqI/txOumo+aBrrYGd0jEIu+ahjvapCerFt7N7Odc4Go2ENqd8F+5O7eIfLsLLQenmt61MFwqxEqCnOUwnyeEDQq49cTBOvbyZV+FThoErDOugycSUyHTyIwKgnsMbYXSRqfftnWwjE6xN39ow008pmCy8ETe1YCY+Xwu5rAdoXMlJ3JMIk2jQcVYy2CrE6di5chR6h8w6QfCfpViwMOSLgQTv1oUcKPz+av072j4sPP7yh3g2xjMSwSR2xGrLJ2Bpap6Y X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(82310400014)(376005)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2024 12:52:07.5496 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87b536ac-0e27-4648-b1b0-08dc5bb88708 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00021F6D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7893 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 23.11.1 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/15/24. 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=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=1d5bfd9fdf17cb809a9e32da71d2abc92f2bf871 Thanks. Xueming Li --- >From 1d5bfd9fdf17cb809a9e32da71d2abc92f2bf871 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 29 Feb 2024 09:31:08 -0800 Subject: [PATCH] net/tap: fix traffic control handle calculation Cc: Xueming Li [ upstream commit 4e924ff6f789c6a67424263bf384f3e4b4fba373 ] The code to take a flow pointer and make a TC handle was incorrect and would always generate the same handle. This is because it was hashing the address of the union on the stack (which is invariant) rather than the contents of the union. The following testpmd case would cause an error: testpmd> flow create 0 ingress pattern eth src is 06:05:04:03:02:01 \ / end actions queue index 2 / end Flow rule #0 created testpmd> flow create 0 ingress pattern eth src is 06:05:04:03:02:02 \ / end actions queue index 3 / end tap_nl_dump_ext_ack(): Filter already exists tap_flow_create(): Kernel refused TC filter rule creation (17): File exists port_flow_complain(): Caught PMD error type 2 (flow rule (handle)): overlapping rules or Kernel too old for flower support: File exists This fix does it in a more robust manner using size independent code. It also initializes the hash seed so the same hash won't show up every time and risk potential leakage of address to other places. Bugzilla ID: 1382 Fixes: de96fe68ae95 ("net/tap: add basic flow API patterns and actions") Fixes: a625ab89df11 ("net/tap: fix build with GCC 11") Signed-off-by: Stephen Hemminger --- drivers/net/tap/tap_flow.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index 5b0fee9064..fa50fe45d7 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -1297,9 +1298,7 @@ tap_flow_validate(struct rte_eth_dev *dev, * In those rules, the handle (uint32_t) is the part that would identify * specifically each rule. * - * On 32-bit architectures, the handle can simply be the flow's pointer address. - * On 64-bit architectures, we rely on jhash(flow) to find a (sufficiently) - * unique handle. + * Use jhash of the flow pointer to make a unique handle. * * @param[in, out] flow * The flow that needs its handle set. @@ -1309,16 +1308,18 @@ tap_flow_set_handle(struct rte_flow *flow) { union { struct rte_flow *flow; - const void *key; - } tmp; - uint32_t handle = 0; + uint32_t words[sizeof(flow) / sizeof(uint32_t)]; + } tmp = { + .flow = flow, + }; + uint32_t handle; + static uint64_t hash_seed; - tmp.flow = flow; + if (hash_seed == 0) + hash_seed = rte_rand(); + + handle = rte_jhash_32b(tmp.words, sizeof(flow) / sizeof(uint32_t), hash_seed); - if (sizeof(flow) > 4) - handle = rte_jhash(tmp.key, sizeof(flow), 1); - else - handle = (uintptr_t)flow; /* must be at least 1 to avoid letting the kernel choose one for us */ if (!handle) handle = 1; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-04-13 20:43:05.777702013 +0800 +++ 0020-net-tap-fix-traffic-control-handle-calculation.patch 2024-04-13 20:43:04.937754010 +0800 @@ -1 +1 @@ -From 4e924ff6f789c6a67424263bf384f3e4b4fba373 Mon Sep 17 00:00:00 2001 +From 1d5bfd9fdf17cb809a9e32da71d2abc92f2bf871 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 4e924ff6f789c6a67424263bf384f3e4b4fba373 ] @@ -30 +32,0 @@ -Cc: stable@dpdk.org