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

Doug Ledford
2015-05-04T16:56:06Z

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

On Mon, 2015-05-04 at 16:53 +0000, Hefty, Sean wrote:
> > > > struct ib_port_attr {
> > > > enum ib_port_state state;
> > > > enum ib_mtu max_mtu;
> > > > enum ib_mtu active_mtu;
> > > > int gid_tbl_len;
> > > > + u64 core_cap_flags;
> > > > u32 port_cap_flags;
> > > > u32 max_msg_sz;
> > > > u32 bad_pkey_cntr;
> > > > @@ -1684,6 +1705,7 @@ struct ib_device {
> > > > u32 local_dma_lkey;
> > > > u8 node_type;
> > > > u8 phys_port_cnt;
> > > > + u64 *core_cap_flags; /* Per port core
> > > > capability flags */
> > >
> > > Why are the core_cap_flags duplicated in the struct and in port
> > attributes?
> >
> > Because the per port ib_port_attr struct is not visible to the core
> > code, it must call ib_query_port each time it wants to see it. In order
> > to make the helpers avoid a call, you have to stash the cap_flags into
> > the ib_device struct. In the past, the only thing there was the
> > node_type, and it was per device and not per node. In order to make all
> > of this work and not require calls into the driver all the time, that
> > has to change to a per-port array. Eventually we could get rid of the
> > node_type element once everything is in place.
>
> I understand why they are in struct ib_device, but why are they duplicated in struct ib_port_attr?

Because ib_query_port returns a struct, so this must be an element of
that struct or it can't be returned (without adding a new, single use
driver upcall).

--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG KeyID: 0E572FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]