From: Moni Shoua Date: Wed, 12 Mar 2014 16:00:06 +0000 (+0200) Subject: IB/mlx4: Fix wrong calculation of link layer X-Git-Tag: v4.1.12-92~293^2~1^2~41 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8b5f90d6a02c544ea9e9447190f6bb00968df3b5;p=users%2Fjedix%2Flinux-maple.git IB/mlx4: Fix wrong calculation of link layer Use ah->port_num to find link layer before value was set to it. Signed-off-by: Moni Shoua (Ported from Mellanox OFED 2.4) Signed-off-by: Mukesh Kacker --- diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c index 3c5dd7abd753..5e588698a885 100644 --- a/drivers/infiniband/hw/mlx4/ah.c +++ b/drivers/infiniband/hw/mlx4/ah.c @@ -148,12 +148,12 @@ int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr) enum rdma_link_layer ll; memset(ah_attr, 0, sizeof *ah_attr); + ah_attr->port_num = be32_to_cpu(ah->av.ib.port_pd) >> 24; ll = rdma_port_get_link_layer(ibah->device, ah_attr->port_num); if (ll == IB_LINK_LAYER_ETHERNET) ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 29; else ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28; - ah_attr->port_num = be32_to_cpu(ah->av.ib.port_pd) >> 24; ah_attr->dlid = ll == IB_LINK_LAYER_INFINIBAND ? be16_to_cpu(ah->av.ib.dlid) : 0; if (ah->av.ib.stat_rate) ah_attr->static_rate = ah->av.ib.stat_rate - MLX4_STAT_RATE_OFFSET;