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 491B3C3DA7F for ; Wed, 31 Jul 2024 08:55:27 +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=IA2T4fasPR/p/OePOuPGe+ShtDI10NQpT8zivEDS/i0=; b=HHYIqzdgkG9x143oo8X1SqJGI5 2szWd/Kk/DF/eMBZ5usRRk5+Zr4VYdsBf1cVK3kG1AEucmNq/bfO+Nb0BfXNz69HYX6BGoOlbJx3a e2SPEBzCi1vICPwhmz/ZfeGCIZzApXNZBTRSIYpsqAEy7wTMuolEttgZNR0JZxZ0S6aMXHNf9FXJa TVB96BQt/Whicku9M+8GMduboDKSP2Ng5Kz/P5zkWmt2i/TVJqZjrkQnuAwHlZP+SfEXsUs40t5z7 WswrMMUSdwVk2j0Zha0rF0alvhdQEidkN5o9k3CoBf4y+RaKDPj5Pc3gPqPnjaRORBGCSiRwhe5PG N9eEJ4bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZ576-00000000OOa-1lkK; Wed, 31 Jul 2024 08:55:16 +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 1sZ56d-00000000OK8-2Wvw for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2024 08:54:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9B9B2621D9; Wed, 31 Jul 2024 08:54:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9769C116B1; Wed, 31 Jul 2024 08:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722416086; bh=qmbJvr1Uuy1tS5AnKk7/a4dNC6RsQBMVIpnBMNp6TJI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WQol9oX3QO1yPMil8dpygVEjJx/zbPmkgQB+uGOgfYzaTfPxs+q7YvBaonwj55y0c ArQClHRNK8XCjrjaHCiMWvxjWSNbdmnoNsif8KSk3AosVtY8fXeEXBYYi2VsggGSeZ Ds5rN32IW6ix3luj2lD9fnPrbbbUcEC8Si5wh+B0OTUxK0+rV/1VPG6EWYu1c13pV5 kFIlbRcbIpX8ZvwK0rQVMRQKKbuboSyTI3K7QFhnNCve2B+HnY9j+IQxKckiFmgYxM RCa9f3WDYiEx45uzxFSTu0ebMc7t9iB7EcBAunQa4gBNLk2ua8UJtdGgoJgSl8shyj JBDifU2bZuRwA== Date: Wed, 31 Jul 2024 09:54:42 +0100 From: Simon Horman To: "Pandey, Radhey Shyam" Cc: Daniel Borkmann , Ariane Keller , "Simek, Michal" , "netdev@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "Katakam, Harini" Subject: Re: net: xilinx: axienet: Query about checksum partial implementation Message-ID: <20240731085442.GN1967603@kernel.org> References: <20240726120700.GA1694627@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_015447_872471_DB9E6B68 X-CRM114-Status: GOOD ( 26.38 ) 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 Tue, Jul 30, 2024 at 07:15:13PM +0000, Pandey, Radhey Shyam wrote: > > -----Original Message----- > > From: Simon Horman > > Sent: Friday, July 26, 2024 5:37 PM > > To: Pandey, Radhey Shyam > > Cc: Daniel Borkmann ; Ariane Keller > > ; Simek, Michal ; > > netdev@vger.kernel.org; linux-arm-kernel@lists.infradead.org > > Subject: net: xilinx: axienet: Query about checksum partial implementation > > > > 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. > > + Harini > > Yes, IIRC default AXI Ethernet IP RX checksum is set to "No checksum offload" > so, it is default case and being set in most designs. Have added Harini to this > thread to confirm on partial checksum verification results. > > Assuming partial implementation is functional then likely DMA IP updates > application field in big endian format and that is the reason we have this > be32 to CPU conversion in place. will dig a bit more and get back on it. Thanks, much appreciated. FWIIW, I do agree that the scenario you describe would mostly explain things, although the mask with 0xFFFF still seems off.