Re: [PATCH net-next v2] gve: Add RSS cache for non RSS device option scenario

Simon Horman
2025-02-05T16:28:44Z

On Tue, Feb 04, 2025 at 01:31:21PM -0800, Jeroen de Borst wrote:
> From: Ziwei Xiao <ziweixiao@google.com>
>
> 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.
>
> Signed-off-by: Ziwei Xiao <ziweixiao@google.com>
> Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
> Signed-off-by: Praveen Kaligineedi <pkaligineedi@google.com>
> Signed-off-by: Jeroen de Borst <jeroend@google.com>
> ---
> 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 | 64 ++++++++++---
> drivers/net/ethernet/google/gve/gve_ethtool.c | 60 ++++++++++--
> drivers/net/ethernet/google/gve/gve_main.c | 92 ++++++++++++++++++-
> 4 files changed, 209 insertions(+), 23 deletions(-)

...

> diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/ethernet/google/gve/gve_ethtool.c
> index bdfc6e77b2af..efcafc607b2a 100644
> --- a/drivers/net/ethernet/google/gve/gve_ethtool.c
> +++ b/drivers/net/ethernet/google/gve/gve_ethtool.c
> @@ -482,6 +482,7 @@ static int gve_set_channels(struct net_device *netdev,
> struct ethtool_channels old_settings;
> int new_tx = cmd->tx_count;
> int new_rx = cmd->rx_count;
> + bool reset_rss;
>
> gve_get_channels(netdev, &old_settings);
>
> @@ -498,16 +499,14 @@ static int gve_set_channels(struct net_device *netdev,
> return -EINVAL;
> }
>
> - if (!netif_running(netdev)) {
> - priv->tx_cfg.num_queues = new_tx;
> - priv->rx_cfg.num_queues = new_rx;
> - return 0;
> - }
> + if (new_rx != priv->rx_cfg.num_queues &&
> + priv->cache_rss_config && !netif_is_rxfh_configured(netdev))
> + reset_rss = true;

Hi Jerome,

This is not a full review (which I was working on but ran out of time for now).
But, if the condition above is not met then reset_rss will be used
uninitialised below.

Flagged by W=1 build with clang-19.

>
> new_tx_cfg.num_queues = new_tx;
> new_rx_cfg.num_queues = new_rx;
>
> - return gve_adjust_queues(priv, new_rx_cfg, new_tx_cfg);
> + return gve_adjust_queues(priv, new_rx_cfg, new_tx_cfg, reset_rss);
> }
>
> static void gve_get_ringparam(struct net_device *netdev,

...

--
pw-bot: cr