RDMA/hns: Bugfix for querying qkey
authorLijun Ou <oulijun@huawei.com>
Fri, 8 May 2020 09:45:51 +0000 (17:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:51 +0000 (17:48 +0200)
[ Upstream commit 349be276509455ac2f19fa4051ed773082c6a27e ]

The qkey queried through the query ud qp verb is a fixed value and it
should be read from qp context.

Fixes: 926a01dc000d ("RDMA/hns: Add QP operations support for hip08 SoC")
Link: https://lore.kernel.org/r/1588931159-56875-2-git-send-email-liweihang@huawei.com
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c

index c3316672b70e645dcc2aa2e224387b1c3726e9f6..96ff610bbdc4ef6dcc18133ec68215b9a004ddbd 100644 (file)
@@ -4639,7 +4639,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
        qp_attr->path_mig_state = IB_MIG_ARMED;
        qp_attr->ah_attr.type   = RDMA_AH_ATTR_TYPE_ROCE;
        if (hr_qp->ibqp.qp_type == IB_QPT_UD)
-               qp_attr->qkey = V2_QKEY_VAL;
+               qp_attr->qkey = le32_to_cpu(context.qkey_xrcd);
 
        qp_attr->rq_psn = roce_get_field(context.byte_108_rx_reqepsn,
                                         V2_QPC_BYTE_108_RX_REQ_EPSN_M,