On Fri, Dec 16, 2016 at 10:11 PM, ira.weiny <ira.weiny@xxxxxxxxx> wrote: > > On Sun, Nov 27, 2016 at 04:51:32PM +0200, Leon Romanovsky wrote: > > From: Or Gerlitz <ogerlitz@xxxxxxxxxxxx> > > > > Add qp_type_cap port attribute which is a bit field representation > > of the ib_qp_type enum. This will allow applications to query what QP > > types are supported by an IB device instance on a specific port. > > > > The qp_type_cap port attribute is set by the core according to the > > protocol supported for the device port. This holds for all the > > providers with the exception of two RoCE drivers that don't implement > > UD and UC. To handle that, they (hns and qedr) are patched to remove > > these QPs from what's the core has set for them as supported. > > > > Signed-off-by: Or Gerlitz <ogerlitz@xxxxxxxxxxxx> > > Reviewed-by: Matan Barak <matanb@xxxxxxxxxxxx> > > Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx> > > --- > > drivers/infiniband/core/device.c | 28 ++++++++++++++++++++++++++++ > > drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++ > > drivers/infiniband/hw/qedr/verbs.c | 2 ++ > > include/rdma/ib_verbs.h | 1 + > > 4 files changed, 34 insertions(+) > > > > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > > index 760ef60..f7abde2 100644 > > --- a/drivers/infiniband/core/device.c > > +++ b/drivers/infiniband/core/device.c > > @@ -646,6 +646,31 @@ void ib_dispatch_event(struct ib_event *event) > > } > > EXPORT_SYMBOL(ib_dispatch_event); > > > > +static void get_port_qp_types(const struct ib_device *device, u8 port_num, > > + struct ib_port_attr *port_attr) > > +{ > > + if (rdma_cap_ib_smi(device, port_num)) > > + port_attr->qp_type_cap |= BIT(IB_QPT_SMI); > > + > > + if (rdma_cap_ib_cm(device, port_num)) > > + port_attr->qp_type_cap |= BIT(IB_QPT_GSI); > > This is not accurate. The IB CM is not the same as having QP1 supported. > Ira, Looking on the kernel mad module code, I see they (your code..) 1st check that rdma_cap_ib_mad(device, port) is true, and next just blindly attempt to open GSI QP (call create_mad_qp([...], IB_QPT_GSI) on the device/port. I guess this is correct by elimination only if the smi cap is false... b/c if the mad cap is set and the smi cap is true, it's possible that GSI isn't supported for the port under some proprietary protocol. So what is per your design a clear robust way to determine if GSI is supported on the device/port? Or. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html