IB: Pass only ib_udata in function prototypes
Now when ib_udata is passed to all the driver's object create/destroy APIs the ib_udata will carry the ib_ucontext for every user command. There is no need to also pass the ib_ucontext via the functions prototypes. Make ib_udata the only argument psssed. Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
这个提交包含在:
@@ -168,7 +168,6 @@ static void send_complete(struct work_struct *work)
|
||||
* rvt_create_cq - create a completion queue
|
||||
* @ibdev: the device this completion queue is attached to
|
||||
* @attr: creation attributes
|
||||
* @context: unused by the QLogic_IB driver
|
||||
* @udata: user data for libibverbs.so
|
||||
*
|
||||
* Called by ib_create_cq() in the generic verbs code.
|
||||
@@ -178,7 +177,6 @@ static void send_complete(struct work_struct *work)
|
||||
*/
|
||||
struct ib_cq *rvt_create_cq(struct ib_device *ibdev,
|
||||
const struct ib_cq_init_attr *attr,
|
||||
struct ib_ucontext *context,
|
||||
struct ib_udata *udata)
|
||||
{
|
||||
struct rvt_dev_info *rdi = ib_to_rvt(ibdev);
|
||||
@@ -232,7 +230,7 @@ struct ib_cq *rvt_create_cq(struct ib_device *ibdev,
|
||||
if (udata && udata->outlen >= sizeof(__u64)) {
|
||||
int err;
|
||||
|
||||
cq->ip = rvt_create_mmap_info(rdi, sz, context, wc);
|
||||
cq->ip = rvt_create_mmap_info(rdi, sz, udata, wc);
|
||||
if (!cq->ip) {
|
||||
ret = ERR_PTR(-ENOMEM);
|
||||
goto bail_wc;
|
||||
|
@@ -53,7 +53,6 @@
|
||||
|
||||
struct ib_cq *rvt_create_cq(struct ib_device *ibdev,
|
||||
const struct ib_cq_init_attr *attr,
|
||||
struct ib_ucontext *context,
|
||||
struct ib_udata *udata);
|
||||
int rvt_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
|
||||
int rvt_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags);
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/mm.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <rdma/uverbs_ioctl.h>
|
||||
#include "mmap.h"
|
||||
|
||||
/**
|
||||
@@ -150,18 +151,19 @@ done:
|
||||
* rvt_create_mmap_info - allocate information for hfi1_mmap
|
||||
* @rdi: rvt dev struct
|
||||
* @size: size in bytes to map
|
||||
* @context: user context
|
||||
* @udata: user data (must be valid!)
|
||||
* @obj: opaque pointer to a cq, wq etc
|
||||
*
|
||||
* Return: rvt_mmap struct on success
|
||||
*/
|
||||
struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi,
|
||||
u32 size,
|
||||
struct ib_ucontext *context,
|
||||
void *obj)
|
||||
struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, u32 size,
|
||||
struct ib_udata *udata, void *obj)
|
||||
{
|
||||
struct rvt_mmap_info *ip;
|
||||
|
||||
if (!udata)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
ip = kmalloc_node(sizeof(*ip), GFP_KERNEL, rdi->dparms.node);
|
||||
if (!ip)
|
||||
return ip;
|
||||
@@ -177,7 +179,9 @@ struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi,
|
||||
|
||||
INIT_LIST_HEAD(&ip->pending_mmaps);
|
||||
ip->size = size;
|
||||
ip->context = context;
|
||||
ip->context =
|
||||
container_of(udata, struct uverbs_attr_bundle, driver_udata)
|
||||
->context;
|
||||
ip->obj = obj;
|
||||
kref_init(&ip->ref);
|
||||
|
||||
|
@@ -53,10 +53,8 @@
|
||||
void rvt_mmap_init(struct rvt_dev_info *rdi);
|
||||
void rvt_release_mmap_info(struct kref *ref);
|
||||
int rvt_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
|
||||
struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi,
|
||||
u32 size,
|
||||
struct ib_ucontext *context,
|
||||
void *obj);
|
||||
struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi, u32 size,
|
||||
struct ib_udata *udata, void *obj);
|
||||
void rvt_update_mmap_info(struct rvt_dev_info *rdi, struct rvt_mmap_info *ip,
|
||||
u32 size, void *obj);
|
||||
|
||||
|
@@ -51,15 +51,13 @@
|
||||
/**
|
||||
* rvt_alloc_pd - allocate a protection domain
|
||||
* @ibpd: PD
|
||||
* @context: optional user context
|
||||
* @udata: optional user data
|
||||
*
|
||||
* Allocate and keep track of a PD.
|
||||
*
|
||||
* Return: 0 on success
|
||||
*/
|
||||
int rvt_alloc_pd(struct ib_pd *ibpd, struct ib_ucontext *context,
|
||||
struct ib_udata *udata)
|
||||
int rvt_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
|
||||
{
|
||||
struct ib_device *ibdev = ibpd->device;
|
||||
struct rvt_dev_info *dev = ib_to_rvt(ibdev);
|
||||
|
@@ -50,8 +50,7 @@
|
||||
|
||||
#include <rdma/rdma_vt.h>
|
||||
|
||||
int rvt_alloc_pd(struct ib_pd *pd, struct ib_ucontext *context,
|
||||
struct ib_udata *udata);
|
||||
int rvt_alloc_pd(struct ib_pd *pd, struct ib_udata *udata);
|
||||
void rvt_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata);
|
||||
|
||||
#endif /* DEF_RDMAVTPD_H */
|
||||
|
@@ -957,8 +957,6 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
|
||||
size_t sg_list_sz;
|
||||
struct ib_qp *ret = ERR_PTR(-ENOMEM);
|
||||
struct rvt_dev_info *rdi = ib_to_rvt(ibpd->device);
|
||||
struct rvt_ucontext *ucontext = rdma_udata_to_drv_context(
|
||||
udata, struct rvt_ucontext, ibucontext);
|
||||
void *priv = NULL;
|
||||
size_t sqsize;
|
||||
|
||||
@@ -1131,8 +1129,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
|
||||
} else {
|
||||
u32 s = sizeof(struct rvt_rwq) + qp->r_rq.size * sz;
|
||||
|
||||
qp->ip = rvt_create_mmap_info(rdi, s,
|
||||
&ucontext->ibucontext,
|
||||
qp->ip = rvt_create_mmap_info(rdi, s, udata,
|
||||
qp->r_rq.wq);
|
||||
if (!qp->ip) {
|
||||
ret = ERR_PTR(-ENOMEM);
|
||||
|
@@ -78,8 +78,6 @@ struct ib_srq *rvt_create_srq(struct ib_pd *ibpd,
|
||||
struct ib_udata *udata)
|
||||
{
|
||||
struct rvt_dev_info *dev = ib_to_rvt(ibpd->device);
|
||||
struct rvt_ucontext *ucontext = rdma_udata_to_drv_context(
|
||||
udata, struct rvt_ucontext, ibucontext);
|
||||
struct rvt_srq *srq;
|
||||
u32 sz;
|
||||
struct ib_srq *ret;
|
||||
@@ -121,9 +119,7 @@ struct ib_srq *rvt_create_srq(struct ib_pd *ibpd,
|
||||
int err;
|
||||
u32 s = sizeof(struct rvt_rwq) + srq->rq.size * sz;
|
||||
|
||||
srq->ip =
|
||||
rvt_create_mmap_info(dev, s, &ucontext->ibucontext,
|
||||
srq->rq.wq);
|
||||
srq->ip = rvt_create_mmap_info(dev, s, udata, srq->rq.wq);
|
||||
if (!srq->ip) {
|
||||
ret = ERR_PTR(-ENOMEM);
|
||||
goto bail_wq;
|
||||
|
在新工单中引用
屏蔽一个用户