From: Ariel Elior <ariel.elior@xxxxxxxxxxx> This patch adds the iWARP specific doorbells to the doorbell recovery mechanism Signed-off-by: Ariel Elior <ariel.elior@xxxxxxxxxxx> Signed-off-by: Michal Kalderon <michal.kalderon@xxxxxxxxxxx> --- drivers/infiniband/hw/qedr/qedr.h | 12 +++++---- drivers/infiniband/hw/qedr/verbs.c | 53 +++++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/hw/qedr/qedr.h b/drivers/infiniband/hw/qedr/qedr.h index 5cff124aeed4..16166638c749 100644 --- a/drivers/infiniband/hw/qedr/qedr.h +++ b/drivers/infiniband/hw/qedr/qedr.h @@ -243,6 +243,11 @@ struct qedr_ucontext { struct mutex mm_list_lock; }; +union db_prod32 { + struct rdma_pwm_val16_data data; + u32 raw; +}; + union db_prod64 { struct rdma_pwm_val32_data data; u64 raw; @@ -274,6 +279,8 @@ struct qedr_userq { struct ib_umem *db_rec_umem; u64 db_rec_addr; struct qedr_user_db_rec *db_rec_virt; + void __iomem *db_rec_db2_addr; + union db_prod32 db_rec_db2_data; }; struct qedr_cq { @@ -317,11 +324,6 @@ struct qedr_mm { struct list_head entry; }; -union db_prod32 { - struct rdma_pwm_val16_data data; - u32 raw; -}; - struct qedr_qp_hwq_info { /* WQE Elements */ struct qed_chain pbl; diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index 1fa9320d5f72..172adccb3064 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -1828,6 +1828,12 @@ static int qedr_cleanup_user(struct qedr_dev *dev, struct qedr_qp *qp) rc = qedr_db_recovery_del(dev, qp->urq.db_addr, &qp->urq.db_rec_virt->db_data); + if (rc) + return rc; + + if (rdma_protocol_iwarp(&dev->ibdev, 1)) + rc = qedr_db_recovery_del(dev, qp->urq.db_rec_db2_addr, + &qp->urq.db_rec_db2_data); return rc; } @@ -1908,6 +1914,19 @@ static int qedr_create_user_qp(struct qedr_dev *dev, qp->urq.db_addr = (void __iomem *)(uintptr_t)ctx->dpi_addr + uresp.rq_db_offset; + if (rdma_protocol_iwarp(&dev->ibdev, 1)) { + qp->urq.db_rec_db2_addr = + (void __iomem *)(uintptr_t)ctx->dpi_addr + + uresp.rq_db2_offset; + + /* calculate the db_rec_db2 data since it is constant so no + * need to reflect from user + */ + qp->urq.db_rec_db2_data.data.icid = cpu_to_le16(qp->icid); + qp->urq.db_rec_db2_data.data.value = + cpu_to_le16(DQ_TCM_IWARP_POST_RQ_CF_CMD); + } + rc = qedr_db_recovery_add(dev, qp->usq.db_addr, &qp->usq.db_rec_virt->db_data, DB_REC_WIDTH_32B, @@ -1919,6 +1938,17 @@ static int qedr_create_user_qp(struct qedr_dev *dev, &qp->urq.db_rec_virt->db_data, DB_REC_WIDTH_32B, DB_REC_USER); + if (rc) + return rc; + + if (rdma_protocol_iwarp(&dev->ibdev, 1)) { + rc = qedr_db_recovery_add(dev, qp->urq.db_rec_db2_addr, + &qp->urq.db_rec_db2_data, + DB_REC_WIDTH_32B, + DB_REC_USER); + if (rc) + return rc; + } qedr_qp_user_print(dev, qp); return rc; @@ -1952,14 +1982,21 @@ static int qedr_set_iwarp_db_info(struct qedr_dev *dev, struct qedr_qp *qp) qp->rq.db_data.data.icid = cpu_to_le16(qp->icid); qp->rq.iwarp_db2 = dev->db_addr + DB_ADDR_SHIFT(DQ_PWM_OFFSET_TCM_FLAGS); - qp->rq.iwarp_db2_data.data.icid = qp->icid; - qp->rq.iwarp_db2_data.data.value = DQ_TCM_IWARP_POST_RQ_CF_CMD; + qp->rq.iwarp_db2_data.data.icid = cpu_to_le16(qp->icid); + qp->rq.iwarp_db2_data.data.value = + cpu_to_le16(DQ_TCM_IWARP_POST_RQ_CF_CMD); rc = qedr_db_recovery_add(dev, qp->rq.db, &qp->rq.db_data, DB_REC_WIDTH_32B, DB_REC_KERNEL); + if (rc) + return rc; + rc = qedr_db_recovery_add(dev, qp->rq.iwarp_db2, + &qp->rq.iwarp_db2_data, + DB_REC_WIDTH_32B, + DB_REC_KERNEL); return rc; } @@ -2092,8 +2129,18 @@ static int qedr_cleanup_kernel(struct qedr_dev *dev, struct qedr_qp *qp) if (rc) return rc; - if (!qp->srq) + if (!qp->srq) { rc = qedr_db_recovery_del(dev, qp->rq.db, &qp->rq.db_data); + if (rc) + return rc; + + if (rdma_protocol_iwarp(&dev->ibdev, 1)) { + rc = qedr_db_recovery_del(dev, qp->rq.iwarp_db2, + &qp->rq.iwarp_db2_data); + if (rc) + return rc; + } + } return rc; } -- 2.14.5