diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-10-30 14:50:51 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-11-04 08:04:57 +0400 |
commit | 2817a336d4d533fb8b68719723cd60ea7dd7c09e (patch) | |
tree | 71aac3aa2a48588fd0b5372cca9499bd1cbe2a5f /include/net/checksum.h | |
parent | efba721f636ee016859d86d15748650119402b10 (diff) | |
download | linux-2817a336d4d533fb8b68719723cd60ea7dd7c09e.tar.xz |
net: skb_checksum: allow custom update/combine for walking skb
Currently, skb_checksum walks over 1) linearized, 2) frags[], and
3) frag_list data and calculats the one's complement, a 32 bit
result suitable for feeding into itself or csum_tcpudp_magic(),
but unsuitable for SCTP as we're calculating CRC32c there.
Hence, in order to not re-implement the very same function in
SCTP (and maybe other protocols) over and over again, use an
update() + combine() callback internally to allow for walking
over the skb with different algorithms.
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/checksum.h')
-rw-r--r-- | include/net/checksum.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/checksum.h b/include/net/checksum.h index 8f59ca50477c..15f33fde826e 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -79,6 +79,12 @@ csum_block_add(__wsum csum, __wsum csum2, int offset) } static inline __wsum +csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len) +{ + return csum_block_add(csum, csum2, offset); +} + +static inline __wsum csum_block_sub(__wsum csum, __wsum csum2, int offset) { u32 sum = (__force u32)csum2; |