From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE8D5125A0 for ; Mon, 20 Nov 2023 09:51:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="evn177yY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCEC5C433C8; Mon, 20 Nov 2023 09:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700473909; bh=TV25DohQMrEGWPZRjX0RacFKMm4hRFAcqopvFP8hYwg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=evn177yYwwW/a5I8QrF7Psp+mK6S0rqPvr2rd6lE/6InVnMuxg89YKyCaF5ZvDT0q OxUA2K2zBcrbVbGRqHk0C7XVjYfNty8q1TL1/6Kt5pMJG0CAKkCaOKQjcZ4OM057Mv Q3ybusUxms5RpNLJ6J7F/7GNUZkoKcWBRObnv7ke6Sm3yvjMp6+nbNe4MlGfivFaAJ gTJvP/F35uIgnCXBRW83XHAb7OI01kJHMfFmvB4Mo2pjdy5f2SRj+jZffENbwF7pCO 8gPCLKBWHS7tl4NNwFte3j7TUyD833np5aB0BFto8NUtBKPcfNyI/8/3i9NadEd6K8 48IMeKHj0VaKA== Date: Mon, 20 Nov 2023 10:51:45 +0100 From: Lorenzo Bianconi To: =?utf-8?B?6buE5p2w?= Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Toshiaki Makita , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [External] Re: [PATCH net] veth: fix ethtool statistical errors Message-ID: References: <20231116114150.48639-1-huangjie.albert@bytedance.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="VZMxcV+xIR+W6tFj" Content-Disposition: inline In-Reply-To: --VZMxcV+xIR+W6tFj Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > Lorenzo Bianconi =E4=BA=8E2023=E5=B9=B411=E6=9C=8817= =E6=97=A5=E5=91=A8=E4=BA=94 17:26=E5=86=99=E9=81=93=EF=BC=9A > > > > > 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 acc= ounting") > > > Signed-off-by: Albert Huang > > > --- > > > 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_dev= ice *dev, > > > for (i =3D 0; i < peer->real_num_rx_queues; i++) { > > > const struct veth_rq_stats *rq_stats =3D &rcv_priv->rq[= i].stats; > > > const void *base =3D (void *)&rq_stats->vs; > > > - unsigned int start, tx_idx =3D idx; > > > + unsigned int start, tx_idx =3D pp_idx; > > > size_t offset; > > > > > > tx_idx +=3D (i % dev->real_num_tx_queues) * VETH_TQ_STA= TS_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 bo= th > > peers? >=20 > Hi, Lorenzo > I found this because I wanted to add more echo information in ethttool=EF= =BC=88for veth, > but I found that the information was incorrect. That's why I paid > attention here. ack. Could you please share the veth pair tx/rx queue configuration? Rergards, Lorenzo >=20 > > 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. > > > OK. I don't know if this is a known issue. >=20 > BR > Albert >=20 >=20 > > Regards, > > Lorenzo --VZMxcV+xIR+W6tFj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCZVssMQAKCRA6cBh0uS2t rOdWAPsG9iBF4iqCk1hj4Vo7HUDtpFulSUqaXmU6X6jFvBuxAAD7BTR4ocKKXDqC MJMd9CBLhHzJGZg0xMaedYS/Ie7spwg= =msjy -----END PGP SIGNATURE----- --VZMxcV+xIR+W6tFj--