patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v2 1/2] hash: fix reading unaligned bits implementation
       [not found] <20230628191219.78753-1-vladimir.medvedkin@intel.com>
@ 2023-06-30 17:09 ` Vladimir Medvedkin
  2023-07-06 14:49   ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Medvedkin @ 2023-06-30 17:09 UTC (permalink / raw)
  To: dev; +Cc: konstantin.v.ananyev, stable

Fixes: 28ebff11c2dc ("hash: add predictable RSS")
Cc: stable@dpdk.org

Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Tested-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/2] hash: fix reading unaligned bits implementation
  2023-06-30 17:09 ` [PATCH v2 1/2] hash: fix reading unaligned bits implementation Vladimir Medvedkin
@ 2023-07-06 14:49   ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2023-07-06 14:49 UTC (permalink / raw)
  To: Vladimir Medvedkin
  Cc: dev, konstantin.v.ananyev, stable, david.marchand, john.mcnamara

30/06/2023 19:09, Vladimir Medvedkin:
> Fixes: 28ebff11c2dc ("hash: add predictable RSS")
> Cc: stable@dpdk.org
> 
> Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> Tested-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

I've just merged another patch from you where the explanation is useless.
Here there is no explanation at all.
The tags are in the wrong order, and there is a checkpatch warning.

I apply this series, considering they are not big issues in this case,
but please consider this is the very last time.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-06 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230628191219.78753-1-vladimir.medvedkin@intel.com>
2023-06-30 17:09 ` [PATCH v2 1/2] hash: fix reading unaligned bits implementation Vladimir Medvedkin
2023-07-06 14:49   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).