Commit aa9c33b4 authored by Michael Hennerich's avatar Michael Hennerich Committed by Bryan Wu

Blackfin arch: Faster Implementation of csum_tcpudp_nofold()

Avoid conditional branch instructions during carry bit additions.
Special thanks to Bernd.
Simplify: Use ((len + proto) << 8) like every other __LITTLE_ENDIAN__ machine

Cc: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent 0ce5eaf8
...@@ -63,22 +63,22 @@ static inline __wsum ...@@ -63,22 +63,22 @@ static inline __wsum
csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
unsigned short proto, __wsum sum) unsigned short proto, __wsum sum)
{ {
unsigned int carry;
__asm__ ("%0 = %0 + %1;\n\t" __asm__ ("%0 = %0 + %2;\n\t"
"CC = AC0;\n\t" "CC = AC0;\n\t"
"if !CC jump 4;\n\t" "%1 = CC;\n\t"
"%0 = %0 + %4;\n\t" "%0 = %0 + %1;\n\t"
"%0 = %0 + %2;\n\t"
"CC = AC0;\n\t"
"if !CC jump 4;\n\t"
"%0 = %0 + %4;\n\t"
"%0 = %0 + %3;\n\t" "%0 = %0 + %3;\n\t"
"CC = AC0;\n\t" "CC = AC0;\n\t"
"if !CC jump 4;\n\t" "%1 = CC;\n\t"
"%0 = %0 + %1;\n\t"
"%0 = %0 + %4;\n\t" "%0 = %0 + %4;\n\t"
"NOP;\n\t" "CC = AC0;\n\t"
: "=d" (sum) "%1 = CC;\n\t"
: "d" (daddr), "d" (saddr), "d" ((ntohs(len)<<16)+proto*256), "d" (1), "0"(sum) "%0 = %0 + %1;\n\t"
: "=d" (sum), "=&d" (carry)
: "d" (daddr), "d" (saddr), "d" ((len + proto) << 8), "0"(sum)
: "CC"); : "CC");
return (sum); return (sum);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment