Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp38140lqp; Mon, 10 Jun 2024 17:27:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkhlbPoBe99vADP8/ch/XH6rncVX/o//Q7ZzGRDNi1A87tz9wzGS2imzU6GKlZee7OvRaD3b3PKUyTklJiVak3DCiXf2917ffdBBI25w== X-Google-Smtp-Source: AGHT+IG+903TzkbvTJ1DTQYyBbPKcU8fQ9uJaJyLRk0jNRPm2EAt9LLa8WqUhF3X8yD+e/02ezaF X-Received: by 2002:a05:620a:40ca:b0:797:6f92:8732 with SMTP id af79cd13be357-797c2db62ddmr229845985a.26.1718065628500; Mon, 10 Jun 2024 17:27:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718065628; cv=pass; d=google.com; s=arc-20160816; b=YqV3YLYdya3hsU0bZwzRFMizkhz6nyACM8uLVf4BFeyjJcuukc2vA4TgN6ZQRWzC20 d+tO/V/4iiVDneu0LeWO1GLtIeFn+o8QPY2J137Uw7Ixm5NWNAfV7sGp2AH4Xu2jX82N OCrjVpq57F/ayyrHmPWulU/lvUM3UY6TaZfLDYPQ4u97dXxQB5w/NyaLvmmDnxhH1k7I knKhdhMmzRamM1QA7Y5bAqlsCa9by+THp8WpKktrAzCjFu6REb1ZJUJS0CDcTwmvXqXz YAgiqo2g7DpdwRpL1IO3JGVBYiNpJiUSwzfAY1OvFjcrTbL9uTm7BGOcwpoGHqmchJF9 CKUw== 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=nwEG30uKgN6S1KNUiUbynw41vDPsjIY/Sw3Pjkp1JnI=; fh=XLKlWVQTm4ivMNcOUcqPzc8BJnfWvLlrVoDy4UZJ0Bg=; b=CDSrXKRkMcQ5rcQHcNmu9uPEOabBofZlj0j4QhGYGpUWQ5c2LoEufjCorqJ9ULbLY0 b293Fp9XFP8Wgxl80bXgQknT8CAeDXyV11qJh3HKaWAoRPIJbnAMhnYwdf25nyX2a2gr tecTufllj8y4AurHCUm5LpPb+plenDgGb6vQCMkUoDLR71M2p48gMdA7xNbzfKj4vo2l QZGN7t/jzizk3wBISBKJuuhp2wKwiEzSkds4pW5t0cPQrfLFPAXa/bMXwXICfLJm4sU4 PWJo4LhvMDwPE6r6ag57AphH/cj7fuXQM9SGjEBIweu989h9slOgiV7bcCcKSOsISdkL Eqnw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="n4Hashe/"; 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-209127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209127-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-7954a02f70asi824620185a.700.2024.06.10.17.27.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 17:27:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="n4Hashe/"; 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-209127-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209127-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2EF891C21A99 for ; Tue, 11 Jun 2024 00:27:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E16A033D8; Tue, 11 Jun 2024 00:26:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="n4Hashe/" 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 A173CEDF; Tue, 11 Jun 2024 00:26:57 +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=1718065619; cv=none; b=HWK+oiysAcQTlg4HLCef7UW488lmsJb59gYXxCIprAycBrzGK+TB3mk8OjZP8EKCqxTT9KdkLxu3yoUTfJ7cJLVJNsqB9c7z4ZoutEENU58ubcULp8sI397pd3spQ80UBMaz9hcXxIsfpRkbNKl3MZfMWxEcMcBDoXD/M63xSrs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718065619; c=relaxed/simple; bh=Rh8XKVV9RvMjAjX+zuKx4/MNQDLuuKmms5rwQuWaenU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=S3rkEuJkbhKAVbbaV8fJj6tQZnu50DZUlhmbm3HJQbHJxIr0U/RYA0kGlyW5dJrKcQMlQeT89A0Clck1g+ZajyjsPGNFJxaUM5l6sZLgujiRE/1z/SXjlLuPwQqi4/e1YY+8tQOMcqLEYyLbwINsk4jjZhxcgJp94jqm0iismKM= 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=n4Hashe/; 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=nwEG30uKgN6S1KNUiUbynw41vDPsjIY/Sw3Pjkp1JnI=; b=n4Hashe/zoTiQcObiKnNdxvY6X 7adNPCYq6MDha3keOCuu9JRaVvZcSx6hzDui4suxeVj5b9vHDflb4L7T7Duhl5gCpiDtqTF6eptbg u0XGVQ8i/A9MyAEI2kPVL1gT3ygr0cLN8PCjVLcjzi6P9+KzBtlvLOUoLsUJtLdGVFNA=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1sGpLb-00HLBr-GB; Tue, 11 Jun 2024 02:26:47 +0200 Date: Tue, 11 Jun 2024 02:26:47 +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: <40cff9a6-bad3-4f85-8cbc-6d4bc72f9b9f@lunn.ch> References: <20240610231022.2460953-1-sean.anderson@linux.dev> <20240610231022.2460953-4-sean.anderson@linux.dev> 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: <20240610231022.2460953-4-sean.anderson@linux.dev> > +static u64 axienet_stat(struct axienet_local *lp, enum temac_stat stat) > +{ > + return u64_stats_read(&lp->hw_stats[stat]); > +} > @@ -1695,6 +1760,35 @@ axienet_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) > stats->tx_packets = u64_stats_read(&lp->tx_packets); > stats->tx_bytes = u64_stats_read(&lp->tx_bytes); > } while (u64_stats_fetch_retry(&lp->tx_stat_sync, start)); > + > + if (!(lp->features & XAE_FEATURE_STATS)) > + return; > + > + do { > + start = u64_stats_fetch_begin(&lp->hw_stat_sync); > + stats->rx_length_errors = > + axienet_stat(lp, STAT_RX_LENGTH_ERRORS); I'm i reading this correctly. You are returning the counters from the last refresh period. What is that? 2.5Gbps would wrapper around a 32 byte counter in 13 seconds. I hope these statistics are not 13 seconds out of date? Since axienet_stats_update() also uses the lp->hw_stat_sync, i don't see why you cannot read the hardware counter value and update to the latest value. Andrew