Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3450000pxb; Mon, 16 Nov 2020 15:17:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSbairGVqCm0gc6CCROSVqZbQRFsqPLecJW3sELef3oiUTtRakWwmxyEE67sZV7K25rfPf X-Received: by 2002:a17:906:82d9:: with SMTP id a25mr16553869ejy.101.1605568668423; Mon, 16 Nov 2020 15:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605568668; cv=none; d=google.com; s=arc-20160816; b=JJtYsOJVZooQ13azKyZ8f3tAu4wCUuVPBwig6zMGlN0zPIemAKGeZgxH9c7s4U/8t7 pkpMHl/R3Hmn4KtXkAxE+N5vNMkccrPGzn2t8Ccq1AR5EJ/vfqRUlzgCdvAdmJinq2hZ Hbw9MXBL03hxbBZIkjuMrClAtu8F96XgYf3iOOnF7J2IgZxznBS9GaW4fOcUQqFJhGkO G6qB0j1dkUF6RNX7Azo0j9egi1jcvbWaKq9eHaEfQ0KH5euzzFyjAT2q4TX4xmEhVOwm QzTMpvuY8hIZNNOTUFZa5C/HkBa+iwFTkTvf6xRQP7v6H70mFogjui0Wx1D1fCRkxEGf zdNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=SeYJ4Vc2x+NsTbkdFVZ6jM8Sh2k8Bn6Yc7TvDwASZlU=; b=KTrcZqO4kdzSApmq4gAMCfLdvlve+sPdr3q0XrbnHX/nU5sjqnV6hFUKzax8GKtnsm AyKI1duU32Nv4eX2ben2ZVbS0h5tO1Wn3FEO4xfWPXEB0T0MRaFVSqyXLIjwt+5rCv5A avkBSSMTTeAK/Yby7UT6K81ksQlviRBNViSv7Z5/RRthZWxx1U+c7CmV1kaSW1GHL9EQ vqiKK0qwYd51FPXC98ppeSofjzgPwsg53kTk/zgpulKRT/NRLBU3/XASlS0jGIRJkX4I 4RKawRUsVMVcp19ZchMK+XrPxHMWwYJy5sY9sSt9MQlNE/i+d5vOVmA/kt27PNGkdd0n tljg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cUdLQLlD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd28si12269318edb.329.2020.11.16.15.17.25; Mon, 16 Nov 2020 15:17:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cUdLQLlD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727957AbgKPXNu (ORCPT + 99 others); Mon, 16 Nov 2020 18:13:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:35872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727342AbgKPXNt (ORCPT ); Mon, 16 Nov 2020 18:13:49 -0500 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 61F062223D; Mon, 16 Nov 2020 23:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605568429; bh=e4YWQykP4JOPmhpqBbyLhdo9/W/RcDDwoCDFNn3Ut1o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cUdLQLlDHMtAFQ0/OLw+HRv1w06+nMlzobP64urpp0RBkQBatE2/MWsUdMnAsFYAL UV8SezOONXh4lJIyuI4UokWCxYtw2vYdo8/3jWCPlhq0jyA7KNpayX9DM5PuKSi4Aa 2+EvQnqw7xRPWwcQhzonFxWDx42xQ+dX0Fw7bBYM= Date: Mon, 16 Nov 2020 15:13:47 -0800 From: Jakub Kicinski To: Vladimir Oltean Cc: Oleksij Rempel , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Russell King , Pengutronix Kernel Team , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: Re: [PATCH v1 net-next] net: dsa: qca: ar9331: add ethtool stats support Message-ID: <20201116151347.591925ca@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20201116230053.ddub7p6lvvszz7ic@skbuf> References: <20201115073533.1366-1-o.rempel@pengutronix.de> <20201116133453.270b8db5@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20201116222146.znetv5u2q2q2vk2j@skbuf> <20201116143544.036baf58@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <20201116230053.ddub7p6lvvszz7ic@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Nov 2020 01:00:53 +0200 Vladimir Oltean wrote: > On Mon, Nov 16, 2020 at 02:35:44PM -0800, Jakub Kicinski wrote: > > On Tue, 17 Nov 2020 00:21:46 +0200 Vladimir Oltean wrote: > > > On Mon, Nov 16, 2020 at 01:34:53PM -0800, Jakub Kicinski wrote: > > > > You must expose relevant statistics via the normal get_stats64 NDO > > > > before you start dumping free form stuff in ethtool -S. > > > > > > Completely agree on the point, Jakub, but to be honest we don't give him > > > that possibility within the DSA framework today, see .ndo_get_stats64 in > > > net/dsa/slave.c which returns the generic dev_get_tstats64 implementation, > > > and not something that hooks into the hardware counters, or into the > > > driver at all, for that matter. > > > > Simple matter of coding, right? I don't see a problem. > > > > Also I only mentioned .ndo_get_stats64, but now we also have stats in > > ethtool->get_pause_stats. > > Yes, sure we can do that. The pause stats and packet counter ops would > need to be exposed to the drivers by DSA first, though. Not sure if this > is something you expect Oleksij to do or if we could pick that up separately > afterwards. Well, I feel like unless we draw the line nobody will have the incentive to do the work. I don't mind if it's Oleksij or anyone else doing the plumbing work, but the task itself seems rather trivial. > > > But it's good that you raise the point, I was thinking too that we > > > should do better in terms of keeping the software counters in sync with > > > the hardware. But what would be a good reference for keeping statistics > > > on an offloaded interface? Is it ok to just populate the netdev counters > > > based on the hardware statistics? > > > > IIRC the stats on the interface should be a sum of forwarded in software > > and in hardware. Which in practice means interface HW stats are okay, > > given eventually both forwarding types end up in the HW interface > > (/MAC block). > > A sum? Wouldn't that count the packets sent/received by the stack twice? Note that I said _forwarded_. Frames are either forwarded by the HW or SW (former never hit the CPU, while the latter do hit the CPU or originate from it).