Commit b4bc7660 authored by Michal Kalderon's avatar Michal Kalderon Committed by Jason Gunthorpe

RDMA/qedr: Add iWARP doorbell recovery support

This patch adds the iWARP specific doorbells to the doorbell recovery
mechanism.

Link: https://lore.kernel.org/r/20191030094417.16866-9-michal.kalderon@marvell.comSigned-off-by: default avatarAriel Elior <ariel.elior@marvell.com>
Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 97f61250
...@@ -238,6 +238,11 @@ struct qedr_ucontext { ...@@ -238,6 +238,11 @@ struct qedr_ucontext {
bool db_rec; bool db_rec;
}; };
union db_prod32 {
struct rdma_pwm_val16_data data;
u32 raw;
};
union db_prod64 { union db_prod64 {
struct rdma_pwm_val32_data data; struct rdma_pwm_val32_data data;
u64 raw; u64 raw;
...@@ -268,6 +273,8 @@ struct qedr_userq { ...@@ -268,6 +273,8 @@ struct qedr_userq {
void __iomem *db_addr; void __iomem *db_addr;
struct qedr_user_db_rec *db_rec_data; struct qedr_user_db_rec *db_rec_data;
struct rdma_user_mmap_entry *db_mmap_entry; struct rdma_user_mmap_entry *db_mmap_entry;
void __iomem *db_rec_db2_addr;
union db_prod32 db_rec_db2_data;
}; };
struct qedr_cq { struct qedr_cq {
...@@ -303,11 +310,6 @@ struct qedr_pd { ...@@ -303,11 +310,6 @@ struct qedr_pd {
struct qedr_ucontext *uctx; struct qedr_ucontext *uctx;
}; };
union db_prod32 {
struct rdma_pwm_val16_data data;
u32 raw;
};
struct qedr_qp_hwq_info { struct qedr_qp_hwq_info {
/* WQE Elements */ /* WQE Elements */
struct qed_chain pbl; struct qed_chain pbl;
......
...@@ -1728,6 +1728,10 @@ static void qedr_cleanup_user(struct qedr_dev *dev, ...@@ -1728,6 +1728,10 @@ static void qedr_cleanup_user(struct qedr_dev *dev,
&qp->urq.db_rec_data->db_data); &qp->urq.db_rec_data->db_data);
rdma_user_mmap_entry_remove(qp->urq.db_mmap_entry); rdma_user_mmap_entry_remove(qp->urq.db_mmap_entry);
} }
if (rdma_protocol_iwarp(&dev->ibdev, 1))
qedr_db_recovery_del(dev, qp->urq.db_rec_db2_addr,
&qp->urq.db_rec_db2_data);
} }
static int qedr_create_user_qp(struct qedr_dev *dev, static int qedr_create_user_qp(struct qedr_dev *dev,
...@@ -1803,6 +1807,17 @@ static int qedr_create_user_qp(struct qedr_dev *dev, ...@@ -1803,6 +1807,17 @@ static int qedr_create_user_qp(struct qedr_dev *dev,
qp->usq.db_addr = ctx->dpi_addr + uresp.sq_db_offset; qp->usq.db_addr = ctx->dpi_addr + uresp.sq_db_offset;
qp->urq.db_addr = ctx->dpi_addr + uresp.rq_db_offset; qp->urq.db_addr = ctx->dpi_addr + uresp.rq_db_offset;
if (rdma_protocol_iwarp(&dev->ibdev, 1)) {
qp->urq.db_rec_db2_addr = 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, rc = qedr_db_recovery_add(dev, qp->usq.db_addr,
&qp->usq.db_rec_data->db_data, &qp->usq.db_rec_data->db_data,
DB_REC_WIDTH_32B, DB_REC_WIDTH_32B,
...@@ -1817,6 +1832,14 @@ static int qedr_create_user_qp(struct qedr_dev *dev, ...@@ -1817,6 +1832,14 @@ static int qedr_create_user_qp(struct qedr_dev *dev,
if (rc) if (rc)
goto err; goto err;
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)
goto err;
}
qedr_qp_user_print(dev, qp); qedr_qp_user_print(dev, qp);
return rc; return rc;
...@@ -1857,6 +1880,13 @@ static int qedr_set_iwarp_db_info(struct qedr_dev *dev, struct qedr_qp *qp) ...@@ -1857,6 +1880,13 @@ static int qedr_set_iwarp_db_info(struct qedr_dev *dev, struct qedr_qp *qp)
&qp->rq.db_data, &qp->rq.db_data,
DB_REC_WIDTH_32B, DB_REC_WIDTH_32B,
DB_REC_KERNEL); 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; return rc;
} }
...@@ -1985,8 +2015,13 @@ static void qedr_cleanup_kernel(struct qedr_dev *dev, struct qedr_qp *qp) ...@@ -1985,8 +2015,13 @@ static void qedr_cleanup_kernel(struct qedr_dev *dev, struct qedr_qp *qp)
qedr_db_recovery_del(dev, qp->sq.db, &qp->sq.db_data); qedr_db_recovery_del(dev, qp->sq.db, &qp->sq.db_data);
if (!qp->srq) if (!qp->srq) {
qedr_db_recovery_del(dev, qp->rq.db, &qp->rq.db_data); qedr_db_recovery_del(dev, qp->rq.db, &qp->rq.db_data);
if (rdma_protocol_iwarp(&dev->ibdev, 1))
qedr_db_recovery_del(dev, qp->rq.iwarp_db2,
&qp->rq.iwarp_db2_data);
}
} }
static int qedr_create_kernel_qp(struct qedr_dev *dev, static int qedr_create_kernel_qp(struct qedr_dev *dev,
......
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