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 v5 4/5] net/gve: add RSS configuration update support
Date: Wed, 31 Jan 2024 14:13:07 -0800 [thread overview]
Message-ID: <20240131221308.2208815-5-joshwash@google.com> (raw)
In-Reply-To: <20240131221308.2208815-1-joshwash@google.com>
This patch adds support for updating the RSS hash key and hash fields
in the GVE PMD through the implementation of rss_hash_update and
rss_hash_conf_get.
The RSS hash key for gVNIC is required to be 40 bytes. On initial
configuration of the RSS hash key, the RSS redirection table will be
set to a static default, using a round-robin approach for all queues.
Note, however, that this patch does not include support for setting the
redirection table explicitly. In dev_configure, if the static
redirection table has been set, it will be updated to reflect the new
queue count, if it has changed.
The RSS key must be set before any other RSS configuration can happen.
As such, an attempt to set the hash types before the key is configured
will fail.
Signed-off-by: Joshua Washington <joshwash@google.com>
Reviewed-by: Rushil Gupta <rushilg@google.com>
Reviewed-by: Jeroen de Borst <jeroendb@google.com>
---
doc/guides/nics/features/gve.ini | 1 +
doc/guides/nics/gve.rst | 20 +++--
drivers/net/gve/gve_ethdev.c | 132 ++++++++++++++++++++++++++++++-
drivers/net/gve/gve_ethdev.h | 3 +
4 files changed, 148 insertions(+), 8 deletions(-)
diff --git a/doc/guides/nics/features/gve.ini b/doc/guides/nics/features/gve.ini
index 838edd456a..4381b1565f 100644
--- a/doc/guides/nics/features/gve.ini
+++ b/doc/guides/nics/features/gve.ini
@@ -9,6 +9,7 @@ Link status = Y
MTU update = Y
TSO = Y
RSS hash = Y
+RSS key update = Y
L4 checksum offload = Y
Basic stats = Y
Linux = Y
diff --git a/doc/guides/nics/gve.rst b/doc/guides/nics/gve.rst
index 1c3eaf03ef..908b2aab11 100644
--- a/doc/guides/nics/gve.rst
+++ b/doc/guides/nics/gve.rst
@@ -70,6 +70,7 @@ Supported features of the GVE PMD are:
- Link state information
- Tx multi-segments (Scatter Tx)
- Tx UDP/TCP/SCTP Checksum
+- RSS hash configuration
Currently, only GQI_QPL and GQI_RDA queue format are supported in PMD.
Jumbo Frame is not supported in PMD for now.
@@ -77,10 +78,17 @@ It'll be added in a future DPDK release.
Also, only GQI_QPL queue format is in use on GCP
since GQI_RDA hasn't been released in production.
-Currently, setting MTU with value larger than 1460 is not supported.
+RSS
+^^^
+
+GVE RSS can be enabled and configured using the standard interfaces. The driver
+does not support querying the initial RSS configuration.
+
+The RSS hash key must be exactly 40 bytes. Upon RSS hash configuration, a
+default redirection table will be set using a round-robin assignment of hash
+values to queues. The default GVE redirection table has 128 entries.
+
+Note that the initial configuration requires a hash key to be provided if one
+had not been provided before. Attempting to set hash types alone without the
+existence of a set key will result in a failed request.
-Currently, only "RSS hash" is force enabled
-so that the backend hardware device calculated hash values
-could be shared with applications.
-But for RSS, there is no such API to config RSS hash function or RETA table.
-So, limited RSS is supported only with default config/setting.
diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index 936ca22cb9..2a68d31808 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(C) 2022 Intel Corporation
+ * Copyright(C) 2022-2023 Intel Corporation
+ * Copyright(C) 2023 Google LLC
*/
#include "gve_ethdev.h"
@@ -8,6 +9,7 @@
#include "base/gve_osdep.h"
#include "gve_version.h"
#include "rte_ether.h"
+#include "gve_rss.h"
static void
gve_write_version(uint8_t *driver_version_register)
@@ -88,12 +90,31 @@ gve_dev_configure(struct rte_eth_dev *dev)
{
struct gve_priv *priv = dev->data->dev_private;
- if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
+ if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) {
dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
+ priv->rss_config.alg = GVE_RSS_HASH_TOEPLITZ;
+ }
if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TCP_LRO)
priv->enable_rsc = 1;
+ /* Reset RSS RETA in case number of queues changed. */
+ if (priv->rss_config.indir) {
+ struct gve_rss_config update_reta_config;
+ gve_init_rss_config_from_priv(priv, &update_reta_config);
+ gve_generate_rss_reta(dev, &update_reta_config);
+
+ int err = gve_adminq_configure_rss(priv, &update_reta_config);
+ if (err)
+ PMD_DRV_LOG(ERR,
+ "Could not reconfigure RSS redirection table.");
+ else
+ gve_update_priv_rss_config(priv, &update_reta_config);
+
+ gve_free_rss_config(&update_reta_config);
+ return err;
+ }
+
return 0;
}
@@ -443,6 +464,8 @@ gve_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
};
dev_info->flow_type_rss_offloads = GVE_RTE_RSS_OFFLOAD_ALL;
+ dev_info->hash_key_size = GVE_RSS_HASH_KEY_SIZE;
+ dev_info->reta_size = GVE_RSS_INDIR_SIZE;
return 0;
}
@@ -646,6 +669,107 @@ gve_xstats_get_names(struct rte_eth_dev *dev,
return count;
}
+
+static int
+gve_rss_hash_update(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct gve_priv *priv = dev->data->dev_private;
+ struct gve_rss_config gve_rss_conf;
+ int rss_reta_size;
+ int err;
+
+ if (gve_validate_rss_hf(rss_conf->rss_hf)) {
+ PMD_DRV_LOG(ERR, "Unsupported hash function.");
+ return -EINVAL;
+ }
+
+ if (rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_TOEPLITZ &&
+ rss_conf->algorithm != RTE_ETH_HASH_FUNCTION_DEFAULT) {
+ PMD_DRV_LOG(ERR, "Device only supports Toeplitz algorithm.");
+ return -EINVAL;
+ }
+
+ if (rss_conf->rss_key_len) {
+ if (rss_conf->rss_key_len != GVE_RSS_HASH_KEY_SIZE) {
+ PMD_DRV_LOG(ERR,
+ "Invalid hash key size. Only RSS hash key size "
+ "of %u supported", GVE_RSS_HASH_KEY_SIZE);
+ return -EINVAL;
+ }
+
+ if (!rss_conf->rss_key) {
+ PMD_DRV_LOG(ERR, "RSS key must be non-null.");
+ return -EINVAL;
+ }
+ } else {
+ if (!priv->rss_config.key_size) {
+ PMD_DRV_LOG(ERR, "RSS key must be initialized before "
+ "any other configuration.");
+ return -EINVAL;
+ }
+ rss_conf->rss_key_len = priv->rss_config.key_size;
+ }
+
+ rss_reta_size = priv->rss_config.indir ?
+ priv->rss_config.indir_size :
+ GVE_RSS_INDIR_SIZE;
+ err = gve_init_rss_config(&gve_rss_conf, rss_conf->rss_key_len,
+ rss_reta_size);
+ if (err)
+ return err;
+
+ gve_rss_conf.alg = GVE_RSS_HASH_TOEPLITZ;
+ err = gve_update_rss_hash_types(priv, &gve_rss_conf, rss_conf);
+ if (err)
+ goto err;
+ err = gve_update_rss_key(priv, &gve_rss_conf, rss_conf);
+ if (err)
+ goto err;
+
+ /* Set redirection table to default or preexisting. */
+ if (!priv->rss_config.indir)
+ gve_generate_rss_reta(dev, &gve_rss_conf);
+ else
+ memcpy(gve_rss_conf.indir, priv->rss_config.indir,
+ gve_rss_conf.indir_size * sizeof(*priv->rss_config.indir));
+
+ err = gve_adminq_configure_rss(priv, &gve_rss_conf);
+ if (!err)
+ gve_update_priv_rss_config(priv, &gve_rss_conf);
+
+err:
+ gve_free_rss_config(&gve_rss_conf);
+ return err;
+}
+
+static int
+gve_rss_hash_conf_get(struct rte_eth_dev *dev,
+ struct rte_eth_rss_conf *rss_conf)
+{
+ struct gve_priv *priv = dev->data->dev_private;
+
+ if (!(dev->data->dev_conf.rxmode.offloads &
+ RTE_ETH_RX_OFFLOAD_RSS_HASH)) {
+ PMD_DRV_LOG(ERR, "RSS not configured.");
+ return -ENOTSUP;
+ }
+
+
+ gve_to_rte_rss_hf(priv->rss_config.hash_types, rss_conf);
+ rss_conf->rss_key_len = priv->rss_config.key_size;
+ if (rss_conf->rss_key) {
+ if (!priv->rss_config.key) {
+ PMD_DRV_LOG(ERR, "Unable to retrieve default RSS hash key.");
+ return -ENOTSUP;
+ }
+ memcpy(rss_conf->rss_key, priv->rss_config.key,
+ rss_conf->rss_key_len * sizeof(*rss_conf->rss_key));
+ }
+
+ return 0;
+}
+
static const struct eth_dev_ops gve_eth_dev_ops = {
.dev_configure = gve_dev_configure,
.dev_start = gve_dev_start,
@@ -666,6 +790,8 @@ static const struct eth_dev_ops gve_eth_dev_ops = {
.mtu_set = gve_dev_mtu_set,
.xstats_get = gve_xstats_get,
.xstats_get_names = gve_xstats_get_names,
+ .rss_hash_update = gve_rss_hash_update,
+ .rss_hash_conf_get = gve_rss_hash_conf_get,
};
static const struct eth_dev_ops gve_eth_dev_ops_dqo = {
@@ -688,6 +814,8 @@ static const struct eth_dev_ops gve_eth_dev_ops_dqo = {
.mtu_set = gve_dev_mtu_set,
.xstats_get = gve_xstats_get,
.xstats_get_names = gve_xstats_get_names,
+ .rss_hash_update = gve_rss_hash_update,
+ .rss_hash_conf_get = gve_rss_hash_conf_get,
};
static void
diff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h
index bc486cb941..d713657d10 100644
--- a/drivers/net/gve/gve_ethdev.h
+++ b/drivers/net/gve/gve_ethdev.h
@@ -29,6 +29,9 @@
#define GVE_RX_MIN_BUF_SIZE_GQI 2048
#define GVE_RX_MAX_BUF_SIZE_GQI 4096
+#define GVE_RSS_HASH_KEY_SIZE 40
+#define GVE_RSS_INDIR_SIZE 128
+
#define GVE_TX_CKSUM_OFFLOAD_MASK ( \
RTE_MBUF_F_TX_L4_MASK | \
RTE_MBUF_F_TX_TCP_SEG)
--
2.43.0.429.g432eaa2c6b-goog
next prev parent reply other threads:[~2024-01-31 22:14 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 ` Joshua Washington [this message]
2024-01-31 22:13 ` [PATCH v5 5/5] net/gve: add RSS redirection table update support 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 ` [PATCH v4 5/7] net/gve: RSS redirection table " Joshua Washington
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=20240131221308.2208815-5-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).