Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4153589rwb; Fri, 30 Sep 2022 13:46:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5a4LH9op/f9l/vUqG9UTLD2dP2Ok+XnO+vDutA/zmch6G2orO9TR8fYAr/zlThIjUHEhXE X-Received: by 2002:a17:907:7d8b:b0:782:e9ed:88d7 with SMTP id oz11-20020a1709077d8b00b00782e9ed88d7mr7811600ejc.186.1664570779898; Fri, 30 Sep 2022 13:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664570779; cv=none; d=google.com; s=arc-20160816; b=iejdlOH8Wlv28jRlpgHQvYezC4oJe00t7M0wtVIAIr89h3UoDsu6mgyjRDzYEYQv97 bVkC3uiB4zO3R9EY5zG45qja/dWzUmwKjJWM6QymNpzhtciK0PqZm5WVJQ5ehiPnfoUA qFyMdwEv7jIaV34XCnmU2YowL8ipkn1lhPWCmQXnSmdEy1wsWz+9lNU+0XTuuDrNJxmp A1UC4GkX+oahtGqJszpSOh/6lYEhado1uNwt5pE84nZBxtoBdtxva/4eoQbASf73TQZV dICtLiFFqDULEJ+qrlt6c5twWR2mAPaENv4Y6uGa8g9ZbbJwd2NgLPn8j+iGRsLDjWiY TqXQ== 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=AL0vAaOv9ksnhaGXf4V4nnJuSUkCNqDdWkCatIEah0k=; b=bd8gbNO+Xn2N6nUtckmOAZ/ksI8gyO8PPTAkJEb9JfJvuDJNqsKfQjoWEZW8p4Znjt 09Np67SPsWsFdjf6i5OYWjiFMWZG66qyLovSvpwlKrPokGx13EFuZmYfcvYQkCCJnHHI +GpuVtXtrH3ZVjJ4rULtlB/EZ4DG9tad9eN+hiFhbIDoYXuoisPs30ZB//RYdccCTWk7 SbGzLbwu9RaLpNqZo+7CuBZFafxldypF4Y45rMkhDUV2QVxOKZdcnt+O3CFG6Sl3N98h 9k0aSvp7NVlKz76M0fxpcWYymKAA3SNhy9Pqdk4feq2pmXh1i9mFggVTBhcBSBHDEBN2 LA3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=ndip50q8; 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 w8-20020a056402268800b00451729caaaesi3175006edd.8.2022.09.30.13.45.54; Fri, 30 Sep 2022 13:46:19 -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=ndip50q8; 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 S232437AbiI3UQR (ORCPT + 99 others); Fri, 30 Sep 2022 16:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232465AbiI3UPw (ORCPT ); Fri, 30 Sep 2022 16:15:52 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E79EDEF6; Fri, 30 Sep 2022 13:15:21 -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=AL0vAaOv9ksnhaGXf4V4nnJuSUkCNqDdWkCatIEah0k=; b=ndip50q8BCZqkbgHXfC+wFjbsQ da9GPaMgztIxX3AhneS7F9ixWqKvRGdJGGI5qV0ANroDztvK5DTbZ1pfcnXR3ovD6hsxVfb8IDwnA l7yn6tYw6OyOwmNycytJ+XE6/kOgTw6hm4/+skJ5JbWloT1EZb1ZVXMpCHER61po2G1g=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oeMPd-000jzg-CD; Fri, 30 Sep 2022 22:15:09 +0200 Date: Fri, 30 Sep 2022 22:15:09 +0200 From: Andrew Lunn To: Shenwei Wang Cc: "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 Subject: Re: [PATCH 1/1] net: fec: using page pool to manage RX buffers Message-ID: References: <20220930193751.1249054-1-shenwei.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220930193751.1249054-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; > +}; These are not used in this patch. Please don't add anything until it is actually used. The danger is, when you add the actual increments, we miss that they are u64 and so need protecting. If they are in the same patch, it is much more obvious. > + > struct fec_enet_priv_tx_q { > struct bufdesc_prop bd; > unsigned char *tx_bounce[TX_RING_SIZE]; > @@ -532,7 +552,15 @@ struct fec_enet_priv_tx_q { > > struct fec_enet_priv_rx_q { > struct bufdesc_prop bd; > - struct sk_buff *rx_skbuff[RX_RING_SIZE]; > + struct fec_enet_priv_txrx_info rx_skb_info[RX_RING_SIZE]; > + > + /* page_pool */ > + struct page_pool *page_pool; > + struct xdp_rxq_info xdp_rxq; > + struct fec_enet_xdp_stats stats; > + > + /* rx queue number, in the range 0-7 */ > + u8 id; > }; > > struct fec_stop_mode_gpr { > @@ -644,6 +672,9 @@ struct fec_enet_private { > > struct imx_sc_ipc *ipc_handle; > > + /* XDP BPF Program */ > + struct bpf_prog *xdp_prog; Not in this patch. > fec_enet_alloc_rxq_buffers(struct net_device *ndev, unsigned int queue) > { > struct fec_enet_private *fep = netdev_priv(ndev); > - unsigned int i; > - struct sk_buff *skb; > + int i, err; > struct bufdesc *bdp; > struct fec_enet_priv_rx_q *rxq; > > + dma_addr_t phys_addr; > + struct page *page; Reverse Christmas tree is messed up in this driver, but please don't make it worse. int i, err; should probably be last, and don't add a blank line. Andrew