Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2859677imm; Mon, 10 Sep 2018 07:30:47 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda7k6/ehN5BfwalKw5oR+iTm/NoYySJsm2iHjGo033jdBfCOjrjZlq7GJRjTsg0T9hsJxPu X-Received: by 2002:a17:902:a983:: with SMTP id bh3-v6mr21921202plb.245.1536589847851; Mon, 10 Sep 2018 07:30:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536589847; cv=none; d=google.com; s=arc-20160816; b=JV/tgjnvuY/YocfVotanTPkAsZue2RtzFcv+DhgQof94Nh4qszsruFAtBeQWHzJnjk xL35m6Xdg7uvh9vip+JXN1RZ2y9uehLuoTMUcHgnEX9xBoEhQRycZ5qqndfiTVbKvOge IFLxf8DR9rvQep5UYW+X638bYKlupCrV9AdLoGca6VVD5ewvMsunanBFr7pKOG2knbFe gGw84Dt0uJVg/+N9OJ4BIaXeqhymII8yWOWOty6mpTpsrabRXgI5yisQwSYJYCBnKddt hAZb7Tk1PGg7qvqXVGr1PnIg7mpF39FBsgGeQaYESCXD+EY6PaGe8XPaNfKy9jCXUkNF +F6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9SifSyhMuydHQHrtbDlzmaT0ctZMeBqJ7gvlao09c98=; b=yLlJMzkQMGXiGsKmFSnwWqVvcC6yHaE8OpR3AglshuJtSikkbNZjLQUu3CxskChMMm 1koj9xdI2D1qi/mbgFmlGvGJA/k7RV9ULGJpDz209udzWmNMLKud/e5PMS6Ep6e9mI9J DeAMP44YzmVszyz5G3IFIwscva7BNpnbDIe6h2RzZMJ4fNJ8aakog/TEJ9KkvWVKuRyH MMVyHy+UP/AhSRRiu0AZ/daf+UC21xvK904OTRBrPc5lTY9mbWpLvUBLUcye404hxspn 1yKZVP3Y10ae/7PkTTSX19P7Jk07g0x16R6lDurj6ypOE+li0BmIFT9rDiN2F4YjpYgf nCcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PhL2c3EO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m63-v6si16694954pld.62.2018.09.10.07.30.30; Mon, 10 Sep 2018 07:30:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PhL2c3EO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728587AbeIJTWm (ORCPT + 99 others); Mon, 10 Sep 2018 15:22:42 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:45918 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728462AbeIJTWm (ORCPT ); Mon, 10 Sep 2018 15:22:42 -0400 Received: by mail-io0-f196.google.com with SMTP id e12-v6so760033iok.12; Mon, 10 Sep 2018 07:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9SifSyhMuydHQHrtbDlzmaT0ctZMeBqJ7gvlao09c98=; b=PhL2c3EOzhBBWNDjMcwoyCJM0P/gbegicSYMz0dyGXP8B0kLd3kcyRfqMaryz1tLVT 7W7lR61I51ZtWBmENpMNWFdv4t8dcdExFgdQ7t8SFjb4S0BFGgg+cuhmdvWkBccP0akP HvxS6wSp1aMZEwXRfItb9F5NFcBnbBnbdXp8tl3vV2vjhfltk/2CGlfDCpu+B8q1R+yp j/n1/4Io3a+Pu3mxFP+nlJI7DyUlODgAlO5ZyMaI0hLw/H8xGn96AEMb5y53D+xBejOA TkYx/enwEyRO2OKo51jan7W516tL9YaOLoXwA2j6+UNhpCDUkLaK0c7TR7hfVYtilh8e PYRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9SifSyhMuydHQHrtbDlzmaT0ctZMeBqJ7gvlao09c98=; b=bbXaPbwMvb5gEaYafajXRfBbB1sQisKMiSO1l1cItqEfTOUp1UjWaYFr2pbufv9t24 FgD1M8nDpQa/+C4FFeUo43l4rHzSi/vtEzj1Q5zNHc6B4/8hWJyF21ugOMUDO1q5eNDS 1nrJJBxtnLH+1Q0klzyHwqbAHn4bEk3Ix/nX8hVt/T+wH+3+kXpbCIMxwPK/TPnZx7oP FZCoSQmM1LDSdhR7vMydydgKcgAgADJm6Sb+n6TdjQbPHXBs87h5h85JtqD7R/8HEVLW 8r1Vy0FttxFj2ht0P1IApY1p22JoAUyRFVx0OlrnRl3iODdfnZBokUE6JHSuIfzK1YpE Sf8g== X-Gm-Message-State: APzg51BPENKFuBR1OY+gsFGvCyXGkfwHnd/kLsg+ABCxeK4gAErzrcKP aPB99xIXmIf9+PkyqBlOF2LpdVQ4cJsBXDsmETopHhFT X-Received: by 2002:a6b:15c2:: with SMTP id 185-v6mr18444764iov.161.1536589699597; Mon, 10 Sep 2018 07:28:19 -0700 (PDT) MIME-Version: 1.0 References: <3c4cddf185438cc7200908b4f971a8e6ed7472fd.1536558233.git.christophe.leroy@c-s.fr> In-Reply-To: <3c4cddf185438cc7200908b4f971a8e6ed7472fd.1536558233.git.christophe.leroy@c-s.fr> From: Xin Long Date: Mon, 10 Sep 2018 22:28:08 +0800 Message-ID: Subject: Re: [PATCH] powerpc: fix csum_ipv6_magic() on little endian platforms To: Christophe Leroy Cc: benh@kernel.crashing.org, paulus@samba.org, Michael Ellerman , jishi@redhat.com, LKML , linuxppc-dev@lists.ozlabs.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 10, 2018 at 2:09 PM Christophe Leroy wrote: > > On little endian platforms, csum_ipv6_magic() keeps len and proto in > CPU byte order. This generates a bad results leading to ICMPv6 packets > from other hosts being dropped by powerpc64le platforms. > > In order to fix this, len and proto should be converted to network > byte order ie bigendian byte order. However checksumming 0x12345678 > and 0x56341278 provide the exact same result so it is enough to > rotate the sum of len and proto by 1 byte. > > PPC32 only support bigendian so the fix is needed for PPC64 only > > Fixes: e9c4943a107b ("powerpc: Implement csum_ipv6_magic in assembly") > Reported-by: Jianlin Shi > Reported-by: Xin Long > Cc: # 4.18+ > Signed-off-by: Christophe Leroy > --- > arch/powerpc/lib/checksum_64.S | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S > index 886ed94b9c13..2a68c43e13f5 100644 > --- a/arch/powerpc/lib/checksum_64.S > +++ b/arch/powerpc/lib/checksum_64.S > @@ -443,6 +443,9 @@ _GLOBAL(csum_ipv6_magic) > addc r0, r8, r9 > ld r10, 0(r4) > ld r11, 8(r4) > +#ifndef CONFIG_CPU_BIG_ENDIAN > + rotldi r5, r5, 8 > +#endif > adde r0, r0, r10 > add r5, r5, r7 > adde r0, r0, r11 > -- > 2.13.3 > Tested-by: Xin Long