Bug 1323 - NIC RSS Symmetric hash is not working on Marvell OcteonTx2 (otx2) platform when configuring 4 tuple
Summary: NIC RSS Symmetric hash is not working on Marvell OcteonTx2 (otx2) platform wh...
Status: UNCONFIRMED
Alias: None
Product: DPDK
Classification: Unclassified
Component: ethdev (show other bugs)
Version: 20.11
Hardware: All All
: Normal major
Target Milestone: ---
Assignee: Jerin
URL:
Depends on:
Blocks:
 
Reported: 2023-11-14 18:31 CET by Siva
Modified: 2023-11-16 09:57 CET (History)
1 user (show)



Attachments

Description Siva 2023-11-14 18:31:18 CET
The NIC RSS symmetric hash is not working on the otx2 platform i.e., client to server and server to client traffic are not hashed to the same core. Below is code snippet how 4 tuple hashing is enabled on NIC RSS.

As read from a different article, I have tried with symmetric hash_key as 0x00, 0x01 instead of 0x6D,0x5A. Even then symmetric hash is not working.

This is critical for my stateful application development. Kindly provide if there is a way to implement it. Thanks! in advance.

DPDK version used is 20.11.

#define RSS_HASH_KEY_LENGTH 40
static uint8_t symmetric_hash_key[RSS_HASH_KEY_LENGTH] = {  0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,  0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,  0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,  0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,  0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,};uint8_t symmetric_hash_key_be[RSS_HASH_KEY_LENGTH];

struct rte_eth_conf port_cfg;

port_cfg.rx_adv_conf.rss_conf.rss_hf = (ETH_RSS_UDP | ETH_RSS_TCP | ETH_RSS_SCTP) | (ETH_RSS_IP & ~ETH_RSS_IPV6_EX);

port_cfg.rx_adv_conf.rss_conf.rss_key_len = RSS_HASH_KEY_LENGTH;

port_cfg.rx_adv_conf.rss_conf.rss_key = symmetric_hash_key;

port_cfg.txmode.mq_mode = ETH_MQ_TX_NONE;

// Other port_cfg params are updated.

rte_eth_dev_configure(port_id, nb_rxq, nb_txq, &port_cfg);
Comment 1 Jerin 2023-11-16 09:56:55 CET
Please make sure kernel has following patch

commit 72e192a163d0959d4e74342850a31b241baba422
Author: Jerin Jacob <jerinj@marvell.com>
Date:   Wed Aug 25 17:48:39 2021 +0530

    octeontx2-af: Allow to configure flow tag LSB byte as RSS adder

    Before C0 HW revision, The RSS adder was computed based the
    following static formula.

    rss_adder<7:0> = flow_tag<7:0> ^ flow_tag<15:8> ^
    flow_tag<23:16> ^ flow_tag<31:24>

    The above scheme has the following drawbacks:
    1) It is not in line with other standard NIC behavior.
    2) There can be an SW use case where SW can compute the hash
    upfront using Toeplitz function and predict the queue selection
    to optimize some packet lookup function. The nonstandard
    way of doing XOR makes the consumer to not predict the queue selection.

    C0 HW revision onwards, The HW can configure the
    rss_adder<7:0> as flow_tag<7:0> to align with standard NICs.

    This patch adds an option to select legacy RSS adder mode
    vs standard NIC behavior by setting NIX_LF_RSS_TAG_LSB_AS_ADDER flag.

    Since this bit field is used as reserved in old HW revisions,
    No need to have an additional HW version check.

    Signed-off-by: Jerin Jacob <jerinj@marvell.com>
    Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>


And DPDK code is selecting NIX_LF_RSS_TAG_LSB_AS_ADDER. Also, it works from C0 HW as mentioned in the linux commit log.

static int
nix_lf_alloc(struct otx2_eth_dev *dev, uint32_t nb_rxq, uint32_t nb_txq)
{
        struct otx2_mbox *mbox = dev->mbox;
        struct nix_lf_alloc_req *req;
        struct nix_lf_alloc_rsp *rsp;
        int rc;

        req = otx2_mbox_alloc_msg_nix_lf_alloc(mbox_get(mbox));
        if (req == NULL) {
                rc = -EINVAL;
                goto fail;
        }
        req->rq_cnt = nb_rxq;
        req->sq_cnt = nb_txq;
        req->cq_cnt = nb_rxq;
        /* XQE_SZ should be in Sync with NIX_CQ_ENTRY_SZ */
        RTE_BUILD_BUG_ON(NIX_CQ_ENTRY_SZ != 128);
        req->xqe_sz = NIX_XQESZ_W16;
        req->rss_sz = dev->rss_info.rss_size;
        req->rss_grps = NIX_RSS_GRPS;
        req->npa_func = otx2_npa_pf_func_get();
        req->sso_func = otx2_sso_pf_func_get();
        req->rx_cfg = BIT_ULL(35 /* DIS_APAD */);
        if (dev->rx_offloads & (DEV_RX_OFFLOAD_TCP_CKSUM |
                         DEV_RX_OFFLOAD_UDP_CKSUM)) {
                req->rx_cfg |= BIT_ULL(37 /* CSUM_OL4 */);
                req->rx_cfg |= BIT_ULL(36 /* CSUM_IL4 */);
        }
        req->rx_cfg |= (BIT_ULL(32 /* DROP_RE */)             |
                        BIT_ULL(33 /* Outer L2 Length */)     |
                        BIT_ULL(38 /* Inner L4 UDP Length */) |
                        BIT_ULL(39 /* Inner L3 Length */)     |
                        BIT_ULL(40 /* Outer L4 UDP Length */) |
                        BIT_ULL(41 /* Outer L3 Length */));

        if (dev->rss_tag_as_xor == 0)
                req->flags = NIX_LF_RSS_TAG_LSB_AS_ADDER;

Note You need to log in before you can comment on or make changes to this bug.