Modify RSS-related interface functions, as the NFDK firmware support
feature NFP_NET_CFG_CTRL_RSS2 rather than NFP_NET_CFG_CTRL_RSS.

Signed-off-by: Jin Liu <jin....@corigine.com>
Signed-off-by: Diana Wang <na.w...@corigine.com>
Signed-off-by: Peng Zhang <peng.zh...@corigine.com>
Signed-off-by: Chaoyong He <chaoyong...@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderl...@corigine.com>
---
 drivers/net/nfp/nfp_common.c    | 12 ++++++------
 drivers/net/nfp/nfp_ctrl.h      |  1 +
 drivers/net/nfp/nfp_ethdev.c    | 12 +++++++++++-
 drivers/net/nfp/nfp_ethdev_vf.c | 12 +++++++++++-
 drivers/net/nfp/nfp_rxtx.c      |  2 +-
 5 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 58e20081fc..c2515cf413 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -171,7 +171,7 @@ nfp_net_configure(struct rte_eth_dev *dev)
 
        /* Checking RX mode */
        if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS &&
-           !(hw->cap & NFP_NET_CFG_CTRL_RSS)) {
+           !(hw->cap & NFP_NET_CFG_CTRL_RSS_ANY)) {
                PMD_INIT_LOG(INFO, "RSS not supported");
                return -EINVAL;
        }
@@ -752,7 +752,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
                .nb_mtu_seg_max = NFP_TX_MAX_MTU_SEG,
        };
 
-       if (hw->cap & NFP_NET_CFG_CTRL_RSS) {
+       if (hw->cap & NFP_NET_CFG_CTRL_RSS_ANY) {
                dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
 
                dev_info->flow_type_rss_offloads = RTE_ETH_RSS_IPV4 |
@@ -1053,7 +1053,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev,
        uint32_t update;
        int ret;
 
-       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS))
+       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
                return -EINVAL;
 
        ret = nfp_net_rss_reta_write(dev, reta_conf, reta_size);
@@ -1081,7 +1081,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev,
 
        hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS))
+       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
                return -EINVAL;
 
        if (reta_size != NFP_NET_CFG_RSS_ITBL_SZ) {
@@ -1179,7 +1179,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev,
        rss_hf = rss_conf->rss_hf;
 
        /* Checking if RSS is enabled */
-       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS)) {
+       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY)) {
                if (rss_hf != 0) { /* Enable RSS? */
                        PMD_DRV_LOG(ERR, "RSS unsupported");
                        return -EINVAL;
@@ -1214,7 +1214,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
 
        hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
-       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS))
+       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
                return -EINVAL;
 
        rss_hf = rss_conf->rss_hf;
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index e73715e2aa..372d537462 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -119,6 +119,7 @@
 #define NFP_NET_CFG_MACADDR             0x0024
 
 #define NFP_NET_CFG_CTRL_LSO_ANY (NFP_NET_CFG_CTRL_LSO | NFP_NET_CFG_CTRL_LSO2)
+#define NFP_NET_CFG_CTRL_RSS_ANY (NFP_NET_CFG_CTRL_RSS | NFP_NET_CFG_CTRL_RSS2)
 
 /*
  * Read-only words (0x0030 - 0x0050):
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 238b2b5451..bd7dd30f10 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -123,7 +123,17 @@ nfp_net_start(struct rte_eth_dev *dev)
        if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS) {
                nfp_net_rss_config_default(dev);
                update |= NFP_NET_CFG_UPDATE_RSS;
-               new_ctrl |= NFP_NET_CFG_CTRL_RSS;
+               switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
+               case NFP_NET_CFG_VERSION_DP_NFD3:
+                       new_ctrl |= NFP_NET_CFG_CTRL_RSS;
+                       break;
+               case NFP_NET_CFG_VERSION_DP_NFDK:
+                       new_ctrl |= NFP_NET_CFG_CTRL_RSS2;
+                       break;
+               default:
+                       PMD_INIT_LOG(ERR, "nfp_net: no fw version match");
+                       return -ENODEV;
+               }
        }
 
        /* Enable device */
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index bb8206c4f6..8769f07be4 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -95,7 +95,17 @@ nfp_netvf_start(struct rte_eth_dev *dev)
        if (rxmode->mq_mode & RTE_ETH_MQ_RX_RSS) {
                nfp_net_rss_config_default(dev);
                update |= NFP_NET_CFG_UPDATE_RSS;
-               new_ctrl |= NFP_NET_CFG_CTRL_RSS;
+               switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
+               case NFP_NET_CFG_VERSION_DP_NFD3:
+                       new_ctrl |= NFP_NET_CFG_CTRL_RSS;
+                       break;
+               case NFP_NET_CFG_VERSION_DP_NFDK:
+                       new_ctrl |= NFP_NET_CFG_CTRL_RSS2;
+                       break;
+               default:
+                       PMD_INIT_LOG(ERR, "nfp_net: no fw version match");
+                       return -ENODEV;
+               }
        }
 
        /* Enable device */
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index fd3ee40aa5..43db8db7c3 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -138,7 +138,7 @@ nfp_net_set_hash(struct nfp_net_rxq *rxq, struct 
nfp_net_rx_desc *rxd,
        uint32_t hash = 0;
        uint32_t hash_type = 0;
 
-       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS))
+       if (!(hw->ctrl & NFP_NET_CFG_CTRL_RSS_ANY))
                return;
 
        /* this is true for new firmwares */
-- 
2.27.0

Reply via email to