Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

ira.weiny
2015-05-04T22:32:35Z

On Mon, May 04, 2015 at 12:36:57PM -0600, Jason Gunthorpe wrote:
> On Mon, May 04, 2015 at 02:14:55AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> > From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> >
> > Add Core capability flags to each port attribute and read those into ib_device
> > upon registration for each port.
>
> +1 on adding it to read_port_table_lengths
>
> But this whole thing is starting to get goofy,
>

<quote>
> 3rd add gets the work
> to fix it up I guess.
</quote>

I don't understand this comment?

>
> Pull pkey_tbl_len, gid_tbl_len and your new thing into a single struct
> and allocate an array of them.
>
> Actually, why not just allocate an array of ib_port_attrs and fill
> that? Then you can use it for the mad size too.

That was debated before and I was hoping to leave that for another day.

It does make some sense to roll it in here.

>
> Not in your patch, but why does read_port_table_lengths use a kmalloc
> for what should be a stack allocation? Yuk.

I don't know. I almost submitted a separate patch for that. I will clean it
up when I combine the functions.

I also don't like the way the arrays in read_port_table_lengths are handled.
This requires a start_port call when comparing bits. It is easier to just make
the array 1 based with index 0 valid only for switches.

This is part of the reason there is a separate function and array.

Ira

>
> Jason