Commit 43c6116573ca0f9fc907e6b46861f2f142acb33b
Committed by
Roland Dreier
1 parent
9d82f5eb33
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Revert "IB/core: Add support for extended query device caps"
While commit 7e36ef8205ff ("IB/core: Temporarily disable ex_query_device uverb") is correct as it makes the extended QUERY_DEVICE uverb (which came as part of commit 5a77abf9a97a ("IB/core: Add support for extended query device caps") and commit 860f10a799c8 ("IB/core: Add flags for on demand paging support")) not available to userspace, it doesn't address the initial issue regarding ib_copy_to_udata() [1][2]. Additionally, further discussions around this new uverb seems to conclude it would require a different data structure than the one currently described in <rdma/ib_user_verbs.h> [3]. Both of these issues require a revert of the changes, so this patch partially reverts commit 8cdd312cfed7 ("IB/mlx5: Implement the ODP capability query verb") and commit 860f10a799c8 ("IB/core: Add flags for on demand paging support") and fully reverts commit 5a77abf9a97a ("IB/core: Add support for extended query device caps"). [1] "Re: [PATCH v3 06/17] IB/core: Add support for extended query device caps" http://mid.gmane.org/1418733236.2779.26.camel@opteya.com [2] "Re: [PATCH] IB/core: Temporarily disable ex_query_device uverb" http://mid.gmane.org/1423067503.3030.83.camel@opteya.com [3] "RE: [PATCH v1 1/5] IB/uverbs: ex_query_device: answer must not depend on request's comp_mask" http://mid.gmane.org/2807E5FD2F6FDA4886F6618EAC48510E0CC12C30@CRSMSX101.amr.corp.intel.com Cc: Eli Cohen <eli@mellanox.com> Cc: Haggai Eran <haggaie@mellanox.com> Cc: Ira Weiny <ira.weiny@intel.com> Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Cc: Sagi Grimberg <sagig@mellanox.com> Cc: Shachar Raindel <raindel@mellanox.com> Signed-off-by: Yann Droneaud <ydroneaud@opteya.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Showing 5 changed files with 42 additions and 130 deletions Side-by-side Diff
drivers/infiniband/core/uverbs.h
drivers/infiniband/core/uverbs_cmd.c
... | ... | @@ -400,52 +400,6 @@ |
400 | 400 | return ret; |
401 | 401 | } |
402 | 402 | |
403 | -static void copy_query_dev_fields(struct ib_uverbs_file *file, | |
404 | - struct ib_uverbs_query_device_resp *resp, | |
405 | - struct ib_device_attr *attr) | |
406 | -{ | |
407 | - resp->fw_ver = attr->fw_ver; | |
408 | - resp->node_guid = file->device->ib_dev->node_guid; | |
409 | - resp->sys_image_guid = attr->sys_image_guid; | |
410 | - resp->max_mr_size = attr->max_mr_size; | |
411 | - resp->page_size_cap = attr->page_size_cap; | |
412 | - resp->vendor_id = attr->vendor_id; | |
413 | - resp->vendor_part_id = attr->vendor_part_id; | |
414 | - resp->hw_ver = attr->hw_ver; | |
415 | - resp->max_qp = attr->max_qp; | |
416 | - resp->max_qp_wr = attr->max_qp_wr; | |
417 | - resp->device_cap_flags = attr->device_cap_flags; | |
418 | - resp->max_sge = attr->max_sge; | |
419 | - resp->max_sge_rd = attr->max_sge_rd; | |
420 | - resp->max_cq = attr->max_cq; | |
421 | - resp->max_cqe = attr->max_cqe; | |
422 | - resp->max_mr = attr->max_mr; | |
423 | - resp->max_pd = attr->max_pd; | |
424 | - resp->max_qp_rd_atom = attr->max_qp_rd_atom; | |
425 | - resp->max_ee_rd_atom = attr->max_ee_rd_atom; | |
426 | - resp->max_res_rd_atom = attr->max_res_rd_atom; | |
427 | - resp->max_qp_init_rd_atom = attr->max_qp_init_rd_atom; | |
428 | - resp->max_ee_init_rd_atom = attr->max_ee_init_rd_atom; | |
429 | - resp->atomic_cap = attr->atomic_cap; | |
430 | - resp->max_ee = attr->max_ee; | |
431 | - resp->max_rdd = attr->max_rdd; | |
432 | - resp->max_mw = attr->max_mw; | |
433 | - resp->max_raw_ipv6_qp = attr->max_raw_ipv6_qp; | |
434 | - resp->max_raw_ethy_qp = attr->max_raw_ethy_qp; | |
435 | - resp->max_mcast_grp = attr->max_mcast_grp; | |
436 | - resp->max_mcast_qp_attach = attr->max_mcast_qp_attach; | |
437 | - resp->max_total_mcast_qp_attach = attr->max_total_mcast_qp_attach; | |
438 | - resp->max_ah = attr->max_ah; | |
439 | - resp->max_fmr = attr->max_fmr; | |
440 | - resp->max_map_per_fmr = attr->max_map_per_fmr; | |
441 | - resp->max_srq = attr->max_srq; | |
442 | - resp->max_srq_wr = attr->max_srq_wr; | |
443 | - resp->max_srq_sge = attr->max_srq_sge; | |
444 | - resp->max_pkeys = attr->max_pkeys; | |
445 | - resp->local_ca_ack_delay = attr->local_ca_ack_delay; | |
446 | - resp->phys_port_cnt = file->device->ib_dev->phys_port_cnt; | |
447 | -} | |
448 | - | |
449 | 403 | ssize_t ib_uverbs_query_device(struct ib_uverbs_file *file, |
450 | 404 | const char __user *buf, |
451 | 405 | int in_len, int out_len) |
452 | 406 | |
... | ... | @@ -466,8 +420,48 @@ |
466 | 420 | return ret; |
467 | 421 | |
468 | 422 | memset(&resp, 0, sizeof resp); |
469 | - copy_query_dev_fields(file, &resp, &attr); | |
470 | 423 | |
424 | + resp.fw_ver = attr.fw_ver; | |
425 | + resp.node_guid = file->device->ib_dev->node_guid; | |
426 | + resp.sys_image_guid = attr.sys_image_guid; | |
427 | + resp.max_mr_size = attr.max_mr_size; | |
428 | + resp.page_size_cap = attr.page_size_cap; | |
429 | + resp.vendor_id = attr.vendor_id; | |
430 | + resp.vendor_part_id = attr.vendor_part_id; | |
431 | + resp.hw_ver = attr.hw_ver; | |
432 | + resp.max_qp = attr.max_qp; | |
433 | + resp.max_qp_wr = attr.max_qp_wr; | |
434 | + resp.device_cap_flags = attr.device_cap_flags; | |
435 | + resp.max_sge = attr.max_sge; | |
436 | + resp.max_sge_rd = attr.max_sge_rd; | |
437 | + resp.max_cq = attr.max_cq; | |
438 | + resp.max_cqe = attr.max_cqe; | |
439 | + resp.max_mr = attr.max_mr; | |
440 | + resp.max_pd = attr.max_pd; | |
441 | + resp.max_qp_rd_atom = attr.max_qp_rd_atom; | |
442 | + resp.max_ee_rd_atom = attr.max_ee_rd_atom; | |
443 | + resp.max_res_rd_atom = attr.max_res_rd_atom; | |
444 | + resp.max_qp_init_rd_atom = attr.max_qp_init_rd_atom; | |
445 | + resp.max_ee_init_rd_atom = attr.max_ee_init_rd_atom; | |
446 | + resp.atomic_cap = attr.atomic_cap; | |
447 | + resp.max_ee = attr.max_ee; | |
448 | + resp.max_rdd = attr.max_rdd; | |
449 | + resp.max_mw = attr.max_mw; | |
450 | + resp.max_raw_ipv6_qp = attr.max_raw_ipv6_qp; | |
451 | + resp.max_raw_ethy_qp = attr.max_raw_ethy_qp; | |
452 | + resp.max_mcast_grp = attr.max_mcast_grp; | |
453 | + resp.max_mcast_qp_attach = attr.max_mcast_qp_attach; | |
454 | + resp.max_total_mcast_qp_attach = attr.max_total_mcast_qp_attach; | |
455 | + resp.max_ah = attr.max_ah; | |
456 | + resp.max_fmr = attr.max_fmr; | |
457 | + resp.max_map_per_fmr = attr.max_map_per_fmr; | |
458 | + resp.max_srq = attr.max_srq; | |
459 | + resp.max_srq_wr = attr.max_srq_wr; | |
460 | + resp.max_srq_sge = attr.max_srq_sge; | |
461 | + resp.max_pkeys = attr.max_pkeys; | |
462 | + resp.local_ca_ack_delay = attr.local_ca_ack_delay; | |
463 | + resp.phys_port_cnt = file->device->ib_dev->phys_port_cnt; | |
464 | + | |
471 | 465 | if (copy_to_user((void __user *) (unsigned long) cmd.response, |
472 | 466 | &resp, sizeof resp)) |
473 | 467 | return -EFAULT; |
... | ... | @@ -3292,54 +3286,5 @@ |
3292 | 3286 | ret = -EFAULT; |
3293 | 3287 | |
3294 | 3288 | return ret ? ret : in_len; |
3295 | -} | |
3296 | - | |
3297 | -int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, | |
3298 | - struct ib_udata *ucore, | |
3299 | - struct ib_udata *uhw) | |
3300 | -{ | |
3301 | - struct ib_uverbs_ex_query_device_resp resp; | |
3302 | - struct ib_uverbs_ex_query_device cmd; | |
3303 | - struct ib_device_attr attr; | |
3304 | - struct ib_device *device; | |
3305 | - int err; | |
3306 | - | |
3307 | - device = file->device->ib_dev; | |
3308 | - if (ucore->inlen < sizeof(cmd)) | |
3309 | - return -EINVAL; | |
3310 | - | |
3311 | - err = ib_copy_from_udata(&cmd, ucore, sizeof(cmd)); | |
3312 | - if (err) | |
3313 | - return err; | |
3314 | - | |
3315 | - if (cmd.reserved) | |
3316 | - return -EINVAL; | |
3317 | - | |
3318 | - err = device->query_device(device, &attr); | |
3319 | - if (err) | |
3320 | - return err; | |
3321 | - | |
3322 | - memset(&resp, 0, sizeof(resp)); | |
3323 | - copy_query_dev_fields(file, &resp.base, &attr); | |
3324 | - resp.comp_mask = 0; | |
3325 | - | |
3326 | -#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING | |
3327 | - if (cmd.comp_mask & IB_USER_VERBS_EX_QUERY_DEVICE_ODP) { | |
3328 | - resp.odp_caps.general_caps = attr.odp_caps.general_caps; | |
3329 | - resp.odp_caps.per_transport_caps.rc_odp_caps = | |
3330 | - attr.odp_caps.per_transport_caps.rc_odp_caps; | |
3331 | - resp.odp_caps.per_transport_caps.uc_odp_caps = | |
3332 | - attr.odp_caps.per_transport_caps.uc_odp_caps; | |
3333 | - resp.odp_caps.per_transport_caps.ud_odp_caps = | |
3334 | - attr.odp_caps.per_transport_caps.ud_odp_caps; | |
3335 | - resp.comp_mask |= IB_USER_VERBS_EX_QUERY_DEVICE_ODP; | |
3336 | - } | |
3337 | -#endif | |
3338 | - | |
3339 | - err = ib_copy_to_udata(ucore, &resp, sizeof(resp)); | |
3340 | - if (err) | |
3341 | - return err; | |
3342 | - | |
3343 | - return 0; | |
3344 | 3289 | } |
drivers/infiniband/hw/mlx5/main.c
... | ... | @@ -1331,8 +1331,6 @@ |
1331 | 1331 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | |
1332 | 1332 | (1ull << IB_USER_VERBS_CMD_CREATE_XSRQ) | |
1333 | 1333 | (1ull << IB_USER_VERBS_CMD_OPEN_QP); |
1334 | - dev->ib_dev.uverbs_ex_cmd_mask = | |
1335 | - (1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE); | |
1336 | 1334 | |
1337 | 1335 | dev->ib_dev.query_device = mlx5_ib_query_device; |
1338 | 1336 | dev->ib_dev.query_port = mlx5_ib_query_port; |
include/rdma/ib_verbs.h
... | ... | @@ -1707,10 +1707,7 @@ |
1707 | 1707 | |
1708 | 1708 | static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len) |
1709 | 1709 | { |
1710 | - size_t copy_sz; | |
1711 | - | |
1712 | - copy_sz = min_t(size_t, len, udata->outlen); | |
1713 | - return copy_to_user(udata->outbuf, src, copy_sz) ? -EFAULT : 0; | |
1710 | + return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0; | |
1714 | 1711 | } |
1715 | 1712 | |
1716 | 1713 | /** |
include/uapi/rdma/ib_user_verbs.h
... | ... | @@ -90,7 +90,6 @@ |
90 | 90 | }; |
91 | 91 | |
92 | 92 | enum { |
93 | - IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE, | |
94 | 93 | IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, |
95 | 94 | IB_USER_VERBS_EX_CMD_DESTROY_FLOW, |
96 | 95 | }; |
... | ... | @@ -200,32 +199,6 @@ |
200 | 199 | __u8 local_ca_ack_delay; |
201 | 200 | __u8 phys_port_cnt; |
202 | 201 | __u8 reserved[4]; |
203 | -}; | |
204 | - | |
205 | -enum { | |
206 | - IB_USER_VERBS_EX_QUERY_DEVICE_ODP = 1ULL << 0, | |
207 | -}; | |
208 | - | |
209 | -struct ib_uverbs_ex_query_device { | |
210 | - __u32 comp_mask; | |
211 | - __u32 reserved; | |
212 | -}; | |
213 | - | |
214 | -struct ib_uverbs_odp_caps { | |
215 | - __u64 general_caps; | |
216 | - struct { | |
217 | - __u32 rc_odp_caps; | |
218 | - __u32 uc_odp_caps; | |
219 | - __u32 ud_odp_caps; | |
220 | - } per_transport_caps; | |
221 | - __u32 reserved; | |
222 | -}; | |
223 | - | |
224 | -struct ib_uverbs_ex_query_device_resp { | |
225 | - struct ib_uverbs_query_device_resp base; | |
226 | - __u32 comp_mask; | |
227 | - __u32 reserved; | |
228 | - struct ib_uverbs_odp_caps odp_caps; | |
229 | 202 | }; |
230 | 203 | |
231 | 204 | struct ib_uverbs_query_port { |