Tom Herbert | 33f11d1 | 2015-12-15 15:41:35 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2015 Tom Herbert <tom@herbertland.com> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | #ifndef __ILA_H |
| 12 | #define __ILA_H |
| 13 | |
| 14 | #include <linux/errno.h> |
| 15 | #include <linux/ip.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/socket.h> |
| 19 | #include <linux/skbuff.h> |
| 20 | #include <linux/types.h> |
| 21 | #include <net/checksum.h> |
| 22 | #include <net/ip.h> |
| 23 | #include <net/protocol.h> |
| 24 | #include <uapi/linux/ila.h> |
| 25 | |
| 26 | struct ila_params { |
| 27 | __be64 locator; |
| 28 | __be64 locator_match; |
| 29 | __wsum csum_diff; |
| 30 | }; |
| 31 | |
| 32 | static inline __wsum compute_csum_diff8(const __be32 *from, const __be32 *to) |
| 33 | { |
| 34 | __be32 diff[] = { |
| 35 | ~from[0], ~from[1], to[0], to[1], |
| 36 | }; |
| 37 | |
| 38 | return csum_partial(diff, sizeof(diff), 0); |
| 39 | } |
| 40 | |
| 41 | void update_ipv6_locator(struct sk_buff *skb, struct ila_params *p); |
| 42 | |
| 43 | int ila_lwt_init(void); |
| 44 | void ila_lwt_fini(void); |
| 45 | |
| 46 | #endif /* __ILA_H */ |