[dpdk-stable] patch 'table: fix hash for 32-bit' has been queued to stable release 19.11.6

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Oct 28 11:44:59 CET 2020


Hi,

FYI, your patch has been queued to stable release 19.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/30/20. 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.

Thanks.

Luca Boccassi

---
>From e4510620eb2e0bca82bba9c95f424fc0ad4934a7 Mon Sep 17 00:00:00 2001
From: Ting Xu <ting.xu at intel.com>
Date: Wed, 22 Jul 2020 10:16:28 +0800
Subject: [PATCH] table: fix hash for 32-bit

[ upstream commit 99541c3028d741a09fe5dca95e79d8d020130173 ]

When create softnic hash table with 16 keys, it failed on 32-bit
environment, because the pointer field in structure rte_bucket_4_16
is only 32 bits. Add a padding field in 32-bit environment to keep
the structure to a multiple of 64 bytes. Apply this to 8-byte and
32-byte key hash function as well.

Fixes: 8aa327214c ("table: hash")

Signed-off-by: Ting Xu <ting.xu at intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
---
 lib/librte_table/rte_table_hash_key16.c | 17 +++++++++++++++++
 lib/librte_table/rte_table_hash_key32.c | 17 +++++++++++++++++
 lib/librte_table/rte_table_hash_key8.c  | 16 ++++++++++++++++
 3 files changed, 50 insertions(+)

diff --git a/lib/librte_table/rte_table_hash_key16.c b/lib/librte_table/rte_table_hash_key16.c
index 2cca1c924a..c4384b114d 100644
--- a/lib/librte_table/rte_table_hash_key16.c
+++ b/lib/librte_table/rte_table_hash_key16.c
@@ -33,6 +33,7 @@
 
 #endif
 
+#ifdef RTE_ARCH_64
 struct rte_bucket_4_16 {
 	/* Cache line 0 */
 	uint64_t signature[4 + 1];
@@ -46,6 +47,22 @@ struct rte_bucket_4_16 {
 	/* Cache line 2 */
 	uint8_t data[0];
 };
+#else
+struct rte_bucket_4_16 {
+	/* Cache line 0 */
+	uint64_t signature[4 + 1];
+	uint64_t lru_list;
+	struct rte_bucket_4_16 *next;
+	uint32_t pad;
+	uint64_t next_valid;
+
+	/* Cache line 1 */
+	uint64_t key[4][2];
+
+	/* Cache line 2 */
+	uint8_t data[0];
+};
+#endif
 
 struct rte_table_hash {
 	struct rte_table_stats stats;
diff --git a/lib/librte_table/rte_table_hash_key32.c b/lib/librte_table/rte_table_hash_key32.c
index a137c50284..3e0031fe1e 100644
--- a/lib/librte_table/rte_table_hash_key32.c
+++ b/lib/librte_table/rte_table_hash_key32.c
@@ -33,6 +33,7 @@
 
 #endif
 
+#ifdef RTE_ARCH_64
 struct rte_bucket_4_32 {
 	/* Cache line 0 */
 	uint64_t signature[4 + 1];
@@ -46,6 +47,22 @@ struct rte_bucket_4_32 {
 	/* Cache line 3 */
 	uint8_t data[0];
 };
+#else
+struct rte_bucket_4_32 {
+	/* Cache line 0 */
+	uint64_t signature[4 + 1];
+	uint64_t lru_list;
+	struct rte_bucket_4_32 *next;
+	uint32_t pad;
+	uint64_t next_valid;
+
+	/* Cache lines 1 and 2 */
+	uint64_t key[4][4];
+
+	/* Cache line 3 */
+	uint8_t data[0];
+};
+#endif
 
 struct rte_table_hash {
 	struct rte_table_stats stats;
diff --git a/lib/librte_table/rte_table_hash_key8.c b/lib/librte_table/rte_table_hash_key8.c
index 1811ad8d05..34e3ed1af9 100644
--- a/lib/librte_table/rte_table_hash_key8.c
+++ b/lib/librte_table/rte_table_hash_key8.c
@@ -31,6 +31,7 @@
 
 #endif
 
+#ifdef RTE_ARCH_64
 struct rte_bucket_4_8 {
 	/* Cache line 0 */
 	uint64_t signature;
@@ -43,6 +44,21 @@ struct rte_bucket_4_8 {
 	/* Cache line 1 */
 	uint8_t data[0];
 };
+#else
+struct rte_bucket_4_8 {
+	/* Cache line 0 */
+	uint64_t signature;
+	uint64_t lru_list;
+	struct rte_bucket_4_8 *next;
+	uint32_t pad;
+	uint64_t next_valid;
+
+	uint64_t key[4];
+
+	/* Cache line 1 */
+	uint8_t data[0];
+};
+#endif
 
 struct rte_table_hash {
 	struct rte_table_stats stats;
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-10-28 10:35:16.082325914 +0000
+++ 0140-table-fix-hash-for-32-bit.patch	2020-10-28 10:35:11.712833086 +0000
@@ -1,8 +1,10 @@
-From 99541c3028d741a09fe5dca95e79d8d020130173 Mon Sep 17 00:00:00 2001
+From e4510620eb2e0bca82bba9c95f424fc0ad4934a7 Mon Sep 17 00:00:00 2001
 From: Ting Xu <ting.xu at intel.com>
 Date: Wed, 22 Jul 2020 10:16:28 +0800
 Subject: [PATCH] table: fix hash for 32-bit
 
+[ upstream commit 99541c3028d741a09fe5dca95e79d8d020130173 ]
+
 When create softnic hash table with 16 keys, it failed on 32-bit
 environment, because the pointer field in structure rte_bucket_4_16
 is only 32 bits. Add a padding field in 32-bit environment to keep
@@ -10,7 +12,6 @@
 32-byte key hash function as well.
 
 Fixes: 8aa327214c ("table: hash")
-Cc: stable at dpdk.org
 
 Signed-off-by: Ting Xu <ting.xu at intel.com>
 Acked-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>


More information about the stable mailing list