From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
Chaoyong He <chaoyong.he@corigine.com>,
Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH 3/4] net/nfp: representor adds RSS configuration
Date: Sat, 10 Feb 2024 18:42:12 +0800 [thread overview]
Message-ID: <20240210104214.1248772-4-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20240210104214.1248772-1-chaoyong.he@corigine.com>
From: Long Wu <long.wu@corigine.com>
Add RSS configuration in representor initializaion.
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(-)
diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h
index d65fcd17cb..d0a3fc696c 100644
--- a/drivers/common/nfp/nfp_common_ctrl.h
+++ b/drivers/common/nfp/nfp_common_ctrl.h
@@ -253,6 +253,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 + \
diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index e84e6ebbff..c6a744e868 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -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;
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 4f4df0cd2e..7284a1e84d 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -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;
}
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 7a0b0c9973..66aaf7ab09 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -1269,16 +1269,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;
}
@@ -1794,7 +1785,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 (nfp_net_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);
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 1d96b0e9d1..04482455d2 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -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
--
2.39.1
next prev parent reply other threads:[~2024-02-10 10:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-10 10:42 [PATCH 0/4] add support of partial offload Chaoyong He
2024-02-10 10:42 ` [PATCH 1/4] net/nfp: support MARK flow action Chaoyong He
2024-02-10 10:42 ` [PATCH 2/4] net/nfp: add interface to check representor Chaoyong He
2024-02-12 16:24 ` Ferruh Yigit
2024-02-17 1:31 ` Chaoyong He
2024-02-10 10:42 ` Chaoyong He [this message]
2024-02-10 10:42 ` [PATCH 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-12 10:10 ` [PATCH 0/4] add support of partial offload David Marchand
2024-02-17 1:31 ` Chaoyong He
2024-02-23 2:42 ` [PATCH v2 0/4] add support of MARK and RSS flow action Chaoyong He
2024-02-23 2:42 ` [PATCH v2 1/4] ethdev: add function to check representor port Chaoyong He
2024-02-23 9:29 ` Ferruh Yigit
2024-02-23 2:42 ` [PATCH v2 2/4] net/nfp: support MARK flow action Chaoyong He
2024-02-23 2:42 ` [PATCH v2 3/4] net/nfp: add representor RSS configuration Chaoyong He
2024-02-23 2:42 ` [PATCH v2 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-26 1:44 ` [PATCH v3 0/4] add support of MARK and " Chaoyong He
2024-02-26 1:44 ` [PATCH v3 1/4] ethdev: add function to check representor port Chaoyong He
2024-02-26 14:31 ` Ferruh Yigit
2024-02-26 1:44 ` [PATCH v3 2/4] net/nfp: support MARK flow action Chaoyong He
2024-02-26 1:44 ` [PATCH v3 3/4] net/nfp: add representor RSS configuration Chaoyong He
2024-02-26 1:45 ` [PATCH v3 4/4] net/nfp: support RSS flow action Chaoyong He
2024-02-26 14:31 ` [PATCH v3 0/4] add support of MARK and " Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240210104214.1248772-4-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).