seg6.h 878 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  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. #ifndef _NET_SEG6_H
  14. #define _NET_SEG6_H
  15. static inline void update_csum_diff4(struct sk_buff *skb, __be32 from,
  16. __be32 to)
  17. {
  18. __be32 diff[] = { ~from, to };
  19. skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum);
  20. }
  21. static inline void update_csum_diff16(struct sk_buff *skb, __be32 *from,
  22. __be32 *to)
  23. {
  24. __be32 diff[] = {
  25. ~from[0], ~from[1], ~from[2], ~from[3],
  26. to[0], to[1], to[2], to[3],
  27. };
  28. skb->csum = ~csum_partial((char *)diff, sizeof(diff), ~skb->csum);
  29. }
  30. #endif