Commit 52c5e9e7 authored by Lang Cheng's avatar Lang Cheng Committed by Jason Gunthorpe

RDMA/hns: Initialize all fields of doorbells to zero

Prevent uninitialized fields when new fields are added, and make code look
simpler.

Link: https://lore.kernel.org/r/1582162471-50361-1-git-send-email-liweihang@huawei.comSigned-off-by: default avatarLang Cheng <chenglang@huawei.com>
Signed-off-by: default avatarWeihang Li <liweihang@huawei.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 8d8d2b76
...@@ -69,7 +69,7 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp, ...@@ -69,7 +69,7 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp,
struct hns_roce_wqe_data_seg *dseg = NULL; struct hns_roce_wqe_data_seg *dseg = NULL;
struct hns_roce_qp *qp = to_hr_qp(ibqp); struct hns_roce_qp *qp = to_hr_qp(ibqp);
struct device *dev = &hr_dev->pdev->dev; struct device *dev = &hr_dev->pdev->dev;
struct hns_roce_sq_db sq_db; struct hns_roce_sq_db sq_db = {};
int ps_opcode = 0, i = 0; int ps_opcode = 0, i = 0;
unsigned long flags = 0; unsigned long flags = 0;
void *wqe = NULL; void *wqe = NULL;
...@@ -318,8 +318,6 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp, ...@@ -318,8 +318,6 @@ static int hns_roce_v1_post_send(struct ib_qp *ibqp,
/* Memory barrier */ /* Memory barrier */
wmb(); wmb();
sq_db.u32_4 = 0;
sq_db.u32_8 = 0;
roce_set_field(sq_db.u32_4, SQ_DOORBELL_U32_4_SQ_HEAD_M, roce_set_field(sq_db.u32_4, SQ_DOORBELL_U32_4_SQ_HEAD_M,
SQ_DOORBELL_U32_4_SQ_HEAD_S, SQ_DOORBELL_U32_4_SQ_HEAD_S,
(qp->sq.head & ((qp->sq.wqe_cnt << 1) - 1))); (qp->sq.head & ((qp->sq.wqe_cnt << 1) - 1)));
...@@ -351,7 +349,7 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp, ...@@ -351,7 +349,7 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp,
struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); struct hns_roce_qp *hr_qp = to_hr_qp(ibqp);
struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
struct device *dev = &hr_dev->pdev->dev; struct device *dev = &hr_dev->pdev->dev;
struct hns_roce_rq_db rq_db; struct hns_roce_rq_db rq_db = {};
__le32 doorbell[2] = {0}; __le32 doorbell[2] = {0};
unsigned long flags = 0; unsigned long flags = 0;
unsigned int wqe_idx; unsigned int wqe_idx;
...@@ -418,9 +416,6 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp, ...@@ -418,9 +416,6 @@ static int hns_roce_v1_post_recv(struct ib_qp *ibqp,
ROCEE_QP1C_CFG3_0_REG + ROCEE_QP1C_CFG3_0_REG +
QP1C_CFGN_OFFSET * hr_qp->phy_port, reg_val); QP1C_CFGN_OFFSET * hr_qp->phy_port, reg_val);
} else { } else {
rq_db.u32_4 = 0;
rq_db.u32_8 = 0;
roce_set_field(rq_db.u32_4, RQ_DOORBELL_U32_4_RQ_HEAD_M, roce_set_field(rq_db.u32_4, RQ_DOORBELL_U32_4_RQ_HEAD_M,
RQ_DOORBELL_U32_4_RQ_HEAD_S, RQ_DOORBELL_U32_4_RQ_HEAD_S,
hr_qp->rq.head); hr_qp->rq.head);
......
...@@ -255,7 +255,7 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, ...@@ -255,7 +255,7 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
struct hns_roce_qp *qp = to_hr_qp(ibqp); struct hns_roce_qp *qp = to_hr_qp(ibqp);
struct hns_roce_wqe_frmr_seg *fseg; struct hns_roce_wqe_frmr_seg *fseg;
struct device *dev = hr_dev->dev; struct device *dev = hr_dev->dev;
struct hns_roce_v2_db sq_db; struct hns_roce_v2_db sq_db = {};
unsigned int owner_bit; unsigned int owner_bit;
unsigned int sge_idx; unsigned int sge_idx;
unsigned int wqe_idx; unsigned int wqe_idx;
...@@ -583,9 +583,6 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, ...@@ -583,9 +583,6 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp,
/* Memory barrier */ /* Memory barrier */
wmb(); wmb();
sq_db.byte_4 = 0;
sq_db.parameter = 0;
roce_set_field(sq_db.byte_4, V2_DB_BYTE_4_TAG_M, roce_set_field(sq_db.byte_4, V2_DB_BYTE_4_TAG_M,
V2_DB_BYTE_4_TAG_S, qp->doorbell_qpn); V2_DB_BYTE_4_TAG_S, qp->doorbell_qpn);
roce_set_field(sq_db.byte_4, V2_DB_BYTE_4_CMD_M, roce_set_field(sq_db.byte_4, V2_DB_BYTE_4_CMD_M,
......
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