Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp387279rdb; Fri, 17 Nov 2023 01:26:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEza9YCxFXMPwdSPS4lpxBFxVAVowTyc4lXkaJYmR0y1e2EWU3F2Q6iQKCvwB1Mii5TwMzE X-Received: by 2002:a17:902:9a8a:b0:1ca:3c63:d5d3 with SMTP id w10-20020a1709029a8a00b001ca3c63d5d3mr11338662plp.2.1700213180424; Fri, 17 Nov 2023 01:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700213180; cv=none; d=google.com; s=arc-20160816; b=gFU3SbWgKXVKVbgx+fDAcPhd/8lUCtipXX3L0Y8ojA11nhNAhP1nPbVWjK+/xXj3u+ xrAtVBfSqRta/TZiNmtQN4N1+hVKWrQDDv9vVafPxIk9c85DVf+fUSgu8ZntBamdHzul Nw4qXZmO3PGwT7iIdYkIECsM6myWDfA7PphBBmliBWjDoTS9BZm4kXrIlYkytiwWevJj 4ojXrKD5G3pPizTnIt/svDO1bwYyDMo/0/YsEsVw2R2CogyzabslxSwtP4BxtiWdsk/E H086KdtquCeCUEmKJIwQfnMSM77S+osFDGaoZ9gZCfLVph1OCTDk5kYhAFDAuFuOUUnm t34g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QwfKkPx4KRlqJ4HoJLo4xElYl19bwlbQpaDUzhgYPM0=; fh=6aFV4osdemCt6MoFpt0UvEegBbfqpK9Q3iIy746x8QU=; b=Wu0wTp6j0hskXfFAC/2RNqZr4A3uavPBsqLA4MZQT5Q+sOWk7LDaA5A24YpaxKdi1S Z3Jty88G9DYYK1pjziDLnxJZ8x4sD6KOCB3p6AyJI1UD4UbPxCHvUfYh0jpvqQhZdPKN pO5RwQsQjKF+5+c+JdpHFpDuWpqw/awIhFhMehUWukyQ8rLAkUBs2JCwDwHHPDsMGhzH dxfBAQCagtleNgoz982L9279PJI5L7BsWehz0BKMfowF1q/76AYY+gqoQQu5I/J5rmx/ 8QqOdlW001w6u0OoGGx7+MklouRKzsEBKMth6yJ5LhSrDmYIUm4oBVV8RcTuhFbBNjBz LSHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FDxpoXME; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id j7-20020a170902da8700b001c754f13381si1514329plx.455.2023.11.17.01.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 01:26:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FDxpoXME; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 800FA81D0B58; Fri, 17 Nov 2023 01:26:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230318AbjKQJ0C (ORCPT + 99 others); Fri, 17 Nov 2023 04:26:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235702AbjKQJZy (ORCPT ); Fri, 17 Nov 2023 04:25:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6955FD52 for ; Fri, 17 Nov 2023 01:25:51 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFB81C433C7; Fri, 17 Nov 2023 09:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700213151; bh=ynP6wGzU5LUouTfo4D4BIT9n/6thiSEuoVGu3nB7YEY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FDxpoXMEU2eEutnSwR58ZwSYEmEEkQoep3f+3MKVPVW280HlDub9DJTIODSirzftT GOhp+iwygQCMejWYZPNGV4Ufp0gsLHb61pEDRS3JK31CGw/hSnIiYUg9zwVgwPJokJ h+twd3Fi2YcBDa/SI7zTPJ+1pGGo2f5jbCve3sZ3HbpJaWuVR53htwbqjomx8sOwQc 6+cT4CkBwQ4E/BT0oPDDdEbBfJDfi1FTuSsFOhoKt//UnQQOqPOVipT3jXTWYEKQRs LZuVZ5j65IrlPYwdvL1njCyxxu/rydwtdT6MRisgdfPiuJNBpk2Q6c/UEvU6NZiWYm Gx0SVvxakukhA== Date: Fri, 17 Nov 2023 10:25:47 +0100 From: Lorenzo Bianconi To: Albert Huang Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Toshiaki Makita , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] veth: fix ethtool statistical errors Message-ID: References: <20231116114150.48639-1-huangjie.albert@bytedance.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wM0LZ3in3H4K3W0K" Content-Disposition: inline In-Reply-To: <20231116114150.48639-1-huangjie.albert@bytedance.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 01:26:17 -0800 (PST) --wM0LZ3in3H4K3W0K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > 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. >=20 > Fixes: 5fe6e56776ba ("veth: rely on peer veth_rq for ndo_xdp_xmit account= ing") > Signed-off-by: Albert Huang > --- > drivers/net/veth.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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 =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; > =20 > tx_idx +=3D (i % dev->real_num_tx_queues) * VETH_TQ_STATS_LEN; > --=20 > 2.20.1 >=20 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 --wM0LZ3in3H4K3W0K Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCZVcxmwAKCRA6cBh0uS2t rL8vAQCJSYOePaGYIAzOPQ5MeXrdFWCb6zjNMqja2zjHP45xGgEAwDNcSm8iPh7+ 8RLoiNT+UNlBNyHWxEGBO5trDBfoRgg= =15I0 -----END PGP SIGNATURE----- --wM0LZ3in3H4K3W0K--