From: Simon Horman <horms@kernel.org>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: Harshitha Ramamurthy <hramamurthy@google.com>,
netdev@vger.kernel.org, jeroendb@google.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, pkaligineedi@google.com,
willemb@google.com, joshwash@google.com, shailend@google.com,
jrkim@google.com, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH net] gve: handle overflow when reporting TX consumed descriptors
Date: Wed, 2 Apr 2025 11:20:15 +0100 [thread overview]
Message-ID: <20250402102015.GL214849@horms.kernel.org> (raw)
In-Reply-To: <Z+zGrWljk7u91VMY@mev-dev.igk.intel.com>
On Wed, Apr 02, 2025 at 07:10:18AM +0200, Michal Swiatkowski wrote:
> On Wed, Apr 02, 2025 at 12:10:37AM +0000, Harshitha Ramamurthy wrote:
> > From: Joshua Washington <joshwash@google.com>
> >
> > When the tx tail is less than the head (in cases of wraparound), the TX
> > consumed descriptor statistic in DQ will be reported as
> > UINT32_MAX - head + tail, which is incorrect. Mask the difference of
> > head and tail according to the ring size when reporting the statistic.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 2c9198356d56 ("gve: Add consumed counts to ethtool stats")
> > Signed-off-by: Joshua Washington <joshwash@google.com>
> > Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
> > ---
> > drivers/net/ethernet/google/gve/gve_ethtool.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/google/gve/gve_ethtool.c b/drivers/net/ethernet/google/gve/gve_ethtool.c
> > index 31a21ccf4863..4dea1fdce748 100644
> > --- a/drivers/net/ethernet/google/gve/gve_ethtool.c
> > +++ b/drivers/net/ethernet/google/gve/gve_ethtool.c
> > @@ -392,7 +392,9 @@ gve_get_ethtool_stats(struct net_device *netdev,
> > */
> > data[i++] = 0;
> > data[i++] = 0;
> > - data[i++] = tx->dqo_tx.tail - tx->dqo_tx.head;
> > + data[i++] =
> > + (tx->dqo_tx.tail - tx->dqo_tx.head) &
> > + tx->mask;
>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>
> I will add it in gve_tx_dqo.c as num_used_tx_slots() and simplify
> num_avail_tx_slots()
> {
> return tx->mask - num_used_tx_slots();
> }
> but it isn't needed, even maybe unwanted as this is just fix.
I think that would be a nice cleanup, but should be as a follow-up
to this minimal fix.
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2025-04-02 10:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 0:10 [PATCH net] gve: handle overflow when reporting TX consumed descriptors Harshitha Ramamurthy
2025-04-02 5:10 ` Michal Swiatkowski
2025-04-02 10:20 ` Simon Horman [this message]
2025-04-03 22:20 ` patchwork-bot+netdevbpf
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=20250402102015.GL214849@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hramamurthy@google.com \
--cc=jeroendb@google.com \
--cc=joshwash@google.com \
--cc=jrkim@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pkaligineedi@google.com \
--cc=shailend@google.com \
--cc=stable@vger.kernel.org \
--cc=willemb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.