On 7/4/2018 8:57 AM, Leon Romanovsky wrote: > From: Jason Gunthorpe <jgg@xxxxxxxxxxxx> > > grh_required is intended to be a global setting where all AV's will require > a GRH, not just the sm_lid. Move the special logic to the creation of the > SM AH. > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx> > Signed-off-by: Artemy Kovalyov <artemyko@xxxxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > --- > drivers/infiniband/core/sa_query.c | 28 ++++++++++++++++++---------- > drivers/infiniband/hw/hfi1/verbs.c | 9 --------- > 2 files changed, 18 insertions(+), 19 deletions(-) > > diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c > index 7005afb8a712..0ba09486b09c 100644 > --- a/drivers/infiniband/core/sa_query.c > +++ b/drivers/infiniband/core/sa_query.c > @@ -2328,16 +2328,24 @@ static void update_sm_ah(struct work_struct *work) > rdma_ah_set_dlid(&ah_attr, port_attr.sm_lid); > rdma_ah_set_sl(&ah_attr, port_attr.sm_sl); > rdma_ah_set_port_num(&ah_attr, port->port_num); > - if (port_attr.grh_required) { > - if (ah_attr.type == RDMA_AH_ATTR_TYPE_OPA) { > - rdma_ah_set_make_grd(&ah_attr, true); > - } else { > - rdma_ah_set_ah_flags(&ah_attr, IB_AH_GRH); > - rdma_ah_set_subnet_prefix(&ah_attr, > - cpu_to_be64(port_attr.subnet_prefix)); > - rdma_ah_set_interface_id(&ah_attr, > - cpu_to_be64(IB_SA_WELL_KNOWN_GUID)); > - } > + > + /* > + * sm_lid of 0xFFFF needs special handling so that it can be Would this be better as "OPA sm_lid ..." ? > + * differentiated from a permissve LID of 0xFFFF. We set the typo: permissve -> permissive > + * grh_required flag here so the SA can program the DGID in the > + * address handle appropriately > + */ > + if (ah_attr.type == RDMA_AH_ATTR_TYPE_OPA && > + (port_attr.grh_required || > + port_attr.sm_lid == be16_to_cpu(IB_LID_PERMISSIVE))) > + rdma_ah_set_make_grd(&ah_attr, true); > + > + if (ah_attr.type == RDMA_AH_ATTR_TYPE_IB && port_attr.grh_required) { > + rdma_ah_set_ah_flags(&ah_attr, IB_AH_GRH); > + rdma_ah_set_subnet_prefix(&ah_attr, > + cpu_to_be64(port_attr.subnet_prefix)); > + rdma_ah_set_interface_id(&ah_attr, > + cpu_to_be64(IB_SA_WELL_KNOWN_GUID)); > } > > new_ah->ah = rdma_create_ah(port->agent->qp->pd, &ah_attr); > diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c > index 5cef1224fa9c..2b07a5667ec8 100644 > --- a/drivers/infiniband/hw/hfi1/verbs.c > +++ b/drivers/infiniband/hw/hfi1/verbs.c > @@ -1498,15 +1498,6 @@ static int query_port(struct rvt_dev_info *rdi, u8 port_num, > props->active_mtu = !valid_ib_mtu(ppd->ibmtu) ? props->max_mtu : > mtu_to_enum(ppd->ibmtu, IB_MTU_4096); > > - /* > - * sm_lid of 0xFFFF needs special handling so that it can > - * be differentiated from a permissve LID of 0xFFFF. > - * We set the grh_required flag here so the SA can program > - * the DGID in the address handle appropriately > - */ > - if (props->sm_lid == be16_to_cpu(IB_LID_PERMISSIVE)) > - props->grh_required = true; > - > return 0; > } > > -- 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