DPDK patches and discussions
 help / color / mirror / Atom feed
From: "lihuisong (C)" <lihuisong@huawei.com>
To: "Xueming(Steven) Li" <xuemingl@nvidia.com>, Ori Kam <orika@nvidia.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"fengchengwen@huawei.com" <fengchengwen@huawei.com>,
	Ivan Malov <ivan.malov@arknetworks.am>
Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function
Date: Thu, 31 Aug 2023 19:29:46 +0800	[thread overview]
Message-ID: <debb1121-dc52-545b-66ab-e408336ea449@huawei.com> (raw)
In-Reply-To: <DM4PR12MB5373F44C963F2E8B56636A7AA1E5A@DM4PR12MB5373.namprd12.prod.outlook.com>


在 2023/8/31 14:25, Xueming(Steven) Li 写道:
>
>> -----Original Message-----
>> From: lihuisong (C) <lihuisong@huawei.com>
>> Sent: 8/31/2023 9:24
>> To: Xueming(Steven) Li <xuemingl@nvidia.com>; Ori Kam <orika@nvidia.com>
>> Cc: dev@dpdk.org; fengchengwen@huawei.com; Ivan Malov
>> <ivan.malov@arknetworks.am>
>> Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function
>>
>>
>> 在 2023/8/30 21:09, Xueming(Steven) Li 写道:
>>>> -----Original Message-----
>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>> Sent: 8/30/2023 20:42
>>>> To: Xueming(Steven) Li <xuemingl@nvidia.com>; Ori Kam
>>>> <orika@nvidia.com>
>>>> Cc: dev@dpdk.org; fengchengwen@huawei.com; Ivan Malov
>>>> <ivan.malov@arknetworks.am>
>>>> Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function
>>>>
>>>>
>>>> 在 2023/8/30 16:38, Xueming(Steven) Li 写道:
>>>>>> -----Original Message-----
>>>>>> From: lihuisong (C) <lihuisong@huawei.com>
>>>>>> Sent: 8/30/2023 15:51
>>>>>> To: Xueming(Steven) Li <xuemingl@nvidia.com>; Ori Kam
>>>>>> <orika@nvidia.com>
>>>>>> Cc: dev@dpdk.org; fengchengwen@huawei.com; Ivan Malov
>>>>>> <ivan.malov@arknetworks.am>
>>>>>> Subject: Re: [PATCH v2 1/2] ethdev: add new symmetric hash function
>>>>>>
>>>>>> Hi Xueming,
>>>>>>
>>>>>> 在 2023/8/27 16:17, Xueming Li 写道:
>>>>>>> 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 | 7 +++++++
>>>>>>>      1 file changed, 7 insertions(+)
>>>>>>>
>>>>>>> diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h index
>>>>>>> 2ebb76dbc0..4f4421ca50 100644
>>>>>>> --- a/lib/ethdev/rte_flow.h
>>>>>>> +++ b/lib/ethdev/rte_flow.h
>>>>>>> @@ -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?
>>>>> 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?
>>> 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").
> 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.

> 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.

>
>>>>>>> +	RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
>>>>>>>      	RTE_ETH_HASH_FUNCTION_MAX,
>>>>>>>      };
>>>>>>>

  reply	other threads:[~2023-08-31 11:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 11:38 [PATCH] doc: deprecation notice to add new " Xueming Li
2023-05-24 12:50 ` Ori Kam
2023-05-24 14:49 ` Stephen Hemminger
2023-07-28 15:10   ` Thomas Monjalon
2023-08-07 11:54 ` [PATCH] ethdev: add new symmetric " Xueming Li
2023-08-07 12:33   ` Ori Kam
2023-08-07 22:32   ` Ivan Malov
2023-08-08  1:43     ` fengchengwen
2023-08-09 12:00       ` Xueming(Steven) Li
2023-08-27  8:17   ` [PATCH v2 1/2] " Xueming Li
2023-08-30  6:55     ` Ori Kam
2023-09-21 15:49       ` Ferruh Yigit
2023-09-22  6:57         ` Xueming(Steven) Li
2023-08-30  7:50     ` lihuisong (C)
2023-08-30  8:38       ` Xueming(Steven) Li
2023-08-30 12:42         ` lihuisong (C)
2023-08-30 13:09           ` Xueming(Steven) Li
2023-08-31  1:23             ` lihuisong (C)
2023-08-31  6:25               ` Xueming(Steven) Li
2023-08-31 11:29                 ` lihuisong (C) [this message]
2023-08-27  8:17   ` [PATCH v2 2/2] net/mlx5: support new RSS " Xueming Li
2023-10-29 15:53     ` Ori Kam
2023-10-30 17:08     ` Raslan Darawsheh

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=debb1121-dc52-545b-66ab-e408336ea449@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=ivan.malov@arknetworks.am \
    --cc=orika@nvidia.com \
    --cc=xuemingl@nvidia.com \
    /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).