Re: [PATCH rdma-next v3 2/7] RDMA/core: Add helper function to create named QPs

Leon Romanovsky
2018-01-14T15:55:24Z

[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]

On Fri, Jan 12, 2018 at 08:42:43AM +0200, Leon Romanovsky wrote:
> On Thu, Jan 11, 2018 at 07:50:21PM +0000, Bart Van Assche wrote:
> > On Thu, 2018-01-11 at 17:31 +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" a char array instead of a const char pointer or dynamically
> > allocated memory (kstrdup())? Can we get rid of the strncpy() calls in code
> > that fills in this data structure?
>
> Yes, we can, initially, I didn't want to bother with corner cases of
> failure in allocations, but in last version of code it is already easy
> to deal, so I'll replace.

OK, I started to replace per-your request and found myself replacing half of
the code from dynamic allocations to be static initialization for the QP
attributes. I need to do it to avoid dealing with release path too.

And found that it is simply too much for this series, and it can come as future
optimization.

Thanks

> >
> > Thanks,
> >
> > Bart.
> >

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]