ethdev: add new symmetric hash function

Message ID 20230807115456.17478-1-xuemingl@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: add new symmetric hash function |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Xueming Li Aug. 7, 2023, 11:54 a.m. UTC
  The new symmetric hash function swap src/dst L3 address and
L4 ports automatically by sorting.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 lib/ethdev/rte_flow.h | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Ori Kam Aug. 7, 2023, 12:33 p.m. UTC | #1
Hi Xueming,


> -----Original Message-----
> From: Xueming(Steven) Li <xuemingl@nvidia.com>
> Sent: Monday, August 7, 2023 2:55 PM
> 
> The new symmetric hash function swap src/dst L3 address and
> L4 ports automatically by sorting.
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
  
Ivan Malov Aug. 7, 2023, 10:32 p.m. UTC | #2
Hi,

Please see my notes below.

On Mon, 7 Aug 2023, Xueming Li wrote:

> The new symmetric hash function swap src/dst L3 address and
> L4 ports automatically by sorting.
>
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
> lib/ethdev/rte_flow.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
> index 86ed98c562..ec6dd170b5 100644
> --- a/lib/ethdev/rte_flow.h
> +++ b/lib/ethdev/rte_flow.h
> @@ -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.

> +	 */
> +	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
> 	RTE_ETH_HASH_FUNCTION_MAX,
> };
>
> -- 
> 2.25.1
>
>
  
fengchengwen Aug. 8, 2023, 1:43 a.m. UTC | #3
On 2023/8/8 6:32, Ivan Malov wrote:
> Hi,
> 
> Please see my notes below.
> 
> On Mon, 7 Aug 2023, Xueming Li wrote:
> 
>> The new symmetric hash function swap src/dst L3 address and
>> L4 ports automatically by sorting.
>>
>> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
>> ---
>> lib/ethdev/rte_flow.h | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
>> index 86ed98c562..ec6dd170b5 100644
>> --- a/lib/ethdev/rte_flow.h
>> +++ b/lib/ethdev/rte_flow.h
>> @@ -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.

+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 ?

> 
> Thank you.
> 
>> +     */
>> +    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.

>> };
>>
>> -- 
>> 2.25.1
>>
>>
> 
> .
  
Xueming Li Aug. 9, 2023, noon UTC | #4
> -----Original Message-----
> From: fengchengwen <fengchengwen@huawei.com>
> Sent: 8/8/2023 9:43
> To: Ivan Malov <ivan.malov@arknetworks.am>; Xueming(Steven) Li
> <xuemingl@nvidia.com>
> Cc: Ori Kam <orika@nvidia.com>; dev@dpdk.org
> Subject: Re: [PATCH] ethdev: add new symmetric hash function
> 
> On 2023/8/8 6:32, Ivan Malov wrote:
> > Hi,
> >
> > Please see my notes below.
> >
> > On Mon, 7 Aug 2023, Xueming Li wrote:
> >
> >> The new symmetric hash function swap src/dst L3 address and
> >> L4 ports automatically by sorting.
> >>
> >> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> >> ---
> >> lib/ethdev/rte_flow.h | 5 +++++
> >> 1 file changed, 5 insertions(+)
> >>
> >> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index
> >> 86ed98c562..ec6dd170b5 100644
> >> --- a/lib/ethdev/rte_flow.h
> >> +++ b/lib/ethdev/rte_flow.h
> >> @@ -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.
> 
> +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.

> >
> > Thank you.
> >
> >> +     */
> >> +    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.
> 
> >> };
> >>
> >> --
> >> 2.25.1
> >>
> >>
> >
> > .
  

Patch

diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 86ed98c562..ec6dd170b5 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -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,
 };