diff options
| author | David S. Miller <davem@davemloft.net> | 2014-11-26 12:25:51 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-11-26 12:25:51 -0500 |
| commit | 12bbd595ab45f093db36d12768926422013b3441 (patch) | |
| tree | 553e4f9745b404e0d1db149192e303fd51681e80 /include | |
| parent | ced7a04e394fe1df41d13b833baab5cfcb1d03b3 (diff) | |
| parent | 4fd671ded14f92cb8db0bf72747f4df508ba5e3d (diff) | |
Merge branch 'remcsum_adjust'
Tom Herbert says:
====================
gue: Generalize remote checksum offload
The remote checksum offload is generalized by creating a common
function (remcsum_adjust) that does the work of modifying the
checksum in remote checksum offload. This function can be called
from normal or GRO path. GUE was modified to use this function.
Remote checksum offload is described in
https://tools.ietf.org/html/draft-herbert-remotecsumoffload-01
Tested by running 200 TCP_STREAM connections over GUE, did not see
any problems with remote checksum offload enabled.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/checksum.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/net/checksum.h b/include/net/checksum.h index 6465bae80a4f..e339a9513e29 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -151,4 +151,20 @@ static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, (__force __be32)to, pseudohdr); } +static inline __wsum remcsum_adjust(void *ptr, __wsum csum, + int start, int offset) +{ + __sum16 *psum = (__sum16 *)(ptr + offset); + __wsum delta; + + /* Subtract out checksum up to start */ + csum = csum_sub(csum, csum_partial(ptr, start, 0)); + + /* Set derived checksum in packet */ + delta = csum_sub(csum_fold(csum), *psum); + *psum = csum_fold(csum); + + return delta; +} + #endif |
