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>
This commit is contained in:
parent
64f817ba98
commit
9bc57e2d19
@ -841,7 +841,6 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
|
|||||||
err_copy:
|
err_copy:
|
||||||
idr_remove_uobj(&ib_uverbs_cq_idr, &obj->uobject);
|
idr_remove_uobj(&ib_uverbs_cq_idr, &obj->uobject);
|
||||||
|
|
||||||
|
|
||||||
err_free:
|
err_free:
|
||||||
ib_destroy_cq(cq);
|
ib_destroy_cq(cq);
|
||||||
|
|
||||||
@ -1273,6 +1272,7 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
|
|||||||
int out_len)
|
int out_len)
|
||||||
{
|
{
|
||||||
struct ib_uverbs_modify_qp cmd;
|
struct ib_uverbs_modify_qp cmd;
|
||||||
|
struct ib_udata udata;
|
||||||
struct ib_qp *qp;
|
struct ib_qp *qp;
|
||||||
struct ib_qp_attr *attr;
|
struct ib_qp_attr *attr;
|
||||||
int ret;
|
int ret;
|
||||||
@ -1280,6 +1280,9 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
|
|||||||
if (copy_from_user(&cmd, buf, sizeof cmd))
|
if (copy_from_user(&cmd, buf, sizeof cmd))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
|
||||||
|
out_len);
|
||||||
|
|
||||||
attr = kmalloc(sizeof *attr, GFP_KERNEL);
|
attr = kmalloc(sizeof *attr, GFP_KERNEL);
|
||||||
if (!attr)
|
if (!attr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -1336,7 +1339,7 @@ ssize_t ib_uverbs_modify_qp(struct ib_uverbs_file *file,
|
|||||||
attr->alt_ah_attr.ah_flags = cmd.alt_dest.is_global ? IB_AH_GRH : 0;
|
attr->alt_ah_attr.ah_flags = cmd.alt_dest.is_global ? IB_AH_GRH : 0;
|
||||||
attr->alt_ah_attr.port_num = cmd.alt_dest.port_num;
|
attr->alt_ah_attr.port_num = cmd.alt_dest.port_num;
|
||||||
|
|
||||||
ret = ib_modify_qp(qp, attr, cmd.attr_mask);
|
ret = qp->device->modify_qp(qp, attr, cmd.attr_mask, &udata);
|
||||||
|
|
||||||
put_qp_read(qp);
|
put_qp_read(qp);
|
||||||
|
|
||||||
@ -2054,6 +2057,7 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file,
|
|||||||
int out_len)
|
int out_len)
|
||||||
{
|
{
|
||||||
struct ib_uverbs_modify_srq cmd;
|
struct ib_uverbs_modify_srq cmd;
|
||||||
|
struct ib_udata udata;
|
||||||
struct ib_srq *srq;
|
struct ib_srq *srq;
|
||||||
struct ib_srq_attr attr;
|
struct ib_srq_attr attr;
|
||||||
int ret;
|
int ret;
|
||||||
@ -2061,6 +2065,9 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file,
|
|||||||
if (copy_from_user(&cmd, buf, sizeof cmd))
|
if (copy_from_user(&cmd, buf, sizeof cmd))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
|
||||||
|
out_len);
|
||||||
|
|
||||||
srq = idr_read_srq(cmd.srq_handle, file->ucontext);
|
srq = idr_read_srq(cmd.srq_handle, file->ucontext);
|
||||||
if (!srq)
|
if (!srq)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -2068,7 +2075,7 @@ ssize_t ib_uverbs_modify_srq(struct ib_uverbs_file *file,
|
|||||||
attr.max_wr = cmd.max_wr;
|
attr.max_wr = cmd.max_wr;
|
||||||
attr.srq_limit = cmd.srq_limit;
|
attr.srq_limit = cmd.srq_limit;
|
||||||
|
|
||||||
ret = ib_modify_srq(srq, &attr, cmd.attr_mask);
|
ret = srq->device->modify_srq(srq, &attr, cmd.attr_mask, &udata);
|
||||||
|
|
||||||
put_srq_read(srq);
|
put_srq_read(srq);
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ int ib_modify_srq(struct ib_srq *srq,
|
|||||||
struct ib_srq_attr *srq_attr,
|
struct ib_srq_attr *srq_attr,
|
||||||
enum ib_srq_attr_mask srq_attr_mask)
|
enum ib_srq_attr_mask srq_attr_mask)
|
||||||
{
|
{
|
||||||
return srq->device->modify_srq(srq, srq_attr, srq_attr_mask);
|
return srq->device->modify_srq(srq, srq_attr, srq_attr_mask, NULL);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ib_modify_srq);
|
EXPORT_SYMBOL(ib_modify_srq);
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ int ib_modify_qp(struct ib_qp *qp,
|
|||||||
struct ib_qp_attr *qp_attr,
|
struct ib_qp_attr *qp_attr,
|
||||||
int qp_attr_mask)
|
int qp_attr_mask)
|
||||||
{
|
{
|
||||||
return qp->device->modify_qp(qp, qp_attr, qp_attr_mask);
|
return qp->device->modify_qp(qp, qp_attr, qp_attr_mask, NULL);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ib_modify_qp);
|
EXPORT_SYMBOL(ib_modify_qp);
|
||||||
|
|
||||||
|
@ -143,7 +143,8 @@ struct ib_qp *ehca_create_qp(struct ib_pd *pd,
|
|||||||
|
|
||||||
int ehca_destroy_qp(struct ib_qp *qp);
|
int ehca_destroy_qp(struct ib_qp *qp);
|
||||||
|
|
||||||
int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask);
|
int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
|
||||||
|
struct ib_udata *udata);
|
||||||
|
|
||||||
int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
|
int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
|
||||||
int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
|
int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
|
||||||
|
@ -1230,7 +1230,8 @@ static int internal_modify_qp(struct ib_qp *ibqp,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
|
int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
|
||||||
|
struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
struct ehca_qp *my_qp = container_of(ibqp, struct ehca_qp, ib_qp);
|
struct ehca_qp *my_qp = container_of(ibqp, struct ehca_qp, ib_qp);
|
||||||
struct ehca_pd *my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,
|
struct ehca_pd *my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,
|
||||||
|
@ -426,11 +426,12 @@ void ipath_error_qp(struct ipath_qp *qp)
|
|||||||
* @ibqp: the queue pair who's attributes we're modifying
|
* @ibqp: the queue pair who's attributes we're modifying
|
||||||
* @attr: the new attributes
|
* @attr: the new attributes
|
||||||
* @attr_mask: the mask of attributes to modify
|
* @attr_mask: the mask of attributes to modify
|
||||||
|
* @udata: user data for ipathverbs.so
|
||||||
*
|
*
|
||||||
* Returns 0 on success, otherwise returns an errno.
|
* Returns 0 on success, otherwise returns an errno.
|
||||||
*/
|
*/
|
||||||
int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||||
int attr_mask)
|
int attr_mask, struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
struct ipath_ibdev *dev = to_idev(ibqp->device);
|
struct ipath_ibdev *dev = to_idev(ibqp->device);
|
||||||
struct ipath_qp *qp = to_iqp(ibqp);
|
struct ipath_qp *qp = to_iqp(ibqp);
|
||||||
|
@ -188,9 +188,11 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
|
|||||||
* @ibsrq: the SRQ to modify
|
* @ibsrq: the SRQ to modify
|
||||||
* @attr: the new attributes of the SRQ
|
* @attr: the new attributes of the SRQ
|
||||||
* @attr_mask: indicates which attributes to modify
|
* @attr_mask: indicates which attributes to modify
|
||||||
|
* @udata: user data for ipathverbs.so
|
||||||
*/
|
*/
|
||||||
int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
|
int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
|
||||||
enum ib_srq_attr_mask attr_mask)
|
enum ib_srq_attr_mask attr_mask,
|
||||||
|
struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
struct ipath_srq *srq = to_isrq(ibsrq);
|
struct ipath_srq *srq = to_isrq(ibsrq);
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
@ -579,7 +579,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
|
|||||||
int ipath_destroy_qp(struct ib_qp *ibqp);
|
int ipath_destroy_qp(struct ib_qp *ibqp);
|
||||||
|
|
||||||
int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||||
int attr_mask);
|
int attr_mask, struct ib_udata *udata);
|
||||||
|
|
||||||
int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
|
||||||
int attr_mask, struct ib_qp_init_attr *init_attr);
|
int attr_mask, struct ib_qp_init_attr *init_attr);
|
||||||
@ -638,7 +638,8 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
|
|||||||
struct ib_udata *udata);
|
struct ib_udata *udata);
|
||||||
|
|
||||||
int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
|
int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
|
||||||
enum ib_srq_attr_mask attr_mask);
|
enum ib_srq_attr_mask attr_mask,
|
||||||
|
struct ib_udata *udata);
|
||||||
|
|
||||||
int ipath_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr);
|
int ipath_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr);
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd,
|
|||||||
struct ib_srq_attr *attr, struct mthca_srq *srq);
|
struct ib_srq_attr *attr, struct mthca_srq *srq);
|
||||||
void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq);
|
void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq);
|
||||||
int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
|
int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
|
||||||
enum ib_srq_attr_mask attr_mask);
|
enum ib_srq_attr_mask attr_mask, struct ib_udata *udata);
|
||||||
int mthca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
|
int mthca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
|
||||||
int mthca_max_srq_sge(struct mthca_dev *dev);
|
int mthca_max_srq_sge(struct mthca_dev *dev);
|
||||||
void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
|
void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
|
||||||
@ -521,7 +521,8 @@ void mthca_qp_event(struct mthca_dev *dev, u32 qpn,
|
|||||||
enum ib_event_type event_type);
|
enum ib_event_type event_type);
|
||||||
int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask,
|
int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask,
|
||||||
struct ib_qp_init_attr *qp_init_attr);
|
struct ib_qp_init_attr *qp_init_attr);
|
||||||
int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask);
|
int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
|
||||||
|
struct ib_udata *udata);
|
||||||
int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
|
||||||
struct ib_send_wr **bad_wr);
|
struct ib_send_wr **bad_wr);
|
||||||
int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
|
int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
|
||||||
|
@ -527,7 +527,8 @@ static int mthca_path_set(struct mthca_dev *dev, struct ib_ah_attr *ah,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
|
int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
|
||||||
|
struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
struct mthca_dev *dev = to_mdev(ibqp->device);
|
struct mthca_dev *dev = to_mdev(ibqp->device);
|
||||||
struct mthca_qp *qp = to_mqp(ibqp);
|
struct mthca_qp *qp = to_mqp(ibqp);
|
||||||
|
@ -358,7 +358,7 @@ void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
|
int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
|
||||||
enum ib_srq_attr_mask attr_mask)
|
enum ib_srq_attr_mask attr_mask, struct ib_udata *udata)
|
||||||
{
|
{
|
||||||
struct mthca_dev *dev = to_mdev(ibsrq->device);
|
struct mthca_dev *dev = to_mdev(ibsrq->device);
|
||||||
struct mthca_srq *srq = to_msrq(ibsrq);
|
struct mthca_srq *srq = to_msrq(ibsrq);
|
||||||
|
@ -888,7 +888,8 @@ struct ib_device {
|
|||||||
struct ib_udata *udata);
|
struct ib_udata *udata);
|
||||||
int (*modify_srq)(struct ib_srq *srq,
|
int (*modify_srq)(struct ib_srq *srq,
|
||||||
struct ib_srq_attr *srq_attr,
|
struct ib_srq_attr *srq_attr,
|
||||||
enum ib_srq_attr_mask srq_attr_mask);
|
enum ib_srq_attr_mask srq_attr_mask,
|
||||||
|
struct ib_udata *udata);
|
||||||
int (*query_srq)(struct ib_srq *srq,
|
int (*query_srq)(struct ib_srq *srq,
|
||||||
struct ib_srq_attr *srq_attr);
|
struct ib_srq_attr *srq_attr);
|
||||||
int (*destroy_srq)(struct ib_srq *srq);
|
int (*destroy_srq)(struct ib_srq *srq);
|
||||||
@ -900,7 +901,8 @@ struct ib_device {
|
|||||||
struct ib_udata *udata);
|
struct ib_udata *udata);
|
||||||
int (*modify_qp)(struct ib_qp *qp,
|
int (*modify_qp)(struct ib_qp *qp,
|
||||||
struct ib_qp_attr *qp_attr,
|
struct ib_qp_attr *qp_attr,
|
||||||
int qp_attr_mask);
|
int qp_attr_mask,
|
||||||
|
struct ib_udata *udata);
|
||||||
int (*query_qp)(struct ib_qp *qp,
|
int (*query_qp)(struct ib_qp *qp,
|
||||||
struct ib_qp_attr *qp_attr,
|
struct ib_qp_attr *qp_attr,
|
||||||
int qp_attr_mask,
|
int qp_attr_mask,
|
||||||
|
Loading…
Reference in New Issue
Block a user