diff options
author | Eli Cohen <eli@mellanox.com> | 2015-02-08 06:28:50 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2015-02-18 11:36:26 -0500 |
commit | 02d1aa7af17ef0e0655745ce32cab369ed040a67 (patch) | |
tree | 8aa0ca395f00c20340452020d06efe4b0d83b111 /include | |
parent | 4fc701ead77ede96df3e8b3de13fdf2b1326ee5b (diff) |
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.
Following the discussion about this patch [1], the code now validates
the command's comp_mask is zero, returning -EINVAL for unknown values,
in order to allow extending the verb in the future.
The verb also checks the user-space provided response buffer size and
only fills in capabilities that will fit in the buffer. In attempt to
follow the spirit of presentation [2] by Tzahi Oved that was presented
during OpenFabrics Alliance International Developer Workshop 2013, the
comp_mask bits will only describe which fields are valid. Furthermore,
fields that can simply be cleared when they are not supported, do not
require a comp_mask bit at all. The verb returns a response_length
field containing the actual number of bytes written by the kernel, so
that a newer version running on an older kernel can tell which fields
were actually returned.
[1] [PATCH v1 0/5] IB/core: extended query device caps cleanup for v3.19
http://thread.gmane.org/gmane.linux.kernel.api/7889/
[2] https://www.openfabrics.org/images/docs/2013_Dev_Workshop/Tues_0423/2013_Workshop_Tues_0830_Tzahi_Oved-verbs_extensions_ofa_2013-tzahio.pdf
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/uapi/rdma/ib_user_verbs.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 867cc5084afb..f0f799afd856 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h | |||
@@ -90,6 +90,7 @@ enum { | |||
90 | }; | 90 | }; |
91 | 91 | ||
92 | enum { | 92 | enum { |
93 | IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE, | ||
93 | IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, | 94 | IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, |
94 | IB_USER_VERBS_EX_CMD_DESTROY_FLOW, | 95 | IB_USER_VERBS_EX_CMD_DESTROY_FLOW, |
95 | }; | 96 | }; |
@@ -201,6 +202,17 @@ struct ib_uverbs_query_device_resp { | |||
201 | __u8 reserved[4]; | 202 | __u8 reserved[4]; |
202 | }; | 203 | }; |
203 | 204 | ||
205 | struct ib_uverbs_ex_query_device { | ||
206 | __u32 comp_mask; | ||
207 | __u32 reserved; | ||
208 | }; | ||
209 | |||
210 | struct ib_uverbs_ex_query_device_resp { | ||
211 | struct ib_uverbs_query_device_resp base; | ||
212 | __u32 comp_mask; | ||
213 | __u32 response_length; | ||
214 | }; | ||
215 | |||
204 | struct ib_uverbs_query_port { | 216 | struct ib_uverbs_query_port { |
205 | __u64 response; | 217 | __u64 response; |
206 | __u8 port_num; | 218 | __u8 port_num; |