From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Albert Huang <huangjie.albert@bytedance.com>
Cc: Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Toshiaki Makita <toshiaki.makita1@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] veth: fix ethtool statistical errors
Date: Fri, 17 Nov 2023 10:25:47 +0100 [thread overview]
Message-ID: <ZVcxmwm/DRTB8QwO@lore-desk> (raw)
In-Reply-To: <20231116114150.48639-1-huangjie.albert@bytedance.com>
[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]
> if peer->real_num_rx_queues > 1, the ethtool -s command for
> veth network device will display some error statistical values.
> The value of tx_idx is reset with each iteration, so even if
> peer->real_num_rx_queues is greater than 1, the value of tx_idx
> will remain constant. This results in incorrect statistical values.
> To fix this issue, assign the value of pp_idx to tx_idx.
>
> Fixes: 5fe6e56776ba ("veth: rely on peer veth_rq for ndo_xdp_xmit accounting")
> Signed-off-by: Albert Huang <huangjie.albert@bytedance.com>
> ---
> drivers/net/veth.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 0deefd1573cf..3a8e3fc5eeb5 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -225,7 +225,7 @@ static void veth_get_ethtool_stats(struct net_device *dev,
> for (i = 0; i < peer->real_num_rx_queues; i++) {
> const struct veth_rq_stats *rq_stats = &rcv_priv->rq[i].stats;
> const void *base = (void *)&rq_stats->vs;
> - unsigned int start, tx_idx = idx;
> + unsigned int start, tx_idx = pp_idx;
> size_t offset;
>
> tx_idx += (i % dev->real_num_tx_queues) * VETH_TQ_STATS_LEN;
> --
> 2.20.1
>
Hi Albert,
Can you please provide more details about the issue you are facing?
In particular, what is the number of configured tx and rx queues for both
peers?
tx_idx is the index of the current (local) tx queue and it must restart from
idx in each iteration otherwise we will have an issue when
peer->real_num_rx_queues is greater than dev->real_num_tx_queues.
Regards,
Lorenzo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-11-17 9:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 11:41 [PATCH net] veth: fix ethtool statistical errors Albert Huang
2023-11-17 9:25 ` Lorenzo Bianconi [this message]
2023-11-20 9:45 ` [External] " 黄杰
2023-11-20 9:51 ` Lorenzo Bianconi
2023-11-20 10:02 ` 黄杰
2023-11-20 10:55 ` Lorenzo Bianconi
2023-11-20 11:01 ` 黄杰
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=ZVcxmwm/DRTB8QwO@lore-desk \
--to=lorenzo@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=huangjie.albert@bytedance.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=toshiaki.makita1@gmail.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