Skip to contentSkip to conversation

gve: Add RSS cache for non RSS device option scenario

PATCH Applied Jeroen de Borst 2 participants 2 messages Feb 19, 2025 – Feb 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 gve: Add RSS cache for non RSS device option scenario

From: Ziwei Xiao <[email protected]>

Not all the devices have the capability for the driver to query for the registered RSS configuration. The driver can discover this by checking the relevant device option during setup. If it cannot, the driver needs to store the RSS config cache and directly return such cache when queried by the ethtool. RSS config is inited when driver probes. Also the default RSS config will be adjusted when there is RX queue count change.

At this point, only keys of GVE_RSS_KEY_SIZE and indirection tables of GVE_RSS_INDIR_SIZE are supported.

--
Change in v4:
- Removed newline from NL_SET_ERR_MSG_MOD

Changes in v3:
- Addressed clang compiler warnings
- Initialize reset_rss to address the clang warning(Simon Horman)
- Free lut memory in error case of gve_adminq_configure_rss (Kalesh Anakkur Purayil)
- Simplify gve_alloc_rss_config_cache (Kalesh Anakkur Purayi)

Changes in v2:
- Change to initialize RSS config when the driver is up instead of doing that when the user setting the RSS (Jakub Kicinski)
- Use NL_SET_ERR_MSG_MOD to log errors when there is extack available (Jakub Kicinski)
- Use ethtool_rxfh_indir_default to set default RSS indir table (Jakub Kicinski)
- Adjust the default RSS config when there is RX queue count change to ensure the default RSS config is correct

---
 drivers/net/ethernet/google/gve/gve.h         | 16 +++-
 drivers/net/ethernet/google/gve/gve_adminq.c  | 66 +++++++++++---
 drivers/net/ethernet/google/gve/gve_ethtool.c | 60 +++++++++++--
 drivers/net/ethernet/google/gve/gve_main.c    | 86 ++++++++++++++++++-
 4 files changed, 205 insertions(+), 23 deletions(-)
drivers/net/ethernet/google/gve/gve.h +15 -1
index 8167cc5fb0df..8e1e706c6f5e 100644
@@ -68,6 +68,9 @@
 #define GVE_FLOW_RULE_IDS_CACHE_SIZE \
 	(GVE_ADMINQ_BUFFER_SIZE / sizeof(((struct gve_adminq_queried_flow_rule *)0)->location))
 
+#define GVE_RSS_KEY_SIZE	40
+#define GVE_RSS_INDIR_SIZE	128
+
 #define GVE_XDP_ACTIONS 5
 
 #define GVE_GQ_TX_MIN_PKT_DESC_BYTES 182
@@ -672,6 +675,7 @@ struct gve_rx_alloc_rings_cfg {
 	u16 packet_buffer_size;
 	bool raw_addressing;
 	bool enable_header_split;
+	bool reset_rss;
 
 	/* Allocated resources are returned here */
 	struct gve_rx_ring *rx;
@@ -722,6 +726,11 @@ struct gve_flow_rules_cache {
 	u32 rule_ids_cache_num;
 };
 
+struct gve_rss_config {
+	u8 *hash_key;
+	u32 *hash_lut;
+};
+
 struct gve_priv {
 	struct net_device *dev;
 	struct gve_tx_ring *tx; /* array of tx_cfg.num_queues */
@@ -842,6 +851,8 @@ struct gve_priv {
 
 	u16 rss_key_size;
 	u16 rss_lut_size;
+	bool cache_rss_config;
+	struct gve_rss_config rss_config;
 };
 
 enum gve_service_task_flags_bit {
@@ -1210,13 +1221,16 @@ int gve_adjust_config(struct gve_priv *priv,
 		      struct gve_rx_alloc_rings_cfg *rx_alloc_cfg);
 int gve_adjust_queues(struct gve_priv *priv,
 		      struct gve_queue_config new_rx_config,
-		      struct gve_queue_config new_tx_config);
+		      struct gve_queue_config new_tx_config,
+		      bool reset_rss);
 /* flow steering rule */
 int gve_get_flow_rule_entry(struct gve_priv *priv, struct ethtool_rxnfc *cmd);
 int gve_get_flow_rule_ids(struct gve_priv *priv, struct ethtool_rxnfc *cmd, u32 *rule_locs);
 int gve_add_flow_rule(struct gve_priv *priv, struct ethtool_rxnfc *cmd);
 int gve_del_flow_rule(struct gve_priv *priv, struct ethtool_rxnfc *cmd);
 int gve_flow_rules_reset(struct gve_priv *priv);
+/* RSS config */
+int gve_init_rss_config(struct gve_priv *priv, u16 num_queues);
 /* report stats handling */
 void gve_handle_report_stats(struct gve_priv *priv);
 /* exported by ethtool.c */
drivers/net/ethernet/google/gve/gve_adminq.c +53 -13

144 lines not on this page · raw message

drivers/net/ethernet/google/gve/gve_ethtool.c +53 -7

99 lines not on this page · raw message

drivers/net/ethernet/google/gve/gve_main.c +84 -2

148 lines not on this page · raw message

Signature · 1 line
2.48.1.601.g30ceb7b040-goog
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Wed, 19 Feb 2025 12:04:51 -0800 you wrote:

From: Ziwei Xiao <[email protected]>

Not all the devices have the capability for the driver to query for the registered RSS configuration. The driver can discover this by checking the relevant device option during setup. If it cannot, the driver needs to store the RSS config cache and directly return such cache when queried by the ethtool. RSS config is inited when driver probes. Also the default RSS config will be adjusted when there is RX queue count change.

[...]

Here is the summary with links:
- [net-next,v4] gve: Add RSS cache for non RSS device option scenario

    https://git.kernel.org/netdev/net-next/c/4b9c7d8fa113

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html