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 2/5] net/gve: add RSS adminq command
Date: Wed, 31 Jan 2024 14:13:05 -0800 [thread overview]
Message-ID: <20240131221308.2208815-3-joshwash@google.com> (raw)
In-Reply-To: <20240131221308.2208815-1-joshwash@google.com>
This change introduces admin queue changes that enable the configuration
of RSS parameters for the GVE driver.
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/base/gve.h | 15 ++++++++
drivers/net/gve/base/gve_adminq.c | 58 +++++++++++++++++++++++++++++++
drivers/net/gve/base/gve_adminq.h | 29 ++++++++++++++++
drivers/net/gve/gve_ethdev.h | 6 +++-
4 files changed, 107 insertions(+), 1 deletion(-)
diff --git a/drivers/net/gve/base/gve.h b/drivers/net/gve/base/gve.h
index f7b297e759..9c58fc4238 100644
--- a/drivers/net/gve/base/gve.h
+++ b/drivers/net/gve/base/gve.h
@@ -51,4 +51,19 @@ enum gve_state_flags_bit {
GVE_PRIV_FLAGS_NAPI_ENABLED = 4,
};
+enum gve_rss_hash_algorithm {
+ GVE_RSS_HASH_UNDEFINED = 0,
+ GVE_RSS_HASH_TOEPLITZ = 1,
+};
+
+struct gve_rss_config {
+ uint16_t hash_types;
+ enum gve_rss_hash_algorithm alg;
+ uint16_t key_size;
+ uint16_t indir_size;
+ uint8_t *key;
+ uint32_t *indir;
+};
+
+
#endif /* _GVE_H_ */
diff --git a/drivers/net/gve/base/gve_adminq.c b/drivers/net/gve/base/gve_adminq.c
index 343bd13d67..629d15cfbe 100644
--- a/drivers/net/gve/base/gve_adminq.c
+++ b/drivers/net/gve/base/gve_adminq.c
@@ -389,6 +389,9 @@ static int gve_adminq_issue_cmd(struct gve_priv *priv,
case GVE_ADMINQ_DECONFIGURE_DEVICE_RESOURCES:
priv->adminq_dcfg_device_resources_cnt++;
break;
+ case GVE_ADMINQ_CONFIGURE_RSS:
+ priv->adminq_cfg_rss_cnt++;
+ break;
case GVE_ADMINQ_SET_DRIVER_PARAMETER:
priv->adminq_set_driver_parameter_cnt++;
break;
@@ -938,3 +941,58 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
gve_free_dma_mem(&ptype_map_dma_mem);
return err;
}
+
+int gve_adminq_configure_rss(struct gve_priv *priv,
+ struct gve_rss_config *rss_config)
+{
+ struct gve_dma_mem indirection_table_dma_mem;
+ struct gve_dma_mem rss_key_dma_mem;
+ union gve_adminq_command cmd;
+ __be32 *indir = NULL;
+ u8 *key = NULL;
+ int err = 0;
+ int i;
+
+ if (!rss_config->indir_size || !rss_config->key_size)
+ return -EINVAL;
+
+ indir = gve_alloc_dma_mem(&indirection_table_dma_mem,
+ rss_config->indir_size *
+ sizeof(*rss_config->indir));
+ if (!indir) {
+ err = -ENOMEM;
+ goto out;
+ }
+ for (i = 0; i < rss_config->indir_size; i++)
+ indir[i] = cpu_to_be32(rss_config->indir[i]);
+
+ key = gve_alloc_dma_mem(&rss_key_dma_mem,
+ rss_config->key_size *
+ sizeof(*rss_config->key));
+ if (!key) {
+ err = -ENOMEM;
+ goto out;
+ }
+ memcpy(key, rss_config->key, rss_config->key_size);
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.opcode = cpu_to_be32(GVE_ADMINQ_CONFIGURE_RSS);
+ cmd.configure_rss = (struct gve_adminq_configure_rss) {
+ .hash_types = cpu_to_be16(rss_config->hash_types),
+ .halg = rss_config->alg,
+ .hkey_len = cpu_to_be16(rss_config->key_size),
+ .indir_len = cpu_to_be16(rss_config->indir_size),
+ .hkey_addr = cpu_to_be64(rss_key_dma_mem.pa),
+ .indir_addr = cpu_to_be64(indirection_table_dma_mem.pa),
+ };
+
+ err = gve_adminq_execute_cmd(priv, &cmd);
+
+out:
+ if (indir)
+ gve_free_dma_mem(&indirection_table_dma_mem);
+ if (key)
+ gve_free_dma_mem(&rss_key_dma_mem);
+ return err;
+}
+
diff --git a/drivers/net/gve/base/gve_adminq.h b/drivers/net/gve/base/gve_adminq.h
index f05362f85f..95f4960561 100644
--- a/drivers/net/gve/base/gve_adminq.h
+++ b/drivers/net/gve/base/gve_adminq.h
@@ -19,6 +19,7 @@ enum gve_adminq_opcodes {
GVE_ADMINQ_DESTROY_TX_QUEUE = 0x7,
GVE_ADMINQ_DESTROY_RX_QUEUE = 0x8,
GVE_ADMINQ_DECONFIGURE_DEVICE_RESOURCES = 0x9,
+ GVE_ADMINQ_CONFIGURE_RSS = 0xA,
GVE_ADMINQ_SET_DRIVER_PARAMETER = 0xB,
GVE_ADMINQ_REPORT_STATS = 0xC,
GVE_ADMINQ_REPORT_LINK_SPEED = 0xD,
@@ -377,6 +378,27 @@ struct gve_adminq_get_ptype_map {
__be64 ptype_map_addr;
};
+#define GVE_RSS_HASH_IPV4 BIT(0)
+#define GVE_RSS_HASH_TCPV4 BIT(1)
+#define GVE_RSS_HASH_IPV6 BIT(2)
+#define GVE_RSS_HASH_IPV6_EX BIT(3)
+#define GVE_RSS_HASH_TCPV6 BIT(4)
+#define GVE_RSS_HASH_TCPV6_EX BIT(5)
+#define GVE_RSS_HASH_UDPV4 BIT(6)
+#define GVE_RSS_HASH_UDPV6 BIT(7)
+#define GVE_RSS_HASH_UDPV6_EX BIT(8)
+
+/* RSS configuration command */
+struct gve_adminq_configure_rss {
+ __be16 hash_types;
+ u8 halg; /* hash algorithm */
+ u8 reserved;
+ __be16 hkey_len;
+ __be16 indir_len;
+ __be64 hkey_addr;
+ __be64 indir_addr;
+};
+
union gve_adminq_command {
struct {
__be32 opcode;
@@ -391,6 +413,7 @@ union gve_adminq_command {
struct gve_adminq_describe_device describe_device;
struct gve_adminq_register_page_list reg_page_list;
struct gve_adminq_unregister_page_list unreg_page_list;
+ struct gve_adminq_configure_rss configure_rss;
struct gve_adminq_set_driver_parameter set_driver_param;
struct gve_adminq_report_stats report_stats;
struct gve_adminq_report_link_speed report_link_speed;
@@ -404,6 +427,8 @@ union gve_adminq_command {
GVE_CHECK_UNION_LEN(64, gve_adminq_command);
+struct gve_priv;
+struct gve_queue_page_list;
int gve_adminq_alloc(struct gve_priv *priv);
void gve_adminq_free(struct gve_priv *priv);
void gve_adminq_release(struct gve_priv *priv);
@@ -433,4 +458,8 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
int gve_adminq_verify_driver_compatibility(struct gve_priv *priv,
u64 driver_info_len,
dma_addr_t driver_info_addr);
+
+int gve_adminq_configure_rss(struct gve_priv *priv,
+ struct gve_rss_config *rss_config);
+
#endif /* _GVE_ADMINQ_H */
diff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h
index 14c72ec91a..f7635e829c 100644
--- a/drivers/net/gve/gve_ethdev.h
+++ b/drivers/net/gve/gve_ethdev.h
@@ -39,7 +39,10 @@
RTE_ETH_RSS_IPV6 | \
RTE_ETH_RSS_IPV6_EX | \
RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
- RTE_ETH_RSS_IPV6_TCP_EX)
+ RTE_ETH_RSS_IPV6_TCP_EX | \
+ RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
+ RTE_ETH_RSS_IPV6_UDP_EX)
/* A list of pages registered with the device during setup and used by a queue
* as buffers
@@ -264,6 +267,7 @@ struct gve_priv {
uint32_t adminq_destroy_tx_queue_cnt;
uint32_t adminq_destroy_rx_queue_cnt;
uint32_t adminq_dcfg_device_resources_cnt;
+ uint32_t adminq_cfg_rss_cnt;
uint32_t adminq_set_driver_parameter_cnt;
uint32_t adminq_report_stats_cnt;
uint32_t adminq_report_link_speed_cnt;
--
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 ` Joshua Washington [this message]
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 ` [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-3-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).