Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7269016rwb; Tue, 15 Nov 2022 09:46:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iVUCadwSRPuXe6M4qXc1q48q7S0GmnR73KuOyeTVV7qEh1hpw75YVwk3p8Mq2zkdsmMVm X-Received: by 2002:a17:906:4ed8:b0:7ae:d58b:30f8 with SMTP id i24-20020a1709064ed800b007aed58b30f8mr13269163ejv.564.1668534387316; Tue, 15 Nov 2022 09:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668534387; cv=none; d=google.com; s=arc-20160816; b=mA8VuYy4+TXCbRb3VhBo4QHSZ5/g2dUy/OAmImNGDc0khdJDWgjj1C7W11BpJvFp/h EF0KbZuR6BCtO3BrlAnsa7M8E5LPo5ZVlvkftGfuSFaFw4ZEZkLYgvcn4ICejJICWc/i OXexGuNa4OA+6biAMBn6lV6OYm0fKsT7EgRFfFN6Zha7JCa5fFHncxMQih8I1F+UuPh2 MMaZKd9v0tHtb2KLtM5E6Tyw66XR/fL2vhY9gnxbug5ioOkMHyvU9LbCneL22IJI9ZIG a7jsXlsjOlqqcSJTYoU5cstcE0hgwVEAYYL1xjyz2vU1lIaExG4cb1Nv53UIFc0Q6QkZ YRqA== 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=MghNhBLFepqKOQwkGUfSW1GJuxjMVRFJVMazuOGss7w=; b=tT9B/uvgzk7fUKnaPgCG8kvToDOg6Qr6uYZztpkXSfW5Rw7Yfc7ui6ARYg9+GGgnNP R3AOWi/WSXDoO+W8EyhofDmRvrCGSkKbsTsjYM1NSZ4SVi2a+bYLja3K1b8ssFIJPly2 mpAMXDs6BIrBUurwkt9ph3u7WYMeHd0gvUspAtfSoQ2qiIHMm15chzSqbvhpCTUd971e uR8sZl+wJ1+w5PUnGzGSVddu3PgMnJSQf4aWiEi1PPLh8dJUhMcj9ALYa+3N12Yf8jE0 9ObXMl0+a9c6YmYAMx2hLgqe1FSpvLR5so9f+vOM1ix7sK4uhp+Z3q1r72zUzRpalNUS yntg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=MbrntDhC; 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 be10-20020a1709070a4a00b00780e022dfb8si6020274ejc.494.2022.11.15.09.46.04; Tue, 15 Nov 2022 09:46:27 -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=MbrntDhC; 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 S231326AbiKOR3k (ORCPT + 91 others); Tue, 15 Nov 2022 12:29:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231391AbiKOR3U (ORCPT ); Tue, 15 Nov 2022 12:29:20 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7BB029C86; Tue, 15 Nov 2022 09:29:17 -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=MghNhBLFepqKOQwkGUfSW1GJuxjMVRFJVMazuOGss7w=; b=MbrntDhCaie5kamEI+pFVXWgke exlodypGNSNS2Bt5dkI3GpEVxZYAaiaV3mJPLkpBIxHKje72LT2DeBlTHmHl/y8CwM3B1edq/n/UG 28bJfK45ZR/yOf4v/ZSiibDhGapmDiwCxpbY1TxB8BiAPiozjuQjh7ZkiaKJ13z+7HT4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1ouzjj-002Tth-P3; Tue, 15 Nov 2022 18:28:39 +0100 Date: Tue, 15 Nov 2022 18:28:39 +0100 From: Andrew Lunn To: Shenwei Wang Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesper Dangaard Brouer , Ilias Apalodimas , Alexei Starovoitov , Daniel Borkmann , John Fastabend , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, kernel test robot Subject: Re: [PATCH v4 2/2] net: fec: add xdp and page pool statistics Message-ID: References: <20221115155744.193789-1-shenwei.wang@nxp.com> <20221115155744.193789-3-shenwei.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221115155744.193789-3-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 > @@ -1582,6 +1586,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) > struct bpf_prog *xdp_prog = READ_ONCE(fep->xdp_prog); > u32 ret, xdp_result = FEC_ENET_XDP_PASS; > u32 data_start = FEC_ENET_XDP_HEADROOM; > + u32 xdp_stats[XDP_STATS_TOTAL]; > struct xdp_buff xdp; > struct page *page; > u32 sub_len = 4; > @@ -1656,11 +1661,13 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) > fec_enet_update_cbd(rxq, bdp, index); > > if (xdp_prog) { > + memset(xdp_stats, 0, sizeof(xdp_stats)); > xdp_buff_clear_frags_flag(&xdp); > /* subtract 16bit shift and FCS */ > xdp_prepare_buff(&xdp, page_address(page), > data_start, pkt_len - sub_len, false); > - ret = fec_enet_run_xdp(fep, xdp_prog, &xdp, rxq, index); > + ret = fec_enet_run_xdp(fep, xdp_prog, &xdp, rxq, > + xdp_stats, index); > xdp_result |= ret; > if (ret != FEC_ENET_XDP_PASS) > goto rx_processing_done; > @@ -1762,6 +1769,15 @@ 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 (xdp_prog) { > + int i; > + > + u64_stats_update_begin(&rxq->syncp); > + for (i = 0; i < XDP_STATS_TOTAL; i++) > + rxq->stats[i] += xdp_stats[i]; > + u64_stats_update_end(&rxq->syncp); > + } > + This looks wrong. You are processing upto the napi budget, 64 frames, in a loop. The memset to 0 happens inside the loop, but you do the accumulation outside the loop? This patch is getting pretty big. Please break it up, at least into one patch for XDP stats and one for page pool stats. Andrew