Message ID | 588779743ae374e1965d5c55ce93dd69e1a76ba8.1525788594.git.swise@opengridcomputing.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
> -----Original Message----- > From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma- > owner@vger.kernel.org] On Behalf Of Steve Wise > Sent: Tuesday, May 08, 2018 9:09 AM > To: Jason Gunthorpe <jgg@mellanox.com>; dledford@redhat.com > Cc: leon@kernel.org; linux-rdma@vger.kernel.org > Subject: [PATCH rdma-next 2/5] RDMA/CMA: add rdma_iw_cm_id() and > rdma_res_to_id() helpers > > Add a helper function for iwarp drivers to be able to map an rdma_cm_id to an > iw_cm_id. This is useful for dumping driver specific NLDEV/RESTRACK > connection state. > > Add a helper to return the rdma_cm_id pointer from the rdma_restack pointer. > This is needed for rdma drivers to map a res entry back to the public rdma_cm_id > struct. > > Signed-off-by: Steve Wise <swise@opengridcomputing.com> > --- > drivers/infiniband/core/cma.c | 20 ++++++++++++++++++++ > include/rdma/rdma_cm.h | 12 ++++++++++++ > 2 files changed, 32 insertions(+) > > diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index > 8c85b24..15e78b00 100644 > --- a/drivers/infiniband/core/cma.c > +++ b/drivers/infiniband/core/cma.c > @@ -146,6 +146,26 @@ const void *rdma_consumer_reject_data(struct > rdma_cm_id *id, } EXPORT_SYMBOL(rdma_consumer_reject_data); > > +struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *id) { > + struct rdma_id_private *id_priv; > + > + id_priv = container_of(id, struct rdma_id_private, id); > + if (id->device->node_type == RDMA_NODE_RNIC) > + return id_priv->cm_id.iw; > + return NULL; > +} > +EXPORT_SYMBOL(rdma_iw_cm_id); > + > +struct rdma_cm_id *rdma_res_to_id(struct rdma_restrack_entry *res) { > + struct rdma_id_private *id_priv = > + container_of(res, struct rdma_id_private, res); > + > + return &id_priv->id; > +} > +EXPORT_SYMBOL(rdma_res_to_id); > + > static void cma_add_one(struct ib_device *device); static void > cma_remove_one(struct ib_device *device, void *client_data); > > diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index > 6909347..e36d971 100644 > --- a/include/rdma/rdma_cm.h > +++ b/include/rdma/rdma_cm.h > @@ -420,4 +420,16 @@ const void *rdma_consumer_reject_data(struct > rdma_cm_id *id, void rdma_read_gids(struct rdma_cm_id *cm_id, union ib_gid > *sgid, > union ib_gid *dgid); > > +/** > + * rdma_iw_cm_id() - return the iw_cm_id pointer for this cm_id. > + * @id: Communication Identifier > + */ > +struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *cm_id); > + > +/** > + * rdma_res_to_id() - return the rdma_cm_id pointer for this restrack. > + * @res: rdma resource tracking entry pointer */ struct rdma_cm_id > +*rdma_res_to_id(struct rdma_restrack_entry *res); > + Lately kdoc documentation is usually along with definitions unless it is static inline function in header file. Can you please move it to C file for this new additions? -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 5/8/2018 1:53 PM, Parav Pandit wrote: >> -----Original Message----- >> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma- >> owner@vger.kernel.org] On Behalf Of Steve Wise >> Sent: Tuesday, May 08, 2018 9:09 AM >> To: Jason Gunthorpe <jgg@mellanox.com>; dledford@redhat.com >> Cc: leon@kernel.org; linux-rdma@vger.kernel.org >> Subject: [PATCH rdma-next 2/5] RDMA/CMA: add rdma_iw_cm_id() and >> rdma_res_to_id() helpers >> >> Add a helper function for iwarp drivers to be able to map an rdma_cm_id to an >> iw_cm_id. This is useful for dumping driver specific NLDEV/RESTRACK >> connection state. >> >> Add a helper to return the rdma_cm_id pointer from the rdma_restack pointer. >> This is needed for rdma drivers to map a res entry back to the public rdma_cm_id >> struct. >> >> Signed-off-by: Steve Wise <swise@opengridcomputing.com> >> --- >> drivers/infiniband/core/cma.c | 20 ++++++++++++++++++++ >> include/rdma/rdma_cm.h | 12 ++++++++++++ >> 2 files changed, 32 insertions(+) >> >> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index >> 8c85b24..15e78b00 100644 >> --- a/drivers/infiniband/core/cma.c >> +++ b/drivers/infiniband/core/cma.c >> @@ -146,6 +146,26 @@ const void *rdma_consumer_reject_data(struct >> rdma_cm_id *id, } EXPORT_SYMBOL(rdma_consumer_reject_data); >> >> +struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *id) { >> + struct rdma_id_private *id_priv; >> + >> + id_priv = container_of(id, struct rdma_id_private, id); >> + if (id->device->node_type == RDMA_NODE_RNIC) >> + return id_priv->cm_id.iw; >> + return NULL; >> +} >> +EXPORT_SYMBOL(rdma_iw_cm_id); >> + >> +struct rdma_cm_id *rdma_res_to_id(struct rdma_restrack_entry *res) { >> + struct rdma_id_private *id_priv = >> + container_of(res, struct rdma_id_private, res); >> + >> + return &id_priv->id; >> +} >> +EXPORT_SYMBOL(rdma_res_to_id); >> + >> static void cma_add_one(struct ib_device *device); static void >> cma_remove_one(struct ib_device *device, void *client_data); >> >> diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index >> 6909347..e36d971 100644 >> --- a/include/rdma/rdma_cm.h >> +++ b/include/rdma/rdma_cm.h >> @@ -420,4 +420,16 @@ const void *rdma_consumer_reject_data(struct >> rdma_cm_id *id, void rdma_read_gids(struct rdma_cm_id *cm_id, union ib_gid >> *sgid, >> union ib_gid *dgid); >> >> +/** >> + * rdma_iw_cm_id() - return the iw_cm_id pointer for this cm_id. >> + * @id: Communication Identifier >> + */ >> +struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *cm_id); >> + >> +/** >> + * rdma_res_to_id() - return the rdma_cm_id pointer for this restrack. >> + * @res: rdma resource tracking entry pointer */ struct rdma_cm_id >> +*rdma_res_to_id(struct rdma_restrack_entry *res); >> + > Lately kdoc documentation is usually along with definitions unless it is static inline function in header file. > Can you please move it to C file for this new additions? So move the function comments from the .h to the .c? Is this practice documented somewhere? I don't see mention of it in Documentation/doc-guide/kernel-doc.rst. All the functions in include/rdma/rdma_cm.h have the function comments in the .h, so moving these new ones would break the format of the rdma_cm module as it stands. Steve. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> -----Original Message----- > From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma- > owner@vger.kernel.org] On Behalf Of Steve Wise > Sent: Wednesday, May 09, 2018 10:11 AM > To: Parav Pandit <parav@mellanox.com>; Jason Gunthorpe > <jgg@mellanox.com>; dledford@redhat.com > Cc: leon@kernel.org; linux-rdma@vger.kernel.org > Subject: Re: [PATCH rdma-next 2/5] RDMA/CMA: add rdma_iw_cm_id() and > rdma_res_to_id() helpers > > > > On 5/8/2018 1:53 PM, Parav Pandit wrote: > >> -----Original Message----- > >> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma- > >> owner@vger.kernel.org] On Behalf Of Steve Wise > >> Sent: Tuesday, May 08, 2018 9:09 AM > >> To: Jason Gunthorpe <jgg@mellanox.com>; dledford@redhat.com > >> Cc: leon@kernel.org; linux-rdma@vger.kernel.org > >> Subject: [PATCH rdma-next 2/5] RDMA/CMA: add rdma_iw_cm_id() and > >> rdma_res_to_id() helpers > >> > >> Add a helper function for iwarp drivers to be able to map an > >> rdma_cm_id to an iw_cm_id. This is useful for dumping driver > >> specific NLDEV/RESTRACK connection state. > >> > >> Add a helper to return the rdma_cm_id pointer from the rdma_restack > pointer. > >> This is needed for rdma drivers to map a res entry back to the public > >> rdma_cm_id struct. > >> > >> Signed-off-by: Steve Wise <swise@opengridcomputing.com> > >> --- > >> drivers/infiniband/core/cma.c | 20 ++++++++++++++++++++ > >> include/rdma/rdma_cm.h | 12 ++++++++++++ > >> 2 files changed, 32 insertions(+) > >> > >> diff --git a/drivers/infiniband/core/cma.c > >> b/drivers/infiniband/core/cma.c index > >> 8c85b24..15e78b00 100644 > >> --- a/drivers/infiniband/core/cma.c > >> +++ b/drivers/infiniband/core/cma.c > >> @@ -146,6 +146,26 @@ const void *rdma_consumer_reject_data(struct > >> rdma_cm_id *id, } EXPORT_SYMBOL(rdma_consumer_reject_data); > >> > >> +struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *id) { > >> + struct rdma_id_private *id_priv; > >> + > >> + id_priv = container_of(id, struct rdma_id_private, id); > >> + if (id->device->node_type == RDMA_NODE_RNIC) > >> + return id_priv->cm_id.iw; > >> + return NULL; > >> +} > >> +EXPORT_SYMBOL(rdma_iw_cm_id); > >> + > >> +struct rdma_cm_id *rdma_res_to_id(struct rdma_restrack_entry *res) { > >> + struct rdma_id_private *id_priv = > >> + container_of(res, struct rdma_id_private, res); > >> + > >> + return &id_priv->id; > >> +} > >> +EXPORT_SYMBOL(rdma_res_to_id); > >> + > >> static void cma_add_one(struct ib_device *device); static void > >> cma_remove_one(struct ib_device *device, void *client_data); > >> > >> diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index > >> 6909347..e36d971 100644 > >> --- a/include/rdma/rdma_cm.h > >> +++ b/include/rdma/rdma_cm.h > >> @@ -420,4 +420,16 @@ const void *rdma_consumer_reject_data(struct > >> rdma_cm_id *id, void rdma_read_gids(struct rdma_cm_id *cm_id, union > >> ib_gid *sgid, > >> union ib_gid *dgid); > >> > >> +/** > >> + * rdma_iw_cm_id() - return the iw_cm_id pointer for this cm_id. > >> + * @id: Communication Identifier > >> + */ > >> +struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *cm_id); > >> + > >> +/** > >> + * rdma_res_to_id() - return the rdma_cm_id pointer for this restrack. > >> + * @res: rdma resource tracking entry pointer */ struct rdma_cm_id > >> +*rdma_res_to_id(struct rdma_restrack_entry *res); > >> + > > Lately kdoc documentation is usually along with definitions unless it is static > inline function in header file. > > Can you please move it to C file for this new additions? > > So move the function comments from the .h to the .c? > Yes. > Is this practice documented somewhere? I don't see mention of it in > Documentation/doc-guide/kernel-doc.rst. All the functions in Kernel-doc.rst allows both. However lot of other kernel follows C file convention, to my knowledge netdev stack. > include/rdma/rdma_cm.h have the function comments in the .h, so moving > these new ones would break the format of the rdma_cm module as it stands. > It ok to break in spirit to follow rest of the kernel style for new function addition. Wherever I am touching function signatures, I am moving them to c file.
On Wed, May 09, 2018 at 10:58:54AM -0600, Parav Pandit wrote: > > So move the function comments from the .h to the .c? > > Yes. > > > Is this practice documented somewhere? I don't see mention of it in > > Documentation/doc-guide/kernel-doc.rst. All the functions in > Kernel-doc.rst allows both. > However lot of other kernel follows C file convention, to my knowledge netdev stack. > > > include/rdma/rdma_cm.h have the function comments in the .h, so moving > > these new ones would break the format of the rdma_cm module as it stands. > > > It ok to break in spirit to follow rest of the kernel style for new function addition. > Wherever I am touching function signatures, I am moving them to c file. We've been trying to clean up the RDMA stuff to consistently use only the .c file. We have a weird mix and match today that doesn't make any sense. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 8c85b24..15e78b00 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -146,6 +146,26 @@ const void *rdma_consumer_reject_data(struct rdma_cm_id *id, } EXPORT_SYMBOL(rdma_consumer_reject_data); +struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *id) +{ + struct rdma_id_private *id_priv; + + id_priv = container_of(id, struct rdma_id_private, id); + if (id->device->node_type == RDMA_NODE_RNIC) + return id_priv->cm_id.iw; + return NULL; +} +EXPORT_SYMBOL(rdma_iw_cm_id); + +struct rdma_cm_id *rdma_res_to_id(struct rdma_restrack_entry *res) +{ + struct rdma_id_private *id_priv = + container_of(res, struct rdma_id_private, res); + + return &id_priv->id; +} +EXPORT_SYMBOL(rdma_res_to_id); + static void cma_add_one(struct ib_device *device); static void cma_remove_one(struct ib_device *device, void *client_data); diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index 6909347..e36d971 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h @@ -420,4 +420,16 @@ const void *rdma_consumer_reject_data(struct rdma_cm_id *id, void rdma_read_gids(struct rdma_cm_id *cm_id, union ib_gid *sgid, union ib_gid *dgid); +/** + * rdma_iw_cm_id() - return the iw_cm_id pointer for this cm_id. + * @id: Communication Identifier + */ +struct iw_cm_id *rdma_iw_cm_id(struct rdma_cm_id *cm_id); + +/** + * rdma_res_to_id() - return the rdma_cm_id pointer for this restrack. + * @res: rdma resource tracking entry pointer + */ +struct rdma_cm_id *rdma_res_to_id(struct rdma_restrack_entry *res); + #endif /* RDMA_CM_H */
Add a helper function for iwarp drivers to be able to map an rdma_cm_id to an iw_cm_id. This is useful for dumping driver specific NLDEV/RESTRACK connection state. Add a helper to return the rdma_cm_id pointer from the rdma_restack pointer. This is needed for rdma drivers to map a res entry back to the public rdma_cm_id struct. Signed-off-by: Steve Wise <swise@opengridcomputing.com> --- drivers/infiniband/core/cma.c | 20 ++++++++++++++++++++ include/rdma/rdma_cm.h | 12 ++++++++++++ 2 files changed, 32 insertions(+)