[PATCH v2 1/2] ethdev: add new symmetric hash function
Xueming(Steven) Li
xuemingl at nvidia.com
Wed Aug 30 10:38:40 CEST 2023
> -----Original Message-----
> From: lihuisong (C) <lihuisong at huawei.com>
> Sent: 8/30/2023 15:51
> To: Xueming(Steven) Li <xuemingl at nvidia.com>; Ori Kam <orika at nvidia.com>
> Cc: dev at dpdk.org; fengchengwen at huawei.com; Ivan Malov
> <ivan.malov at 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 at 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.
> > + RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
> > RTE_ETH_HASH_FUNCTION_MAX,
> > };
> >
More information about the dev
mailing list