aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2014-05-02 19:28:54 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-05 15:26:29 -0400
commit20fce54fa74a55ad1e821b61612393d7159b6af8 (patch)
tree3b487bd1f4d7da1570b37a4672abc0c0197226fc
parent4405b4d635aa2c5c7eb8873696b54811531e0d08 (diff)
sparc: csum_add for Sparc
versions. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/include/asm/checksum_32.h12
-rw-r--r--arch/sparc/include/asm/checksum_64.h12
2 files changed, 24 insertions, 0 deletions
diff --git a/arch/sparc/include/asm/checksum_32.h b/arch/sparc/include/asm/checksum_32.h
index bdbda1453aa9..04471dc64847 100644
--- a/arch/sparc/include/asm/checksum_32.h
+++ b/arch/sparc/include/asm/checksum_32.h
@@ -238,4 +238,16 @@ static inline __sum16 ip_compute_csum(const void *buff, int len)
238 return csum_fold(csum_partial(buff, len, 0)); 238 return csum_fold(csum_partial(buff, len, 0));
239} 239}
240 240
241#define HAVE_ARCH_CSUM_ADD
242static inline __wsum csum_add(__wsum csum, __wsum addend)
243{
244 __asm__ __volatile__(
245 "addcc %0, %1, %0\n"
246 "addx %0, %%g0, %0"
247 : "=r" (csum)
248 : "r" (addend), "0" (csum));
249
250 return csum;
251}
252
241#endif /* !(__SPARC_CHECKSUM_H) */ 253#endif /* !(__SPARC_CHECKSUM_H) */
diff --git a/arch/sparc/include/asm/checksum_64.h b/arch/sparc/include/asm/checksum_64.h
index 019b9615e43c..2ff81ae8f3af 100644
--- a/arch/sparc/include/asm/checksum_64.h
+++ b/arch/sparc/include/asm/checksum_64.h
@@ -164,4 +164,16 @@ static inline __sum16 ip_compute_csum(const void *buff, int len)
164 return csum_fold(csum_partial(buff, len, 0)); 164 return csum_fold(csum_partial(buff, len, 0));
165} 165}
166 166
167#define HAVE_ARCH_CSUM_ADD
168static inline __wsum csum_add(__wsum csum, __wsum addend)
169{
170 __asm__ __volatile__(
171 "addcc %0, %1, %0\n"
172 "addx %0, %%g0, %0"
173 : "=r" (csum)
174 : "r" (addend), "0" (csum));
175
176 return csum;
177}
178
167#endif /* !(__SPARC64_CHECKSUM_H) */ 179#endif /* !(__SPARC64_CHECKSUM_H) */