From: Vamsi Attunuru <vattun...@marvell.com>

patch adds pmd support for hash_index_get() ethdev_op callback.

Signed-off-by: Vamsi Attunuru <vattun...@marvell.com>
---
 drivers/net/octeontx2/otx2_ethdev.c |  1 +
 drivers/net/octeontx2/otx2_ethdev.h |  3 +++
 drivers/net/octeontx2/otx2_rss.c    | 18 ++++++++++++++++++
 3 files changed, 22 insertions(+)

diff --git a/drivers/net/octeontx2/otx2_ethdev.c 
b/drivers/net/octeontx2/otx2_ethdev.c
index 4a60f9f..eb41ba4 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -1961,6 +1961,7 @@ static const struct eth_dev_ops otx2_eth_dev_ops = {
        .reta_query               = otx2_nix_dev_reta_query,
        .rss_hash_update          = otx2_nix_rss_hash_update,
        .rss_hash_conf_get        = otx2_nix_rss_hash_conf_get,
+       .rss_hash_index_get       = otx2_nix_rss_hash_index_get,
        .xstats_get               = otx2_nix_xstats_get,
        .xstats_get_names         = otx2_nix_xstats_get_names,
        .xstats_reset             = otx2_nix_xstats_reset,
diff --git a/drivers/net/octeontx2/otx2_ethdev.h 
b/drivers/net/octeontx2/otx2_ethdev.h
index 33fa0c6..b410988 100644
--- a/drivers/net/octeontx2/otx2_ethdev.h
+++ b/drivers/net/octeontx2/otx2_ethdev.h
@@ -471,6 +471,9 @@ int otx2_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
 int otx2_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
                               struct rte_eth_rss_conf *rss_conf);
 
+int otx2_nix_rss_hash_index_get(struct rte_eth_dev *eth_dev,
+                               uint32_t hash, uint32_t *hash_idx);
+
 /* CGX */
 int otx2_cgx_rxtx_start(struct otx2_eth_dev *dev);
 int otx2_cgx_rxtx_stop(struct otx2_eth_dev *dev);
diff --git a/drivers/net/octeontx2/otx2_rss.c b/drivers/net/octeontx2/otx2_rss.c
index 5afa214..4b40dfd 100644
--- a/drivers/net/octeontx2/otx2_rss.c
+++ b/drivers/net/octeontx2/otx2_rss.c
@@ -328,6 +328,24 @@ otx2_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
 }
 
 int
+otx2_nix_rss_hash_index_get(struct rte_eth_dev *eth_dev,
+                           uint32_t hash, uint32_t *hash_idx)
+{
+       struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
+       union flow_tag {
+               uint32_t hash;
+               uint8_t byte[4];
+       } tag;
+
+       tag.hash = hash;
+
+       *hash_idx = (tag.byte[0] ^ tag.byte[1] ^ tag.byte[2] ^ tag.byte[3]) %
+                       dev->rss_info.rss_size;
+
+       return 0;
+}
+
+int
 otx2_nix_rss_config(struct rte_eth_dev *eth_dev)
 {
        struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
-- 
2.8.4

Reply via email to