Skip to content

Commit 0aabf99

Browse files
Weihang Ligregkh
authored andcommitted
RDMA/hns: Fix configuration of ack_req_freq in QPC
[ Upstream commit fbed9d2 ] The hardware will add AckReq flag in BTH header according to the value of ack_req_freq to request ACK from responder for the packets with this flag. It should be greater than or equal to lp_pktn_ini instead of using a fixed value. Fixes: 7b9bd73 ("RDMA/hns: Fix wrong assignment of lp_pktn_ini in QPC") Link: https://lore.kernel.org/r/1600509802-44382-8-git-send-email-liweihang@huawei.com Signed-off-by: Weihang Li <liweihang@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 09ed024 commit 0aabf99

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

drivers/infiniband/hw/hns/hns_roce_hw_v2.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3641,9 +3641,6 @@ static void modify_qp_reset_to_init(struct ib_qp *ibqp,
36413641
V2_QPC_BYTE_76_SRQ_EN_S, 1);
36423642
}
36433643

3644-
roce_set_field(context->byte_172_sq_psn, V2_QPC_BYTE_172_ACK_REQ_FREQ_M,
3645-
V2_QPC_BYTE_172_ACK_REQ_FREQ_S, 4);
3646-
36473644
roce_set_bit(context->byte_172_sq_psn, V2_QPC_BYTE_172_FRE_S, 1);
36483645

36493646
hr_qp->access_flags = attr->qp_access_flags;
@@ -3954,6 +3951,7 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
39543951
dma_addr_t trrl_ba;
39553952
dma_addr_t irrl_ba;
39563953
enum ib_mtu mtu;
3954+
u8 lp_pktn_ini;
39573955
u8 port_num;
39583956
u64 *mtts;
39593957
u8 *dmac;
@@ -4061,13 +4059,21 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
40614059
}
40624060

40634061
#define MAX_LP_MSG_LEN 65536
4064-
/* MTU*(2^LP_PKTN_INI) shouldn't be bigger than 64kb */
4062+
/* MTU * (2 ^ LP_PKTN_INI) shouldn't be bigger than 64KB */
4063+
lp_pktn_ini = ilog2(MAX_LP_MSG_LEN / ib_mtu_enum_to_int(mtu));
4064+
40654065
roce_set_field(context->byte_56_dqpn_err, V2_QPC_BYTE_56_LP_PKTN_INI_M,
4066-
V2_QPC_BYTE_56_LP_PKTN_INI_S,
4067-
ilog2(MAX_LP_MSG_LEN / ib_mtu_enum_to_int(mtu)));
4066+
V2_QPC_BYTE_56_LP_PKTN_INI_S, lp_pktn_ini);
40684067
roce_set_field(qpc_mask->byte_56_dqpn_err, V2_QPC_BYTE_56_LP_PKTN_INI_M,
40694068
V2_QPC_BYTE_56_LP_PKTN_INI_S, 0);
40704069

4070+
/* ACK_REQ_FREQ should be larger than or equal to LP_PKTN_INI */
4071+
roce_set_field(context->byte_172_sq_psn, V2_QPC_BYTE_172_ACK_REQ_FREQ_M,
4072+
V2_QPC_BYTE_172_ACK_REQ_FREQ_S, lp_pktn_ini);
4073+
roce_set_field(qpc_mask->byte_172_sq_psn,
4074+
V2_QPC_BYTE_172_ACK_REQ_FREQ_M,
4075+
V2_QPC_BYTE_172_ACK_REQ_FREQ_S, 0);
4076+
40714077
roce_set_bit(qpc_mask->byte_108_rx_reqepsn,
40724078
V2_QPC_BYTE_108_RX_REQ_PSN_ERR_S, 0);
40734079
roce_set_field(qpc_mask->byte_96_rx_reqmsn, V2_QPC_BYTE_96_RX_REQ_MSN_M,

0 commit comments

Comments
 (0)