Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1500516rbb; Mon, 26 Feb 2024 11:10:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWOOotkj/40gP/acb3abjIkSP7zdCHi7kSObfF0CS/SlF8hqexwO/QYp8kAt/tSb2Xv2CK7wn3KfnRVQ7P+8Re/DmbupuShhSnRJfqIFw== X-Google-Smtp-Source: AGHT+IHumcHvhgBKKEBKl20wHbEo9SLBQlxoYPUTEM+8MWhygt3zKOEOZh1Gb8HKShXdLGGyPfk7 X-Received: by 2002:a05:620a:10:b0:787:c11c:7dd3 with SMTP id j16-20020a05620a001000b00787c11c7dd3mr55017qki.0.1708974658340; Mon, 26 Feb 2024 11:10:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708974658; cv=pass; d=google.com; s=arc-20160816; b=wsfcuWjEu/dEOWjsLCWiSgpi25HmM7vrheSqqxdyhleZjTd1MxDDuHRBfJUKnRZNhY 8fjIKKMC2Hw8PMg5NCQwVL/RA5DUwybE6DrQ+xc6cI82dK/kT9RO3u7DQcAgnm0iDgI1 9S5esw4IafAVle7/yuhL4Lwpf/tFKe54fXryVf0EW8X/4RNIDYHgzu1IoT3Cmy8kFjAk zG4KBC+TftNQz7Oj6wXFYEbKJcn8bv7bQR4022WYpAydD16rfr1QCHe1pM5qIvEMe1pJ hUjIVRj5cH7YNXzNmv1RiIaY+/YKpcA+ZOaMA+j0EYwhdcXHN1d4mA7T7/Neixhu2BYP Reow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p9KjOlu0+TEJffXffYs7C37fc+zygG+gBQDwUHyWubM=; fh=ghCVufBtmMBMu1FHBztvwBE1r+f5aiqP+jDN8ijmQR8=; b=zJRwCfcyo7hcay/JcsD4+rKWquLs6wz9n9DcLD8nv5D6PYJZsVGxxC0uw6YIGCsDg2 D+ZxB4jaBNi5G3G/I3U2w6FpDZiKuVqDbI/IVBBls7yCJy6tAVvv3PKk2h3VEyYtHsHx X4bO6v+SdPBrtnQSxrDmYe1u/4MvHLARsUW/qqIGFGwhBtcit3JjNCWe4ebRaakC9WZE Q553Pbd3VqSvKyvZYK7yPAwvnCzlNDpS9Vc7tNgVREDnUI9bywf4pQteVhS30aRIgXy0 RqTiA48QtbhFuusN4B7DANv3TxRgzkQY9zLJeB09ZLK58sfs+kY4yrLV3sfL7+JImanx nv6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=MOK4PN3O; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-82200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82200-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i7-20020a05620a404700b00787b59e5659si6309889qko.200.2024.02.26.11.10.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 11:10:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=MOK4PN3O; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-82200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82200-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3D6621C23D57 for ; Mon, 26 Feb 2024 19:10:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60082130AE1; Mon, 26 Feb 2024 19:07:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="MOK4PN3O" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05AE112F5A1; Mon, 26 Feb 2024 19:07:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708974424; cv=none; b=fk3Yx+mxwmChLFVvFNrJOGzgfuQJve/jOSNU+vFTfUH8YLpFMP8EAFn429lx6pjLw326BnLGkgbiRfFHBMjjIIOAZwlP68oQ+5BhvfsVBjm9ykSBMkf8+Ksgk5M2si/ue28739QhjNcWqa3c7DOqrJoNdIJBy6UNk8fMvVNy0J8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708974424; c=relaxed/simple; bh=dME12RiHWkWvlr/Yymi7aKCtbspaBLR+cUleBOIT3Rk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SVf/QRAE3J+BIhbUxe3HIdQ4gP+KLDWIj3ZCq0JTSNI5cvoE18duFi2BYl5SyVrlxP+WA5KgTQmXYx158GHNR+sU5An0WqP/59w3ZMCaOuUv5XP4139ZoDscFIWYGRMvku0GUIlT7v08ECuLKCOvu07GlT4eijUPXwTdgJalk0k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=MOK4PN3O; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=p9KjOlu0+TEJffXffYs7C37fc+zygG+gBQDwUHyWubM=; b=MOK4PN3Og8rk6JU6g/g8QfsZhX mALDPkPGKkCfHWrsMRhTPcRVXeI+jhwqbEbrajU8tBCo1QmNgg4/jTfWwR8wjcFvDFUNNSEIaleJt uLiKY21HevkbnEgWwEQ+Kb4na7jJjlsNq5lcqNguwVVSmFRf618UvykUgUcxcGOnHfmQNRomPhIjB BCqP6A3BQEyebPbZG/NKGATVluIzPC9px/m/Y7O1reqVIzSnP5E7WgZ1D1cg6rIJp0/MOrDevKgXv uDcUt/n1GpuYVldBbIbJ8juegUuJVgoqRCAGAQPQwefpH/GZvxo8sYARgf35T+dFNxlpsR9RUv8gy nP4T7rRQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:37538) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1regJO-0004mT-08; Mon, 26 Feb 2024 19:06:50 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1regJK-0006fG-SC; Mon, 26 Feb 2024 19:06:46 +0000 Date: Mon, 26 Feb 2024 19:06:46 +0000 From: "Russell King (Oracle)" To: Charlie Jenkins Cc: Guenter Roeck , Christophe Leroy , David Laight , Palmer Dabbelt , Andrew Morton , Helge Deller , "James E.J. Bottomley" , Parisc List , Arnd Bergmann , "linux-kernel@vger.kernel.org" , Palmer Dabbelt , Linux ARM Subject: Re: [PATCH v10] lib: checksum: Use aligned accesses for ip_fast_csum and csum_ipv6_magic tests Message-ID: References: <20240223-fix_sparse_errors_checksum_tests-v10-1-b6a45914b7d8@rivosinc.com> <7ae930a7-3b10-4470-94ee-89cb650b3349@csgroup.eu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) On Mon, Feb 26, 2024 at 10:35:18AM -0800, Charlie Jenkins wrote: > On Mon, Feb 26, 2024 at 05:50:57PM +0000, Russell King (Oracle) wrote: > > On Mon, Feb 26, 2024 at 08:44:29AM -0800, Guenter Roeck wrote: > > > On 2/26/24 03:34, Christophe Leroy wrote: > > > > > > > > > > > > Le 23/02/2024 ? 23:11, Charlie Jenkins a ?crit?: > > > > > The test cases for ip_fast_csum and csum_ipv6_magic were not properly > > > > > aligning the IP header, which were causing failures on architectures > > > > > that do not support misaligned accesses like some ARM platforms. To > > > > > solve this, align the data along (14 + NET_IP_ALIGN) bytes which is the > > > > > standard alignment of an IP header and must be supported by the > > > > > architecture. > > > > > > > > I'm still wondering what we are really trying to fix here. > > > > > > > > All other tests are explicitely testing that it works with any alignment. > > > > > > > > Shouldn't ip_fast_csum() and csum_ipv6_magic() work for any alignment as > > > > well ? I would expect it, I see no comment in arm code which explicits > > > > that assumption around those functions. > > > > > > > > Isn't the problem only the following line, because csum_offset is > > > > unaligned ? > > > > > > > > csum = *(__wsum *)(random_buf + i + csum_offset); > > > > > > > > Otherwise, if there really is an alignment issue for the IPv6 source or > > > > destination address, isn't it enough to perform a 32 bits alignment ? > > > > > > > > > > It isn't just arm. > > > > > > Question should be what alignments the functions are supposed to be able > > > to handle, not what they are optimized for. If byte and/or half word alignments > > > are expected to be supported, there is still architecture code which would > > > have to be fixed. Unaligned accesses are known to fail on hppa64/parisc64 > > > and on sh4, for example. If unaligned accesses are expected to be handled, > > > it would probably make sense to add a separate test case, though, to clarify > > > that the test fails due to alignment issues, not due to input parameters. > > > > It's network driver dependent. Most network drivers receive packets > > to the offset defined by NET_IP_ALIGN (which is normally 2) which > > has the effect of "mis-aligning" the ethernet header, but aligning > > the IP header. > > > > Whether drivers do that is up to drivers (and their capabilities). > > Some network drivers can not do this kind of alignment, so there are > > cases where the received packets aren't offset by two bytes, leading > > to the IP header being aligned to an odd 16-bit word rather than an > > even 16-bit word (and thus 32-bit aligned.) > > > > Then you have the possibility of other headers between the ethernet > > and IP header - not only things like VLANs, but also possibly DSA > > headers (for switches) and how big those are. > > Those additional combinations can be supported by future test cases, > but the goal of this patch was simply to have basic testing for these > functions. The NET_IP_ALIGN offset is what the kernel defines to be > supported, so that is the test case I went for. I think you misunderstand. "NET_IP_ALIGN offset is what the kernel defines to be supported" is a gross misinterpretation. It is not "defined to be supported" at all. It is the _preferred_ alignment nothing more, nothing less. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!