Re: [PATCH RFC] IB: Add rdma_cap_ib_switch helper and use where appropriate

Jason Gunthorpe
2015-06-18T20:25:19Z

On Thu, Jun 18, 2015 at 04:18:27PM -0400, Hal Rosenstock wrote:

> In addition, an ib_switch helper was added to ib_verbs.h
> based on the is_switch device bit rather than node_type
> (although those should be consistent).

This is basically fine, but it would be nicer to change the port
handling stuff over to port number code (ie end_port/start_port and
maybe some new stuff) than to keep the existing open coded versions.

> @@ -3299,7 +3300,7 @@ static void ib_mad_init_device(struct ib_device *device)
> {
> int start, end, i;
>
> - if (device->node_type == RDMA_NODE_IB_SWITCH) {
> + if (rdma_cap_ib_switch(device)) {
> start = 0;
> end = 0;
> } else {

This sort of stuff especially.

Ira had patch that made some functions related to this public, not
sure if it is applied yet..

Jason