Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2100610rdb; Mon, 20 Nov 2023 01:46:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlQradexrElA77UeKty6vdSJxSfqll6jtLnQuBullXleV9X2BPvDhvGyPvZllGH6YxW9En X-Received: by 2002:a05:6a21:3282:b0:188:9f15:796b with SMTP id yt2-20020a056a21328200b001889f15796bmr9808012pzb.1.1700473597298; Mon, 20 Nov 2023 01:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700473597; cv=none; d=google.com; s=arc-20160816; b=HH8Mupok4vfbOXYEe8fGW/J3SZZ95qtNrirB03R8qcTycEOfJNZ/afzR6EDoh39YQg bev0XdPc3xY3le3Ju61u/+qNG8K7lgnGx7ATEWS00nV6wOir3y0dHn2bPF8uB/ikKW15 KI8Uc5tKxpYJUEXAg7A4X5J1ypKCQ5dclTyI7lTjMKwlrbGnq0BDXtSORxTUXgcNab6R f+o5Ik2XjAcLZvQFppnL/DOXiQJxpLlX5c5c4/f+gzvnDIRc5u1E8Vhri7XfGhv59J/s Dh9G+LslRBqnJeUfZnAt4cF/rLwn61jim+HSK2WtGGH77ypJO3DpDDyVOotH8nmFIBNI /YEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zkX770QsciZgmyIjGlD/aDGrwKJCqahJAwyCfq7+gms=; fh=Bjnrhy+jL9qvI5l7os7iBLPIVPdCM3PZpIzFqcrefAg=; b=fg+Alv5EDxVUqHZNXMkg+L0v0rEJvgaRDnBqzLqUkzoqVD3rVvDhUmz3GOnxOqgpQg orbR657qoyI9sOuGDLeGundR8WjsBqsbjocUktpvG+byNf0JhGy1x/X4Tq3PSnO2vUvT Z8rwCAM1hcCgv3MNNWoIiDr5PJgyreP7XaJLj3NrDDypvk7HFKheB57I9+DT8eWaRwYH 7Qil1NuZRSMVyKW46dB7rOWNdA1wemDM9dN0KZJkxoIsa/mMoC1UsX08tF0MKLFEb4v9 a3ycCoBAKvsJo7wFHQHxVuQMu04CeZLRzgzR4jkuaDP9aSWxvdg6X22NOoCk+l2KlK3k foXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=em0LFo0+; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id o5-20020a1709026b0500b001ce5b9a512fsi7496577plk.606.2023.11.20.01.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 01:46:37 -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=@bytedance.com header.s=google header.b=em0LFo0+; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id BBAF480947F8; Mon, 20 Nov 2023 01:46:34 -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 S232370AbjKTJq2 (ORCPT + 99 others); Mon, 20 Nov 2023 04:46:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232229AbjKTJq1 (ORCPT ); Mon, 20 Nov 2023 04:46:27 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 416FBA7 for ; Mon, 20 Nov 2023 01:46:01 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2c503dbe50dso54490101fa.1 for ; Mon, 20 Nov 2023 01:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1700473559; x=1701078359; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zkX770QsciZgmyIjGlD/aDGrwKJCqahJAwyCfq7+gms=; b=em0LFo0+cNdIwjHui+KvAJqhsgPFIryudKSw7lvCaZkfx5RO7o8Mqc7OrgvX6AyGuH PhkeM8C5Us3U6x/f1oeEjd5/4IW98UwJK0lzs0fM5/5LMwfluNFD6GHv14CXje6Vw92m oXuWl7mhIf2tp2bD9maiczdrRXQtRVjNRDQucBbBQIiJ2SbGgZGsgvHFtqMQhgl0qxoP zXeAub3ZG6LY8bFr1tI/FZQtylF+Xz9ryw/lVGpKRgYQbQskQJg+Wfst3Vswdk2zRde5 C9sXJQY8Kl3n1wC8/tJloR9et6V7DOoQrXvJzOoGeG5tuwqVJV3JUF98qYMLZgHz35fY wQrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700473559; x=1701078359; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zkX770QsciZgmyIjGlD/aDGrwKJCqahJAwyCfq7+gms=; b=ALbX1SQCMsQtLzk4D3g7ThgzvLZLYGlOmvpf3j6ZUIc8RXnDcASCjo9cs/KhtqvuVI 3N6PEaEu4YycoOeEdy7rz11wreBHudfZGM7RLA03UForQIrjNu5NlBKggzhnLqj8eIgO MQIdDgf1fIALOqzNTO9mtQ0QgOlWAG2gBi2hZATx6zz79quAHDn9J4LF05iA5rNh7yUz 0Q0LWqomVuWLgcSd+7Y7xQXu2U+UZIj1rTSyCEbOGFHN82lKzKqfkE7+5YQJl5NB1SeY WA132kBvmM7wJQmehjh2GflcLxBjexspeIf+QAWpAy5Mnfjn0/J8l1ZVDk7V92RKmC3F 1Wuw== X-Gm-Message-State: AOJu0YyFThNwczvkLliGieUKLLRIDb2j2yN34bKYyqvKoJL76oVbliDq dq0AfKx6h9HqnULGhQs7jIdwNV1GqUEew1wthk73yQ== X-Received: by 2002:a2e:8e38:0:b0:2c6:ed5e:bbf0 with SMTP id r24-20020a2e8e38000000b002c6ed5ebbf0mr4711811ljk.34.1700473559467; Mon, 20 Nov 2023 01:45:59 -0800 (PST) MIME-Version: 1.0 References: <20231116114150.48639-1-huangjie.albert@bytedance.com> In-Reply-To: From: =?UTF-8?B?6buE5p2w?= Date: Mon, 20 Nov 2023 17:45:47 +0800 Message-ID: Subject: Re: [External] Re: [PATCH net] veth: fix ethtool statistical errors To: Lorenzo Bianconi Cc: Eric Dumazet , Jakub Kicinski , Paolo Abeni , "David S. Miller" , Toshiaki Makita , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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]); Mon, 20 Nov 2023 01:46:34 -0800 (PST) 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 accou= nting") > > 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_devic= e *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_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? 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. > tx_idx is the index of the current (local) tx queue and it must restart f= rom > 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. BR Albert > Regards, > Lorenzo