lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 07 Apr 2014 13:06:20 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	therbert@...gle.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/6] net: Allow csum_add to be provided in arch

From: Tom Herbert <therbert@...gle.com>
Date: Fri, 4 Apr 2014 17:26:46 -0700 (PDT)

> csum_add is really nothing more then add-with-carry which
> can be implemented efficiently in some architectures.
> Allow architecture to define this protected by HAVE_ARCH_CSUM_ADD.
> 
> Provide csum_add in for x86.
> 
> Signed-off-by: Tom Herbert <therbert@...gle.com>

The Sparc version looks like this, feel free to integrate it into this
patch.

diff --git a/arch/sparc/include/asm/checksum_32.h b/arch/sparc/include/asm/checksum_32.h
index bdbda14..3297436 100644
--- a/arch/sparc/include/asm/checksum_32.h
+++ b/arch/sparc/include/asm/checksum_32.h
@@ -238,4 +238,15 @@ static inline __sum16 ip_compute_csum(const void *buff, int len)
 	return csum_fold(csum_partial(buff, len, 0));
 }
 
+#define HAVE_ARCH_CSUM_ADD
+static inline __wsum csum_add(__wsum csum, __wsum addend)
+{
+	__asm__ __volatile__(
+"	addcc	%0, %1, %0\n"
+"	addx	%0, %%g0, %0"
+	: "=r" (csum)
+	: "r" (addend), "0" (csum));
+	return csum;
+}
+
 #endif /* !(__SPARC_CHECKSUM_H) */
diff --git a/arch/sparc/include/asm/checksum_64.h b/arch/sparc/include/asm/checksum_64.h
index 019b961..38b24a3 100644
--- a/arch/sparc/include/asm/checksum_64.h
+++ b/arch/sparc/include/asm/checksum_64.h
@@ -164,4 +164,15 @@ static inline __sum16 ip_compute_csum(const void *buff, int len)
 	return csum_fold(csum_partial(buff, len, 0));
 }
 
+#define HAVE_ARCH_CSUM_ADD
+static inline __wsum csum_add(__wsum csum, __wsum addend)
+{
+	__asm__ __volatile__(
+"	addcc	%0, %1, %0\n"
+"	addc	%0, %%g0, %0"
+	: "=r" (csum)
+	: "r" (addend), "0" (csum));
+	return csum;
+}
+
 #endif /* !(__SPARC64_CHECKSUM_H) */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ