Message ID | 20240227185334.2697324-1-linux@roeck-us.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-83863-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2899760dyb; Tue, 27 Feb 2024 10:53:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVz3BCBUIrwlajvoNxTb7+9sGpX2xcY3XoXCkm/nmcNN6zzmJvdN4KYX2jM7sXax5hCWvkGtemObRRqPbMY12RUEvEpXw== X-Google-Smtp-Source: AGHT+IFrnDFLaM5q2JHwF5lxpGLBwFJx10Cjirz6QigrLs/oBVm7+3bb8EIZPunUp/S5nvzkerd8 X-Received: by 2002:ac8:7c8c:0:b0:42e:6fae:10c3 with SMTP id y12-20020ac87c8c000000b0042e6fae10c3mr9313426qtv.63.1709060034184; Tue, 27 Feb 2024 10:53:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709060034; cv=pass; d=google.com; s=arc-20160816; b=WQBwfTMXobD9RqvzADQ27FzeKM5WV+77x3AGvwpYyqs6K52FjdP58Lq/FdD3oYEgh+ K+PpzK6AAGRU2gp4GkBQdCBhc5oW3u8kxcLfiw0ExZqo3FCou2yc16oHqneva0b3nbbV Y8LKyeYK/XzouK30jvuJAtq8vcboHe8JRGklNOgPBY+HrJrAR8V0dJWuyEuH6aTTY6OG qBuRJEfkze+F9a34P/0Ijm5lTRlDurQXeOx8cipV328RfsVJp6eO/GVTE+qvOGRJz7S2 QxrIsnTy8cdk4cZBd1n56FWLZ4YzXMMFke+KjW9ZI+RfvZHi+UbLlZ1ma2py/cEA1Ctl GFrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:sender:dkim-signature; bh=cpCYkRMcyEqaONCfb5aChB5RBA9px7XTtxAnjvNYuKY=; fh=bxoE7bLOrorsG28yULe5ttroJhk+zclckGX8M2OqStw=; b=h5OiLc9tyVmc8GUn1eY6bNA2FVk6K1sr7p+Ya9ao5ouZR3BZsRyIbQXPLncv3rNpMt U9dKwTHco5/4x03uJJhl2XNhYaWQuxFn6FPK7p+KpnDJgGQPs3xOceacux68Nv6hrNrG y+tmZUGy/LjxdrNPGd1O5KJRFN/0sCAd/ytFQgDHb0wrBB1CVcIya5GfrqdhUftyhLXB zagqbxesao2cd7fomP3QW2WAHpnxOjWfdwVGzMXYpv0r8yinlzn1PzpNcAWiaMBpIAaQ n+dkNuu7f0QkLZymZ5+Uwo5b1KvLHkuTaPfu8MpyvKgfZx+sWh6CumcjqWDSpGXvDLxz 9BcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="iLQq/bjY"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83863-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83863-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v22-20020a05622a145600b0042e7c95c759si6884919qtx.333.2024.02.27.10.53.54 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:53:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83863-ouuuleilei=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=pass header.i=@gmail.com header.s=20230601 header.b="iLQq/bjY"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-83863-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83863-ouuuleilei=gmail.com@vger.kernel.org" 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 F1CD51C22C3D for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 18:53:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46E1451C45; Tue, 27 Feb 2024 18:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iLQq/bjY" Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F7301EB20; Tue, 27 Feb 2024 18:53:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060020; cv=none; b=HaQCjulwR0xi/uoxIP8atj7Iz6mVYOgzrNYiIIBFEr3cNiwrit2LXgH9qYUsNcy6rWxxTi1QK1+iR8VXl6WxMO/SDAYGYhTPEmSRCTzwCNwc5JfxsQqztplRqC2PfdjXYl7Z+MhzgcoS0CegSG+xO0crDKI2/mL/HvRyADJ8N6k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060020; c=relaxed/simple; bh=XWdSQTiJ5UeZ7Y9pEB7wgt+hK9Ql9hUqNK43darvBNA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=mm/WttfI3Gc1GzqezoUOQAdQ/GTx/8N5y3q+UOaRZtKRJcScsdN9ImWQxdoht0rdHVZ4Ovrdpz2ESorH2enP1O/o+o5vgvgryQQBYqM3Ifma1aWuIilzEZlvjZt53O0T4KoU2mnvcrah3HtjhR47Qz8RyEzJ69PXusNTyCUoOH0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iLQq/bjY; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6e558a67f70so286755b3a.0; Tue, 27 Feb 2024 10:53:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709060018; x=1709664818; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=cpCYkRMcyEqaONCfb5aChB5RBA9px7XTtxAnjvNYuKY=; b=iLQq/bjYXCiG/1mRl3JsAGnABluiXGRdUvO08sEkU2kpKk2JTlwSs3R4nJ+86cYzYG UuIhDpEGanOD7feoSdj1W2YLamh4IKnrTdUss5Dnlg18v910HiUJJjEEE1MHkb8raJEv YWJnfMdhJEDh/SGtsa7COUpNjH7YbhiXEUzNUqZ5/t88aUsPBbxiMQHtCttyIfVRwe98 NDsj88wfRbAy5X3EO9WAiH5LfB/9FlyTaKKp2RThD5+4xfBB7XROUHFoq067JFeI6Ws0 mgqSkGUVbO0Er3G991uhR2uGy4cMewAZBQh0kXaIhwvSo0KrH52DN5QehPws+ugtT9pF PGKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709060018; x=1709664818; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cpCYkRMcyEqaONCfb5aChB5RBA9px7XTtxAnjvNYuKY=; b=iTvEPNkVQygFxUmVzmRN6TJXdi3hHQoKoMQcfD0on798PZqH6+RRyWw5JuJ5rhCN9/ lfJeMb1keSEVumW3SnBGNl7EK/Z2zrPLw4C3AUk4IYTJz3sPIFwxdJ48CcQxJIlzOFIC MNCbFaaecUjyw1//qTlRBRdD5LJRci2Xeh1fYKSrpJc2wUIF5l/kNQlrynnO5m8At6+J PfS2t0LqD1bcoEXKIv/sVYDBGShRqJa942UDQw9auA7LFiFJCyvLBgDQ8BGGqsDFeLrX a/aaMQQ4+FrXxLF1H7iiIek3jkFuuxCdu7aSxVqEngbN/oH2I7sxN+yP1FiS7Ppz4rFr dDWQ== X-Forwarded-Encrypted: i=1; AJvYcCUP9RS+tbwKfcCoXW/CYtYwUXrGTL3SQ7awAVKdmkGB6awB2Yt9qJGXwqVRYfnJyxMHb2uPlf1FJkEk/zWEF6I1DxxN7GaokmYfvgmzhbIBpeg+pzMwnn3RlsEkabiSrGPAfZSsi6OiEU4H X-Gm-Message-State: AOJu0Yy4Yrp35xftnPiS1AUMmRyB9EhM93LCCToL9Fhvuc3MnjbfR1RF +vL3gB61yfcgnvedxUNpuro/K7aMCnTYOo8CsS8xx/GoOs5a4dcbIcwz0e32 X-Received: by 2002:aa7:88cd:0:b0:6df:c3b1:1c2e with SMTP id k13-20020aa788cd000000b006dfc3b11c2emr11949486pff.30.1709060018244; Tue, 27 Feb 2024 10:53:38 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id y5-20020a62b505000000b006e4cb18123fsm6198444pfe.84.2024.02.27.10.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:53:37 -0800 (PST) Sender: Guenter Roeck <groeck7@gmail.com> From: Guenter Roeck <linux@roeck-us.net> To: Helge Deller <deller@gmx.de> Cc: "James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>, Charlie Jenkins <charlie@rivosinc.com>, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck <linux@roeck-us.net> Subject: [PATCH] parisc: More csum_ipv6_magic fixes Date: Tue, 27 Feb 2024 10:53:34 -0800 Message-Id: <20240227185334.2697324-1-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792079334722752774 X-GMAIL-MSGID: 1792079334722752774 |
Series |
parisc: More csum_ipv6_magic fixes
|
|
Commit Message
Guenter Roeck
Feb. 27, 2024, 6:53 p.m. UTC
IPv6 checksum tests with unaligned addresses resulted in unexpected
failures.
Expected expected == csum_result, but
expected == 46591 (0xb5ff)
csum_result == 46381 (0xb52d)
with alignment offset 1
Oddly enough, the problem disappeared after adding test code into
the beginning of csum_ipv6_magic().
As it turns out, the 'sum' parameter of csum_ipv6_magic() is declared as
__wsum, which is a 32-bit variable type. However, it is treated as 64-bit
variable in the assembler code. Tests showed that the upper 32 bit of
the register used to pass the variable are _not_ cleared when entering
the function. This can result in checksum calculation errors.
Clearing the upper 32 bit of 'sum' as first operation in the assembler
code fixes the problem.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Maybe there is a way to do this without additional instruction, but if so
I have not been able to find it.
arch/parisc/include/asm/checksum.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/parisc/include/asm/checksum.h b/arch/parisc/include/asm/checksum.h index c949aa20fa16..2aceebcd695c 100644 --- a/arch/parisc/include/asm/checksum.h +++ b/arch/parisc/include/asm/checksum.h @@ -126,6 +126,7 @@ static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, ** Try to keep 4 registers with "live" values ahead of the ALU. */ +" depdi 0, 31, 32, %0\n"/* clear upper half of incoming checksum */ " ldd,ma 8(%1), %4\n" /* get 1st saddr word */ " ldd,ma 8(%2), %5\n" /* get 1st daddr word */ " add %4, %0, %0\n"