From: Ting Xu <ting.xu@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com, Ting Xu <ting.xu@intel.com>,
stable@dpdk.org
Subject: [dpdk-stable] [PATCH v4] lib/table: fix cache alignment issue
Date: Wed, 22 Jul 2020 10:16:28 +0800 [thread overview]
Message-ID: <20200722021628.17194-1-ting.xu@intel.com> (raw)
In-Reply-To: <20200616162705.83575-1-ting.xu@intel.com>
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")
Cc: stable@dpdk.org
Signed-off-by: Ting Xu <ting.xu@intel.com>
---
v3->v4: Change design based on comment
v2->v3: Rebase
v1->v2: Correct patch time
---
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 2cca1c924..c4384b114 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 a137c5028..3e0031fe1 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 1811ad8d0..34e3ed1af 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.17.1
next prev parent reply other threads:[~2020-07-22 2:12 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 16:27 [dpdk-stable] [PATCH v1] " Ting Xu
2020-06-17 5:43 ` [dpdk-stable] [PATCH v2] " Ting Xu
2020-07-02 8:06 ` [dpdk-stable] [dpdk-dev] " Zhou, JunX W
2020-07-09 1:48 ` [dpdk-stable] [PATCH v3] " Ting Xu
2020-07-20 14:37 ` Dumitrescu, Cristian
2020-07-21 5:15 ` Xu, Ting
2020-07-21 21:16 ` Dumitrescu, Cristian
2020-07-22 2:16 ` Xu, Ting
2020-07-22 2:16 ` Ting Xu [this message]
2020-07-22 8:26 ` [dpdk-stable] [PATCH v4] " Dumitrescu, Cristian
2020-07-22 8:30 ` Xu, Ting
2020-07-22 8:49 ` Dumitrescu, Cristian
2020-07-22 8:48 ` Dumitrescu, Cristian
2020-07-29 12:01 ` [dpdk-stable] [dpdk-dev] " David Marchand
2020-07-29 13:13 ` Dumitrescu, Cristian
2020-07-29 13:28 ` David Marchand
2020-07-29 13:54 ` Dumitrescu, Cristian
2020-07-29 13:59 ` David Marchand
2020-07-29 14:53 ` Dumitrescu, Cristian
2020-07-30 6:57 ` Xu, Ting
2020-07-30 10:35 ` Kevin Traynor
2020-09-09 6:18 ` Xu, Ting
2020-09-15 8:03 ` David Marchand
2020-10-14 8:26 ` Xu, Ting
2020-10-14 13:53 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200722021628.17194-1-ting.xu@intel.com \
--to=ting.xu@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).