patch 'hash: fix reading unaligned bits in Toeplitz hash' has been queued to stable release 22.11.3

Xueming Li xuemingl at nvidia.com
Thu Aug 10 01:58:36 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.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 08/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/commit/?h=22.11-staging&id=1db71d413ef0fc45a8acdd06bca3268ac51d18a5

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 1db71d413ef0fc45a8acdd06bca3268ac51d18a5 Mon Sep 17 00:00:00 2001
From: Vladimir Medvedkin <vladimir.medvedkin at intel.com>
Date: Fri, 30 Jun 2023 17:09:26 +0000
Subject: [PATCH] hash: fix reading unaligned bits in Toeplitz hash
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 3a54f8de715c29613cf3d34ce3910d2bd27bffb9 ]

Fixes: 28ebff11c2dc ("hash: add predictable RSS")

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin at intel.com>
Acked-by: Konstantin Ananyev <konstantin.v.ananyev at yandex.ru>
---
 lib/hash/rte_thash.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 0249883b8d..2228af576b 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -670,7 +670,7 @@ rte_thash_get_gfni_matrices(struct rte_thash_ctx *ctx)
 }
 
 static inline uint8_t
-read_unaligned_byte(uint8_t *ptr, unsigned int len, unsigned int offset)
+read_unaligned_byte(uint8_t *ptr, unsigned int offset)
 {
 	uint8_t ret = 0;
 
@@ -681,13 +681,14 @@ read_unaligned_byte(uint8_t *ptr, unsigned int len, unsigned int offset)
 			(CHAR_BIT - (offset % CHAR_BIT));
 	}
 
-	return ret >> (CHAR_BIT - len);
+	return ret;
 }
 
 static inline uint32_t
 read_unaligned_bits(uint8_t *ptr, int len, int offset)
 {
 	uint32_t ret = 0;
+	int shift;
 
 	len = RTE_MAX(len, 0);
 	len = RTE_MIN(len, (int)(sizeof(uint32_t) * CHAR_BIT));
@@ -695,13 +696,14 @@ read_unaligned_bits(uint8_t *ptr, int len, int offset)
 	while (len > 0) {
 		ret <<= CHAR_BIT;
 
-		ret |= read_unaligned_byte(ptr, RTE_MIN(len, CHAR_BIT),
-			offset);
+		ret |= read_unaligned_byte(ptr, offset);
 		offset += CHAR_BIT;
 		len -= CHAR_BIT;
 	}
 
-	return ret;
+	shift = (len == 0) ? 0 :
+		(CHAR_BIT - ((len + CHAR_BIT) % CHAR_BIT));
+	return ret >> shift;
 }
 
 /* returns mask for len bits with given offset inside byte */
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-08-09 21:51:19.649886200 +0800
+++ 0057-hash-fix-reading-unaligned-bits-in-Toeplitz-hash.patch	2023-08-09 21:51:18.204352000 +0800
@@ -1 +1 @@
-From 3a54f8de715c29613cf3d34ce3910d2bd27bffb9 Mon Sep 17 00:00:00 2001
+From 1db71d413ef0fc45a8acdd06bca3268ac51d18a5 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 3a54f8de715c29613cf3d34ce3910d2bd27bffb9 ]
@@ -7 +9,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list