From: Zhao Li <enderaoelyther@gmail.com>
To: Joshua Washington <joshwash@google.com>,
Harshitha Ramamurthy <hramamurthy@google.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Willem de Bruijn <willemb@google.com>,
Jordan Rhee <jordanrhee@google.com>,
Ankit Garg <nktgrg@google.com>, Ziwei Xiao <ziweixiao@google.com>,
Jeroen de Borst <jeroendb@google.com>,
Praveen Kaligineedi <pkaligineedi@google.com>,
Tim Hostetler <thostet@google.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Matt Olson <maolson@google.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Zhao Li <enderaoelyther@gmail.com>
Subject: [PATCH net v2] gve: mark the flow rule cache out of sync when a rule update fails
Date: Thu, 19 Nov 2026 12:45:37 +0800 [thread overview]
Message-ID: <20261119044537.57936-1-enderaoelyther@gmail.com> (raw)
gve_adminq_configure_flow_rule() marks the flow rule cache out of sync
only when the device accepts the command, although a failed add,
delete or reset can leave the device state unknown.
gve_reset() sends the flow rule reset command from
gve_teardown_control_plane_resources() and then frees and reallocates
the cache buffers. If that command fails, the cache keeps its nonzero
rule count and stays marked in sync, but its entries are now zeroed.
gve_get_flow_rule_entry() then finds location 0 inside the cached range,
since every zeroed entry has location 0, and reports an all-zero
TCP/IPv4 rule that steers to queue 0, whatever the device holds at that
location. Queries for other locations fall outside the cached range and
read the rules from the device again.
Mark the cache out of sync whenever a flow rule command is attempted,
so that the next query reads the rules from the device.
Found by an AI code review agent; not triggered. Compile-tested with W=1.
Fixes: 57718b60df9b ("gve: Add flow steering adminq commands")
Suggested-by: Harshitha Ramamurthy <hramamurthy@google.com>
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
---
v2:
- mark the cache out of sync on every flow rule command instead of
clearing it when its buffers are freed (Harshitha Ramamurthy)
- describe the problem in more detail; drop Cc: stable
v1: https://lore.kernel.org/netdev/20261118023429.29330-1-enderaoelyther@gmail.com/
No new W=1, sparse or smatch warnings.
drivers/net/ethernet/google/gve/gve_adminq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
index 2c848f0c23dc..d0e0d9ace3bc 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.c
+++ b/drivers/net/ethernet/google/gve/gve_adminq.c
@@ -1401,8 +1401,7 @@ gve_adminq_configure_flow_rule(struct gve_priv *priv,
sizeof(struct gve_adminq_configure_flow_rule),
flow_rule_cmd);
- if (!err)
- priv->flow_rules_cache.rules_cache_synced = false;
+ priv->flow_rules_cache.rules_cache_synced = false;
return err;
}
base-commit: e203d8a4751d48aa00eda31e3b320ba8e0d47dbf
--
2.56.1
reply other threads:[~2026-11-19 4:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261119044537.57936-1-enderaoelyther@gmail.com \
--to=enderaoelyther@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hramamurthy@google.com \
--cc=jeroendb@google.com \
--cc=jordanrhee@google.com \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maolson@google.com \
--cc=netdev@vger.kernel.org \
--cc=nktgrg@google.com \
--cc=pabeni@redhat.com \
--cc=pkaligineedi@google.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=thostet@google.com \
--cc=willemb@google.com \
--cc=ziweixiao@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