Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1446271rwb; Wed, 28 Sep 2022 19:20:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Moxd/91ftyKY/dZuK3z5euQ+HH7cblUxXILOuFGT9r2edzk/IDLUTr4I6rHbMab2MxXxU X-Received: by 2002:a63:1f12:0:b0:438:fa5b:ff76 with SMTP id f18-20020a631f12000000b00438fa5bff76mr809258pgf.390.1664418052072; Wed, 28 Sep 2022 19:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664418052; cv=none; d=google.com; s=arc-20160816; b=AIs+wrUA26Etcok64KT5x9Cy7YW/VCbHpVrfxT35jpknpR5BS9aYUZ+BVouanImYL7 dOAHUPXqmUPWIxSD+d0xW7SAA62uwEZQy6wsiIkCbyrLeD3qiGTcgIbk2vmnyDFSGu0N Jt1Le1usPF7HQRvHiGq6jWGP54laJ3eVkr4ag88wEqFJV19mhL7hdClIS6YvL/kQ83g/ 9dEzLp3OzbOMO0FCJpz+xW94GAUNoqSB+PWQeOx/sgGIRIX8fvuhZ05XRFBmSzCxaUU+ dKtiAFWnDYO6k6yXRJpn3ix84joiC1+EJnIFqkG3KnPsD1Vh20SGULAGL1BDKiax6c5D fYhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oGBNk7ehsr6naNZyndXMCMbMLWq4E6sNqHzKAcVK0R0=; b=oSOMD9CNpNUgo9+WAqYefiDhb1dPNhwpDXjK6lX2ti0CosFkMV1tJHP8frnJqWJI6D fkS9GEQdFtQ751CFCF9sYRaYxOqNNDe30EBAekugxWPQw6xorVCI6nQfpS8ZoYNcLien RU1tS4hpGukg9RxjsZURMnWI6Dy6an9JgMsvCbVqFbWCckuIdOE0/7SXT8c5Ki+QGsLJ CxSYy1zd0E8gYYuCDXOFRj07TgcMZUwozvyjWSBkodjCIDZGlMCWdLla8LZlxdcIdJhp XHTl2x5/D41w1gaJ0TCDUlrsq66kW9KdWhp0x0SQ9HUKNA+aEF7pSoaQWsH5X4F9xJ1q LVKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=N2j6it1i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a26-20020a63705a000000b0041a5a80428esi7434005pgn.750.2022.09.28.19.20.40; Wed, 28 Sep 2022 19:20:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=N2j6it1i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233492AbiI2Bv3 (ORCPT + 99 others); Wed, 28 Sep 2022 21:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234361AbiI2BvF (ORCPT ); Wed, 28 Sep 2022 21:51:05 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22F5F760E5; Wed, 28 Sep 2022 18:51:02 -0700 (PDT) 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220928152509.141490-1-shenwei.wang@nxp.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +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