From: Joshua Washington <joshwash@google.com>
To: Junfeng Guo <junfeng.guo@intel.com>,
Jeroen de Borst <jeroendb@google.com>,
Rushil Gupta <rushilg@google.com>,
Joshua Washington <joshwash@google.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@amd.com>
Subject: [PATCH v4 5/7] net/gve: RSS redirection table update support
Date: Fri, 26 Jan 2024 09:33:14 -0800 [thread overview]
Message-ID: <20240126173317.2779230-6-joshwash@google.com> (raw)
In-Reply-To: <20240126173317.2779230-1-joshwash@google.com>
This patch introduces support for updating the RSS redirection table in
the GVE PMD through the implementation of rss_reta_update and
rss_reta_query.
Due to an infrastructure limitation, the RSS hash key must be manually
configured before the redirection table can be updated or queried. The
redirection table is expected to be exactly 128 bytes.
Signed-off-by: Joshua Washington <joshwash@google.com>
Reviewed-by: Rushil Gupta <rushilg@google.com>
Reviewed-by: Jeroen de Borst <jeroendb@google.com>
---
drivers/net/gve/gve_ethdev.c | 95 ++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index 2a68d31808..3b8ec5872d 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -770,6 +770,97 @@ gve_rss_hash_conf_get(struct rte_eth_dev *dev,
return 0;
}
+static int
+gve_rss_reta_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)
+{
+ struct gve_priv *priv = dev->data->dev_private;
+ struct gve_rss_config gve_rss_conf;
+ int table_id;
+ int err;
+ int i;
+
+ /* RSS key must be set before the redirection table can be set. */
+ if (!priv->rss_config.key || priv->rss_config.key_size == 0) {
+ PMD_DRV_LOG(ERR, "RSS hash key msut be set before the "
+ "redirection table can be updated.");
+ return -ENOTSUP;
+ }
+
+ if (reta_size != GVE_RSS_INDIR_SIZE) {
+ PMD_DRV_LOG(ERR, "Redirection table must have %hu elements",
+ (uint16_t)GVE_RSS_INDIR_SIZE);
+ return -EINVAL;
+ }
+
+ err = gve_init_rss_config_from_priv(priv, &gve_rss_conf);
+ if (err) {
+ PMD_DRV_LOG(ERR, "Error allocating new RSS config.");
+ return err;
+ }
+
+ table_id = 0;
+ for (i = 0; i < priv->rss_config.indir_size; i++) {
+ int table_entry = i % RTE_ETH_RETA_GROUP_SIZE;
+ if (reta_conf[table_id].mask & (1ULL << table_entry))
+ gve_rss_conf.indir[i] =
+ reta_conf[table_id].reta[table_entry];
+
+ if (table_entry == RTE_ETH_RETA_GROUP_SIZE - 1)
+ table_id++;
+ }
+
+ err = gve_adminq_configure_rss(priv, &gve_rss_conf);
+ if (err)
+ PMD_DRV_LOG(ERR, "Problem configuring RSS with device.");
+ else
+ gve_update_priv_rss_config(priv, &gve_rss_conf);
+
+ gve_free_rss_config(&gve_rss_conf);
+ return err;
+}
+
+static int
+gve_rss_reta_query(struct rte_eth_dev *dev,
+ struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)
+{
+ struct gve_priv *priv = dev->data->dev_private;
+ int table_id;
+ int i;
+
+ if (!(dev->data->dev_conf.rxmode.offloads &
+ RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
+ PMD_DRV_LOG(ERR, "RSS not configured.");
+ return -ENOTSUP;
+ }
+
+ /* RSS key must be set before the redirection table can be queried. */
+ if (!priv->rss_config.key) {
+ PMD_DRV_LOG(ERR, "RSS hash key must be set before the "
+ "redirection table can be initialized.");
+ return -ENOTSUP;
+ }
+
+ if (reta_size != priv->rss_config.indir_size) {
+ PMD_DRV_LOG(ERR, "RSS redirection table must have %d entries.",
+ priv->rss_config.indir_size);
+ return -EINVAL;
+ }
+
+ table_id = 0;
+ for (i = 0; i < priv->rss_config.indir_size; i++) {
+ int table_entry = i % RTE_ETH_RETA_GROUP_SIZE;
+ if (reta_conf[table_id].mask & (1ULL << table_entry))
+ reta_conf[table_id].reta[table_entry] =
+ priv->rss_config.indir[i];
+
+ if (table_entry == RTE_ETH_RETA_GROUP_SIZE - 1)
+ table_id++;
+ }
+
+ return 0;
+}
+
static const struct eth_dev_ops gve_eth_dev_ops = {
.dev_configure = gve_dev_configure,
.dev_start = gve_dev_start,
@@ -792,6 +883,8 @@ static const struct eth_dev_ops gve_eth_dev_ops = {
.xstats_get_names = gve_xstats_get_names,
.rss_hash_update = gve_rss_hash_update,
.rss_hash_conf_get = gve_rss_hash_conf_get,
+ .reta_update = gve_rss_reta_update,
+ .reta_query = gve_rss_reta_query,
};
static const struct eth_dev_ops gve_eth_dev_ops_dqo = {
@@ -816,6 +909,8 @@ static const struct eth_dev_ops gve_eth_dev_ops_dqo = {
.xstats_get_names = gve_xstats_get_names,
.rss_hash_update = gve_rss_hash_update,
.rss_hash_conf_get = gve_rss_hash_conf_get,
+ .reta_update = gve_rss_reta_update,
+ .reta_query = gve_rss_reta_query,
};
static void
--
2.43.0.429.g432eaa2c6b-goog
next prev parent reply other threads:[~2024-01-26 17:34 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 17:58 [PATCH 0/7] net/gve: RSS Support for GVE Driver Joshua Washington
2024-01-23 17:58 ` [PATCH v2 1/7] net/gve: fully expose RSS offload support in dev_info Joshua Washington
2024-01-23 17:58 ` [PATCH v2 2/7] net/gve: RSS adminq command changes Joshua Washington
2024-01-23 17:58 ` [PATCH v2 3/7] net/gve: add gve_rss library for handling RSS-related behaviors Joshua Washington
2024-01-23 17:58 ` [PATCH v2 4/7] net/gve: RSS configuration update support Joshua Washington
2024-01-23 17:58 ` [PATCH v2 5/7] net/gve: RSS redirection table " Joshua Washington
2024-01-23 17:58 ` [PATCH v2 6/7] net/gve: update gve.ini with RSS capabilities Joshua Washington
2024-01-23 17:58 ` [PATCH v2 7/7] net/gve: update GVE documentation with RSS support Joshua Washington
2024-01-24 0:04 ` [PATCH 0/7] net/gve: RSS Support for GVE Driver Joshua Washington
2024-01-24 0:04 ` [PATCH v3 1/7] net/gve: fully expose RSS offload support in dev_info Joshua Washington
2024-01-24 0:04 ` [PATCH v3 2/7] net/gve: RSS adminq command changes Joshua Washington
2024-01-24 0:04 ` [PATCH v3 3/7] net/gve: add gve_rss library for handling RSS-related behaviors Joshua Washington
2024-01-24 0:04 ` [PATCH v3 4/7] net/gve: RSS configuration update support Joshua Washington
2024-01-24 0:04 ` [PATCH v3 5/7] net/gve: RSS redirection table " Joshua Washington
2024-01-24 0:04 ` [PATCH v3 6/7] net/gve: update gve.ini with RSS capabilities Joshua Washington
2024-01-24 0:04 ` [PATCH v3 7/7] net/gve: update GVE documentation with RSS support Joshua Washington
2024-01-24 0:09 ` [PATCH 0/7] net/gve: RSS Support for GVE Driver Joshua Washington
2024-01-24 0:13 ` [PATCH v3 " Joshua Washington
2024-01-24 0:14 ` Joshua Washington
2024-01-24 0:14 ` [PATCH v3 1/7] net/gve: fully expose RSS offload support in dev_info Joshua Washington
2024-01-24 0:14 ` [PATCH v3 2/7] net/gve: RSS adminq command changes Joshua Washington
2024-01-24 0:14 ` [PATCH v3 3/7] net/gve: add gve_rss library for handling RSS-related behaviors Joshua Washington
2024-01-24 0:14 ` [PATCH v3 4/7] net/gve: RSS configuration update support Joshua Washington
2024-01-24 0:14 ` [PATCH v3 5/7] net/gve: RSS redirection table " Joshua Washington
2024-01-24 0:14 ` [PATCH v3 6/7] net/gve: update gve.ini with RSS capabilities Joshua Washington
2024-01-24 0:15 ` [PATCH v3 7/7] net/gve: update GVE documentation with RSS support Joshua Washington
[not found] ` <20240126173317.2779230-1-joshwash@google.com>
2024-01-26 17:33 ` [PATCH v4 1/7] net/gve: fully expose RSS offload support in dev_info Joshua Washington
2024-01-31 22:13 ` [PATCH v5 0/5] net/gve: RSS Support for GVE Driver Joshua Washington
2024-01-31 22:13 ` [PATCH v5 1/5] net/gve: expose RSS offload support in dev info Joshua Washington
2024-01-31 22:13 ` [PATCH v5 2/5] net/gve: add RSS adminq command Joshua Washington
2024-01-31 22:13 ` [PATCH v5 3/5] net/gve: add gve RSS library Joshua Washington
2024-01-31 22:13 ` [PATCH v5 4/5] net/gve: add RSS configuration update support Joshua Washington
2024-01-31 22:13 ` [PATCH v5 5/5] net/gve: add RSS redirection table " Joshua Washington
2024-02-01 13:28 ` [PATCH v5 0/5] net/gve: RSS Support for GVE Driver Ferruh Yigit
2024-01-26 17:33 ` [PATCH v4 2/7] net/gve: RSS adminq command changes Joshua Washington
2024-01-26 17:33 ` [PATCH v4 3/7] net/gve: add gve_rss library for handling RSS-related behaviors Joshua Washington
2024-01-26 17:33 ` [PATCH v4 4/7] net/gve: RSS configuration update support Joshua Washington
2024-01-26 17:33 ` Joshua Washington [this message]
2024-01-26 17:33 ` [PATCH v4 6/7] net/gve: update gve.ini with RSS capabilities Joshua Washington
2024-01-31 14:48 ` Ferruh Yigit
2024-01-31 14:55 ` Ferruh Yigit
2024-01-26 17:33 ` [PATCH v4 7/7] net/gve: update GVE documentation with RSS support Joshua Washington
2024-01-31 14:50 ` Ferruh Yigit
2024-01-31 14:58 ` 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=20240126173317.2779230-6-joshwash@google.com \
--to=joshwash@google.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=jeroendb@google.com \
--cc=junfeng.guo@intel.com \
--cc=rushilg@google.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).