Now NFP NIC support two type of RSS logic, NFP_NET_CFG_CTRL_RSS and NFP_NET_CFG_CTRL_RSS2, use NFP_NET_CFG_CTRL_RSS2 if NIC capability support, otherwise use 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 | 5 ++++- drivers/net/nfp/nfp_ethdev_vf.c | 5 ++++- drivers/net/nfp/nfp_rxtx.c | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c index 755c5ec4d9..0e55f0c792 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; } @@ -769,7 +769,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 | @@ -1080,7 +1080,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); @@ -1108,7 +1108,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) { @@ -1206,7 +1206,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; @@ -1241,7 +1241,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 b6817c10da..673a17c26c 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -123,7 +123,10 @@ 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; + if (hw->cap & NFP_NET_CFG_CTRL_RSS2) + new_ctrl |= NFP_NET_CFG_CTRL_RSS2; + else + new_ctrl |= NFP_NET_CFG_CTRL_RSS; } /* Enable device */ diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index 66a1c0a36b..3f4ad3e7ab 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -95,7 +95,10 @@ 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; + if (hw->cap & NFP_NET_CFG_CTRL_RSS2) + new_ctrl |= NFP_NET_CFG_CTRL_RSS2; + else + new_ctrl |= NFP_NET_CFG_CTRL_RSS; } /* Enable device */ diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c index 1b00f96ed3..7414c5167d 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