Re: [RFC PATCH 3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit mask

Jason Gunthorpe
2015-05-04T18:46:10Z

On Mon, May 04, 2015 at 02:14:57AM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:

> Use the new Core Capability bits instead of inferring this support from the
> protocol.

Does this really need to be a seperate patch? At least for the
core_cap_flags parts it makes no sense to change those lines twice

> - props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
> + props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;

Hurm,

Maybe add some macros to help this out, document the standard that
the port implements:

#define RDMA_CORE_PORT_IB_IBA_v1_2 (RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD)
#define RDMA_CORE_PORT_ROCEE_IBA_v1_2_A15 ..
#define RDMA_CORE_PORT_ROCEE_IBA_v1_3_A16 ..

> static inline int cap_ib_mad(struct ib_device *device, u8 port_num)
> {
> - return rdma_ib_or_iboe(device, port_num);
> + return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);

'bool' is OK in the kernel, just use that instead of !! - in fact all of
thse cap returns should return bool. Michael should fix that in his
series too.

Jason