From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) (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 C8359EA9 for ; Thu, 29 Sep 2022 01:51:07 +0000 (UTC) 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=oGBNk7ehsr6naNZyndXMCMbMLWq4E6sNqHzKAcVK0R0=; b=N2j6it1iwchaJQ6Jw5RQXNCHoj J19EWqrL0hSDlTAcP+QEHawdH5d9OYTsG2zhQz+nKNZQvrIqxGbdX96gmADamfWO72dBAMcTHAG+X 1ymlj6tsvfo8H0xh2dr/nR2RfxrLSJ9HzQuMG8dofHR2oGtgu/KTM2NAlpu6YLyE2T8Y=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1odihJ-000ZSE-Nb; Thu, 29 Sep 2022 03:50:45 +0200 Date: Thu, 29 Sep 2022 03:50:45 +0200 From: Andrew Lunn To: Shenwei Wang Cc: Joakim Zhang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: Re: [PATCH 1/1] net: fec: add initial XDP support Message-ID: References: <20220928152509.141490-1-shenwei.wang@nxp.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220928152509.141490-1-shenwei.wang@nxp.com> > +struct fec_enet_xdp_stats { > + u64 xdp_pass; > + u64 xdp_drop; > + u64 xdp_xmit; > + u64 xdp_redirect; > + u64 xdp_xmit_err; > + u64 xdp_tx; > + u64 xdp_tx_err; > +}; > + > + switch (act) { > + case XDP_PASS: > + rxq->stats.xdp_pass++; Since the stats are u64, and most machines using the FEC are 32 bit, you cannot just do an increment. Took a look at u64_stats_sync.h. > -#define FEC_STATS_SIZE (ARRAY_SIZE(fec_stats) * sizeof(u64)) > +static struct fec_xdp_stat { > + char name[ETH_GSTRING_LEN]; > + u32 count; > +} fec_xdp_stats[] = { > + { "rx_xdp_redirect", 0 }, > + { "rx_xdp_pass", 0 }, > + { "rx_xdp_drop", 0 }, > + { "rx_xdp_tx", 0 }, > + { "rx_xdp_tx_errors", 0 }, > + { "tx_xdp_xmit", 0 }, > + { "tx_xdp_xmit_errors", 0 }, > +}; > + > +#define FEC_STATS_SIZE ((ARRAY_SIZE(fec_stats) + \ > + ARRAY_SIZE(fec_xdp_stats)) * sizeof(u64)) The page pool also has some stats. See page_pool_get_stats(), page_pool_ethtool_stats_get_strings() etc. Andrew