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 1EB2AC54788 for ; Thu, 22 Feb 2024 13:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UyCA1jYlZ1E1lf9YxXbbZRhFn8SNJwUz8AMUaY4m58k=; b=BlUl53kTiNlG7/ 3tklP9NswQBQ4AGNz4KS/nLv+WmHEWNJM8r5eyjGlawYyczPI0mcbR/36i0+qJMH6ygXbptA2LD7X 2i7xG21nCpyZArNhFWO8OhrqdHTS6R4iWX5JW8qoSbyzCoV/Ogm65LQe0WwzS8Qh+Ocq1FHhOO7ya JHyrNG14CXTTvIEdm0Y7WFpG67xLN0OKnw9pgnowVcezV9+/ER/GSWIlsQG2z9uJqGwHsIk5etxIj ScMUf9lj25hgbkoUQR88YWbY86NreK2cNE/gxlWfXenzH4v0Sj+E2SUF730TGJtwQRU6PKKJh3fiB maXUvwrUiWDVeL9g2FEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rd9AQ-000000053Ax-1Nfa; Thu, 22 Feb 2024 13:31:14 +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 1rd9AN-000000053AD-1SQT for linux-arm-kernel@lists.infradead.org; Thu, 22 Feb 2024 13:31:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 9608BCE2225; Thu, 22 Feb 2024 13:31:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B09CDC433C7; Thu, 22 Feb 2024 13:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708608668; bh=aOcJtCmwKp2GuBFt7gwIwEmbmxIllUoOP4HuHQpHAjE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IBkYPdke3iI1N//HBlZqUDekP6PITPEZ1gqufxPPOx7I8aVsg4jhGe1Sd+1V/6LrT h9ZyexhnlHPBqSGdvmiSB1K7iRJguanPbo7cqsW4+rgnYkYWDe3yIf2RkgqVO59XAP WXgTE2MeeJji0OvaVlR8vRm4+OgrhwKljD8qWt6BzNsDvCFaHGwwxbwozXh/b7gXLw 56Bp2rDECET0TlUV+ARswXxjARFLlMfWJ9LusIfVc12yiZBsasuyllikTXYlUa/suJ UNi2sYf4VaJIbdRDmN+lo7MheIXMXWM/Dcf54XPiEwgirBvn+3de9Tx3JqU+yEs0rV tiPGxxdBn2hwg== Date: Thu, 22 Feb 2024 13:31:03 +0000 From: Simon Horman To: Diogo Ivo Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, danishanwar@ti.com, rogerq@kernel.org, vigneshr@ti.com, arnd@arndb.de, wsa+renesas@sang-engineering.com, vladimir.oltean@nxp.com, andrew@lunn.ch, dan.carpenter@linaro.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jan.kiszka@siemens.com Subject: Re: [PATCH net-next v3 10/10] net: ti: icssg-prueth: Add ICSSG Ethernet driver for AM65x SR1.0 platforms Message-ID: <20240222133103.GB960874@kernel.org> References: <20240221152421.112324-1-diogo.ivo@siemens.com> <20240221152421.112324-11-diogo.ivo@siemens.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240221152421.112324-11-diogo.ivo@siemens.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240222_053111_832480_BD5C0D5D X-CRM114-Status: GOOD ( 19.45 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 21, 2024 at 03:24:16PM +0000, Diogo Ivo wrote: > Add the PRUeth driver for the ICSSG subsystem found in AM65x SR1.0 devices. > The main differences that set SR1.0 and SR2.0 apart are the missing TXPRU > core in SR1.0, two extra DMA channels for management purposes and different > firmware that needs to be configured accordingly. > > Based on the work of Roger Quadros, Vignesh Raghavendra and > Grygorii Strashko in TI's 5.10 SDK [1]. > > [1]: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/?h=ti-linux-5.10.y > > Co-developed-by: Jan Kiszka > Signed-off-by: Jan Kiszka > Signed-off-by: Diogo Ivo ... > diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c ... > +static void icssg_config_sr1(struct prueth *prueth, struct prueth_emac *emac, > + int slice) > +{ > + struct icssg_sr1_config config; > + void __iomem *va; > + int i, index; > + > + memset(&config, 0, sizeof(config)); > + config.addr_lo = cpu_to_le32(lower_32_bits(prueth->msmcram.pa)); > + config.addr_hi = cpu_to_le32(upper_32_bits(prueth->msmcram.pa)); > + config.num_tx_threads = 0; > + config.rx_flow_id = emac->rx_flow_id_base; /* flow id for host port */ > + config.rx_mgr_flow_id = emac->rx_mgm_flow_id_base; /* for mgm ch */ > + config.rand_seed = get_random_u32(); Hi Diogo and Jan, The fields of config above are all __le32. However the last three lines above assign host byte-order values to these fields. This does not seem correct. This is flagged by Sparse along with some problems. Please ensure that new Sparse warnings are not introduced. > + > + for (i = PRUETH_EMAC_BUF_POOL_START_SR1; i < PRUETH_NUM_BUF_POOLS_SR1; i++) { > + index = i - PRUETH_EMAC_BUF_POOL_START_SR1; > + config.tx_buf_sz[i] = cpu_to_le32(emac_egress_buf_pool_size[index]); > + } > + > + va = prueth->shram.va + slice * ICSSG_CONFIG_OFFSET_SLICE1; > + memcpy_toio(va, &config, sizeof(config)); > + > + emac->speed = SPEED_1000; > + emac->duplex = DUPLEX_FULL; > +} > + > +static int emac_send_command_sr1(struct prueth_emac *emac, u32 cmd) > +{ > + dma_addr_t desc_dma, buf_dma; > + struct prueth_tx_chn *tx_chn; > + struct cppi5_host_desc_t *first_desc; > + u32 *data = emac->cmd_data; > + u32 pkt_len = sizeof(emac->cmd_data); > + void **swdata; > + int ret = 0; > + u32 *epib; In new Networking code please express local variables in reverse xmas tree order - longest line to shortest. Something like this (completely untested!): struct cppi5_host_desc_t *first_desc; u32 pkt_len = sizeof(emac->cmd_data); dma_addr_t desc_dma, buf_dma; struct prueth_tx_chn *tx_chn; u32 *data = emac->cmd_data; void **swdata; int ret = 0; u32 *epib; There is also one such problem in Patch 06/10. These problems can be detected using: https://github.com/ecree-solarflare/xmastree ... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel