Re: [PATCH 2/5] IB/core: Formalize the creation of immutable per port data within the ib_device object

Jason Gunthorpe
2015-05-12T22:17:55Z

On Tue, May 12, 2015 at 05:02:25PM -0400, ira.weiny wrote:

> > some values don't fill anything, leaving garbage? So, is the array
> > size wrong, or what is going on here?
>
> The port_immutable array is indexed based on the port number. So on an HCA 0
> is invalid. On a switch 1 is invalid.

Again, use start_port/end_port

kzalloc(sizeof(..)*(end_port(xx) + 1));
for (i = start_port(xx); i < end_port(xx); ++i)

Then it is not so tortured..

> > Lets just have the core swap in this generic function if it detects
> > the port_immutable function pointer is null. Then this patch doesn't
> > have to update drivers.
>
> Ignoring based on other comment.

Maybe think about if there is 0 gid/pkey_tbl_len then do the
query_port automatically in the core code, that would purge alot of
boiler plate in the drivers.

Moving the tbl_len's out of query_port is a future clean up.

Jason