Commit 52e3b42a authored by oulijun's avatar oulijun Committed by Jason Gunthorpe

RDMA/hns: Filter for zero length of sge in hip08 kernel mode

When the length of sge is zero, the driver need to filter it
Signed-off-by: default avatarLijun Ou <oulijun@huawei.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent ace1c541
...@@ -230,26 +230,37 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, ...@@ -230,26 +230,37 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
V2_RC_SEND_WQE_BYTE_4_INLINE_S, 1); V2_RC_SEND_WQE_BYTE_4_INLINE_S, 1);
} else { } else {
if (wr->num_sge <= 2) { if (wr->num_sge <= 2) {
for (i = 0; i < wr->num_sge; i++) for (i = 0; i < wr->num_sge; i++) {
set_data_seg_v2(dseg + i, if (likely(wr->sg_list[i].length)) {
wr->sg_list + i); set_data_seg_v2(dseg,
wr->sg_list + i);
dseg++;
}
}
} else { } else {
roce_set_field(rc_sq_wqe->byte_20, roce_set_field(rc_sq_wqe->byte_20,
V2_RC_SEND_WQE_BYTE_20_MSG_START_SGE_IDX_M, V2_RC_SEND_WQE_BYTE_20_MSG_START_SGE_IDX_M,
V2_RC_SEND_WQE_BYTE_20_MSG_START_SGE_IDX_S, V2_RC_SEND_WQE_BYTE_20_MSG_START_SGE_IDX_S,
sge_ind & (qp->sge.sge_cnt - 1)); sge_ind & (qp->sge.sge_cnt - 1));
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++) {
set_data_seg_v2(dseg + i, if (likely(wr->sg_list[i].length)) {
wr->sg_list + i); set_data_seg_v2(dseg,
wr->sg_list + i);
dseg++;
}
}
dseg = get_send_extend_sge(qp, dseg = get_send_extend_sge(qp,
sge_ind & (qp->sge.sge_cnt - 1)); sge_ind & (qp->sge.sge_cnt - 1));
for (i = 0; i < wr->num_sge - 2; i++) { for (i = 0; i < wr->num_sge - 2; i++) {
set_data_seg_v2(dseg + i, if (likely(wr->sg_list[i + 2].length)) {
wr->sg_list + 2 + i); set_data_seg_v2(dseg,
sge_ind++; wr->sg_list + 2 + i);
dseg++;
sge_ind++;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment