summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEli Cohen <eli@dev.mellanox.co.il>2014-12-11 16:04:15 +0100
committerRoland Dreier <roland@purestorage.com>2014-12-16 03:13:35 +0100
commit5a77abf9a97a7ecc8fb0f6bf4ad411fb12b02f31 (patch)
tree2fbcf2c088cde299781ef0104c165f595aebd415 /include
parentIB/mlx5: Add function to read WQE from user-space (diff)
downloadlinux-5a77abf9a97a7ecc8fb0f6bf4ad411fb12b02f31.tar.xz
linux-5a77abf9a97a7ecc8fb0f6bf4ad411fb12b02f31.zip
IB/core: Add support for extended query device caps
Add extensible query device capabilities verb to allow adding new features. ib_uverbs_ex_query_device is added and copy_query_dev_fields is used to copy capability fields to be used by both ib_uverbs_query_device and ib_uverbs_ex_query_device. Signed-off-by: Eli Cohen <eli@mellanox.com> Signed-off-by: Haggai Eran <haggaie@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include')
-rw-r--r--include/rdma/ib_verbs.h5
-rw-r--r--include/uapi/rdma/ib_user_verbs.h14
2 files changed, 17 insertions, 2 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 470a011d6fa4..97a999f9e4d8 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1662,7 +1662,10 @@ static inline int ib_copy_from_udata(void *dest, struct ib_udata *udata, size_t
static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len)
{
- return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0;
+ size_t copy_sz;
+
+ copy_sz = min_t(size_t, len, udata->outlen);
+ return copy_to_user(udata->outbuf, src, copy_sz) ? -EFAULT : 0;
}
/**
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 26daf55ff76e..e8a96071e352 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -90,8 +90,9 @@ enum {
};
enum {
+ IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
- IB_USER_VERBS_EX_CMD_DESTROY_FLOW
+ IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
};
/*
@@ -201,6 +202,17 @@ struct ib_uverbs_query_device_resp {
__u8 reserved[4];
};
+struct ib_uverbs_ex_query_device {
+ __u32 comp_mask;
+ __u32 reserved;
+};
+
+struct ib_uverbs_ex_query_device_resp {
+ struct ib_uverbs_query_device_resp base;
+ __u32 comp_mask;
+ __u32 reserved;
+};
+
struct ib_uverbs_query_port {
__u64 response;
__u8 port_num;