Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3456306pxb; Mon, 16 Nov 2020 15:30:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxUuG99FhVira+/OccdF6IinsnTzY0H9Nv+rXUbtStP7av8ZUhcaAG0CZp7+9qJNP1mMuty X-Received: by 2002:a17:906:3187:: with SMTP id 7mr16721660ejy.225.1605569453614; Mon, 16 Nov 2020 15:30:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605569453; cv=none; d=google.com; s=arc-20160816; b=iBcmu4BO9ZpKsywKVbJI3rL/5lFWjfit2yxb+NCSnCtOLNN1tdiFjoEBJYZ3ul/wNE 4RIMQ1QxvYrsTdlhc4DeluaH36ZasL9gO9YYv4kas1X96L4BylwnS9yu9rAfJnpGWGnB Z1nkD5RXFSnsHqqeoUMiHyZORqWyGXDjWler2uyuZwy06oM7bXWcQafluodYP30SN2z0 7Alo7jmdwcfL6Z69Yv5CRssrK2mNwK1GIvL430ERXFUJOJ7xscVH1NRmpn77zTuq/+Bm wQFGFfjW2k5mnwZokr5AxSuZpl10cLs+EMAlLa0jaGndzHmwqafNhwDy8tGWOhhRinNu Z9wg== 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=wUTJnk0WNF2C1OAWXBX/8iYtXEqbW2vzqFSK0d54U9Q=; b=bxFPsDrh8+PLkH+1wBHv6AWE1eDtAImDLiLqANGAbQWv9U6jUQv5yoSOoMLrtVrWbd P9OqtaRyVlsVQTW+jc1MV1KloAOYYhaLN8Eo7Pod4UDvA0eiPleV/L/pUFhpKA/iLt70 24+6inNjwJw83XOA42lwqBxHfmepViAfBJZS979zJQRTay+n2PAcI0zX+IqWChBoMQao NkvS38AYXYUVGFdIH3SN37T5t/hMkTleyO+u58rUA903NDpqArJXWxObZZbQMVR8d4qO 1WC0fp/+m8K+F6Z9gf6jeWoJb/YOLsdMvkxu6I5ZQDHVLxzhNS55rB9XIuFEuCpYntf2 1qVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pzxQv8go; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq9si12338240ejb.618.2020.11.16.15.30.31; Mon, 16 Nov 2020 15:30:53 -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=@gmail.com header.s=20161025 header.b=pzxQv8go; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727158AbgKPX1g (ORCPT + 99 others); Mon, 16 Nov 2020 18:27:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbgKPX1f (ORCPT ); Mon, 16 Nov 2020 18:27:35 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F27C0613CF; Mon, 16 Nov 2020 15:27:35 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id i19so26815917ejx.9; Mon, 16 Nov 2020 15:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=wUTJnk0WNF2C1OAWXBX/8iYtXEqbW2vzqFSK0d54U9Q=; b=pzxQv8gobywFgQUXzIXno6VDhFKrgI9QizO0rUJSu/TexYTAadGbErSPFqdq+cZ4qf 56crq6hU7RInP/hhi2NJKs8lomMMZirrEz1WsPGjWGXjjpxT6R9PDgpo9h55UHxGHxoc CP5iWYwlwR9Z+6EjEpT0YRLRhUWg1Y0x7KgAUk0foSmVsYqq9hCXVjYZPdvJIdQSjxpk 7JcOUjjMkaMTNUwruya7K3QiJvMEgjsu1MczHQWvReCNKma/eBdgY4ebeTwAh0p++Hh7 bA/013Ni8F/32G4B/vA8EEUKieTDexZCObQgoOPmsauQswxZqK3z7i6nzLSEBWPPCIF/ tcxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wUTJnk0WNF2C1OAWXBX/8iYtXEqbW2vzqFSK0d54U9Q=; b=erXtNfjUXroivJ7HoSKBccmxyVpjfk54GXmikGK1nql1+8PoEoJB7cSWUMR/nfKUbb HY7Emw7/2d73IUzxnYq4IDgF6B8QFNrHEZ8HqgZEX3fxJQJbL3cxRyoYk3080AQ9F8Eb mZVCP5OpCgFkBUwy5YJLFc4VJT6oLRY2COlYvfHe6yaeTx/gVztveUircPUv6S2YyIyL WGLJWrJolMFo4hRiT/H4JncT5Bs/Zu+9FQPMHFBXbAaqgzk93AR1ER8S1enJTnhMkHVJ sMh3sDw26pRk2aC0JOj2bXFXH4ZNfH2UQ6kA+2Wbj1/QoxkUVClwFHwx6L4thrwu87ta o9rw== X-Gm-Message-State: AOAM5310Lfv286UrU8H9SXyg1GN6H5CT/38VgdjYQX6xqHn3MDdGGwWd PPTZv6SCsU/OHruDpapnOfE= X-Received: by 2002:a17:906:5017:: with SMTP id s23mr17580679ejj.359.1605569253053; Mon, 16 Nov 2020 15:27:33 -0800 (PST) Received: from skbuf ([188.25.2.177]) by smtp.gmail.com with ESMTPSA id mj12sm7275991ejb.117.2020.11.16.15.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2020 15:27:32 -0800 (PST) Date: Tue, 17 Nov 2020 01:27:31 +0200 From: Vladimir Oltean To: Jakub Kicinski 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: <20201116232731.4utpige7fguzghsi@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> <20201116151347.591925ca@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201116151347.591925ca@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 16, 2020 at 03:13:47PM -0800, Jakub Kicinski wrote: > 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. So then I'll let Oleksij show his availability. > > > > 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). Ah, you were just thinking out loud, I really did not understand what you meant by the separation between "forwarded in software" and "forwarded in hardware". Yes, the hardware typically only gives us MAC-level counters anyway. Another way to look at it is that the number of packets forwarded in hardware from a given port are equal to the total number of RX packets on that MAC minus the packets seen by the CPU coming from that port. So all in all, it's the MAC-level counters we should expose in .ndo_get_stats64, I'm glad you agree. As for the error packets, I suppose that would be a driver-specific aggregate. What about RMON/RFC2819 style etherStatsPkts65to127Octets? We have a number of switches supporting that style of counters, including the one that Oleksij is adding support for, apparently (but not all switches though). I suppose your M.O. is that anything standardizable is welcome to be standardized via rtnetlink? Andrew, Florian, any opinions here?