drivers/infiniband/core/cma_configfs.c | 93 ++++++++++++++++++++
drivers/infiniband/core/core_priv.h | 9 ++
drivers/infiniband/core/cq.c | 35 +++++++-
- drivers/infiniband/core/device.c | 22 +++++
+ drivers/infiniband/core/device.c | 32 +++++++
drivers/infiniband/core/fmr_pool.c | 55 ++++++++++++
drivers/infiniband/core/mad.c | 3 +
drivers/infiniband/core/netlink.c | 29 +++++++
- drivers/infiniband/core/nldev.c | 25 ++++++
+ drivers/infiniband/core/nldev.c | 30 +++++++
drivers/infiniband/core/restrack.c | 4 +
drivers/infiniband/core/roce_gid_mgmt.c | 31 +++++++
drivers/infiniband/core/sa_query.c | 47 ++++++++++
drivers/infiniband/core/user_mad.c | 20 +++++
drivers/infiniband/core/uverbs_main.c | 33 +++++++
drivers/infiniband/core/verbs.c | 2 +
- include/rdma/ib_addr.h | 23 +++++
+ include/rdma/ib_addr.h | 31 +++++++
include/rdma/ib_verbs.h | 147 ++++++++++++++++++++++++++++++++
include/rdma/rdma_netlink.h | 4 +
- include/rdma/restrack.h | 2 +
- 23 files changed, 687 insertions(+), 1 deletion(-)
+ include/rdma/restrack.h | 3 +
+ 23 files changed, 711 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index xxxxxxx..xxxxxxx xxxxxx
index xxxxxxx..xxxxxxx xxxxxx
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
-@@ -462,6 +462,7 @@ int ib_register_device(struct ib_device *device,
+@@ -84,6 +84,7 @@ static LIST_HEAD(client_list);
+ static DEFINE_MUTEX(device_mutex);
+ static DECLARE_RWSEM(lists_rwsem);
+
++#ifdef HAVE_REGISTER_LSM_NOTIFIER
+ static int ib_security_change(struct notifier_block *nb, unsigned long event,
+ void *lsm_data);
+ static void ib_policy_change_task(struct work_struct *work);
+@@ -92,6 +93,7 @@ static DECLARE_WORK(ib_policy_change_work, ib_policy_change_task);
+ static struct notifier_block ibdev_lsm_nb = {
+ .notifier_call = ib_security_change,
+ };
++#endif
+
+ static int ib_device_check_mandatory(struct ib_device *device)
+ {
+@@ -387,6 +389,7 @@ static int setup_port_pkey_list(struct ib_device *device)
+ return 0;
+ }
+
++#ifdef HAVE_REGISTER_LSM_NOTIFIER
+ static void ib_policy_change_task(struct work_struct *work)
+ {
+ struct ib_device *dev;
+@@ -421,6 +424,7 @@ static int ib_security_change(struct notifier_block *nb, unsigned long event,
+
+ return NOTIFY_OK;
+ }
++#endif /* HAVE_REGISTER_LSM_NOTIFIER */
+
+ /**
+ * __dev_new_index - allocate an device index
+@@ -462,6 +466,7 @@ int ib_register_device(struct ib_device *device,
int ret;
struct ib_client *client;
struct ib_udata uhw = {.outlen = 0, .inlen = 0};
struct device *parent = device->dev.parent;
WARN_ON_ONCE(device->dma_device);
-@@ -493,6 +494,15 @@ int ib_register_device(struct ib_device *device,
+@@ -493,6 +498,15 @@ int ib_register_device(struct ib_device *device,
WARN_ON_ONCE(!parent);
device->dma_device = parent;
}
mutex_lock(&device_mutex);
-@@ -1159,15 +1169,27 @@ EXPORT_SYMBOL(ib_get_net_dev_by_params);
+@@ -1159,15 +1173,27 @@ EXPORT_SYMBOL(ib_get_net_dev_by_params);
static const struct rdma_nl_cbs ibnl_ls_cb_table[RDMA_NL_LS_NUM_OPS] = {
[RDMA_NL_LS_OP_RESOLVE] = {
.flags = RDMA_NL_ADMIN_PERM,
},
};
+@@ -1217,11 +1243,13 @@ static int __init ib_core_init(void)
+ goto err_mad;
+ }
+
++#ifdef HAVE_REGISTER_LSM_NOTIFIER
+ ret = register_lsm_notifier(&ibdev_lsm_nb);
+ if (ret) {
+ pr_warn("Couldn't register LSM notifier. ret %d\n", ret);
+ goto err_sa;
+ }
++#endif
+
+ nldev_init();
+ rdma_nl_register(RDMA_NL_LS, ibnl_ls_cb_table);
+@@ -1229,8 +1257,10 @@ static int __init ib_core_init(void)
+
+ return 0;
+
++#ifdef HAVE_REGISTER_LSM_NOTIFIER
+ err_sa:
+ ib_sa_cleanup();
++#endif
+ err_mad:
+ ib_mad_cleanup();
+ err_addr:
+@@ -1251,7 +1281,9 @@ static void __exit ib_core_cleanup(void)
+ ib_cache_cleanup();
+ nldev_exit();
+ rdma_nl_unregister(RDMA_NL_LS);
++#ifdef HAVE_REGISTER_LSM_NOTIFIER
+ unregister_lsm_notifier(&ibdev_lsm_nb);
++#endif
+ ib_sa_cleanup();
+ ib_mad_cleanup();
+ addr_cleanup();
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index xxxxxxx..xxxxxxx xxxxxx
--- a/drivers/infiniband/core/fmr_pool.c
if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX])
return -EINVAL;
+@@ -826,6 +851,7 @@ static int res_get_common_dumpit(struct sk_buff *skb,
+ struct nlmsghdr *nlh;
+ u32 index, port = 0;
+ bool filled = false;
++ COMPAT_HL_NODE
+
+ err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
+ nldev_policy, NULL);
+@@ -872,7 +898,11 @@ static int res_get_common_dumpit(struct sk_buff *skb,
+ }
+
+ down_read(&device->res.rwsem);
++#ifdef HAVE_HLIST_FOR_EACH_ENTRY_3_PARAMS
+ hash_for_each_possible(device->res.hash, res, node, res_type) {
++#else
++ hash_for_each_possible(device->res.hash, res, hlnode, node, res_type) {
++#endif
+ if (idx < start)
+ goto next;
+
diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c
index xxxxxxx..xxxxxxx xxxxxx
--- a/drivers/infiniband/core/restrack.c
index xxxxxxx..xxxxxxx xxxxxx
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
-@@ -241,15 +241,25 @@ static inline enum ib_mtu iboe_get_mtu(int mtu)
+@@ -151,7 +151,11 @@ static inline int rdma_addr_gid_offset(struct rdma_dev_addr *dev_addr)
+ return dev_addr->dev_type == ARPHRD_INFINIBAND ? 4 : 0;
+ }
+
++#ifdef HAVE_IS_VLAN_DEV_CONST
+ static inline u16 rdma_vlan_dev_vlan_id(const struct net_device *dev)
++#else
++static inline u16 rdma_vlan_dev_vlan_id(struct net_device *dev)
++#endif
+ {
+ return is_vlan_dev(dev) ? vlan_dev_vlan_id(dev) : 0xffff;
+ }
+@@ -241,15 +245,25 @@ static inline enum ib_mtu iboe_get_mtu(int mtu)
static inline int iboe_get_rate(struct net_device *dev)
{
if (cmd.base.speed >= 40000)
return IB_RATE_40_GBPS;
else if (cmd.base.speed >= 30000)
-@@ -260,6 +270,19 @@ static inline int iboe_get_rate(struct net_device *dev)
+@@ -260,6 +274,19 @@ static inline int iboe_get_rate(struct net_device *dev)
return IB_RATE_10_GBPS;
else
return IB_RATE_PORT_CURRENT;
}
static inline int rdma_link_local_addr(struct in6_addr *addr)
+@@ -307,7 +334,11 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid)
+ return vid < 0x1000 ? vid : 0xffff;
+ }
+
++#ifdef HAVE_IS_VLAN_DEV_CONST
+ static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev)
++#else
++static inline struct net_device *rdma_vlan_dev_real_dev(struct net_device *dev)
++#endif
+ {
+ return is_vlan_dev(dev) ? vlan_dev_real_dev(dev) : NULL;
+ }
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index xxxxxxx..xxxxxxx xxxxxx
--- a/include/rdma/ib_verbs.h
index xxxxxxx..xxxxxxx xxxxxx
--- a/include/rdma/restrack.h
+++ b/include/rdma/restrack.h
-@@ -11,7 +11,9 @@
+@@ -11,7 +11,10 @@
#include <linux/sched.h>
#include <linux/kref.h>
#include <linux/completion.h>
+#ifdef HAVE_LINUX_SCHED_TASK_H
#include <linux/sched/task.h>
+#endif
++#include <linux/hashtable.h>
/**
* enum rdma_restrack_type - HW objects to track