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 AE569C43217 for ; Thu, 25 Nov 2021 17:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347763AbhKYRai (ORCPT ); Thu, 25 Nov 2021 12:30:38 -0500 Received: from mga02.intel.com ([134.134.136.20]:37834 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242904AbhKYR2h (ORCPT ); Thu, 25 Nov 2021 12:28:37 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10179"; a="222770518" X-IronPort-AV: E=Sophos;i="5.87,263,1631602800"; d="scan'208";a="222770518" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2021 09:17:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,263,1631602800"; d="scan'208";a="509828399" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by fmsmga007.fm.intel.com with ESMTP; 25 Nov 2021 09:17:12 -0800 Received: from newjersey.igk.intel.com (newjersey.igk.intel.com [10.102.20.203]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 1APHH9FD003210; Thu, 25 Nov 2021 17:17:09 GMT From: Alexander Lobakin To: "Russell King (Oracle)" Cc: Alexander Lobakin , "David S. Miller" , Jakub Kicinski , Jesse Brandeburg , Michal Swiatkowski , Maciej Fijalkowski , Jonathan Corbet , Shay Agroskin , Arthur Kiyanovski , David Arinzon , Noam Dagan , Saeed Bishara , Ioana Ciornei , Claudiu Manoil , Tony Nguyen , Thomas Petazzoni , Marcin Wojtas , Saeed Mahameed , Leon Romanovsky , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , John Fastabend , Edward Cree , Martin Habets , "Michael S. Tsirkin" , Jason Wang , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Lorenzo Bianconi , Yajun Deng , Sergey Ryazanov , David Ahern , Andrei Vagin , Johannes Berg , Vladimir Oltean , Cong Wang , netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v2 net-next 07/26] mvneta: add .ndo_get_xdp_stats() callback Date: Thu, 25 Nov 2021 18:16:49 +0100 Message-Id: <20211125171649.127647-1-alexandr.lobakin@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: References: <20211123163955.154512-1-alexandr.lobakin@intel.com> <20211123163955.154512-8-alexandr.lobakin@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King (Oracle) Date: Wed, 24 Nov 2021 11:39:05 +0000 > On Tue, Nov 23, 2021 at 05:39:36PM +0100, Alexander Lobakin wrote: > > + for_each_possible_cpu(cpu) { > > + const struct mvneta_pcpu_stats *stats; > > + const struct mvneta_stats *ps; > > + u64 xdp_xmit_err; > > + u64 xdp_redirect; > > + u64 xdp_tx_err; > > + u64 xdp_pass; > > + u64 xdp_drop; > > + u64 xdp_xmit; > > + u64 xdp_tx; > > + u32 start; > > + > > + stats = per_cpu_ptr(pp->stats, cpu); > > + ps = &stats->es.ps; > > + > > + do { > > + start = u64_stats_fetch_begin_irq(&stats->syncp); > > + > > + xdp_drop = ps->xdp_drop; > > + xdp_pass = ps->xdp_pass; > > + xdp_redirect = ps->xdp_redirect; > > + xdp_tx = ps->xdp_tx; > > + xdp_tx_err = ps->xdp_tx_err; > > + xdp_xmit = ps->xdp_xmit; > > + xdp_xmit_err = ps->xdp_xmit_err; > > + } while (u64_stats_fetch_retry_irq(&stats->syncp, start)); > > + > > + xdp_stats->drop += xdp_drop; > > + xdp_stats->pass += xdp_pass; > > + xdp_stats->redirect += xdp_redirect; > > + xdp_stats->tx += xdp_tx; > > + xdp_stats->tx_errors += xdp_tx_err; > > + xdp_stats->xmit_packets += xdp_xmit; > > + xdp_stats->xmit_errors += xdp_xmit_err; > > Same comment as for mvpp2 - this could share a lot of code from > mvneta_ethtool_update_pcpu_stats() (although it means we end up > calculating a little more for the alloc error and refill error > that this API doesn't need) but I think sharing that code would be > a good idea. Ah, I didn't do that because in my first series I was removing Ethtool counters at all. In this one, I left them as-is due to some of folks hinted me that those counters (not specifically on mvpp2 or mvneta, let's say on virtio-net or so) could have already been used in some admin scripts somewhere in the world (but with a TODO to figure out which driver I could remove them in and do that). It would be great if you know and would hint me if I could remove those XDP-related Ethtool counters from Marvell drivers or not. If so, I'll wipe them, otherwise just factor out common parts to wipe out code duplication. > -- > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! Thanks, Al