gve: Add RSS cache for non RSS device option scenario
Subsystems (3)
PATCH v3 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.
--
Changes in v3:
- 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
@@ -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
Jakub Kicinski
maintainerdrivers/net/ethernet/google/gve/gve_ethtool.c static int gve_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rx · line 915
Quoted 4 lines · On Thu, 13 Feb 2025 15:38:28 -0800 Jeroen de Borst wrote:
drivers/net/ethernet/google/gve/gve_ethtool.c +3
-1-return gve_adminq_configure_rss (priv, rxfh); + err =gve_adminq_configure_rss (priv, rxfh); +if (err) { +NL_SET_ERR_MSG_MOD (extack,"Fail to configure RSS config\n" );
coccicheck says:
drivers/net/ethernet/google/gve/gve_ethtool.c:915:29-61: WARNING avoid newline at end of message in NL_SET_ERR_MSG_MOD
Signature · 1 line
pw-bot: cr
Quoted 10 lines · Jakub Kicinski
drivers/net/ethernet/google/gve/gve_ethtool.c static int gve_get_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rx · line 915
Quoted 4 lines · On Thu, 13 Feb 2025 15:38:28 -0800 Jeroen de Borst wrote:
drivers/net/ethernet/google/gve/gve_ethtool.c +3
-1-return gve_adminq_configure_rss (priv, rxfh); + err =gve_adminq_configure_rss (priv, rxfh); +if (err) { +NL_SET_ERR_MSG_MOD (extack,"Fail to configure RSS config\n" );coccicheck says:
drivers/net/ethernet/google/gve/gve_ethtool.c:915:29-61: WARNING avoid newline at end of message in
NL_SET_ERR_MSG_MOD
Thanks for pointing this out. Will send a v4 patch to remove the \n.
Quoted 2 lines
--
pw-bot: cr