Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp39063lqp; Mon, 10 Jun 2024 17:30:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkTFiXUCSLdqbNDahkBHzgFFYVlkNMbiA3Kwp/u2f/3yT0p4GWz4m8To6/SOFrKWEB05lAuia0LF6tHHdeNc/XvqOzem1zqVELczu99g== X-Google-Smtp-Source: AGHT+IGjAe0Sn+qPuR+/WARWJamK43QKNQ6LWxdS/JZ9b3Jolx2jwzxOLeredAXbC8BmvWRSX8xg X-Received: by 2002:a05:6a00:238b:b0:704:3491:d752 with SMTP id d2e1a72fcca58-7043491defdmr6362660b3a.16.1718065811386; Mon, 10 Jun 2024 17:30:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718065811; cv=pass; d=google.com; s=arc-20160816; b=J/OFctl5mk1aOsiGYGwEONG71ZkQQQntviO95epitGUPgD66rz3tgVkmXeN05/LzgJ ECKPT2E7ek3o+QEAk6D0PUmcC+cwY/HOCBPzuWzlacpxv7zuHPylwbJpAtfu0B3EvBHm bHJkV1SvUHyIm/i1g5rf9Z5gGJ0k0dE9Q7rY4OqTFn+H0agb93bqf1t72gR2M7eWxDe7 corGXQRPx20zhBAK5enVcgE7yCe3VzqHjkKi9Tnr2FLUceOTzVlwGf96Q2ZIFcNZqD3e 2dISrLBbmYAnQ42dOMGom6l6AMdnGPngHMLWJgbjE9GMAtQ3t5loPnMdkD6mxnoHPYdx dxFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FI8V6GbrcwcqNDoiQdYzznx5EeFgF0kW14MQ9g3uM74=; fh=XLKlWVQTm4ivMNcOUcqPzc8BJnfWvLlrVoDy4UZJ0Bg=; b=uKG1i/qgihpSl/OteURwsXjh9pImR3LIH15wW99Wm965AQAmCZx/gDDWPL+nMtg6N4 85zC10plEuhDfLyiDSDWxSpSgdAMj4sRSl91/Muznc6ZjPaKIpMblyAnvB3sGyE5IPVS 8Xnth09+rwkkkc4m9fiCquHaUum3K7CrsiHEMBzS4kNfIagNkN4kNAM3QTrqd4owhx3s XERbRXyVCbQmv7c0d6d3TOxw0TzfIL/1oTmIwMZGnfrKlTr4/pgd3cFTGbHOKtem+07b Xdg9fhv3Aqt/o9R1c6iu1PqlBZJIPvXsLBrlkjNFiyLwvaX+I5/ZVZJTwLr16FN588ps z3bQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=1RUpnTfi; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-209130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209130-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de262c01b2si5638632a12.421.2024.06.10.17.30.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 17:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=1RUpnTfi; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-209130-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209130-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E6B4DB21D6C for ; Tue, 11 Jun 2024 00:29:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D765469D; Tue, 11 Jun 2024 00:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="1RUpnTfi" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F1E1EDF; Tue, 11 Jun 2024 00:29:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718065757; cv=none; b=AtGyv+7uQ8dfXx8QGKBgrmZLCtAXmMKB3Rqtr19gHEmXVb+GqOt4BRpvFCp0uaS/u8rQopmKd9vSwAJ/D9EJb2qoR0gorT47Vm3X799G082dgWCGhqUSwlMuXee0QCyklPuedH0HQpNMa1HRwoTst3hZe5ewM7sa2SnPvgF6bbo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718065757; c=relaxed/simple; bh=5i2/zbwVRP1igz/41njrXF7PwGq4eAlplJF8NeffXHU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tJIVLocXKK7dKP3/gLo5g5urwuDzVBm2eaUdUDqwngA4jsrlTp0Uqtth0U8iA/DMyKdsKTd1kHPbuVHCoRIXGtQwK/LQgEjT8CEK0FYEvDpfaz1IhtGPs2O4kbqQ0UmzNWBVALJZssnv+V5CIVINCkIVxxQdVWDiNQR01lVvXXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=1RUpnTfi; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=FI8V6GbrcwcqNDoiQdYzznx5EeFgF0kW14MQ9g3uM74=; b=1RUpnTfixFI/LG/nXiAskkZSA1 U9xYDRtwIekyWRC/+7UaWvQ73dNRYjmaQs7e3wpgCybE/VX28Src4+MGAjkhOroK4oG+67c1ATwUB BneeN7J1QIiSTIZZX/JJ5JEdTm1Z/QD4PWRL3U+QeJ1yiAROeQ0h04+tTrHPr2wnpAQk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1sGpNp-00HLDV-Cl; Tue, 11 Jun 2024 02:29:05 +0200 Date: Tue, 11 Jun 2024 02:29:05 +0200 From: Andrew Lunn To: Sean Anderson Cc: Radhey Shyam Pandey , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michal Simek , Jakub Kicinski , Russell King , Paolo Abeni , Eric Dumazet , linux-kernel@vger.kernel.org, "David S . Miller" Subject: Re: [PATCH net-next 3/3] net: xilinx: axienet: Add statistics support Message-ID: References: <20240610231022.2460953-1-sean.anderson@linux.dev> <20240610231022.2460953-4-sean.anderson@linux.dev> <7c06c9d7-ad11-4acd-8c80-fbeb902da40d@lunn.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7c06c9d7-ad11-4acd-8c80-fbeb902da40d@lunn.ch> On Tue, Jun 11, 2024 at 02:13:40AM +0200, Andrew Lunn wrote: > On Mon, Jun 10, 2024 at 07:10:22PM -0400, Sean Anderson wrote: > > Add support for reading the statistics counters, if they are enabled. > > The counters may be 64-bit, but we can't detect this as there's no > > ability bit for it and the counters are read-only. Therefore, we assume > > the counters are 32-bits. > > > +static void axienet_stats_update(struct axienet_local *lp) > > +{ > > + enum temac_stat stat; > > + > > + lockdep_assert_held(&lp->stats_lock); > > + > > + u64_stats_update_begin(&lp->hw_stat_sync); > > + for (stat = 0; stat < STAT_COUNT; stat++) { > > + u32 counter = axienet_ior(lp, XAE_STATS_OFFSET + stat * 8); > > The * 8 here suggests the counters are spaced so that they could be 64 > bit wide, even when only 32 bits are used. Does the documentation say > anything about the upper 32 bits when the counters are only 32 bits? > Are they guaranteed to read as zero? I'm just wondering if the code > should be forward looking and read all 64 bits? Actually, if you read the upper 32 bits and they are not 0, you know you have 64 bit counters. You can then kill off your period task, it is not needed because your software counters will wrap around the same time as the hardware counters. Andrew