]> git.openfabrics.org - compat-rdma/compat.git/commitdiff
Added macros and headers to support MLX5 on RHEL7.4
authorVladimir Sokolovsky <vlad@mellanox.com>
Wed, 1 Aug 2018 21:44:26 +0000 (16:44 -0500)
committerVladimir Sokolovsky <vlad@mellanox.com>
Wed, 1 Aug 2018 21:45:05 +0000 (16:45 -0500)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
config/rdma.m4
include/linux/bpf_trace.h [new file with mode: 0644]
include/linux/firmware.h [new file with mode: 0644]
include/linux/skbuff.h [new file with mode: 0644]
include/net/tc_act/tc_pedit.h [new file with mode: 0644]
include/net/tc_act/tc_vlan.h [new file with mode: 0644]
include/uapi/linux/devlink.h [new file with mode: 0644]
include/uapi/linux/net_tstamp.h [new file with mode: 0644]

index eac2cdbc7670b16ca4734f7b2005e6725a0887fa..aab7dbe74d97c5862c42d208e2905663985914d4 100644 (file)
@@ -6617,6 +6617,260 @@ AC_DEFUN([LINUX_CONFIG_COMPAT],
        ],[
                AC_MSG_RESULT(no)
        ])
+
+       AC_MSG_CHECKING([if linux/pci.h has pci_irq_vector, pci_free_irq_vectors, pci_alloc_irq_vectors])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/pci.h>
+       ],[
+               pci_irq_vector(NULL, 0);
+               pci_free_irq_vectors(NULL);
+               pci_alloc_irq_vectors(NULL, 0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PCI_IRQ_API, 1,
+                       [linux/pci.h has pci_irq_vector, pci_free_irq_vectors, pci_alloc_irq_vectors])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct devlink_ops has eswitch_encap_mode_set/get])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/devlink.h>
+       ],[
+               struct devlink_ops dlops = {
+                       .eswitch_encap_mode_set = NULL,
+                       .eswitch_encap_mode_get = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEVLINK_HAS_ESWITCH_ENCAP_MODE_SET, 1,
+                         [eswitch_encap_mode_set/get is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct devlink_ops has eswitch_inline_mode_get/set])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/devlink.h>
+       ],[
+               struct devlink_ops dlops = {
+                       .eswitch_inline_mode_get = NULL,
+                       .eswitch_inline_mode_set = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEVLINK_HAS_ESWITCH_INLINE_MODE_GET_SET, 1,
+                         [eswitch_inline_mode_get/set is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if struct devlink_ops has eswitch_mode_get/set])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/devlink.h>
+       ],[
+               struct devlink_ops dlops = {
+                       .eswitch_mode_get = NULL,
+                       .eswitch_mode_set = NULL,
+               };
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_DEVLINK_HAS_ESWITCH_MODE_GET_SET, 1,
+                         [eswitch_mode_get/set is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if napi_complete_done returns value])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/netdevice.h>
+
+       ],[
+               if (napi_complete_done(NULL, 0))
+                       return;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_NAPI_COMPLETE_DONE_RET_VALUE, 1,
+                         [napi_complete_done returns value])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if skbuff.h has skb_put_zero])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/skbuff.h>
+       ],[
+               skb_put_zero(NULL, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_SKB_PUT_ZERO, 1,
+                         [skb_put_zero is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if flow_dissector.h enum flow_dissector_key_keyid has FLOW_DISSECTOR_KEY_TCP])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/flow_dissector.h>
+       ],[
+               enum flow_dissector_key_id keyid = FLOW_DISSECTOR_KEY_TCP;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_FLOW_DISSECTOR_KEY_TCP, 1,
+                         [FLOW_DISSECTOR_KEY_TCP is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if net/tc_act/tc_pedit.h has tcf_pedit_nkeys])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/tc_act/tc_pedit.h>
+       ],[
+               const struct tc_action xx;
+               tcf_pedit_nkeys(&xx);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TCF_PEDIT_NKEYS, 1,
+                         [tcf_pedit_nkeys is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if net/tc_act/tc_pedit.h struct tcf_pedit has member tcfp_keys_ex])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/tc_act/tc_pedit.h>
+       ],[
+               struct tcf_pedit x = {
+                       .tcfp_keys_ex = NULL,
+               };
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TCF_PEDIT_TCFP_KEYS_EX, 1,
+                         [struct tcf_pedit has member tcfp_keys_ex])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if tc_vlan.h has tcf_vlan_push_prio])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/tc_act/tc_vlan.h>
+       ],[
+               tcf_vlan_push_prio(NULL);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TCF_VLAN_PUSH_PRIO, 1,
+                         [tcf_vlan_push_prio is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if net/tc_act/tc_csum.h has TCA_CSUM_UPDATE_FLAG_IPV4HDR])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/tc_act/tc_csum.h>
+       ],[
+               int x = TCA_CSUM_UPDATE_FLAG_IPV4HDR;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TCA_CSUM_UPDATE_FLAG_IPV4HDR, 1,
+                         [TCA_CSUM_UPDATE_FLAG_IPV4HDR is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if net/pkt_cls.h has tcf_exts_has_actions])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/pkt_cls.h>
+       ],[
+               struct tcf_exts exts;
+               tcf_exts_has_actions(&exts);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TCF_EXTS_HAS_ACTIONS, 1,
+                         [tcf_exts_has_actions is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if net/tc_act/tc_tunnel_key.h has tcf_tunnel_info])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/tc_act/tc_tunnel_key.h>
+       ],[
+               const struct tc_action xx;
+               tcf_tunnel_info(&xx);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TCF_TUNNEL_INFO, 1,
+                         [tcf_tunnel_info is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+       AC_MSG_CHECKING([if flow_dissector.h enum flow_dissector_key_keyid has FLOW_DISSECTOR_KEY_IP])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/flow_dissector.h>
+       ],[
+               enum flow_dissector_key_id keyid = FLOW_DISSECTOR_KEY_IP;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_FLOW_DISSECTOR_KEY_IP, 1,
+                         [FLOW_DISSECTOR_KEY_IP is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if flow_dissector.h enum flow_dissector_key_keyid has FLOW_DISSECTOR_KEY_VLAN])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/flow_dissector.h>
+       ],[
+               enum flow_dissector_key_id keyid = FLOW_DISSECTOR_KEY_VLAN;
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_FLOW_DISSECTOR_KEY_VLAN, 1,
+                         [FLOW_DISSECTOR_KEY_VLAN is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
+       AC_MSG_CHECKING([if net/pkt_cls.h has tcf_exts_stats_update])
+       LB_LINUX_TRY_COMPILE([
+               #include <net/pkt_cls.h>
+       ],[
+               tcf_exts_stats_update(NULL, 0, 0, 0);
+
+               return 0;
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_TCF_EXTS_STATS_UPDATE, 1,
+                         [tcf_exts_stats_update is defined])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
 ])
 #
 # COMPAT_CONFIG_HEADERS
diff --git a/include/linux/bpf_trace.h b/include/linux/bpf_trace.h
new file mode 100644 (file)
index 0000000..6acf46b
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef _COMPAT_LINUX_BPF_TRACE_H
+#define _COMPAT_LINUX_BPF_TRACE_H
+
+#include "../../compat/config.h"
+
+#ifdef HAVE_LINUX_BPF_TRACE_H
+#include <linux/bpf.h>
+#include_next <linux/bpf_trace.h>
+#endif
+
+#endif /* _COMPAT_LINUX_BPF_TRACE_H */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
new file mode 100644 (file)
index 0000000..2e2e822
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef _COMPAT_LINUX_FIRMWARE_H
+#define _COMPAT_LINUX_FIRMWARE_H
+
+#include_next <linux/firmware.h>
+
+/* Include the autogenerated header file */
+#include "../../compat/config.h"
+
+#ifndef HAVE_REQUEST_FIRMWARE_DIRECT
+#define request_firmware_direct        request_firmware
+#endif
+
+#endif /* _COMPAT_LINUX_FIRMWARE_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
new file mode 100644 (file)
index 0000000..ffc2841
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _COMPAT_LINUX_SKBUFF_H
+#define _COMPAT_LINUX_SKBUFF_H
+
+#include "../../compat/config.h"
+#include <linux/version.h>
+
+#include_next <linux/skbuff.h>
+
+
+#ifndef HAVE_SKB_PUT_ZERO
+#define skb_put_zero LINUX_BACKPORT(skb_put_zero)
+static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len)
+{
+       void *tmp = skb_put(skb, len);
+
+       memset(tmp, 0, len);
+
+       return tmp;
+}
+#endif
+
+#endif /* _COMPAT_LINUX_SKBUFF_H */
diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h
new file mode 100644 (file)
index 0000000..06b97d2
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef _COMPAT_NET_TC_ACT_TC_PEDIT_H
+#define _COMPAT_NET_TC_ACT_TC_PEDIT_H 1
+
+#include "../../../compat/config.h"
+
+#ifdef HAVE_TCF_PEDIT_TCFP_KEYS_EX
+#include_next <net/tc_act/tc_pedit.h>
+
+#ifndef HAVE_TCF_PEDIT_NKEYS
+#include <linux/tc_act/tc_pedit.h>
+
+
+static inline bool is_tcf_pedit(const struct tc_action *a)
+{
+#ifdef CONFIG_NET_CLS_ACT
+       if (a->ops && a->ops->type == TCA_ACT_PEDIT)
+               return true;
+#endif
+       return false;
+}
+
+static inline int tcf_pedit_nkeys(const struct tc_action *a)
+{
+       return to_pedit(a)->tcfp_nkeys;
+}
+
+static inline u32 tcf_pedit_htype(const struct tc_action *a, int index)
+{
+       if (to_pedit(a)->tcfp_keys_ex)
+               return to_pedit(a)->tcfp_keys_ex[index].htype;
+
+       return TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
+}
+
+static inline u32 tcf_pedit_cmd(const struct tc_action *a, int index)
+{
+       if (to_pedit(a)->tcfp_keys_ex)
+               return to_pedit(a)->tcfp_keys_ex[index].cmd;
+
+       return __PEDIT_CMD_MAX;
+}
+
+static inline u32 tcf_pedit_mask(const struct tc_action *a, int index)
+{
+       return to_pedit(a)->tcfp_keys[index].mask;
+}
+
+static inline u32 tcf_pedit_val(const struct tc_action *a, int index)
+{
+       return to_pedit(a)->tcfp_keys[index].val;
+}
+
+static inline u32 tcf_pedit_offset(const struct tc_action *a, int index)
+{
+       return to_pedit(a)->tcfp_keys[index].off;
+}
+
+#endif /* HAVE_TCF_PEDIT_NKEYS */
+
+#endif /* HAVE_TCF_PEDIT_TCFP_KEYS_EX */
+
+#endif /* _COMPAT_NET_TC_ACT_TC_PEDIT_H */
diff --git a/include/net/tc_act/tc_vlan.h b/include/net/tc_act/tc_vlan.h
new file mode 100644 (file)
index 0000000..07d3969
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef _COMPAT_NET_TC_ACT_TC_VLAN_H
+#define _COMPAT_NET_TC_ACT_TC_VLAN_H 1
+
+#include "../../../compat/config.h"
+
+#ifndef CONFIG_COMPAT_TCF_VLAN_MOD
+#include_next <net/tc_act/tc_vlan.h>
+#endif
+
+#ifndef to_vlan
+#define act_to_vlan(a) ((struct tcf_vlan *) a->priv)
+#else
+#define act_to_vlan(a) to_vlan(a)
+#endif
+
+#ifdef CONFIG_COMPAT_TCF_VLAN_MOD
+#include <net/act_api.h>
+#include <linux/tc_act/tc_vlan.h>
+
+struct tcf_vlan {
+       struct tcf_common common;
+       int tcfv_action;
+       u16 tcfv_push_vid;
+       __be16 tcfv_push_proto;
+       u8 tcfv_push_prio;
+};
+#define pc_to_vlan(pc) \
+       container_of(pc, struct tcf_vlan, common)
+
+static inline bool is_tcf_vlan(const struct tc_action *a)
+{
+#ifdef CONFIG_NET_CLS_ACT
+       if (a->ops && a->ops->type == TCA_ACT_VLAN)
+               return true;
+#endif
+       return false;
+}
+
+static inline u32 tcf_vlan_action(const struct tc_action *a)
+{
+       return act_to_vlan(a)->tcfv_action;
+}
+
+static inline u16 tcf_vlan_push_vid(const struct tc_action *a)
+{
+       return act_to_vlan(a)->tcfv_push_vid;
+}
+
+static inline __be16 tcf_vlan_push_proto(const struct tc_action *a)
+{
+       return act_to_vlan(a)->tcfv_push_proto;
+}
+
+#endif
+
+#ifndef HAVE_TCF_VLAN_PUSH_PRIO
+static inline __be16 tcf_vlan_push_prio(const struct tc_action *a)
+{
+       return act_to_vlan(a)->tcfv_push_prio;
+}
+#endif
+
+#endif /* _COMPAT_NET_TC_ACT_TC_VLAN_H */
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
new file mode 100644 (file)
index 0000000..1db55e8
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef COMPAT_LINUX_UAPI_DEVLINK_H
+#define COMPAT_LINUX_UAPI_DEVLINK_H
+
+#include "../../../compat/config.h"
+
+#ifndef HAVE_DEVLINK_HAS_ESWITCH_MODE_GET_SET
+enum devlink_eswitch_mode {
+       DEVLINK_ESWITCH_MODE_LEGACY,
+       DEVLINK_ESWITCH_MODE_SWITCHDEV,
+};
+#endif
+
+#ifndef HAVE_DEVLINK_HAS_ESWITCH_INLINE_MODE_GET_SET
+enum devlink_eswitch_inline_mode {
+       DEVLINK_ESWITCH_INLINE_MODE_NONE,
+       DEVLINK_ESWITCH_INLINE_MODE_LINK,
+       DEVLINK_ESWITCH_INLINE_MODE_NETWORK,
+       DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT,
+};
+#endif
+
+#ifndef HAVE_DEVLINK_HAS_ESWITCH_ENCAP_MODE_SET
+enum devlink_eswitch_encap_mode {
+       DEVLINK_ESWITCH_ENCAP_MODE_NONE,
+       DEVLINK_ESWITCH_ENCAP_MODE_BASIC,
+};
+#endif
+
+#ifdef HAVE_DEVLINK_H
+#include_next <uapi/linux/devlink.h>
+#else /* HAVE_DEVLINK_H */
+
+#endif /* HAVE_DEVLINK_H */
+
+#endif /* COMPAT_LINUX_UAPI_DEVLINK_H */
diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
new file mode 100644 (file)
index 0000000..3a95741
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef _COMPAT_LINUX_NET_TSTAMP_H
+#define _COMPAT_LINUX_NET_TSTAMP_H
+
+#include "../../../compat/config.h"
+
+#include_next <linux/net_tstamp.h>
+
+#ifndef HAVE_HWTSTAMP_FILTER_NTP_ALL
+#define HWTSTAMP_FILTER_NTP_ALL        15
+#endif
+
+#endif /* _COMPAT_LINUX_NET_TSTAMP_H */