2 * Copyright (c) 2015 Tom Herbert <tom@herbertland.com>
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.
14 #include <linux/errno.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>
23 #include <net/protocol.h>
24 #include <uapi/linux/ila.h>
35 struct ila_identifier
{
38 #if defined(__LITTLE_ENDIAN_BITFIELD)
42 #elif defined(__BIG_ENDIAN_BITFIELD)
47 #error "Adjust your <asm/byteorder.h> defines"
58 #define CSUM_NEUTRAL_FLAG htonl(0x10000000)
64 struct ila_locator loc
;
65 struct ila_identifier ident
;
70 static inline struct ila_addr
*ila_a2i(struct in6_addr
*addr
)
72 return (struct ila_addr
*)addr
;
75 static inline bool ila_addr_is_ila(struct ila_addr
*iaddr
)
77 return (iaddr
->ident
.type
!= ILA_ATYPE_IID
);
81 struct ila_locator locator
;
82 struct ila_locator locator_match
;
88 static inline __wsum
compute_csum_diff8(const __be32
*from
, const __be32
*to
)
91 ~from
[0], ~from
[1], to
[0], to
[1],
94 return csum_partial(diff
, sizeof(diff
), 0);
97 static inline bool ila_csum_neutral_set(struct ila_identifier ident
)
99 return !!(ident
.csum_neutral
);
102 void ila_update_ipv6_locator(struct sk_buff
*skb
, struct ila_params
*p
,
103 bool set_csum_neutral
);
105 void ila_init_saved_csum(struct ila_params
*p
);
107 int ila_lwt_init(void);
108 void ila_lwt_fini(void);
109 int ila_xlat_init(void);
110 void ila_xlat_fini(void);