]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
IB/mlx4: Fix wrong calculation of link layer
authorMoni Shoua <monis@mellanox.co.il>
Wed, 12 Mar 2014 16:00:06 +0000 (18:00 +0200)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:45:19 +0000 (14:45 -0700)
Use ah->port_num to find link layer before value was set to it.

Signed-off-by: Moni Shoua <monis@mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/infiniband/hw/mlx4/ah.c

index 3c5dd7abd753f67a1f6db90b647f4f5ec8b38f18..5e588698a885ab580150f6fd74af941ed515ced6 100644 (file)
@@ -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;