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 9173A45CE3 for ; Mon, 11 Nov 2024 07:41:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89FB94067A; Mon, 11 Nov 2024 07:41:00 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2083.outbound.protection.outlook.com [40.107.94.83]) by mails.dpdk.org (Postfix) with ESMTP id C959D40E15 for ; Mon, 11 Nov 2024 07:40:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=W6M1oZ+7AhMA5wxDJ3NcIlosHwen/AOasbBirgrLWy8nOYUoiK/WVoEZa8ZSjC4f/pJwP5qZJQ6bcYEtkfYlNeZsoOQ1LKLJhAdbCjOuaCYqYLGNpNAj2uaINVX+ktoov+MPtfIyGF+kMuFATeJKVzepEFoIHj8pX47MiHJgaOYqjQAW0/zjMZSV8L5LCG2CWQpWG1whn4N/4vxJmgdTOgljnPqbBxp2H+VhyWimhPXMO05LNILOnX3Q/3HScre63BwrgQth7kNI0Oz+AKLbYE9NMUtTkqm11SLiHQVzIfZu5aJQkyFArG+JxPrRlucSyYvB88zganYRZFXHdsQiWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=mUlVM/+8CMPrMvMSYeYG1yGl2EiD8DioW8vMaJ3wvyY=; b=HysAKpZcmwr/WO5zkLzbUmiZMZQuwfJnWpTH4sKgMs8OoRIlG1q5e7XJp7G9JIeDKgAM6CFAuyShbjjXgPxV2oXtEdgLjMujGjlwZtq4fB7Fciubnx3dpaYb0DNfQtiEDzEpAhOlm6PmFW1yb5yQxVQA17mspM0oVdgZHWlIbL8fyZ4Ft8Y0ItVs01UQ++1ubqQvc9ayLe1n4BOM4Fn/q3n7/kipKvh+lw6KwuDEAl1/Ck5IeNhCN2r3WopjpQgYlVisJPFXvW9g/i3rHOehG+O7BftnUqFB4jYKsN6CIkTYeq/hJ+hpVwHYz+BBSKhuI8Yn/aQ8K6DCnxibr5hHSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.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 (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=mUlVM/+8CMPrMvMSYeYG1yGl2EiD8DioW8vMaJ3wvyY=; b=NI8jSOW59ZkrHd526o90FdLj55JAtPApbULYW9I3c4WnyDPpxx0Ba0pJDJqmT/5H3tvAo8tSeZTMFt1KljXyRTET9gq7RRzLCD6V16p/KW8SCEGaPScZtlwy7ohcxjjaTuP90nqQoHVqP4FEb3+ZaTG13Q+IUblUr+cfd0vatlyj+CintoqdWQKh1X4fkDauDBXZqY6flyqk2YrgHN3+dVhSyskjktYKaRjenRFKyn+iMyaPE0W5qon3+t31Gr4FA2F1I0z7KN0VRqzap9Zf0HS3xRsmuzKwmuGnreTAwBNWBfC2OfADDn07I4ajm9DkBQOrc8cZxba9JS1It7PrlQ== Received: from SA0PR11CA0084.namprd11.prod.outlook.com (2603:10b6:806:d2::29) by DM6PR12MB4451.namprd12.prod.outlook.com (2603:10b6:5:2ab::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.26; Mon, 11 Nov 2024 06:40:55 +0000 Received: from SN1PEPF00026368.namprd02.prod.outlook.com (2603:10b6:806:d2:cafe::db) by SA0PR11CA0084.outlook.office365.com (2603:10b6:806:d2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.27 via Frontend Transport; Mon, 11 Nov 2024 06:40:55 +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 SN1PEPF00026368.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.14 via Frontend Transport; Mon, 11 Nov 2024 06:40:55 +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.1544.4; Sun, 10 Nov 2024 22:40:36 -0800 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.1544.4; Sun, 10 Nov 2024 22:40:34 -0800 From: Xueming Li To: Vladimir Medvedkin CC: , dpdk stable Subject: patch 'hash: fix thash LFSR initialization' has been queued to stable release 23.11.3 Date: Mon, 11 Nov 2024 14:28:40 +0800 Message-ID: <20241111062847.216344-115-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241111062847.216344-1-xuemingl@nvidia.com> References: <20241111062847.216344-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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026368:EE_|DM6PR12MB4451:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cb0dd32-4e1e-48a2-c61f-08dd021bcb5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?d0tL5Nfohd6X58o7bWMTkpfIEB+E60QRBOUMeM0cNPFjgax13mxTkvkKjOZn?= =?us-ascii?Q?0rEi/zwXmkh+Yr/rfMbIk7upsAw+vrrk1jglo/0C6nJ763K64U2vut8/d4uN?= =?us-ascii?Q?j2T92itxBrPinNenXNIA1pcQAz1AqkGCX6MB72OoNbF9ARkfhNK4YdEbGmcT?= =?us-ascii?Q?vcTBBctfOZNaXitjZKiQ5KHNP1B1D9rjexAlBhQywXetpEqvjvQyTxpoNiNH?= =?us-ascii?Q?+zJy9G3frxKYII6SpGIQxCmu1tG+lW+ATDwZjSkq3Gj9WoarEKfNHHYBvnzG?= =?us-ascii?Q?z+bifW6Vag+UDGrV7tshPDHFFK+oqzk3eNhBFTq+1sKfN3RapJtcvqPtBAPH?= =?us-ascii?Q?QjuGky7p97gPwtnvM20YPY/9kKkudXMpRV1/K7Vy4298pkhmKbTwrcNqIRQ4?= =?us-ascii?Q?yrIq/pqkrKRdoUXM6YqSQJ1FjK6QWA2GVLGnjH09cz7nKAxjZqHz4+AhNggW?= =?us-ascii?Q?SJH+at4yuXBiva172eIw+d7+AvTBPkZ+j9FDzxOfZv+U9EP82zPOtuXUM9bJ?= =?us-ascii?Q?6MXcrEx49NoX3CKxmAlVMi6cnifO/bBzYckA+hU2rBhckMpu2tCcmXz/tBUe?= =?us-ascii?Q?MxZe/Yty8RO0ThJO36QkMLodxHePUABGX2Tb8pe+NpT3Jrq01zrsoqjrS1RS?= =?us-ascii?Q?H8dCLoWDDIrOYMjtwUJ992Fj6qsflvKfM3zKnqWoITV7FZu5DjLoXOfTCX8I?= =?us-ascii?Q?f2JZ8BOsVh3fAGm6BAS2iGWMf+wPZSRSLoG93WOhP1gWgC+0PqaL1VVx81mx?= =?us-ascii?Q?eoRcRYNR/YuUJ4vqA+VX0kGp1miphAIE8VrwhiU5SJ+p3qCrP3yYZXP9vdRl?= =?us-ascii?Q?l5VMrw+TaGveANo1eKJNS9w9pZ3C/YrNddHC+MZbl5W5uW9QLfyHxjVDmhXH?= =?us-ascii?Q?X/xlRVThm81M1UF5dinJJ8I5hRCF7/9oqSwPiBzMgCIIWaAua/648rwfW7La?= =?us-ascii?Q?YqXcLPK47Gxf31vX7J7Kh5P6WFna7y77zE3stj9f18EjYt77yZXTorS+jcmF?= =?us-ascii?Q?G3vhU7qe7Dx/HiRrKaS2d0O1TbD5WR1ntCocrQo4dbtuDlmt5v5t3YAwuijr?= =?us-ascii?Q?MzHZRdan5SwF2BiaSXaENuBNRuxePBj2bi5rRHqU5c44SUvWSPQQA7Uwzbbt?= =?us-ascii?Q?lHWJSckpKs0rV51m8wBylx9uLvNpajHNj4qfugcaQoaYDoD71r9ZPnjG1s0q?= =?us-ascii?Q?eQy3VsVhWEgPzzIiPcKcNJecLGL/XUpJ3m3d+n9Zldj/6NUISyQi34G0RmFX?= =?us-ascii?Q?e8RBq1qt4rTi/EXiLWeExxJrw1iPvOkUvHv3AaV3vei1bDf3lBU41eIoNP1n?= =?us-ascii?Q?9VrXpdIT5Gj37cEUq+gUNGvI/jGLK7uRnf+pZj/OflD3StmBwhTlWaMgqhoC?= =?us-ascii?Q?AR8UaaYEGoevDSWDSkZ1u73/tySBesOezw1TSLFJ9cxqJVu07w=3D=3D?= 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:(13230040)(1800799024)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 06:40:55.4365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3cb0dd32-4e1e-48a2-c61f-08dd021bcb5d 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: SN1PEPF00026368.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4451 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.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/30/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=c6474cb613a54d7d2c073080c183ce70c9634ecd Thanks. Xueming Li --- >From c6474cb613a54d7d2c073080c183ce70c9634ecd Mon Sep 17 00:00:00 2001 From: Vladimir Medvedkin Date: Fri, 6 Sep 2024 17:01:41 +0000 Subject: [PATCH] hash: fix thash LFSR initialization Cc: Xueming Li [ upstream commit ebf7f1188ea83d6154746e90d535392113ecb1e8 ] Reverse polynomial for an LFSR was initialized improperly which could generate improper bit sequence in some situations. This patch implements proper polynomial reversing function. Fixes: 28ebff11c2dc ("hash: add predictable RSS") Signed-off-by: Vladimir Medvedkin --- lib/hash/rte_thash.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 4ff567ee5a..a952006686 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -160,6 +160,30 @@ thash_get_rand_poly(uint32_t poly_degree) RTE_DIM(irreducible_poly_table[poly_degree])]; } +static inline uint32_t +get_rev_poly(uint32_t poly, int degree) +{ + int i; + /* + * The implicit highest coefficient of the polynomial + * becomes the lowest after reversal. + */ + uint32_t rev_poly = 1; + uint32_t mask = (1 << degree) - 1; + + /* + * Here we assume "poly" argument is an irreducible polynomial, + * thus the lowest coefficient of the "poly" must always be equal to "1". + * After the reversal, this the lowest coefficient becomes the highest and + * it is omitted since the highest coefficient is implicitly determined by + * degree of the polynomial. + */ + for (i = 1; i < degree; i++) + rev_poly |= ((poly >> i) & 0x1) << (degree - i); + + return rev_poly & mask; +} + static struct thash_lfsr * alloc_lfsr(struct rte_thash_ctx *ctx) { @@ -179,7 +203,7 @@ alloc_lfsr(struct rte_thash_ctx *ctx) lfsr->state = rte_rand() & ((1 << lfsr->deg) - 1); } while (lfsr->state == 0); /* init reverse order polynomial */ - lfsr->rev_poly = (lfsr->poly >> 1) | (1 << (lfsr->deg - 1)); + lfsr->rev_poly = get_rev_poly(lfsr->poly, lfsr->deg); /* init proper rev_state*/ lfsr->rev_state = lfsr->state; for (i = 0; i <= lfsr->deg; i++) -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-11 14:23:10.434207333 +0800 +++ 0114-hash-fix-thash-LFSR-initialization.patch 2024-11-11 14:23:05.352192835 +0800 @@ -1 +1 @@ -From ebf7f1188ea83d6154746e90d535392113ecb1e8 Mon Sep 17 00:00:00 2001 +From c6474cb613a54d7d2c073080c183ce70c9634ecd Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit ebf7f1188ea83d6154746e90d535392113ecb1e8 ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -19 +21 @@ -index 10721effe6..99a685f0c8 100644 +index 4ff567ee5a..a952006686 100644 @@ -22 +24 @@ -@@ -166,6 +166,30 @@ thash_get_rand_poly(uint32_t poly_degree) +@@ -160,6 +160,30 @@ thash_get_rand_poly(uint32_t poly_degree) @@ -53 +55 @@ -@@ -185,7 +209,7 @@ alloc_lfsr(struct rte_thash_ctx *ctx) +@@ -179,7 +203,7 @@ alloc_lfsr(struct rte_thash_ctx *ctx)