From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4B75C352A1 for ; Wed, 7 Dec 2022 06:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229670AbiLGGQh (ORCPT ); Wed, 7 Dec 2022 01:16:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbiLGGQg (ORCPT ); Wed, 7 Dec 2022 01:16:36 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A0B558BC6 for ; Tue, 6 Dec 2022 22:16:35 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2njK-0003p7-Oa; Wed, 07 Dec 2022 07:16:30 +0100 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1p2njK-0007Y7-G9; Wed, 07 Dec 2022 07:16:30 +0100 Date: Wed, 7 Dec 2022 07:16:30 +0100 From: Oleksij Rempel To: Jakub Kicinski Cc: Woojung Huh , Andrew Lunn , Arun.Ramadoss@microchip.com, Florian Fainelli , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, Eric Dumazet , kernel@pengutronix.de, Paolo Abeni , Vladimir Oltean , Vivien Didelot Subject: Re: [PATCH net-next v1 1/1] net: dsa: microchip: add stats64 support for ksz8 series of switches Message-ID: <20221207061630.GC19179@pengutronix.de> References: <20221205052904.2834962-1-o.rempel@pengutronix.de> <20221206114133.291881a4@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221206114133.291881a4@kernel.org> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Dec 06, 2022 at 11:41:33AM -0800, Jakub Kicinski wrote: > On Mon, 5 Dec 2022 06:29:04 +0100 Oleksij Rempel wrote: > > + stats->rx_packets = raw->rx_bcast + raw->rx_mcast + raw->rx_ucast + > > + raw->rx_pause; > > + stats->tx_packets = raw->tx_bcast + raw->tx_mcast + raw->tx_ucast + > > + raw->tx_pause; > > FWIW for normal netdevs / NICs the rtnl_link_stat pkts do not include > pause frames, normally. Otherwise one can't maintain those stats in SW > (and per-ring stats, if any, don't add up to the full link stats). > But if you have a good reason to do this - I won't nack.. Pause frames are accounted by rx/tx_bytes by HW. Since pause frames may have different size, it is not possible to correct byte counters, so I need to add them to the packet counters. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |