diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-07 14:10:40 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-07 14:10:40 -0500 |
| commit | 0b1ce1a8ca14478bc6748c18434c523fb0ae8225 (patch) | |
| tree | 32cc28b7a773510df12cd5f3bb0c79dcf572eefe | |
| parent | bdfeb5a10471530dc93098e7b7663628ec951407 (diff) | |
| parent | 43c6116573ca0f9fc907e6b46861f2f142acb33b (diff) | |
Merge tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
Pull one more infiniband revert from Roland Dreier:
"One more last-second RDMA change for 3.19: Yann realized that the
previous revert of new userspace ABI did not go far enough, and we're
still exposing a change that we don't want. Revert even closer to
3.18 interface to make sure we get things right in the long run"
Yann Droneaud pipes up:
"I hope this could go in v3.19 as, at this stage, we don't want to
expose any bits of this ABI in a released kernel"
* tag 'rdma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband:
Revert "IB/core: Add support for extended query device caps"
| -rw-r--r-- | drivers/infiniband/core/uverbs.h | 1 | ||||
| -rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 137 | ||||
| -rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 2 | ||||
| -rw-r--r-- | include/rdma/ib_verbs.h | 5 | ||||
| -rw-r--r-- | include/uapi/rdma/ib_user_verbs.h | 27 |
5 files changed, 42 insertions, 130 deletions
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index b716b0815644..643c08a025a5 100644 --- a/drivers/infiniband/core/uverbs.h +++ b/drivers/infiniband/core/uverbs.h | |||
| @@ -258,6 +258,5 @@ IB_UVERBS_DECLARE_CMD(close_xrcd); | |||
| 258 | 258 | ||
| 259 | IB_UVERBS_DECLARE_EX_CMD(create_flow); | 259 | IB_UVERBS_DECLARE_EX_CMD(create_flow); |
| 260 | IB_UVERBS_DECLARE_EX_CMD(destroy_flow); | 260 | IB_UVERBS_DECLARE_EX_CMD(destroy_flow); |
| 261 | IB_UVERBS_DECLARE_EX_CMD(query_device); | ||
| 262 | 261 | ||
| 263 | #endif /* UVERBS_H */ | 262 | #endif /* UVERBS_H */ |
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 532d8eba8b02..b7943ff16ed3 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
| @@ -400,52 +400,6 @@ err: | |||
| 400 | return ret; | 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 | ssize_t ib_uverbs_query_device(struct ib_uverbs_file *file, | 403 | ssize_t ib_uverbs_query_device(struct ib_uverbs_file *file, |
| 450 | const char __user *buf, | 404 | const char __user *buf, |
| 451 | int in_len, int out_len) | 405 | int in_len, int out_len) |
| @@ -466,7 +420,47 @@ ssize_t ib_uverbs_query_device(struct ib_uverbs_file *file, | |||
| 466 | return ret; | 420 | return ret; |
| 467 | 421 | ||
| 468 | memset(&resp, 0, sizeof resp); | 422 | memset(&resp, 0, sizeof resp); |
| 469 | copy_query_dev_fields(file, &resp, &attr); | 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; | ||
| 470 | 464 | ||
| 471 | if (copy_to_user((void __user *) (unsigned long) cmd.response, | 465 | if (copy_to_user((void __user *) (unsigned long) cmd.response, |
| 472 | &resp, sizeof resp)) | 466 | &resp, sizeof resp)) |
| @@ -3293,52 +3287,3 @@ ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file, | |||
| 3293 | 3287 | ||
| 3294 | return ret ? ret : in_len; | 3288 | return ret ? ret : in_len; |
| 3295 | } | 3289 | } |
| 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 | } | ||
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 8a87404e9c76..03bf81211a54 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
| @@ -1331,8 +1331,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) | |||
| 1331 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | | 1331 | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | |
| 1332 | (1ull << IB_USER_VERBS_CMD_CREATE_XSRQ) | | 1332 | (1ull << IB_USER_VERBS_CMD_CREATE_XSRQ) | |
| 1333 | (1ull << IB_USER_VERBS_CMD_OPEN_QP); | 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 | dev->ib_dev.query_device = mlx5_ib_query_device; | 1335 | dev->ib_dev.query_device = mlx5_ib_query_device; |
| 1338 | dev->ib_dev.query_port = mlx5_ib_query_port; | 1336 | dev->ib_dev.query_port = mlx5_ib_query_port; |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 0d74f1de99aa..65994a19e840 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
| @@ -1707,10 +1707,7 @@ static inline int ib_copy_from_udata(void *dest, struct ib_udata *udata, size_t | |||
| 1707 | 1707 | ||
| 1708 | static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len) | 1708 | static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len) |
| 1709 | { | 1709 | { |
| 1710 | size_t copy_sz; | 1710 | return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0; |
| 1711 | |||
| 1712 | copy_sz = min_t(size_t, len, udata->outlen); | ||
| 1713 | return copy_to_user(udata->outbuf, src, copy_sz) ? -EFAULT : 0; | ||
| 1714 | } | 1711 | } |
| 1715 | 1712 | ||
| 1716 | /** | 1713 | /** |
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 4275b961bf60..867cc5084afb 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h | |||
| @@ -90,7 +90,6 @@ enum { | |||
| 90 | }; | 90 | }; |
| 91 | 91 | ||
| 92 | enum { | 92 | enum { |
| 93 | IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE, | ||
| 94 | IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, | 93 | IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, |
| 95 | IB_USER_VERBS_EX_CMD_DESTROY_FLOW, | 94 | IB_USER_VERBS_EX_CMD_DESTROY_FLOW, |
| 96 | }; | 95 | }; |
| @@ -202,32 +201,6 @@ struct ib_uverbs_query_device_resp { | |||
| 202 | __u8 reserved[4]; | 201 | __u8 reserved[4]; |
| 203 | }; | 202 | }; |
| 204 | 203 | ||
| 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 | }; | ||
| 230 | |||
| 231 | struct ib_uverbs_query_port { | 204 | struct ib_uverbs_query_port { |
| 232 | __u64 response; | 205 | __u64 response; |
| 233 | __u8 port_num; | 206 | __u8 port_num; |
