compat: Explicitly include net/ip.h in net/udp.h.
[cascardo/ovs.git] / datapath / compat.h
index 2873f0a..c827b11 100644 (file)
 #include <net/route.h>
 #include <net/xfrm.h>
 
-
-#ifndef HAVE_NLA_NUL_STRING
-static inline int CHECK_NUL_STRING(struct nlattr *attr, int maxlen)
-{
-       char *s;
-       int len;
-       if (!attr)
-               return 0;
-
-       len = nla_len(attr);
-       if (len >= maxlen)
-               return -EINVAL;
-
-       s = nla_data(attr);
-       if (s[len - 1] != '\0')
-               return -EINVAL;
-
-       return 0;
-}
-#else
-static inline int CHECK_NUL_STRING(struct nlattr *attr, int maxlen)
-{
-       return 0;
-}
-#endif  /* !HAVE_NLA_NUL_STRING */
-
-static inline void skb_clear_rxhash(struct sk_buff *skb)
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
-       skb->rxhash = 0;
-#endif
-}
-
-#ifdef HAVE_PARALLEL_OPS
-#define SET_PARALLEL_OPS       .parallel_ops = true,
+#ifdef HAVE_GENL_MULTICAST_GROUP_WITH_ID
+#define GROUP_ID(grp)  ((grp)->id)
 #else
-#define SET_PARALLEL_OPS
+#define GROUP_ID(grp)  0
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
@@ -82,7 +49,8 @@ static inline struct rtable *find_route(struct net *net,
 {
        struct rtable *rt;
        /* Tunnel configuration keeps DSCP part of TOS bits, But Linux
-        * router expect RT_TOS bits only. */
+        * router expect RT_TOS bits only.
+        */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
        struct flowi fl = { .nl_u = { .ip4_u = {
@@ -108,4 +76,14 @@ static inline struct rtable *find_route(struct net *net,
        return rt;
 #endif
 }
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
+static inline bool skb_encapsulation(struct sk_buff *skb)
+{
+       return skb->encapsulation;
+}
+#else
+#define skb_encapsulation(skb) false
+#endif
+
 #endif /* compat.h */