diff options
author | Lijun Ou <oulijun@huawei.com> | 2019-02-23 07:01:21 -0500 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-03-25 19:59:55 -0400 |
commit | f04cc17878b47bfa47af2e50f481d7f6eaaf3ca7 (patch) | |
tree | 578a9fffff374723175ae69694adc25934a800ee | |
parent | 401b44804c2ae7ea1121235fa9c9827d12c2a573 (diff) |
RDMA/hns: Only assign the relatived fields of psn if IB_QP_SQ_PSN is set
Only when the IB_QP_SQ_PSN flags of attr_mask is set is it valid to assign
the relatived fields of psn into the qp context when modified qp.
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r-- | drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 83 |
1 files changed, 46 insertions, 37 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 1c54390e1c85..4a9bc75b2279 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c | |||
@@ -3886,13 +3886,6 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp, | |||
3886 | V2_QPC_BYTE_240_RX_ACK_MSN_M, | 3886 | V2_QPC_BYTE_240_RX_ACK_MSN_M, |
3887 | V2_QPC_BYTE_240_RX_ACK_MSN_S, 0); | 3887 | V2_QPC_BYTE_240_RX_ACK_MSN_S, 0); |
3888 | 3888 | ||
3889 | roce_set_field(context->byte_244_rnr_rxack, | ||
3890 | V2_QPC_BYTE_244_RX_ACK_EPSN_M, | ||
3891 | V2_QPC_BYTE_244_RX_ACK_EPSN_S, attr->sq_psn); | ||
3892 | roce_set_field(qpc_mask->byte_244_rnr_rxack, | ||
3893 | V2_QPC_BYTE_244_RX_ACK_EPSN_M, | ||
3894 | V2_QPC_BYTE_244_RX_ACK_EPSN_S, 0); | ||
3895 | |||
3896 | roce_set_field(qpc_mask->byte_248_ack_psn, | 3889 | roce_set_field(qpc_mask->byte_248_ack_psn, |
3897 | V2_QPC_BYTE_248_ACK_LAST_OPTYPE_M, | 3890 | V2_QPC_BYTE_248_ACK_LAST_OPTYPE_M, |
3898 | V2_QPC_BYTE_248_ACK_LAST_OPTYPE_S, 0); | 3891 | V2_QPC_BYTE_248_ACK_LAST_OPTYPE_S, 0); |
@@ -3906,27 +3899,6 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp, | |||
3906 | V2_QPC_BYTE_240_IRRL_TAIL_REAL_M, | 3899 | V2_QPC_BYTE_240_IRRL_TAIL_REAL_M, |
3907 | V2_QPC_BYTE_240_IRRL_TAIL_REAL_S, 0); | 3900 | V2_QPC_BYTE_240_IRRL_TAIL_REAL_S, 0); |
3908 | 3901 | ||
3909 | roce_set_field(context->byte_220_retry_psn_msn, | ||
3910 | V2_QPC_BYTE_220_RETRY_MSG_PSN_M, | ||
3911 | V2_QPC_BYTE_220_RETRY_MSG_PSN_S, attr->sq_psn); | ||
3912 | roce_set_field(qpc_mask->byte_220_retry_psn_msn, | ||
3913 | V2_QPC_BYTE_220_RETRY_MSG_PSN_M, | ||
3914 | V2_QPC_BYTE_220_RETRY_MSG_PSN_S, 0); | ||
3915 | |||
3916 | roce_set_field(context->byte_224_retry_msg, | ||
3917 | V2_QPC_BYTE_224_RETRY_MSG_PSN_M, | ||
3918 | V2_QPC_BYTE_224_RETRY_MSG_PSN_S, attr->sq_psn >> 16); | ||
3919 | roce_set_field(qpc_mask->byte_224_retry_msg, | ||
3920 | V2_QPC_BYTE_224_RETRY_MSG_PSN_M, | ||
3921 | V2_QPC_BYTE_224_RETRY_MSG_PSN_S, 0); | ||
3922 | |||
3923 | roce_set_field(context->byte_224_retry_msg, | ||
3924 | V2_QPC_BYTE_224_RETRY_MSG_FPKT_PSN_M, | ||
3925 | V2_QPC_BYTE_224_RETRY_MSG_FPKT_PSN_S, attr->sq_psn); | ||
3926 | roce_set_field(qpc_mask->byte_224_retry_msg, | ||
3927 | V2_QPC_BYTE_224_RETRY_MSG_FPKT_PSN_M, | ||
3928 | V2_QPC_BYTE_224_RETRY_MSG_FPKT_PSN_S, 0); | ||
3929 | |||
3930 | roce_set_field(qpc_mask->byte_220_retry_psn_msn, | 3902 | roce_set_field(qpc_mask->byte_220_retry_psn_msn, |
3931 | V2_QPC_BYTE_220_RETRY_MSG_MSN_M, | 3903 | V2_QPC_BYTE_220_RETRY_MSG_MSN_M, |
3932 | V2_QPC_BYTE_220_RETRY_MSG_MSN_S, 0); | 3904 | V2_QPC_BYTE_220_RETRY_MSG_MSN_S, 0); |
@@ -3977,17 +3949,8 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp, | |||
3977 | } | 3949 | } |
3978 | } | 3950 | } |
3979 | 3951 | ||
3980 | roce_set_field(context->byte_172_sq_psn, V2_QPC_BYTE_172_SQ_CUR_PSN_M, | ||
3981 | V2_QPC_BYTE_172_SQ_CUR_PSN_S, attr->sq_psn); | ||
3982 | roce_set_field(qpc_mask->byte_172_sq_psn, V2_QPC_BYTE_172_SQ_CUR_PSN_M, | ||
3983 | V2_QPC_BYTE_172_SQ_CUR_PSN_S, 0); | ||
3984 | |||
3985 | roce_set_field(qpc_mask->byte_196_sq_psn, V2_QPC_BYTE_196_IRRL_HEAD_M, | 3952 | roce_set_field(qpc_mask->byte_196_sq_psn, V2_QPC_BYTE_196_IRRL_HEAD_M, |
3986 | V2_QPC_BYTE_196_IRRL_HEAD_S, 0); | 3953 | V2_QPC_BYTE_196_IRRL_HEAD_S, 0); |
3987 | roce_set_field(context->byte_196_sq_psn, V2_QPC_BYTE_196_SQ_MAX_PSN_M, | ||
3988 | V2_QPC_BYTE_196_SQ_MAX_PSN_S, attr->sq_psn); | ||
3989 | roce_set_field(qpc_mask->byte_196_sq_psn, V2_QPC_BYTE_196_SQ_MAX_PSN_M, | ||
3990 | V2_QPC_BYTE_196_SQ_MAX_PSN_S, 0); | ||
3991 | 3954 | ||
3992 | if ((attr_mask & IB_QP_MAX_QP_RD_ATOMIC) && attr->max_rd_atomic) { | 3955 | if ((attr_mask & IB_QP_MAX_QP_RD_ATOMIC) && attr->max_rd_atomic) { |
3993 | roce_set_field(context->byte_208_irrl, V2_QPC_BYTE_208_SR_MAX_M, | 3956 | roce_set_field(context->byte_208_irrl, V2_QPC_BYTE_208_SR_MAX_M, |
@@ -4190,6 +4153,52 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp, | |||
4190 | hr_qp->sl = rdma_ah_get_sl(&attr->ah_attr); | 4153 | hr_qp->sl = rdma_ah_get_sl(&attr->ah_attr); |
4191 | } | 4154 | } |
4192 | 4155 | ||
4156 | if (attr_mask & IB_QP_SQ_PSN) { | ||
4157 | roce_set_field(context->byte_172_sq_psn, | ||
4158 | V2_QPC_BYTE_172_SQ_CUR_PSN_M, | ||
4159 | V2_QPC_BYTE_172_SQ_CUR_PSN_S, attr->sq_psn); | ||
4160 | roce_set_field(qpc_mask->byte_172_sq_psn, | ||
4161 | V2_QPC_BYTE_172_SQ_CUR_PSN_M, | ||
4162 | V2_QPC_BYTE_172_SQ_CUR_PSN_S, 0); | ||
4163 | |||
4164 | roce_set_field(context->byte_196_sq_psn, | ||
4165 | V2_QPC_BYTE_196_SQ_MAX_PSN_M, | ||
4166 | V2_QPC_BYTE_196_SQ_MAX_PSN_S, attr->sq_psn); | ||
4167 | roce_set_field(qpc_mask->byte_196_sq_psn, | ||
4168 | V2_QPC_BYTE_196_SQ_MAX_PSN_M, | ||
4169 | V2_QPC_BYTE_196_SQ_MAX_PSN_S, 0); | ||
4170 | |||
4171 | roce_set_field(context->byte_220_retry_psn_msn, | ||
4172 | V2_QPC_BYTE_220_RETRY_MSG_PSN_M, | ||
4173 | V2_QPC_BYTE_220_RETRY_MSG_PSN_S, attr->sq_psn); | ||
4174 | roce_set_field(qpc_mask->byte_220_retry_psn_msn, | ||
4175 | V2_QPC_BYTE_220_RETRY_MSG_PSN_M, | ||
4176 | V2_QPC_BYTE_220_RETRY_MSG_PSN_S, 0); | ||
4177 | |||
4178 | roce_set_field(context->byte_224_retry_msg, | ||
4179 | V2_QPC_BYTE_224_RETRY_MSG_PSN_M, | ||
4180 | V2_QPC_BYTE_224_RETRY_MSG_PSN_S, | ||
4181 | attr->sq_psn >> 16); | ||
4182 | roce_set_field(qpc_mask->byte_224_retry_msg, | ||
4183 | V2_QPC_BYTE_224_RETRY_MSG_PSN_M, | ||
4184 | V2_QPC_BYTE_224_RETRY_MSG_PSN_S, 0); | ||
4185 | |||
4186 | roce_set_field(context->byte_224_retry_msg, | ||
4187 | V2_QPC_BYTE_224_RETRY_MSG_FPKT_PSN_M, | ||
4188 | V2_QPC_BYTE_224_RETRY_MSG_FPKT_PSN_S, | ||
4189 | attr->sq_psn); | ||
4190 | roce_set_field(qpc_mask->byte_224_retry_msg, | ||
4191 | V2_QPC_BYTE_224_RETRY_MSG_FPKT_PSN_M, | ||
4192 | V2_QPC_BYTE_224_RETRY_MSG_FPKT_PSN_S, 0); | ||
4193 | |||
4194 | roce_set_field(context->byte_244_rnr_rxack, | ||
4195 | V2_QPC_BYTE_244_RX_ACK_EPSN_M, | ||
4196 | V2_QPC_BYTE_244_RX_ACK_EPSN_S, attr->sq_psn); | ||
4197 | roce_set_field(qpc_mask->byte_244_rnr_rxack, | ||
4198 | V2_QPC_BYTE_244_RX_ACK_EPSN_M, | ||
4199 | V2_QPC_BYTE_244_RX_ACK_EPSN_S, 0); | ||
4200 | } | ||
4201 | |||
4193 | if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) | 4202 | if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) |
4194 | set_access_flags(hr_qp, context, qpc_mask, attr, attr_mask); | 4203 | set_access_flags(hr_qp, context, qpc_mask, attr, attr_mask); |
4195 | 4204 | ||