Message ID | 20180115151255.30167-3-leon@kernel.org (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
On Mon, 2018-01-15 at 17:12 +0200, Leon Romanovsky wrote: > --- a/include/rdma/ib_verbs.h > +++ b/include/rdma/ib_verbs.h > @@ -1141,6 +1141,12 @@ struct ib_qp_init_attr { > u8 port_num; > struct ib_rwq_ind_table *rwq_ind_tbl; > u32 source_qpn; > + > + /* > + * Name of entity which created this QP, empty string means that > + * it will be taken automatically from task_struct. > + */ > + char comm[TASK_COMM_LEN]; > }; Why is comm[] an array? For queue pairs created from user space, are there any queue pairs that can live longer than the task that created them? If not, does that mean that it is safe to change comm into a const char pointer? Additionally, please use the kernel-doc syntax to document structure members. Thanks, Bart.
On Tue, Jan 16, 2018 at 09:35:42PM +0000, Bart Van Assche wrote: > On Mon, 2018-01-15 at 17:12 +0200, Leon Romanovsky wrote: > > --- a/include/rdma/ib_verbs.h > > +++ b/include/rdma/ib_verbs.h > > @@ -1141,6 +1141,12 @@ struct ib_qp_init_attr { > > u8 port_num; > > struct ib_rwq_ind_table *rwq_ind_tbl; > > u32 source_qpn; > > + > > + /* > > + * Name of entity which created this QP, empty string means that > > + * it will be taken automatically from task_struct. > > + */ > > + char comm[TASK_COMM_LEN]; > > }; > > Why is comm[] an array? For queue pairs created from user space, are there any > queue pairs that can live longer than the task that created them? If not, does > that mean that it is safe to change comm into a const char pointer? As I wrote in cover letter, this code will be refactored and moved to PD once Steve's implementation of CMA resource tracking will be accepted in upstream. > > Additionally, please use the kernel-doc syntax to document structure members. Kernel-doc checker doesn't work with patches and ib_verbs.h full of kernel-doc warning. > > Thanks, > > Bart.
On Wed, 2018-01-17 at 07:59 +0200, Leon Romanovsky wrote: > On Tue, Jan 16, 2018 at 09:35:42PM +0000, Bart Van Assche wrote: > > Additionally, please use the kernel-doc syntax to document structure members. > > Kernel-doc checker doesn't work with patches and ib_verbs.h full of > kernel-doc warning. I can review the kernel-doc syntax for you if the kernel-doc checking script triggers too many warnings. Bart.
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 2b1372da708a..3f1442bd5fdc 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h @@ -301,4 +301,23 @@ struct ib_device *ib_device_get_by_index(u32 ifindex); /* RDMA device netlink */ void nldev_init(void); void nldev_exit(void); + +static inline struct ib_qp *_ib_create_qp(struct ib_device *dev, + struct ib_pd *pd, + struct ib_qp_init_attr *attr, + struct ib_udata *udata) +{ + struct ib_qp *qp; + + qp = dev->create_qp(pd, attr, udata); + if (!IS_ERR(qp)) { + qp->device = dev; + if (attr->qp_type < IB_QPT_MAX) + rdma_restrack_add(&qp->res, + RDMA_RESTRACK_QP, + attr->comm); + } + + return qp; +} #endif /* _CORE_PRIV_H */ diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 271265cd7c1a..41d4f59cac5e 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1141,6 +1141,12 @@ struct ib_qp_init_attr { u8 port_num; struct ib_rwq_ind_table *rwq_ind_tbl; u32 source_qpn; + + /* + * Name of entity which created this QP, empty string means that + * it will be taken automatically from task_struct. + */ + char comm[TASK_COMM_LEN]; }; struct ib_qp_open_attr {