From: Vladimir Sokolovsky Date: Thu, 1 Dec 2016 12:24:43 +0000 (+0200) Subject: compat: Added support for SLES12 SP1 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=5a1eccf6bb538cd8179faf9c9510600c55568675;p=~tnikolova%2Fcompat%2F.git compat: Added support for SLES12 SP1 Signed-off-by: Vladimir Sokolovsky --- diff --git a/config/rdma.m4 b/config/rdma.m4 index e935849..dcb0de5 100644 --- a/config/rdma.m4 +++ b/config/rdma.m4 @@ -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 + #include + ],[ + 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 + ],[ + 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 + ],[ + 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 + ],[ + 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 + ],[ + 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 + ],[ + 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 + ],[ + 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 + ],[ + 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 + ],[ + 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 diff --git a/include/linux/compat-3.16.h b/include/linux/compat-3.16.h index 2d7f048..3cca60a 100644 --- a/include/linux/compat-3.16.h +++ b/include/linux/compat-3.16.h @@ -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 + +#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 index 0000000..cff23a8 --- /dev/null +++ b/include/linux/ethtool.h @@ -0,0 +1,15 @@ +#ifndef __COMPAT_ETHTOOL_H +#define __COMPAT_ETHTOOL_H + +#include_next + +#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 diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index c20aa9e..0167e4b 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -1,12 +1,14 @@ #ifndef LINUX_IF_VLAN_H #define LINUX_IF_VLAN_H +#include "../../compat/config.h" + #include_next -#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 */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index fa33d67..346afa2 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -26,6 +26,15 @@ #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