diff options
Diffstat (limited to 'include/net/checksum.h')
-rw-r--r-- | include/net/checksum.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/net/checksum.h b/include/net/checksum.h index 124246172a88..07602b7fa218 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h | |||
@@ -93,4 +93,29 @@ static inline __wsum csum_unfold(__sum16 n) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) | 95 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) |
96 | |||
97 | static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) | ||
98 | { | ||
99 | __be32 diff[] = { ~from, to }; | ||
100 | |||
101 | *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); | ||
102 | } | ||
103 | |||
104 | static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) | ||
105 | { | ||
106 | csum_replace4(sum, (__force __be32)from, (__force __be32)to); | ||
107 | } | ||
108 | |||
109 | struct sk_buff; | ||
110 | extern void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, | ||
111 | __be32 from, __be32 to, int pseudohdr); | ||
112 | |||
113 | static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, | ||
114 | __be16 from, __be16 to, | ||
115 | int pseudohdr) | ||
116 | { | ||
117 | inet_proto_csum_replace4(sum, skb, (__force __be32)from, | ||
118 | (__force __be32)to, pseudohdr); | ||
119 | } | ||
120 | |||
96 | #endif | 121 | #endif |