[v3,3/4] net/nfp: add representor RSS configuration
Checks
Commit Message
From: Long Wu <long.wu@corigine.com>
Add RSS configuration logics in representor initialization function.
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/common/nfp/nfp_common_ctrl.h | 1 +
drivers/net/nfp/flower/nfp_flower.c | 12 ++++++++++--
drivers/net/nfp/flower/nfp_flower_representor.c | 13 +++++++++++++
drivers/net/nfp/nfp_net_common.c | 17 ++++++-----------
drivers/net/nfp/nfp_net_common.h | 9 +++++++++
5 files changed, 39 insertions(+), 13 deletions(-)
@@ -254,6 +254,7 @@ struct nfp_net_fw_ver {
#define NFP_NET_CFG_RSS_IPV4_SCTP (1 << 14) /* RSS for IPv4/SCTP */
#define NFP_NET_CFG_RSS_IPV6_SCTP (1 << 15) /* RSS for IPv6/SCTP */
#define NFP_NET_CFG_RSS_TOEPLITZ (1 << 24) /* Use Toeplitz hash */
+#define NFP_NET_CFG_RSS_CRC32 (1 << 26) /* Use CRC32 hash */
#define NFP_NET_CFG_RSS_KEY (NFP_NET_CFG_RSS_BASE + 0x4)
#define NFP_NET_CFG_RSS_KEY_SZ 0x28
#define NFP_NET_CFG_RSS_ITBL (NFP_NET_CFG_RSS_BASE + 0x4 + \
@@ -31,6 +31,8 @@ nfp_flower_pf_start(struct rte_eth_dev *dev)
uint32_t new_ctrl;
uint32_t update = 0;
struct nfp_net_hw *net_hw;
+ struct rte_eth_conf *dev_conf;
+ struct rte_eth_rxmode *rxmode;
struct nfp_flower_representor *repr;
repr = dev->data->dev_private;
@@ -48,8 +50,14 @@ nfp_flower_pf_start(struct rte_eth_dev *dev)
/* Writing configuration parameters in the device */
nfp_net_params_setup(net_hw);
- update |= NFP_NET_CFG_UPDATE_RSS;
- new_ctrl |= nfp_net_cfg_ctrl_rss(hw->cap);
+ dev_conf = &dev->data->dev_conf;
+ rxmode = &dev_conf->rxmode;
+
+ if ((rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) != 0) {
+ nfp_net_rss_config_default(dev);
+ update |= NFP_NET_CFG_UPDATE_RSS;
+ new_ctrl |= nfp_net_cfg_ctrl_rss(hw->cap);
+ }
/* Enable device */
new_ctrl |= NFP_NET_CFG_CTRL_ENABLE;
@@ -44,6 +44,12 @@ static int
nfp_flower_repr_dev_infos_get(__rte_unused struct rte_eth_dev *dev,
struct rte_eth_dev_info *dev_info)
{
+ struct nfp_net_hw *pf_hw;
+ struct nfp_flower_representor *repr;
+
+ repr = dev->data->dev_private;
+ pf_hw = repr->app_fw_flower->pf_hw;
+
/* Hardcoded pktlen and queues for now */
dev_info->max_rx_queues = 1;
dev_info->max_tx_queues = 1;
@@ -64,6 +70,13 @@ nfp_flower_repr_dev_infos_get(__rte_unused struct rte_eth_dev *dev,
dev_info->max_mac_addrs = 1;
+ if ((pf_hw->super.cap & NFP_NET_CFG_CTRL_RSS_ANY) != 0) {
+ dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ dev_info->flow_type_rss_offloads = NFP_NET_RSS_CAP;
+ dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ;
+ dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ;
+ }
+
return 0;
}
@@ -1267,16 +1267,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
if ((cap & NFP_NET_CFG_CTRL_RSS_ANY) != 0) {
dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
-
- dev_info->flow_type_rss_offloads = RTE_ETH_RSS_IPV4 |
- RTE_ETH_RSS_NONFRAG_IPV4_TCP |
- RTE_ETH_RSS_NONFRAG_IPV4_UDP |
- RTE_ETH_RSS_NONFRAG_IPV4_SCTP |
- RTE_ETH_RSS_IPV6 |
- RTE_ETH_RSS_NONFRAG_IPV6_TCP |
- RTE_ETH_RSS_NONFRAG_IPV6_UDP |
- RTE_ETH_RSS_NONFRAG_IPV6_SCTP;
-
+ dev_info->flow_type_rss_offloads = NFP_NET_RSS_CAP;
dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ;
dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ;
}
@@ -1792,7 +1783,11 @@ nfp_net_rss_hash_write(struct rte_eth_dev *dev,
cfg_rss_ctrl |= NFP_NET_CFG_RSS_IPV6_SCTP;
cfg_rss_ctrl |= NFP_NET_CFG_RSS_MASK;
- cfg_rss_ctrl |= NFP_NET_CFG_RSS_TOEPLITZ;
+
+ if (rte_eth_dev_is_repr(dev))
+ cfg_rss_ctrl |= NFP_NET_CFG_RSS_CRC32;
+ else
+ cfg_rss_ctrl |= NFP_NET_CFG_RSS_TOEPLITZ;
/* Configuring where to apply the RSS hash */
nn_cfg_writel(hw, NFP_NET_CFG_RSS_CTRL, cfg_rss_ctrl);
@@ -41,6 +41,15 @@
#define NFP_BEAT_LENGTH 8
+/* RSS capability*/
+#define NFP_NET_RSS_CAP (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_IPV6 | \
+ RTE_ETH_RSS_NONFRAG_IPV4_TCP | \
+ RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
+ RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_SCTP)
+
/*
* Each PF has corresponding word to beat:
* Offset | Usage