net/octeontx2: support RSS hash level
authorKiran Kumar K <kirankumark@marvell.com>
Thu, 17 Sep 2020 02:07:35 +0000 (07:37 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:12 +0000 (18:55 +0200)
Add support to choose rss hash level from ethdev rss config.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
drivers/net/octeontx2/otx2_ethdev.h
drivers/net/octeontx2/otx2_rss.c

index e9efe52..a114112 100644 (file)
 #define NIX_RSS_OFFLOAD                (ETH_RSS_PORT | ETH_RSS_IP | ETH_RSS_UDP |\
                                 ETH_RSS_TCP | ETH_RSS_SCTP | \
                                 ETH_RSS_TUNNEL | ETH_RSS_L2_PAYLOAD | \
-                                NIX_RSS_L3_L4_SRC_DST)
+                                NIX_RSS_L3_L4_SRC_DST | ETH_RSS_LEVEL_MASK)
 
 #define NIX_TX_OFFLOAD_CAPA ( \
        DEV_TX_OFFLOAD_MBUF_FAST_FREE   | \
index d859937..03f7bc7 100644 (file)
@@ -323,6 +323,7 @@ otx2_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
                         struct rte_eth_rss_conf *rss_conf)
 {
        struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+       uint8_t rss_hash_level;
        uint32_t flowkey_cfg;
        uint8_t alg_idx;
        int rc;
@@ -339,7 +340,11 @@ otx2_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
                otx2_nix_rss_set_key(dev, rss_conf->rss_key,
                                     (uint32_t)rss_conf->rss_key_len);
 
-       flowkey_cfg = otx2_rss_ethdev_to_nix(dev, rss_conf->rss_hf, 0);
+       rss_hash_level = ETH_RSS_LEVEL(rss_conf->rss_hf);
+       if (rss_hash_level)
+               rss_hash_level -= 1;
+       flowkey_cfg =
+               otx2_rss_ethdev_to_nix(dev, rss_conf->rss_hf, rss_hash_level);
 
        rc = otx2_rss_set_hf(dev, flowkey_cfg, &alg_idx,
                             NIX_DEFAULT_RSS_CTX_GROUP,
@@ -375,6 +380,7 @@ otx2_nix_rss_config(struct rte_eth_dev *eth_dev)
 {
        struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
        uint32_t idx, qcnt = eth_dev->data->nb_rx_queues;
+       uint8_t rss_hash_level;
        uint32_t flowkey_cfg;
        uint64_t rss_hf;
        uint8_t alg_idx;
@@ -399,7 +405,10 @@ otx2_nix_rss_config(struct rte_eth_dev *eth_dev)
        }
 
        rss_hf = eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf;
-       flowkey_cfg = otx2_rss_ethdev_to_nix(dev, rss_hf, 0);
+       rss_hash_level = ETH_RSS_LEVEL(rss_hf);
+       if (rss_hash_level)
+               rss_hash_level -= 1;
+       flowkey_cfg = otx2_rss_ethdev_to_nix(dev, rss_hf, rss_hash_level);
 
        rc = otx2_rss_set_hf(dev, flowkey_cfg, &alg_idx,
                             NIX_DEFAULT_RSS_CTX_GROUP,