compat: Added support for SLES12 SP1
authorVladimir Sokolovsky <vlad@mellanox.com>
Thu, 1 Dec 2016 12:24:43 +0000 (14:24 +0200)
committerVladimir Sokolovsky <vlad@mellanox.com>
Thu, 1 Dec 2016 14:58:09 +0000 (16:58 +0200)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
config/rdma.m4
include/linux/compat-3.16.h
include/linux/ethtool.h [new file with mode: 0644]
include/linux/if_vlan.h
include/linux/netdevice.h

index e935849..dcb0de5 100644 (file)
@@ -3556,6 +3556,153 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
                AC_MSG_RESULT(no)
        ])
 
+       AC_MSG_CHECKING([if time64.h has ns_to_timespec64])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/clocksource.h>
+               #include <linux/time64.h>
+       ],[
+               ns_to_timespec64(0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NS_TO_TIMESPACE64, 1,
+                         [ns_to_timespec64 is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct ptp_clock_info has gettime])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/ptp_clock_kernel.h>
+       ],[
+               struct ptp_clock_info info = {
+                       .gettime = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PTP_CLOCK_INFO_GETTIME_32BIT, 1,
+                         [gettime 32bit is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if ethtool.h has get_module_eeprom])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/ethtool.h>
+       ],[
+               struct ethtool_ops x = {
+                       .get_module_eeprom = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_GET_MODULE_EEPROM, 1,
+                         [HAVE_GET_MODULE_EEPROM is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if ethtool.h has get_module_eeprom])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/ethtool.h>
+       ],[
+               struct ethtool_ops_ext x = {
+                       .get_module_eeprom = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_GET_MODULE_EEPROM_EXT, 1,
+                       [HAVE_GET_MODULE_EEPROM_EXT is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if netdevice.h has napi_complete_done])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               napi_complete_done(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NAPI_COMPLETE_DONE, 1,
+                         [napi_complete_done is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if ethtool_ext has set_phys_id])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/ethtool.h>
+       ],[
+               const struct ethtool_ops_ext en_ethtool_ops_ext = {
+                       .set_phys_id = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SET_PHYS_ID_EXT, 1,
+                         [set_phys_id is defined in ethtool_ops_ext])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct tc_cls_flower_offload exists])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/pkt_cls.h>
+       ],[
+               struct tc_cls_flower_offload x;
+               x = x;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TC_FLOWER_OFFLOAD, 1,
+                         [struct tc_cls_flower_offload is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if if_vlan.h has vlan_features_check])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/if_vlan.h>
+       ],[
+               vlan_features_check(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_VLAN_FEATURES_CHECK, 1,
+                         [vlan_features_check is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct net_device_ops has *ndo_get_iflink])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+       ],[
+               struct net_device_ops x = {
+                       .ndo_get_iflink = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NDO_GET_IFLINK, 1,
+                         [ndo_get_iflink is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
 ])
 #
 # COMPAT_CONFIG_HEADERS
index 2d7f048..3cca60a 100644 (file)
@@ -36,6 +36,12 @@ int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
 #define RPC_MAXCWND(xprt)      ((xprt)->max_reqs << RPC_CWNDSHIFT)
 #define RPCXPRT_CONGESTED(xprt) ((xprt)->cong >= (xprt)->cwnd)
 
+#include <linux/netdev_features.h>
+
+#ifndef NETIF_F_GSO_UDP_TUNNEL_CSUM
+#define NETIF_F_GSO_UDP_TUNNEL_CSUM 0
+#endif
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) */
 
 #endif /* LINUX_3_16_COMPAT_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
new file mode 100644 (file)
index 0000000..cff23a8
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __COMPAT_ETHTOOL_H
+#define __COMPAT_ETHTOOL_H
+
+#include_next <linux/ethtool.h>
+
+#ifndef ETH_MODULE_SFF_8636
+#define ETH_MODULE_SFF_8636            0x3
+#define ETH_MODULE_SFF_8636_LEN                256
+#endif
+
+#ifndef ETH_MODULE_SFF_8436
+#define ETH_MODULE_SFF_8436            0x4
+#define ETH_MODULE_SFF_8436_LEN                256
+#endif
+#endif
index c20aa9e..0167e4b 100644 (file)
@@ -1,12 +1,14 @@
 #ifndef LINUX_IF_VLAN_H
 #define LINUX_IF_VLAN_H
 
+#include "../../compat/config.h"
+
 #include_next <linux/if_vlan.h>
 
-#ifndef vlan_tx_tag_present
-#define vlan_tx_tag_present skb_vlan_tag_present
-#define vlan_tx_tag_get skb_vlan_tag_get
-#define vlan_tx_tag_get_id skb_vlan_tag_get_id
+#ifndef skb_vlan_tag_present
+#define skb_vlan_tag_present vlan_tx_tag_present
+#define skb_vlan_tag_get vlan_tx_tag_get
+#define skb_vlan_tag_get_id vlan_tx_tag_get_id
 #endif
 
 #ifndef HAVE_IS_VLAN_DEV
@@ -16,4 +18,56 @@ static inline int is_vlan_dev(struct net_device *dev)
 }
 #endif
 
+#ifndef ETH_P_8021AD
+#define ETH_P_8021AD    0x88A8          /* 802.1ad Service VLAN         */
+#endif
+
+#ifndef HAVE_VLAN_GET_PROTOCOL
+/**
+ * vlan_get_protocol - get protocol EtherType.
+ * @skb: skbuff to query
+ * @type: first vlan protocol
+ * @depth: buffer to store length of eth and vlan tags in bytes
+ *
+ * Returns the EtherType of the packet, regardless of whether it is
+ * vlan encapsulated (normal or hardware accelerated) or not.
+ */
+static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type,
+                                        int *depth)
+{
+       unsigned int vlan_depth = skb->mac_len;
+
+       /* if type is 802.1Q/AD then the header should already be
+        * present at mac_len - VLAN_HLEN (if mac_len > 0), or at
+        * ETH_HLEN otherwise
+        */
+       if (type == htons(ETH_P_8021Q) || type == htons(ETH_P_8021AD)) {
+               if (vlan_depth) {
+                       if (WARN_ON(vlan_depth < VLAN_HLEN))
+                               return 0;
+                       vlan_depth -= VLAN_HLEN;
+               } else {
+                       vlan_depth = ETH_HLEN;
+               }
+               do {
+                       struct vlan_hdr *vh;
+
+                       if (unlikely(!pskb_may_pull(skb,
+                                                   vlan_depth + VLAN_HLEN)))
+                               return 0;
+
+                       vh = (struct vlan_hdr *)(skb->data + vlan_depth);
+                       type = vh->h_vlan_encapsulated_proto;
+                       vlan_depth += VLAN_HLEN;
+               } while (type == htons(ETH_P_8021Q) ||
+                        type == htons(ETH_P_8021AD));
+       }
+
+       if (depth)
+               *depth = vlan_depth;
+
+       return type;
+}
+#endif
+
 #endif /* LINUX_IF_VLAN_H */
index fa33d67..346afa2 100644 (file)
 #define netdev_master_upper_dev_get_rcu(x) (x)->master
 #endif
 
+#ifndef HAVE_NETIF_KEEP_DST
+/* This device needs to keep skb dst for qdisc enqueue or ndo_start_xmit() */
+static inline void netif_keep_dst(struct net_device *dev)
+{
+       /* IFF_XMIT_DST_RELEASE_PERM   = 1<<17 */
+       dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | (1<<17) );
+}
+#endif
+
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18)
 #ifdef HAVE_ALLOC_ETHERDEV_MQ
 #ifndef HAVE_NETIF_SET_REAL_NUM_TX_QUEUES