Skip to contentSkip to conversation

doc: deprecation notice to add new hash function

PATCH In review Xueming Li 9 participants 23 messages May 24, 2023 – Oct 30, 2023 Network drivers

lore
Share & tools
lore

Xueming Li

author
#0 lore raw

PATCH 1/1 doc: deprecation notice to add new hash function

Deprecation notice to annouce new RSS hash function type. The new symmetric hash function sort L3 address and L4 ports before Toeplitz calculation.

---
 doc/guides/rel_notes/deprecation.rst | 4 ++++
 1 file changed, 4 insertions(+)
doc/guides/rel_notes/deprecation.rst +4 -0
index dcc1ca1696..fc988c3bfe 100644
@@ -163,3 +163,7 @@ Deprecation Notices
   The new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status
   starting with DPDK 23.07 release.
+
+* ethdev: The enum ``rte_eth_hash_function`` will be extended to add
+  new subtype value ``RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT`` in
+  DPDK 23.11.
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

Hi Xueming,

Quoted 25 lines

-----Original Message-----
From: Xueming(Steven) Li <[email protected]>
Sent: Wednesday, May 24, 2023 2:38 PM

Deprecation notice to annouce new RSS hash function type. The new symmetric hash function sort L3 address and L4 ports before Toeplitz calculation.

---
 doc/guides/rel_notes/deprecation.rst | 4 ++++
 1 file changed, 4 insertions(+)
doc/guides/rel_notes/deprecation.rst +3 -0
index dcc1ca1696..fc988c3bfe 100644
@@ -163,3 +163,7 @@ Deprecation Notices
   The new port library API (functions rte_swx_port_*)
   will gradually transition from experimental to stable status
   starting with DPDK 23.07 release.
+
+* ethdev: The enum ``rte_eth_hash_function`` will be extended to add
+  new subtype value
Quoted 4 lines

``RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT`` in
+ DPDK 23.11.
--
2.25.1

Best,
Ori

#2 lore raw
In reply to Xueming Li

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 169

Quoted 4 lines · On Wed, 24 May 2023 19:38:27 +0800 Xueming Li <[email protected]> wrote:
doc/guides/rel_notes/deprecation.rst +4 -0
+
+* ethdev: The enum ``rte_eth_hash_function`` will be extended to add
+  new subtype value ``RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT`` in
+  DPDK 23.11.

Simple new additions like this don't need to clutter the deprecation part of the release notes. This is for changes which would break applications.

#3 lore raw

24/05/2023 16:49, Stephen Hemminger:

Quoted 10 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 169

Quoted 4 lines · On Wed, 24 May 2023 19:38:27 +0800 Xueming Li <[email protected]> wrote:
doc/guides/rel_notes/deprecation.rst +4 -0
+
+* ethdev: The enum ``rte_eth_hash_function`` will be extended to add
+  new subtype value ``RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT`` in
+  DPDK 23.11.

Simple new additions like this don't need to clutter the deprecation part of the release notes. This is for changes which would break applications.

Marking this patch as superseded.
My patch is mentioning such case: adding an enum field.
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

author
#4 lore raw

PATCH 1/1 ethdev: add new symmetric hash function

In reply to Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
 lib/ethdev/rte_flow.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/ethdev/rte_flow.h +5 -0
index 86ed98c562..ec6dd170b5 100644
@@ -3204,6 +3204,11 @@ enum rte_eth_hash_function {
 	 * src or dst address will xor with zero pair.
 	 */
 	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: src, dst will be swapped
+	 * automatically by sorting.
+	 */
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
 	RTE_ETH_HASH_FUNCTION_MAX,
 };
 
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH] ethdev: add new symmetric hash function

In reply to Xueming Li

Hi,

Please see my notes below.

Quoted 13 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
lib/ethdev/rte_flow.h | 5 +++++

1 file changed, 5 insertions(+)
lib/ethdev/rte_flow.h +0 -0
index 86ed98c562..ec6dd170b5 100644

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3209

Quoted 6 lines
lib/ethdev/rte_flow.h +3 -0
@@ -3204,6 +3204,11 @@ enum rte_eth_hash_function {
 	 * src or dst address will xor with zero pair.
 	 */
 	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: src, dst will be swapped
+	 * automatically by sorting.

This is very vague. Consider:

For symmetric Toeplitz, four inputs are prepared as follows:
- src_addr | dst_addr
- src_addr ^ dst_addr
- src_port | dst_port
- src_port ^ dst_port
and then passed to the regular Toeplitz function.

It is important to be as specific as possible
so that readers don't have to guess.

Thank you.

Quoted 9 lines
lib/ethdev/rte_flow.h +2 -0
+	 */
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
 	RTE_ETH_HASH_FUNCTION_MAX,
 };
 
Signature · 1 line
2.25.1
#7 lore raw

Re: [PATCH] ethdev: add new symmetric hash function

Quoted 35 lines · Ivan Malov

Hi,

Please see my notes below.

Quoted 13 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
lib/ethdev/rte_flow.h | 5 +++++

1 file changed, 5 insertions(+)
lib/ethdev/rte_flow.h +0 -0
index 86ed98c562..ec6dd170b5 100644

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3209

Quoted 6 lines
lib/ethdev/rte_flow.h +3 -0
@@ -3204,6 +3204,11 @@ enum rte_eth_hash_function {
      * src or dst address will xor with zero pair.
      */
     RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+    /**
+     * Symmetric Toeplitz: src, dst will be swapped
+     * automatically by sorting.

This is very vague. Consider:

For symmetric Toeplitz, four inputs are prepared as follows:
- src_addr | dst_addr
- src_addr ^ dst_addr
- src_port | dst_port
- src_port ^ dst_port
and then passed to the regular Toeplitz function.

Quoted 2 lines

It is important to be as specific as possible
so that readers don't have to guess.

+1 for this, I try to understand and google it, but can't find useful info.

Also, how this new algo with src/dst only ?

Quoted 6 lines

Thank you.

Quoted 3 lines
lib/ethdev/rte_flow.h +2 -0
+     */
+    RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
     RTE_ETH_HASH_FUNCTION_MAX,

The new value will break the definition of MAX (maybe ABI compatible).
but I found only hns3 drivers use RTE_ETH_HASH_FUNCTION_MAX, not sure the application will use it.

Quoted 8 lines
Quoted 6 lines
lib/ethdev/rte_flow.h +0 -0
 };
 

--
2.25.1

.

#8 lore raw

RE: [PATCH] ethdev: add new symmetric hash function

Quoted 46 lines

-----Original Message-----
From: fengchengwen <[email protected]>
Sent: 8/8/2023 9:43
To: Ivan Malov <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: Ori Kam <[email protected]>; [email protected]
Subject: Re: [PATCH] ethdev: add new symmetric hash function

Quoted 35 lines · Ivan Malov

Hi,

Please see my notes below.

Quoted 13 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
lib/ethdev/rte_flow.h | 5 +++++

1 file changed, 5 insertions(+)
lib/ethdev/rte_flow.h index renamed from lib/ethdev/rte_flow.h +0 -0

86ed98c562..ec6dd170b5 100644

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3209

Quoted 6 lines
lib/ethdev/rte_flow.h +3 -0
@@ -3204,6 +3204,11 @@ enum rte_eth_hash_function {
      * src or dst address will xor with zero pair.
      */
     RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+    /**
+     * Symmetric Toeplitz: src, dst will be swapped
+     * automatically by sorting.

This is very vague. Consider:

For symmetric Toeplitz, four inputs are prepared as follows:
- src_addr | dst_addr
- src_addr ^ dst_addr
- src_port | dst_port
- src_port ^ dst_port
and then passed to the regular Toeplitz function.

Quoted 7 lines
Quoted 2 lines

It is important to be as specific as possible so that readers don't have to guess.

+1 for this, I try to understand and google it, but can't find useful info.

Also, how this new algo with src/dst only ?

Thanks for taking care of this.
When set the L3 and the L4 fields are sorted prior to the hash function.
If src_ip > dst_ip, swap src_ip and dst_ip.
If src_port > dst_port, swap src_port and dst_port.

Quoted 19 lines
Quoted 6 lines

Thank you.

Quoted 3 lines
lib/ethdev/rte_flow.h +2 -0
+     */
+    RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
     RTE_ETH_HASH_FUNCTION_MAX,

The new value will break the definition of MAX (maybe ABI compatible). but I found only hns3 drivers use RTE_ETH_HASH_FUNCTION_MAX, not sure the application will use it.

Quoted 8 lines
Quoted 6 lines
lib/ethdev/rte_flow.h +0 -1
 };
 
--

2.25.1

.

author
#9 lore raw

PATCH v2 1/2 ethdev: add new symmetric hash function

In reply to Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
 lib/ethdev/rte_flow.h | 7 +++++++
 1 file changed, 7 insertions(+)
lib/ethdev/rte_flow.h +7 -0
index 2ebb76dbc0..4f4421ca50 100644
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
 	 * src or dst address will xor with zero pair.
 	 */
 	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
 	RTE_ETH_HASH_FUNCTION_MAX,
 };
 
Signature · 1 line
2.25.1
Acked-by on v2 1/2
#10 lore raw

RE: [PATCH v2 1/2] ethdev: add new symmetric hash function

Hi Xueming,

Quoted 31 lines

-----Original Message-----
From: Xueming(Steven) Li <[email protected]>
Sent: Sunday, August 27, 2023 11:18 AM

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
 lib/ethdev/rte_flow.h | 7 +++++++
 1 file changed, 7 insertions(+)
lib/ethdev/rte_flow.h +7 -1
index 2ebb76dbc0..4f4421ca50 100644
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
 	 * src or dst address will xor with zero pair.
 	 */
 	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
 	RTE_ETH_HASH_FUNCTION_MAX,
 };
 
--
Quoted 1 line

2.25.1

Best,
Ori

Acked-by Applied
#11 lore raw

Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 11 lines · Ori Kam
Quoted 8 lines

-----Original Message-----
From: Xueming(Steven) Li <[email protected]>
Sent: Sunday, August 27, 2023 11:18 AM

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

Updated commit log with information provided in this mail thread.

Applied to dpdk-next-net/main, thanks.

Note only ethdev patch applied, not series, mlx5 patch delegated to Raslan.

#12 lore raw

RE: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 16 lines

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: 9/21/2023 23:50
To: Ori Kam <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>; Raslan Darawsheh <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 7 lines · Ori Kam
Quoted 7 lines

-----Original Message-----
From: Xueming(Steven) Li <[email protected]>
Sent: Sunday, August 27, 2023 11:18 AM

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Updated commit log with information provided in this mail thread.

Thanks very much!

Quoted 5 lines

Applied to dpdk-next-net/main, thanks.

Note only ethdev patch applied, not series, mlx5 patch delegated to Raslan.

#13 lore raw

Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

In reply to Xueming Li

Hi Xueming,

Quoted 13 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
  lib/ethdev/rte_flow.h | 7 +++++++
  1 file changed, 7 insertions(+)
lib/ethdev/rte_flow.h +0 -0
index 2ebb76dbc0..4f4421ca50 100644

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3204

Quoted 9 lines
lib/ethdev/rte_flow.h +6 -0
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
  	 * src or dst address will xor with zero pair.
  	 */
  	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */

If hash result are computed by the order: "src_ip+dst_ip+src_port+dst_port" How to obtain the value of every L3 and L4 field obove?
I still cannot understand how to swap and set these values for these fields?

Quoted 4 lines
lib/ethdev/rte_flow.h +1 -0
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
  	RTE_ETH_HASH_FUNCTION_MAX,
  };
 
#14 lore raw

RE: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 30 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 15:51
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Hi Xueming,

Quoted 17 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
  lib/ethdev/rte_flow.h | 7 +++++++
  1 file changed, 7 insertions(+)
lib/ethdev/rte_flow.h index renamed from lib/ethdev/rte_flow.h +0 -0

2ebb76dbc0..4f4421ca50 100644

lib/ethdev/rte_flow.h +1 -0
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
  	 * src or dst address will xor with zero pair.
  	 */
  	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
Quoted 8 lines

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3204

Quoted 5 lines
lib/ethdev/rte_flow.h +5 -0
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */

If hash result are computed by the order: "src_ip+dst_ip+src_port+dst_port" How to obtain the value of every L3 and L4 field obove?
I still cannot understand how to swap and set these values for these fields?

Hash result is computed by order ""src_ip+dst_ip+src_port+dst_port" Here is a detailed explanation of standard hash and symmetric hash by key:
https://www.ndsl.kaist.edu/~kyoungsoo/papers/TR-symRSS.pdf

If src_ip > dst_ip, swap them, then the input becomes:
"dst_ip+src_ip+src_port+dst_port" // please note src and dst IP are swapped.
Same for L4 ports.

Quoted 4 lines
Quoted 4 lines
lib/ethdev/rte_flow.h +1 -0
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
  	RTE_ETH_HASH_FUNCTION_MAX,
  };
 
#15 lore raw

Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 37 lines · Xueming(Steven) Li
Quoted 29 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 15:51
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Hi Xueming,

Quoted 17 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
   lib/ethdev/rte_flow.h | 7 +++++++
   1 file changed, 7 insertions(+)
lib/ethdev/rte_flow.h index renamed from lib/ethdev/rte_flow.h +0 -0

2ebb76dbc0..4f4421ca50 100644

lib/ethdev/rte_flow.h +1 -0
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
   	 * src or dst address will xor with zero pair.
   	 */
   	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
Quoted 8 lines

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3204

Quoted 5 lines
lib/ethdev/rte_flow.h +5 -0
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */

If hash result are computed by the order: "src_ip+dst_ip+src_port+dst_port" How to obtain the value of every L3 and L4 field obove?
I still cannot understand how to swap and set these values for these fields?

Quoted 7 lines

Hash result is computed by order ""src_ip+dst_ip+src_port+dst_port" Here is a detailed explanation of standard hash and symmetric hash by key:
https://www.ndsl.kaist.edu/~kyoungsoo/papers/TR-symRSS.pdf

If src_ip > dst_ip, swap them, then the input becomes:
"dst_ip+src_ip+src_port+dst_port" // please note src and dst IP are swapped.
Same for L4 ports.

get it.
What are the advantages of the symmetric toeplitz sort? Or why swap here?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
lib/ethdev/rte_flow.h +1 -0
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
   	RTE_ETH_HASH_FUNCTION_MAX,
   };
 
#16 lore raw

RE: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 55 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 20:42
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 21 lines · Xueming(Steven) Li
Quoted 21 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 15:51
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Hi Xueming,

Quoted 8 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
   lib/ethdev/rte_flow.h | 7 +++++++
   1 file changed, 7 insertions(+)
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
lib/ethdev/rte_flow.h index renamed from lib/ethdev/rte_flow.h +0 -0

2ebb76dbc0..4f4421ca50 100644

lib/ethdev/rte_flow.h +0 -0
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
   	 * src or dst address will xor with zero pair.
   	 */
Quoted 8 lines

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3204

Quoted 7 lines
lib/ethdev/rte_flow.h +6 -0
   	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */

If hash result are computed by the order:

"src_ip+dst_ip+src_port+dst_port"

Quoted 6 lines
Quoted 2 lines

How to obtain the value of every L3 and L4 field obove?
I still cannot understand how to swap and set these values for these fields?

Hash result is computed by order ""src_ip+dst_ip+src_port+dst_port" Here is a detailed explanation of standard hash and symmetric hash by key:
https://www.ndsl.kaist.edu/~kyoungsoo/papers/TR-symRSS.pdf

Quoted 7 lines
Quoted 2 lines

If src_ip > dst_ip, swap them, then the input becomes:
"dst_ip+src_ip+src_port+dst_port" // please note src and dst IP are

swapped.

Quoted 1 line

Same for L4 ports.

get it.
What are the advantages of the symmetric toeplitz sort? Or why swap here?

It's a different symmetric hash calculation, hardware can support either/all of them.

From calculation perspective, the hash result distribution is better, the result is more suitable to be used as hash table key.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
lib/ethdev/rte_flow.h +1 -0
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
   	RTE_ETH_HASH_FUNCTION_MAX,
   };
 
#17 lore raw

Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 56 lines · Xueming(Steven) Li
Quoted 56 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 20:42
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 20 lines · Xueming(Steven) Li
Quoted 20 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 15:51
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Hi Xueming,

Quoted 8 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
    lib/ethdev/rte_flow.h | 7 +++++++
    1 file changed, 7 insertions(+)
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
lib/ethdev/rte_flow.h index renamed from lib/ethdev/rte_flow.h +0 -0

2ebb76dbc0..4f4421ca50 100644

lib/ethdev/rte_flow.h +0 -0
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
    	 * src or dst address will xor with zero pair.
    	 */
Quoted 8 lines

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3204

Quoted 7 lines
lib/ethdev/rte_flow.h +6 -0
    	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */

If hash result are computed by the order:

"src_ip+dst_ip+src_port+dst_port"

Quoted 8 lines
Quoted 2 lines

How to obtain the value of every L3 and L4 field obove?
I still cannot understand how to swap and set these values for these fields?

Hash result is computed by order ""src_ip+dst_ip+src_port+dst_port" Here is a detailed explanation of standard hash and symmetric hash by key:
https://www.ndsl.kaist.edu/~kyoungsoo/papers/TR-symRSS.pdf

If src_ip > dst_ip, swap them, then the input becomes:
"dst_ip+src_ip+src_port+dst_port" // please note src and dst IP are

swapped.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Same for L4 ports.

get it.
What are the advantages of the symmetric toeplitz sort? Or why swap here?

It's a different symmetric hash calculation, hardware can support either/all of them.

From calculation perspective, the hash result distribution is better, the result is more
suitable to be used as hash table key.

I get it now.
but I have a question.
why not is that if src_ip < dst_ip, then swap src_ip and dst_ip?
I guess this is going to have the same effect as you said, right?
The symmetric toeplitz sort is not a standard algorithm, is just to enhance the hash result distribution. If what I understand is right,
it is better that the new RSS algorithm should works on the one of them ("src_ip > dst_ip" or "src_ip < dst_ip").

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
lib/ethdev/rte_flow.h +1 -0
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
    	RTE_ETH_HASH_FUNCTION_MAX,
    };
 
#18 lore raw

RE: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 81 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/31/2023 9:24
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 47 lines · Xueming(Steven) Li
Quoted 47 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 20:42
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 35 lines · Xueming(Steven) Li
Quoted 35 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 15:51
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Hi Xueming,

Quoted 13 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
    lib/ethdev/rte_flow.h | 7 +++++++
    1 file changed, 7 insertions(+)
lib/ethdev/rte_flow.h index renamed from lib/ethdev/rte_flow.h +0 -0

2ebb76dbc0..4f4421ca50 100644

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3204

Quoted 9 lines
lib/ethdev/rte_flow.h +6 -0
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
    	 * src or dst address will xor with zero pair.
    	 */
    	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */

If hash result are computed by the order:

Quoted 3 lines
Quoted 3 lines

"src_ip+dst_ip+src_port+dst_port"

Quoted 2 lines
Quoted 2 lines

How to obtain the value of every L3 and L4 field obove?
I still cannot understand how to swap and set these values for these

fields?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Hash result is computed by order ""src_ip+dst_ip+src_port+dst_port" Here is a detailed explanation of standard hash and symmetric hash by

key:

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

https://www.ndsl.kaist.edu/~kyoungsoo/papers/TR-symRSS.pdf

If src_ip > dst_ip, swap them, then the input becomes:
"dst_ip+src_ip+src_port+dst_port" // please note src and dst IP
are

swapped.

Quoted 1 line

Same for L4 ports.

get it.
What are the advantages of the symmetric toeplitz sort? Or why swap here?

It's a different symmetric hash calculation, hardware can support either/all

of them.

Quoted 3 lines

From calculation perspective, the hash result distribution is better,
the result is more suitable to be used as hash table key.

Quoted 9 lines

I get it now.
but I have a question.
why not is that if src_ip < dst_ip, then swap src_ip and dst_ip?
I guess this is going to have the same effect as you said, right? The symmetric toeplitz sort is not a standard algorithm, is just to enhance the hash result distribution.
If what I understand is right,
it is better that the new RSS algorithm should works on the one of them ("src_ip > dst_ip" or "src_ip < dst_ip").

Any special reason to introduce the descending sort?
I personally prefer to keep the enum clean unless some new hw or new algorithm introduced.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
lib/ethdev/rte_flow.h +1 -0
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
    	RTE_ETH_HASH_FUNCTION_MAX,
    };
 
#19 lore raw

Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 87 lines · Xueming(Steven) Li
Quoted 78 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/31/2023 9:24
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 46 lines · Xueming(Steven) Li
Quoted 46 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 20:42
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Quoted 35 lines · Xueming(Steven) Li
Quoted 35 lines

-----Original Message-----
From: lihuisong (C) <[email protected]>
Sent: 8/30/2023 15:51
To: Xueming(Steven) Li <[email protected]>; Ori Kam <[email protected]>
Cc: [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function

Hi Xueming,

Quoted 13 lines · Xueming Li

The new symmetric hash function swap src/dst L3 address and L4 ports automatically by sorting.

---
     lib/ethdev/rte_flow.h | 7 +++++++
     1 file changed, 7 insertions(+)
lib/ethdev/rte_flow.h index renamed from lib/ethdev/rte_flow.h +0 -0

2ebb76dbc0..4f4421ca50 100644

lib/ethdev/rte_flow.h enum rte_eth_hash_function { · line 3204

Quoted 9 lines
lib/ethdev/rte_flow.h +6 -0
@@ -3196,6 +3196,13 @@ enum rte_eth_hash_function {
     	 * src or dst address will xor with zero pair.
     	 */
     	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
+	/**
+	 * Symmetric Toeplitz: L3 and L4 fields are sorted prior to
+	 * the hash function.
+	 *  If src_ip > dst_ip, swap src_ip and dst_ip.
+	 *  If src_port > dst_port, swap src_port and dst_port.
+	 */

If hash result are computed by the order:

Quoted 3 lines
Quoted 3 lines

"src_ip+dst_ip+src_port+dst_port"

Quoted 2 lines
Quoted 2 lines

How to obtain the value of every L3 and L4 field obove?
I still cannot understand how to swap and set these values for these

fields?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Hash result is computed by order ""src_ip+dst_ip+src_port+dst_port" Here is a detailed explanation of standard hash and symmetric hash by

key:

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

https://www.ndsl.kaist.edu/~kyoungsoo/papers/TR-symRSS.pdf

If src_ip > dst_ip, swap them, then the input becomes:
"dst_ip+src_ip+src_port+dst_port" // please note src and dst IP
are

swapped.

Quoted 1 line

Same for L4 ports.

get it.
What are the advantages of the symmetric toeplitz sort? Or why swap here?

It's a different symmetric hash calculation, hardware can support either/all

of them.

Quoted 2 lines

From calculation perspective, the hash result distribution is better,
the result is more suitable to be used as hash table key.

Quoted 9 lines

I get it now.
but I have a question.
why not is that if src_ip < dst_ip, then swap src_ip and dst_ip?
I guess this is going to have the same effect as you said, right? The symmetric toeplitz sort is not a standard algorithm, is just to enhance the hash result distribution.
If what I understand is right,
it is better that the new RSS algorithm should works on the one of them ("src_ip > dst_ip" or "src_ip < dst_ip").

Quoted 1 line

Any special reason to introduce the descending sort?

Because the descending sort also can achieve the goal. After all, this doesn't seem like a standard algorithm.

Quoted 1 line

I personally prefer to keep the enum clean unless some new hw or new algorithm introduced.

Agree with you. But this new enum cannot reveal ascending or descending sort.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
lib/ethdev/rte_flow.h +1 -0
+	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
     	RTE_ETH_HASH_FUNCTION_MAX,
     };
 
author
#20 lore raw

PATCH v2 2/2 net/mlx5: support new RSS symmetric hash function

In reply to Xueming Li

This patch supports the new RSS symmetric hash function:
RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT

The new hash function makes symmetric hash result by swapping the source and destination IP and L4 port automatically.

---
 drivers/net/mlx5/mlx5_flow.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow.h +2 -2
index 3a97975d69..e162baa7da 100644
@@ -1456,8 +1456,8 @@ struct rte_flow_template_table {
 #define MLX5_RSS_HASH_NONE 0ULL
 
 #define MLX5_RSS_IS_SYMM(func) \
-		((func) == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ)
-
+		(((func) == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) || \
+		 ((func) == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT))
 
 /* extract next protocol type from Ethernet & VLAN headers */
 #define MLX5_ETHER_TYPE_FROM_HEADER(_s, _m, _itm, _prt) do { \
Signature · 1 line
2.25.1
Acked-by on v2 2/2
#21 lore raw

RE: [PATCH v2 2/2] net/mlx5: support new RSS symmetric hash function

Quoted 6 lines

-----Original Message-----
From: Xueming(Steven) Li <[email protected]>
Sent: Sunday, August 27, 2023 11:18 AM

Quoted 8 lines

This patch supports the new RSS symmetric hash function:
RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT

The new hash function makes symmetric hash result by swapping the source and destination IP and L4 port automatically.

---

Best,
Ori

#22 lore raw

RE: [PATCH v2 2/2] net/mlx5: support new RSS symmetric hash function

In reply to Xueming Li

Hi,

Quoted 8 lines

-----Original Message-----
From: Xueming Li <[email protected]>
Sent: Sunday, August 27, 2023 11:18 AM
To: Ori Kam <[email protected]>
Cc: Xueming(Steven) Li <[email protected]>; [email protected]; [email protected]; Ivan Malov <[email protected]>
Subject: [PATCH v2 2/2] net/mlx5: support new RSS symmetric hash function

Quoted 7 lines

This patch supports the new RSS symmetric hash function:
RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT

The new hash function makes symmetric hash result by swapping the source and destination IP and L4 port automatically.

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh