[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+hQTn26hK-4CA=cAwCxEMzogqD30PYdqz4NP8kjmH2gg@mail.gmail.com>
Date: Thu, 18 Nov 2021 09:02:43 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Johannes Berg <johannes@...solutions.net>
Cc: Peter Zijlstra <peterz@...radead.org>,
kernel test robot <lkp@...el.com>, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org, x86@...nel.org,
Alexander Duyck <alexanderduyck@...com>,
linux-um@...ts.infradead.org
Subject: Re: [tip:x86/core 1/1] arch/x86/um/../lib/csum-partial_64.c:98:12:
error: implicit declaration of function 'load_unaligned_zeropad'
On Thu, Nov 18, 2021 at 8:57 AM Eric Dumazet <edumazet@...gle.com> wrote:
>
> Unless fixups can be handled, the signature of the function needs to
> be different.
>
> In UM, we would need to provide a number of bytes that can be read.
We can make this a bit less ugly of course.
diff --git a/arch/x86/lib/csum-partial_64.c b/arch/x86/lib/csum-partial_64.c
index 5ec35626945b6db2f7f41c6d46d5e422810eac46..7a3c4e7e05c4b21566e1ee3813a071509a9d54ff
100644
--- a/arch/x86/lib/csum-partial_64.c
+++ b/arch/x86/lib/csum-partial_64.c
@@ -21,6 +21,25 @@ static inline unsigned short from32to16(unsigned a)
return b;
}
+
+static inline unsigned long load_partial_long(const void *buff, int len)
+{
+#ifndef CONFIG_DCACHE_WORD_ACCESS
+ union {
+ unsigned long ulval;
+ u8 bytes[sizeof(long)];
+ } v;
+
+ v.ulval = 0;
+ memcpy(v.bytes, buff, len);
+ return v.ulval;
+#else
+ unsigned int shift = (sizeof(long) - len) * BITS_PER_BYTE;
+
+ return (load_unaligned_zeropad(buff) << shift) >> shift;
+#endif
+}
+
/*
* Do a checksum on an arbitrary memory area.
* Returns a 32bit checksum.
@@ -91,11 +110,9 @@ __wsum csum_partial(const void *buff, int len, __wsum sum)
: "memory");
buff += 8;
}
- if (len & 7) {
- unsigned int shift = (8 - (len & 7)) * 8;
- unsigned long trail;
-
- trail = (load_unaligned_zeropad(buff) << shift) >> shift;
+ len &= 7;
+ if (len) {
+ unsigned long trail = load_partial_long(buff, len);
asm("addq %[trail],%[res]\n\t"
"adcq $0,%[res]"
Powered by blists - more mailing lists