datapath: remove rpl_ipv6_skip_exthdr
[cascardo/ovs.git] / datapath / linux / compat / include / net / ipv6.h
1 #ifndef __NET_IPV6_WRAPPER_H
2 #define __NET_IPV6_WRAPPER_H 1
3
4 #include <linux/version.h>
5
6 #include_next <net/ipv6.h>
7
8 #ifndef NEXTHDR_SCTP
9 #define NEXTHDR_SCTP    132 /* Stream Control Transport Protocol */
10 #endif
11
12 #ifndef HAVE_IP6_FH_F_SKIP_RH
13
14 enum {
15         IP6_FH_F_FRAG           = (1 << 0),
16         IP6_FH_F_AUTH           = (1 << 1),
17         IP6_FH_F_SKIP_RH        = (1 << 2),
18 };
19
20 /* This function is upstream, but not the version which skips routing
21  * headers with 0 segments_left. We fixed it when we introduced
22  * IP6_FH_F_SKIP_RH.
23  */
24 #define ipv6_find_hdr rpl_ipv6_find_hdr
25 extern int rpl_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
26                              int target, unsigned short *fragoff, int *fragflg);
27 #endif
28
29 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
30 static inline u32 ipv6_addr_hash(const struct in6_addr *a)
31 {
32 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
33         const unsigned long *ul = (const unsigned long *)a;
34         unsigned long x = ul[0] ^ ul[1];
35
36         return (u32)(x ^ (x >> 32));
37 #else
38         return (__force u32)(a->s6_addr32[0] ^ a->s6_addr32[1] ^
39                              a->s6_addr32[2] ^ a->s6_addr32[3]);
40 #endif
41 }
42 #endif
43
44 #ifndef HAVE___IPV6_ADDR_JHASH
45 static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 unused)
46 {
47        return ipv6_addr_jhash(a);
48 }
49 #endif
50
51 #define ip6_flowlabel rpl_ip6_flowlabel
52 static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr)
53 {
54         return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK;
55 }
56
57 #ifndef IPV6_TCLASS_SHIFT
58 #define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK)
59 #define IPV6_TCLASS_SHIFT       20
60 #endif
61
62 #define ip6_tclass rpl_ip6_tclass
63 static inline u8 ip6_tclass(__be32 flowinfo)
64 {
65         return ntohl(flowinfo & IPV6_TCLASS_MASK) >> IPV6_TCLASS_SHIFT;
66 }
67
68 #define ip6_make_flowinfo rpl_ip6_make_flowinfo
69 static inline __be32 ip6_make_flowinfo(unsigned int tclass, __be32 flowlabel)
70 {
71         return htonl(tclass << IPV6_TCLASS_SHIFT) | flowlabel;
72 }
73
74 #endif