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 A5AEBC30653 for ; Mon, 1 Jul 2024 13:53:54 +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=9Z4G28gL2HnK0vrLdSm8LnkDAXyK3nXqg40/VYEv/KQ=; b=Ep9R+ZdOruodMIlkPsk9BC6djM q8V66mO9ASdUhuEx8D8x7rILdjQiisI3Yih4mq4p/QiAxl0Nc6PR9E6WJCMOEwX6ikgWMnw3o1RLD L+PFV2/11TJ3zqAbpUqVqrNBEifGYRG3ubkxGIpDaHha79Ikq2cIxzsF0ExCy4ItLRqVgYBQbh4T3 JdNi0JNxc078lez1IYT1T1d4u36Wp3SvYNcRYEw2fL6spWjNrJDqSgbPekHtgtwz7zfkXCcbu47hV SbjPhMsXlXHBEe5HtVXI8VSZitnxiZXW6PCoijTMIBy5a0Hpcy0Gz7UG6D1/osd31DnKgFuV+WMat ElepzJkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOHTP-00000003a3e-2YKK; Mon, 01 Jul 2024 13:53:39 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOHTD-00000003ZyO-3D4M for linux-arm-kernel@lists.infradead.org; Mon, 01 Jul 2024 13:53:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 715D66134E; Mon, 1 Jul 2024 13:53:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3DE0C116B1; Mon, 1 Jul 2024 13:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719842006; bh=r8TwQcnCucjLf3kM3DNF0A1LB9UEN+OlT5l5Gu1zqZ8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rXVSrgwX6xGnNVw8bHLm1pEJOdWLG9BWhabv/PL/EfTjTIvdzWelbL2/GpdRkr4CA tCNVaajyzy1L6IHs0PPpeab4t1oeOhQVPCDUHo58+az4k2YoYGp64UvDaOufgzRGoX 5+HnfF6ZDnwQHw07UqOS1gZ2xyIYvtgGemJfk0dGHOiEorbD2vTYhlCrpEwJ5GbJID kkLss+ukrXm22I/2RhVmZdCWShVt7xlMtm3KaQT3g7BSN6RirZ9O9i3PJ1viGFBn29 H2q+fUX4AN+DNiptlO+VYIib/Th4w1d+vrzyTVeGXxm5cZoGdvf0ftRGlyETZBn428 5lid3z318HhYg== Date: Mon, 1 Jul 2024 14:53:19 +0100 From: Simon Horman To: Lorenzo Bianconi 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, andrew@lunn.ch, arnd@arndb.de Subject: Re: [PATCH v4 2/2] net: airoha: Introduce ethernet support for EN7581 SoC Message-ID: <20240701135319.GE17134@kernel.org> References: <56f57f37b80796e9706555503e5b4cf194f69479.1719672695.git.lorenzo@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56f57f37b80796e9706555503e5b4cf194f69479.1719672695.git.lorenzo@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240701_065327_961213_55932913 X-CRM114-Status: GOOD ( 20.25 ) 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 On Sat, Jun 29, 2024 at 05:01:38PM +0200, Lorenzo Bianconi wrote: > Add airoha_eth driver in order to introduce ethernet support for > Airoha EN7581 SoC available on EN7581 development board (en7581-evb). > en7581-evb networking architecture is composed by airoha_eth as mac > controller (cpu port) and a mt7530 dsa based switch. > EN7581 mac controller is mainly composed by Frame Engine (FE) and > QoS-DMA (QDMA) modules. FE is used for traffic offloading (just basic > functionalities are supported now) while QDMA is used for DMA operation > and QOS functionalities between mac layer and the dsa switch (hw QoS is > not available yet and it will be added in the future). > Currently only hw lan features are available, hw wan will be added with > subsequent patches. > > Tested-by: Benjamin Larsson > Signed-off-by: Lorenzo Bianconi Hi Lorenzo, Some minor feedback from my side. > +static void airoha_qdma_set_irqmask(struct airoha_eth *eth, int index, > + u32 clear, u32 set) > +{ > + unsigned long flags; > + > + if (WARN_ON_ONCE(index >= ARRAY_SIZE(eth->irqmask))) > + return; > + > + spin_lock_irqsave(ð->irq_lock, flags); > + > + eth->irqmask[index] &= ~clear; > + eth->irqmask[index] |= set; > + airoha_qdma_wr(eth, REG_INT_ENABLE(index), eth->irqmask[index]); > + /* Read irq_enable register in order to guarantee the update above > + * completes in the spinlock critical section. > + */ > + airoha_rr(eth, REG_INT_ENABLE(index)); airoha_rr() expects an __iomem pointer as it's first argument, but the type of eth is struct airoha_eth *eth. Should this be using airoha_qdma_rr() instead? Flagged by Sparse. > + > + spin_unlock_irqrestore(ð->irq_lock, flags); > +} ... > +static void airoha_ethtool_get_strings(struct net_device *dev, u32 sset, > + u8 *data) > +{ > + int i; > + > + if (sset != ETH_SS_STATS) > + return; > + > + for (i = 0; i < ARRAY_SIZE(airoha_ethtool_stats_name); i++) { > + memcpy(data + i * ETH_GSTRING_LEN, > + airoha_ethtool_stats_name[i], ETH_GSTRING_LEN); > + } > + > + data += ETH_GSTRING_LEN * ARRAY_SIZE(airoha_ethtool_stats_name); > + page_pool_ethtool_stats_get_strings(data); > +} W=1 allmodconfig builds on x86_64 with gcc-13 complain about the use of memcpy above because the source is (often?) less than ETH_GSTRING_LEN bytes long. I think the preferred solution is to use ethtool_puts(), something like this (compile tested only!): @@ -2291,12 +2291,9 @@ static void airoha_ethtool_get_strings(struct net_device *dev, u32 sset, if (sset != ETH_SS_STATS) return; - for (i = 0; i < ARRAY_SIZE(airoha_ethtool_stats_name); i++) { - memcpy(data + i * ETH_GSTRING_LEN, - airoha_ethtool_stats_name[i], ETH_GSTRING_LEN); - } + for (i = 0; i < ARRAY_SIZE(airoha_ethtool_stats_name); i++) + ethtool_puts(&data, airoha_ethtool_stats_name[i]); - data += ETH_GSTRING_LEN * ARRAY_SIZE(airoha_ethtool_stats_name); page_pool_ethtool_stats_get_strings(data); } ... > +static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np) > +{ > + const __be32 *id_ptr = of_get_property(np, "reg", NULL); > + struct net_device *dev; > + struct airoha_gdm_port *port; nit: reverse xmas tree > + int err, index; > + u32 id; ... -- pw-bot: changes-requested