From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39475C2BD09 for ; Tue, 9 Jul 2024 21:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lmY8XhGZIKD3AgYJYwULof9OD2/C9zFlGQFV0jvkWiw=; b=2UeIW5j2xp2VPZ0qzYWvitO0sW 90iIueftMnYH3cP5eVeu7PDvAsyQCYpcVvrFyCHXV6/QJ3LdxeFIqHrvF47OnwLeBCH9wHKPvlPN9 di1byaCpAVy6prY3k5Bego/jEFEnQ2NOD53h7sCnDKNu14dV8RUdzWRYMI4ZHh9Rj9Nbu0FUuMUhS e4mQvpLW6lln9gngKQgsLKok0wqRn4u3tC+f4CcVVR61LEDPRl2jJc8eyjLAiHrTY+yyhP4lWdDId vM7Q7B1qTG6fRDIwSM2B03nntvOX30rMP9AmB4UEoSEoQV34DGvYVWF6qKuNwET5nNSreSHHUp3zB RJGwa1yw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRIam-00000008gdt-1tHe; Tue, 09 Jul 2024 21:41:44 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRIaW-00000008gZS-1ScG for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 21:41:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 54644CE131F; Tue, 9 Jul 2024 21:41:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12C15C3277B; Tue, 9 Jul 2024 21:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720561285; bh=SbPui1m3AbW2qMNDA/2hyBzJDO2nizxqPFCaBUQhvh4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Zdqnlp3cfXCg1vtf8kYrFslpTxMjoIIVaYuKHXr3o9Zo5c9CssG94rFfBYPK1mIMF WGJQ0XQs1RiB6iccNf7Rd+irjH77f9A1PANeZ6XmWxre7vg6E9CiGUFGH+Xuu1ajvC dgMDk4XcpvCfRbv4neg6FTrwjUuhFDrSDvQocb/Gi0WOOLENSTCgswHGlcgwDYjYkR OBBMmrjp56WwlXBCYT5W7ifjmsMRBdwhQCLAVBeuGDGs2MdF3DBSDuaj7lVVz45nP9 m4qXXRurak2mcvRWmOd2Bm4tF8kJpE8JrWQKEM31nifkiocXZFUN7aOWMh98TAtNm9 Qq4w5krFTQHng== Date: Tue, 9 Jul 2024 23:41:21 +0200 From: Lorenzo Bianconi To: Andrew Lunn Cc: netdev@vger.kernel.org, nbd@nbd.name, lorenzo.bianconi83@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, conor@kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, devicetree@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, upstream@airoha.com, angelogioacchino.delregno@collabora.com, benjamin.larsson@genexis.eu, rkannoth@marvell.com, sgoutham@marvell.com, arnd@arndb.de, horms@kernel.org Subject: Re: [PATCH v6 net-next 2/2] net: airoha: Introduce ethernet support for EN7581 SoC Message-ID: References: <68a37d33-6155-4ffc-a0ad-8c5a5b8fed25@lunn.ch> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Cq3ZvBjA33dFjzfY" Content-Disposition: inline In-Reply-To: <68a37d33-6155-4ffc-a0ad-8c5a5b8fed25@lunn.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_144128_755997_315B588C X-CRM114-Status: GOOD ( 19.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --Cq3ZvBjA33dFjzfY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > +static int airoha_qdma_init_rx_queue(struct airoha_eth *eth, > > + struct airoha_queue *q, int ndesc) > > +{ > > + struct page_pool_params pp_params =3D { > > + .order =3D 0, > > + .pool_size =3D 256, > > + .flags =3D PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV, > > + .dma_dir =3D DMA_FROM_DEVICE, > > + .max_len =3D PAGE_SIZE, > > + .nid =3D NUMA_NO_NODE, > > + .dev =3D eth->dev, > > + .napi =3D &q->napi, > > + }; >=20 > I think you can make this const. ack >=20 > > +static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device= _node *np) > > +{ >=20 > > + port =3D netdev_priv(dev); > > + mutex_init(&port->stats.mutex); > > + port->dev =3D dev; > > + port->eth =3D eth; > > + port->id =3D id; > > + > > + err =3D register_netdev(dev); > > + if (err) > > + return err; > > + > > + eth->ports[index] =3D port; >=20 > eth->ports[index] appears to be used in > airoha_qdma_rx_process(). There is a small race condition here, since > the interface could be in use before register_netdev() returns, > e.g. NFS root. It would be better to do the assignment before > registering the interface. actually I check eth->ports[] is not NULL before accessing it in airoha_qdma_rx_process(): p =3D airoha_qdma_get_gdm_port(eth, desc); if (p < 0 || !eth->ports[p]) { ... } Moreover, in airoha_alloc_gdm_port(), I set eth->ports[index] pointer just = if register_netdev() is successful in order to avoid to call unregister_netdev= () on an not-registered net_device in the airoha_probe() error path. I guess w= e can even check reg_state for this: for (i =3D 0; i < ARRAY_SIZE(eth->ports); i++) { ... if (dev->reg_state =3D=3D NETREG_REGISTERED) unregister_netdev(dev); } What do you prefer? Regards, Lorenzo >=20 > These are quite minor, so please add to the next version: >=20 > Reviewed-by: Andrew Lunn >=20 > Andrew >=20 > --- > pw-bot: cr --Cq3ZvBjA33dFjzfY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCZo2ugQAKCRA6cBh0uS2t rGN2AP0bH3wSTrIDAe85Rz4cnutNGUlzziiMIYqhemR1cSKNpwEAoNK2xWm5yS8V emtoQ9fNnbYzEVx2KF1312Kt2xUh/QA= =d8Yw -----END PGP SIGNATURE----- --Cq3ZvBjA33dFjzfY--