doc: add Toeplitz hash guide
[dpdk.git] / doc / guides / prog_guide / toeplitz_hash_lib.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2021 Intel Corporation.
3
4 Toeplitz Hash Library
5 =====================
6
7 DPDK provides a Toeplitz Hash Library
8 to calculate the Toeplitz hash function and to use its properties.
9 The Toeplitz hash function is commonly used in a wide range of NICs
10 to calculate the RSS hash sum to spread the traffic among the queues.
11
12 .. _figure_rss_queue_assign:
13
14 .. figure:: img/rss_queue_assign.*
15
16    RSS queue assignment example
17
18
19 Toeplitz hash function API
20 --------------------------
21
22 There are two functions that provide calculation of the Toeplitz hash sum:
23
24 * ``rte_softrss()``
25 * ``rte_softrss_be()``
26
27 Both of these functions take the parameters:
28
29 * A pointer to the tuple, containing fields extracted from the packet.
30 * A length of this tuple counted in double words.
31 * A pointer to the RSS hash key corresponding to the one installed on the NIC.
32
33 Both functions expect the tuple to be in "host" byte order
34 and a multiple of 4 bytes in length.
35 The ``rte_softrss()`` function expects the ``rss_key``
36 to be exactly the same as the one installed on the NIC.
37 The ``rte_softrss_be`` function is a faster implementation,
38 but it expects ``rss_key`` to be converted to the host byte order.