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 0B05FC3DA7F for ; Fri, 26 Jul 2024 12:07:43 +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:Content-Type:MIME-Version: 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:In-Reply-To:References:List-Owner; bh=3HWuGpCJNw6ac0hbMnznhuTc6gaynt5uXILIkMIX0KA=; b=2JYhD6N2/TCOz+EMXUnSaq51rK iRN2N+K5yFNwyAT8Cv0A6pkXZDCBrshMyNe0Dt9SkwsxppCnkIq1WtyMavfv8CL7VT7nxFK9n/Dko gmn3D3nzS9GtDlvXoFUZwjpSI2pDvrRTdyFR7tjlTLNfwm/kJxVejdGcyror9j/wAtLeT8Hb4NVY9 OgDwZKm6DFdWOgRD85xPhFFgTUQpqEiAKT+5dvwI3o41u0H2Wj47F7YTy7Iv1XH7nx/FWoEvIaVB5 kJR4GGd0krhG3Ru9jXlbOO1BHZfhIQPNLsmhKixoSbdF7YiyPbF2bafeB9zAlA4guvvjcfnBvqeng U2DPgYYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXJjQ-00000003oCI-1oUM; Fri, 26 Jul 2024 12:07:32 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXJj0-00000003o5u-2wLj for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 12:07:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 823D8616AE; Fri, 26 Jul 2024 12:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3CFAC32782; Fri, 26 Jul 2024 12:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721995624; bh=Qnti6MN/VkxTOBCQfUMUJjrKVzl+gAkHfmZCS7vXg7I=; h=Date:From:To:Cc:Subject:From; b=uyE8l0a/EdG2pO9Aajfwr8+EZsO9gyCEquppBHXUZEfg6OcF2MExFORxH8hXSxwxU gH4rxO2RJBXG3SCab8eLq7JJX6L6nRN8//ZG9FObRg118AJTp2nmdeM841Gyy9a8I7 kYpn+B4Zp5FsP3w1VaJ4x4MuKtdUbeKCZHMcBVULG+Hct3aDM1QvesTEmJDBTOreBb hK84kMLGg/D0zF5uBn9d8tvqC9xZw46mxaa09W2NyRkG4nqaQNg+OfMJqMrq6CBq8N 74E9l25WJ84PhHSPMLuyyOwIG3OelpaA7CvCVLfEudB1oX35JwfnGVbuSuW5+GoqfW gI8zeQLAW7IeQ== Date: Fri, 26 Jul 2024 13:07:00 +0100 From: Simon Horman To: Radhey Shyam Pandey Cc: Daniel Borkmann , Ariane Keller , Michal Simek , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: net: xilinx: axienet: Query about checksum partial implementation Message-ID: <20240726120700.GA1694627@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_050706_846252_1961A074 X-CRM114-Status: GOOD ( 11.48 ) 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 Hi Radhey, all, I am wondering if you could shed some light on the following checksum partial handling in the axienet_rx_poll(): /* if we're doing Rx csum offload, set it up */ if (lp->features & XAE_FEATURE_FULL_RX_CSUM) { ... } else if ((lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) != 0 && skb->protocol == htons(ETH_P_IP) && skb->len > 64) { skb->csum = be32_to_cpu(cur_p->app3 & 0xFFFF); ... } In particluar the "skb->csum =" line. The type of cur_p->app3 is u32, and 0xFFFF is also host byte order. So far so good. But after the bitwise operation it is treated as a big-endian value by passing it to be32_to_cpu. Perhaps I am missing something obvious, but my question is how does that work? * Was it only tested on big endian sysgtems where be32_to_cpu() is a no-op * Was it only tested on little endian systems where be32_to_cpu() is a byteswap and somehow that works (how?). * Is the code unecessised because the XAE_FEATURE_FULL_RX_CSUM branch is always taken? A grep of dts files shows up arch/microblaze/boot/dts/system.dts which sets sets xlnx,rxcsum to 0, which corresponds to XAE_NO_CSUM_OFFLOAD. * Something else Flagged by Sparse The in quesoitn code seems to have been introduced by 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver")