From: Xin Long <lucien.xin@gmail.com>
To: network dev <netdev@vger.kernel.org>, linuxppc-dev@lists.ozlabs.org
Cc: Christophe Leroy <christophe.leroy@c-s.fr>,
Michael Ellerman <mpe@ellerman.id.au>,
Roopa Prabhu <roopa@cumulusnetworks.com>
Subject: [PATCH net] powerpc: use big endian to hash len and proto in csum_ipv6_magic
Date: Sat, 8 Sep 2018 18:15:12 +0800 [thread overview]
Message-ID: <9183876a4a8ff0099686521d60f395a5230b67ed.1536401712.git.lucien.xin@gmail.com> (raw)
The function csum_ipv6_magic doesn't convert len and proto to big
endian before doing ipv6 csum hash, which is not consistent with
RFC and other arches.
Jianlin found it when ICMPv6 packets from other hosts were dropped
in the powerpc64 system.
This patch is to fix it by using instruction 'lwbrx' to do this
conversion in powerpc32/64 csum_ipv6_magic.
Fixes: e9c4943a107b ("powerpc: Implement csum_ipv6_magic in assembly")
Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
arch/powerpc/lib/checksum_32.S | 4 ++++
arch/powerpc/lib/checksum_64.S | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S
index aa22406..7d3446e 100644
--- a/arch/powerpc/lib/checksum_32.S
+++ b/arch/powerpc/lib/checksum_32.S
@@ -325,6 +325,10 @@ _GLOBAL(csum_ipv6_magic)
adde r0, r0, r9
lwz r11, 12(r4)
adde r0, r0, r10
+ STWX_BE r5, 0, r1
+ lwz r5, 0(r1)
+ STWX_BE r6, 0, r1
+ lwz r6, 0(r1)
add r5, r5, r6 /* assumption: len + proto doesn't carry */
adde r0, r0, r11
adde r0, r0, r5
diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
index 886ed94..302e732 100644
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -439,6 +439,10 @@ EXPORT_SYMBOL(csum_partial_copy_generic)
_GLOBAL(csum_ipv6_magic)
ld r8, 0(r3)
ld r9, 8(r3)
+ STWX_BE r5, 0, r1
+ lwz r5, 0(r1)
+ STWX_BE r6, 0, r1
+ lwz r6, 0(r1)
add r5, r5, r6
addc r0, r8, r9
ld r10, 0(r4)
--
2.1.0
next reply other threads:[~2018-09-08 10:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-08 10:15 Xin Long [this message]
2018-09-08 16:33 ` [PATCH net] powerpc: use big endian to hash len and proto in csum_ipv6_magic LEROY Christophe
2018-09-12 6:01 ` David Miller
2018-09-12 6:27 ` Christophe LEROY
2018-09-12 6:27 ` Xin Long
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9183876a4a8ff0099686521d60f395a5230b67ed.1536401712.git.lucien.xin@gmail.com \
--to=lucien.xin@gmail.com \
--cc=christophe.leroy@c-s.fr \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).