blob: 4dd52a7e95f1ead8d1d97f1903f6e103a13da3fd [file] [log] [blame]
David Lebrun1ababeb2016-11-08 14:57:39 +01001/*
2 * SR-IPv6 implementation
3 *
4 * Author:
5 * David Lebrun <david.lebrun@uclouvain.be>
6 *
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#ifndef _NET_SEG6_H
15#define _NET_SEG6_H
16
17static inline void update_csum_diff4(struct sk_buff *skb, __be32 from,
18 __be32 to)
19{
20 __be32 diff[] = { ~from, to };
21
22 skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum);
23}
24
25static inline void update_csum_diff16(struct sk_buff *skb, __be32 *from,
26 __be32 *to)
27{
28 __be32 diff[] = {
29 ~from[0], ~from[1], ~from[2], ~from[3],
30 to[0], to[1], to[2], to[3],
31 };
32
33 skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum);
34}
35
36#endif