aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Campbell <ralphc@pathscale.com>2006-08-11 17:58:09 -0400
committerRoland Dreier <rolandd@cisco.com>2006-09-22 18:22:25 -0400
commit9bc57e2d19db4da81c1150120658cc3658a99ed4 (patch)
tree0047863da8629f79d59f50d243ad7d6c01a5ec5c
parent64f817ba98095156149ba5991592d5d039f6da74 (diff)
IB/uverbs: Pass userspace data to modify_srq and modify_qp methods
Pass a struct ib_udata to the low-level driver's ->modify_srq() and ->modify_qp() methods, so that it can get to the device-specific data passed in by the userspace driver. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c13
-rw-r--r--drivers/infiniband/core/verbs.c4
-rw-r--r--drivers/infiniband/hw/ehca/ehca_iverbs.h3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c3
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c3
-rw-r--r--drivers/infiniband/hw/ipath/ipath_srq.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.h5
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h5
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c3
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c2
-rw-r--r--include/rdma/ib_verbs.h6
11 files changed, 34 insertions, 17 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index deae43f31e79..3fcb5d189a23 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -841,7 +841,6 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
841err_copy: 841err_copy:
842 idr_remove_uobj(&ib_uverbs_cq_idr, &obj->uobject); 842 idr_remove_uobj(&ib_uverbs_cq_idr, &obj->uobject);
843 843
844
845err_free: 844err_free:
846 ib_destroy_cq(cq); 845 ib_destroy_cq(cq);
847 846
@@ -1273,6 +1272,7 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
1273 int out_len) 1272 int out_len)
1274{ 1273{
1275 struct ib_uverbs_modify_qp cmd; 1274 struct ib_uverbs_modify_qp cmd;
1275 struct ib_udata udata;
1276 struct ib_qp *qp; 1276 struct ib_qp *qp;
1277 struct ib_qp_attr *attr; 1277 struct ib_qp_attr *attr;
1278 int ret; 1278 int ret;
@@ -1280,6 +1280,9 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
1280 if (copy_from_user(&cmd, buf, sizeof cmd)) 1280 if (copy_from_user(&cmd, buf, sizeof cmd))
1281 return -EFAULT; 1281 return -EFAULT;
1282 1282
1283 INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
1284 out_len);
1285
1283 attr = kmalloc(sizeof *attr, GFP_KERNEL); 1286 attr = kmalloc(sizeof *attr, GFP_KERNEL);
1284 if (!attr) 1287 if (!attr)
1285 return -ENOMEM; 1288 return -ENOMEM;
@@ -1336,7 +1339,7 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
1336 attr->alt_ah_attr.ah_flags = cmd.alt_dest.is_global ? IB_AH_GRH : 0; 1339 attr->alt_ah_attr.ah_flags = cmd.alt_dest.is_global ? IB_AH_GRH : 0;
1337 attr->alt_ah_attr.port_num = cmd.alt_dest.port_num; 1340 attr->alt_ah_attr.port_num = cmd.alt_dest.port_num;
1338 1341
1339 ret = ib_modify_qp(qp, attr, cmd.attr_mask); 1342 ret = qp->device->modify_qp(qp, attr, cmd.attr_mask, &udata);
1340 1343
1341 put_qp_read(qp); 1344 put_qp_read(qp);
1342 1345
@@ -2054,6 +2057,7 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file,
2054 int out_len) 2057 int out_len)
2055{ 2058{
2056 struct ib_uverbs_modify_srq cmd; 2059 struct ib_uverbs_modify_srq cmd;
2060 struct ib_udata udata;
2057 struct ib_srq *srq; 2061 struct ib_srq *srq;
2058 struct ib_srq_attr attr; 2062 struct ib_srq_attr attr;
2059 int ret; 2063 int ret;
@@ -2061,6 +2065,9 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file,
2061 if (copy_from_user(&cmd, buf, sizeof cmd)) 2065 if (copy_from_user(&cmd, buf, sizeof cmd))
2062 return -EFAULT; 2066 return -EFAULT;
2063 2067
2068 INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
2069 out_len);
2070
2064 srq = idr_read_srq(cmd.srq_handle, file->ucontext); 2071 srq = idr_read_srq(cmd.srq_handle, file->ucontext);
2065 if (!srq) 2072 if (!srq)
2066 return -EINVAL; 2073 return -EINVAL;
@@ -2068,7 +2075,7 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file,
2068 attr.max_wr = cmd.max_wr; 2075 attr.max_wr = cmd.max_wr;
2069 attr.srq_limit = cmd.srq_limit; 2076 attr.srq_limit = cmd.srq_limit;
2070 2077
2071 ret = ib_modify_srq(srq, &attr, cmd.attr_mask); 2078 ret = srq->device->modify_srq(srq, &attr, cmd.attr_mask, &udata);
2072 2079
2073 put_srq_read(srq); 2080 put_srq_read(srq);
2074 2081
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 468999c38803..06f98e9e14f9 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -231,7 +231,7 @@ int ib_modify_srq(struct ib_srq *srq,
231 struct ib_srq_attr *srq_attr, 231 struct ib_srq_attr *srq_attr,
232 enum ib_srq_attr_mask srq_attr_mask) 232 enum ib_srq_attr_mask srq_attr_mask)
233{ 233{
234 return srq->device->modify_srq(srq, srq_attr, srq_attr_mask); 234 return srq->device->modify_srq(srq, srq_attr, srq_attr_mask, NULL);
235} 235}
236EXPORT_SYMBOL(ib_modify_srq); 236EXPORT_SYMBOL(ib_modify_srq);
237 237
@@ -547,7 +547,7 @@ int ib_modify_qp(struct ib_qp *qp,
547 struct ib_qp_attr *qp_attr, 547 struct ib_qp_attr *qp_attr,
548 int qp_attr_mask) 548 int qp_attr_mask)
549{ 549{
550 return qp->device->modify_qp(qp, qp_attr, qp_attr_mask); 550 return qp->device->modify_qp(qp, qp_attr, qp_attr_mask, NULL);
551} 551}
552EXPORT_SYMBOL(ib_modify_qp); 552EXPORT_SYMBOL(ib_modify_qp);
553 553
diff --git a/drivers/infiniband/hw/ehca/ehca_iverbs.h b/drivers/infiniband/hw/ehca/ehca_iverbs.h
index bbdc437f5167..319c39d47f3a 100644
--- a/drivers/infiniband/hw/ehca/ehca_iverbs.h
+++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h
@@ -143,7 +143,8 @@ struct ib_qp *ehca_create_qp(struct ib_pd *pd,
143 143
144int ehca_destroy_qp(struct ib_qp *qp); 144int ehca_destroy_qp(struct ib_qp *qp);
145 145
146int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask); 146int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
147 struct ib_udata *udata);
147 148
148int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr, 149int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
149 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr); 150 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index 4b27bedc6c24..4394123cdbd7 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -1230,7 +1230,8 @@ modify_qp_exit1:
1230 return ret; 1230 return ret;
1231} 1231}
1232 1232
1233int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) 1233int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
1234 struct ib_udata *udata)
1234{ 1235{
1235 struct ehca_qp *my_qp = container_of(ibqp, struct ehca_qp, ib_qp); 1236 struct ehca_qp *my_qp = container_of(ibqp, struct ehca_qp, ib_qp);
1236 struct ehca_pd *my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd, 1237 struct ehca_pd *my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index 83e557be591e..44c32d2db990 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -426,11 +426,12 @@ void ipath_error_qp(struct ipath_qp *qp)
426 * @ibqp: the queue pair who's attributes we're modifying 426 * @ibqp: the queue pair who's attributes we're modifying
427 * @attr: the new attributes 427 * @attr: the new attributes
428 * @attr_mask: the mask of attributes to modify 428 * @attr_mask: the mask of attributes to modify
429 * @udata: user data for ipathverbs.so
429 * 430 *
430 * Returns 0 on success, otherwise returns an errno. 431 * Returns 0 on success, otherwise returns an errno.
431 */ 432 */
432int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, 433int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
433 int attr_mask) 434 int attr_mask, struct ib_udata *udata)
434{ 435{
435 struct ipath_ibdev *dev = to_idev(ibqp->device); 436 struct ipath_ibdev *dev = to_idev(ibqp->device);
436 struct ipath_qp *qp = to_iqp(ibqp); 437 struct ipath_qp *qp = to_iqp(ibqp);
diff --git a/drivers/infiniband/hw/ipath/ipath_srq.c b/drivers/infiniband/hw/ipath/ipath_srq.c
index f760434660bd..fa77da6667ed 100644
--- a/drivers/infiniband/hw/ipath/ipath_srq.c
+++ b/drivers/infiniband/hw/ipath/ipath_srq.c
@@ -188,9 +188,11 @@ bail:
188 * @ibsrq: the SRQ to modify 188 * @ibsrq: the SRQ to modify
189 * @attr: the new attributes of the SRQ 189 * @attr: the new attributes of the SRQ
190 * @attr_mask: indicates which attributes to modify 190 * @attr_mask: indicates which attributes to modify
191 * @udata: user data for ipathverbs.so
191 */ 192 */
192int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, 193int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
193 enum ib_srq_attr_mask attr_mask) 194 enum ib_srq_attr_mask attr_mask,
195 struct ib_udata *udata)
194{ 196{
195 struct ipath_srq *srq = to_isrq(ibsrq); 197 struct ipath_srq *srq = to_isrq(ibsrq);
196 unsigned long flags; 198 unsigned long flags;
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h
index 2df684727dc1..698396778f00 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h
@@ -579,7 +579,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
579int ipath_destroy_qp(struct ib_qp *ibqp); 579int ipath_destroy_qp(struct ib_qp *ibqp);
580 580
581int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, 581int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
582 int attr_mask); 582 int attr_mask, struct ib_udata *udata);
583 583
584int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, 584int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
585 int attr_mask, struct ib_qp_init_attr *init_attr); 585 int attr_mask, struct ib_qp_init_attr *init_attr);
@@ -638,7 +638,8 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
638 struct ib_udata *udata); 638 struct ib_udata *udata);
639 639
640int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, 640int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
641 enum ib_srq_attr_mask attr_mask); 641 enum ib_srq_attr_mask attr_mask,
642 struct ib_udata *udata);
642 643
643int ipath_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr); 644int ipath_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr);
644 645
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index f8160b8de090..33bd0b8bfd13 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -506,7 +506,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd,
506 struct ib_srq_attr *attr, struct mthca_srq *srq); 506 struct ib_srq_attr *attr, struct mthca_srq *srq);
507void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq); 507void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq);
508int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, 508int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
509 enum ib_srq_attr_mask attr_mask); 509 enum ib_srq_attr_mask attr_mask, struct ib_udata *udata);
510int mthca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr); 510int mthca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
511int mthca_max_srq_sge(struct mthca_dev *dev); 511int mthca_max_srq_sge(struct mthca_dev *dev);
512void mthca_srq_event(struct mthca_dev *dev, u32 srqn, 512void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
@@ -521,7 +521,8 @@ void mthca_qp_event(struct mthca_dev *dev, u32 qpn,
521 enum ib_event_type event_type); 521 enum ib_event_type event_type);
522int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask, 522int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask,
523 struct ib_qp_init_attr *qp_init_attr); 523 struct ib_qp_init_attr *qp_init_attr);
524int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask); 524int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
525 struct ib_udata *udata);
525int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, 526int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
526 struct ib_send_wr **bad_wr); 527 struct ib_send_wr **bad_wr);
527int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, 528int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 2e8f6f36e0a5..6d6ba4180a39 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -527,7 +527,8 @@ static int mthca_path_set(struct mthca_dev *dev, struct ib_ah_attr *ah,
527 return 0; 527 return 0;
528} 528}
529 529
530int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) 530int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
531 struct ib_udata *udata)
531{ 532{
532 struct mthca_dev *dev = to_mdev(ibqp->device); 533 struct mthca_dev *dev = to_mdev(ibqp->device);
533 struct mthca_qp *qp = to_mqp(ibqp); 534 struct mthca_qp *qp = to_mqp(ibqp);
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index b60a9d79ae54..0f316c87bf64 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -358,7 +358,7 @@ void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq)
358} 358}
359 359
360int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, 360int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
361 enum ib_srq_attr_mask attr_mask) 361 enum ib_srq_attr_mask attr_mask, struct ib_udata *udata)
362{ 362{
363 struct mthca_dev *dev = to_mdev(ibsrq->device); 363 struct mthca_dev *dev = to_mdev(ibsrq->device);
364 struct mthca_srq *srq = to_msrq(ibsrq); 364 struct mthca_srq *srq = to_msrq(ibsrq);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index ee1f3a355666..61eed3996117 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -888,7 +888,8 @@ struct ib_device {
888 struct ib_udata *udata); 888 struct ib_udata *udata);
889 int (*modify_srq)(struct ib_srq *srq, 889 int (*modify_srq)(struct ib_srq *srq,
890 struct ib_srq_attr *srq_attr, 890 struct ib_srq_attr *srq_attr,
891 enum ib_srq_attr_mask srq_attr_mask); 891 enum ib_srq_attr_mask srq_attr_mask,
892 struct ib_udata *udata);
892 int (*query_srq)(struct ib_srq *srq, 893 int (*query_srq)(struct ib_srq *srq,
893 struct ib_srq_attr *srq_attr); 894 struct ib_srq_attr *srq_attr);
894 int (*destroy_srq)(struct ib_srq *srq); 895 int (*destroy_srq)(struct ib_srq *srq);
@@ -900,7 +901,8 @@ struct ib_device {
900 struct ib_udata *udata); 901 struct ib_udata *udata);
901 int (*modify_qp)(struct ib_qp *qp, 902 int (*modify_qp)(struct ib_qp *qp,
902 struct ib_qp_attr *qp_attr, 903 struct ib_qp_attr *qp_attr,
903 int qp_attr_mask); 904 int qp_attr_mask,
905 struct ib_udata *udata);
904 int (*query_qp)(struct ib_qp *qp, 906 int (*query_qp)(struct ib_qp *qp,
905 struct ib_qp_attr *qp_attr, 907 struct ib_qp_attr *qp_attr,
906 int qp_attr_mask, 908 int qp_attr_mask,