Skip to content

Commit

Permalink
sparc: csum_add for Sparc
Browse files Browse the repository at this point in the history
versions.

Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tom Herbert authored and David S. Miller committed May 5, 2014
1 parent 4405b4d commit 20fce54
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions arch/sparc/include/asm/checksum_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,16 @@ 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) */
12 changes: 12 additions & 0 deletions arch/sparc/include/asm/checksum_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,16 @@ 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 /* !(__SPARC64_CHECKSUM_H) */

0 comments on commit 20fce54

Please sign in to comment.