Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6079639rwb; Mon, 14 Nov 2022 14:03:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7wLJ0j7vsQF5ya9h4xP1OE0m0oL6xBldE5K2wnHkW6kDilC8XIcGzhqlvkwMKcpjbJxg7s X-Received: by 2002:a17:90b:400e:b0:210:f1f7:575e with SMTP id ie14-20020a17090b400e00b00210f1f7575emr15676422pjb.47.1668463413177; Mon, 14 Nov 2022 14:03:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668463413; cv=none; d=google.com; s=arc-20160816; b=o6OAw1Y3rMkphGZAvI7hvovTtrYb0Z54VWXFWxQSnb1YYmkW3l/mmXBsq/Bq8jE/Ke rmy20fHOaxRJW/KhYWH7006opjHjP5gwceuRfp6LCjm+Dk3JamppZ4LWQE1kXx36pE8w jfefieNE34KnQXjFmRcPx0/fVMpW42mKaIAEwPPPj3PLaw5AWb0MiZ39GkK56jg8awbT 1N+RBZZOSzTQLLmZ6aI27CF7NlMFtzrXodpHxYhPcj0NZN6A35+2O8AuXr2vVMt+pbiP NsxVAsApkRKKELwpTD7/Uju4nmH8fUvGQF6EA2AQEyIqZJD9kc7BiY+N6hcBD052JQFT mJww== 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=ybRBmyZ9Ux4/ZlZayQOkr0DOOOiP1ndIctY8VIKIKUE=; b=YtLj20+fPewKR9LFMb34+I3QW4ohPIK3PZed7lvaWQ/KnGs3uRYDHYqTYG7Te+AyzK q30N6stxtb9wNWnx9lvS5Gn3f4YrEKgtO1XMmCEMuOK8mv0f3H2UAH1EZ7b1nHracvmI YieucDYCNGuEyg8KTdhi7sR3HizlDlkLHYeN6t2t49i1EuT3DeBobxyVFFOeXfbOgLWn HwuQ1AkDgeOwA/oFKajFKaufiP/CUeUQzt3D55Ts28WZy/Uzg3sN94YqPBLWa72cWYDv Pp4cvojhl2Iay9etat7sDGrHOsA5UIvJ6mpaC1EQFdZjm662lAj35o3dHzr4LC96f5xG Qt0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=quRN4uGq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik17-20020a170902ab1100b00188a51cb587si10039483plb.576.2022.11.14.14.03.19; Mon, 14 Nov 2022 14:03:33 -0800 (PST) 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=quRN4uGq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237834AbiKNVqs (ORCPT + 88 others); Mon, 14 Nov 2022 16:46:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237735AbiKNVqm (ORCPT ); Mon, 14 Nov 2022 16:46:42 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB44B193EB; Mon, 14 Nov 2022 13:46:39 -0800 (PST) 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=ybRBmyZ9Ux4/ZlZayQOkr0DOOOiP1ndIctY8VIKIKUE=; b=quRN4uGqrdtZlmhoTwXWBHXz1G ceM9rqgywMYzu1/P7gE1FjSzXgcqNQ/0L53qB6eXs7YTX3D2GSoFI4huu+MNdsa0RAvYDU6G/HVUC ENhd8/4iryoINocZR/d7x8LOWWX7r67EB0ZE5nqJ6r83zRDnjrKvFGH5Hu+FouONCMdg=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ouhHH-002Ntk-BT; Mon, 14 Nov 2022 22:46:03 +0100 Date: Mon, 14 Nov 2022 22:46:03 +0100 From: Andrew Lunn To: Shenwei Wang Cc: Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Wei Fang , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "imx@lists.linux.dev" , kernel test robot Subject: Re: [EXT] Re: [PATCH v3 1/1] net: fec: add xdp and page pool statistics Message-ID: References: <20221111153505.434398-1-shenwei.wang@nxp.com> <20221114134542.697174-1-alexandr.lobakin@intel.com> <20221114152327.702592-1-alexandr.lobakin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 > @@ -1764,7 +1768,13 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) > > if (xdp_result & FEC_ENET_XDP_REDIR) > xdp_do_flush_map(); > +#if 1 > + if (xdp_prog) { > + int i; > + for(i = 0; i < XDP_STATS_TOTAL; i++) > + atomic64_add(xdp_stats[i], &rxq->stats[i]); > + } > +#endif Atomic operations are expensive. You should not use them unless you really do need them. What driver are you copying here? There is nothing particularly new here, so you should just be copying code from another driver, and hope you picked a good example. Andrew