Skip to content

Commit 0b1ce1a

Browse files
committed
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"
2 parents bdfeb5a + 43c6116 commit 0b1ce1a

File tree

5 files changed

+42
-130
lines changed

5 files changed

+42
-130
lines changed

drivers/infiniband/core/uverbs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,5 @@ IB_UVERBS_DECLARE_CMD(close_xrcd);
258258

259259
IB_UVERBS_DECLARE_EX_CMD(create_flow);
260260
IB_UVERBS_DECLARE_EX_CMD(destroy_flow);
261-
IB_UVERBS_DECLARE_EX_CMD(query_device);
262261

263262
#endif /* UVERBS_H */

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 41 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -400,52 +400,6 @@ ssize_t ib_uverbs_get_context(struct ib_uverbs_file *file,
400400
return ret;
401401
}
402402

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-
449403
ssize_t ib_uverbs_query_device(struct ib_uverbs_file *file,
450404
const char __user *buf,
451405
int in_len, int out_len)
@@ -466,7 +420,47 @@ ssize_t ib_uverbs_query_device(struct ib_uverbs_file *file,
466420
return ret;
467421

468422
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;
470464

471465
if (copy_to_user((void __user *) (unsigned long) cmd.response,
472466
&resp, sizeof resp))
@@ -3293,52 +3287,3 @@ ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file,
32933287

32943288
return ret ? ret : in_len;
32953289
}
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-
}

drivers/infiniband/hw/mlx5/main.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,8 +1331,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
13311331
(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) |
13321332
(1ull << IB_USER_VERBS_CMD_CREATE_XSRQ) |
13331333
(1ull << IB_USER_VERBS_CMD_OPEN_QP);
1334-
dev->ib_dev.uverbs_ex_cmd_mask =
1335-
(1ull << IB_USER_VERBS_EX_CMD_QUERY_DEVICE);
13361334

13371335
dev->ib_dev.query_device = mlx5_ib_query_device;
13381336
dev->ib_dev.query_port = mlx5_ib_query_port;

include/rdma/ib_verbs.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,10 +1707,7 @@ static inline int ib_copy_from_udata(void *dest, struct ib_udata *udata, size_t
17071707

17081708
static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len)
17091709
{
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;
17141711
}
17151712

17161713
/**

include/uapi/rdma/ib_user_verbs.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ enum {
9090
};
9191

9292
enum {
93-
IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE,
9493
IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD,
9594
IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
9695
};
@@ -202,32 +201,6 @@ struct ib_uverbs_query_device_resp {
202201
__u8 reserved[4];
203202
};
204203

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-
231204
struct ib_uverbs_query_port {
232205
__u64 response;
233206
__u8 port_num;

0 commit comments

Comments
 (0)