提交 2df84fa8 编写于 作者: D Devesh Sharma 提交者: Roland Dreier

RDMA/ocrdma: SQ and RQ doorbell offset clean up

Introducing new macros to define SQ and RQ doorbell offset.
Signed-off-by: NDevesh Sharma <devesh.sharma@emulex.com>
Signed-off-by: NSelvin Xavier <selvin.xavier@emulex.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 ea617626
...@@ -386,13 +386,6 @@ static inline struct ocrdma_srq *get_ocrdma_srq(struct ib_srq *ibsrq) ...@@ -386,13 +386,6 @@ static inline struct ocrdma_srq *get_ocrdma_srq(struct ib_srq *ibsrq)
return container_of(ibsrq, struct ocrdma_srq, ibsrq); return container_of(ibsrq, struct ocrdma_srq, ibsrq);
} }
static inline int ocrdma_get_num_posted_shift(struct ocrdma_qp *qp)
{
return ((qp->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY &&
qp->id < 128) ? 24 : 16);
}
static inline int is_cqe_valid(struct ocrdma_cq *cq, struct ocrdma_cqe *cqe) static inline int is_cqe_valid(struct ocrdma_cq *cq, struct ocrdma_cqe *cqe)
{ {
int cqe_valid; int cqe_valid;
......
...@@ -103,7 +103,10 @@ enum { ...@@ -103,7 +103,10 @@ enum {
OCRDMA_DB_GEN2_SRQ_OFFSET = OCRDMA_DB_GEN2_RQ_OFFSET, OCRDMA_DB_GEN2_SRQ_OFFSET = OCRDMA_DB_GEN2_RQ_OFFSET,
OCRDMA_DB_CQ_OFFSET = 0x120, OCRDMA_DB_CQ_OFFSET = 0x120,
OCRDMA_DB_EQ_OFFSET = OCRDMA_DB_CQ_OFFSET, OCRDMA_DB_EQ_OFFSET = OCRDMA_DB_CQ_OFFSET,
OCRDMA_DB_MQ_OFFSET = 0x140 OCRDMA_DB_MQ_OFFSET = 0x140,
OCRDMA_DB_SQ_SHIFT = 16,
OCRDMA_DB_RQ_SHIFT = 24
}; };
#define OCRDMA_DB_CQ_RING_ID_MASK 0x3FF /* bits 0 - 9 */ #define OCRDMA_DB_CQ_RING_ID_MASK 0x3FF /* bits 0 - 9 */
......
...@@ -1127,15 +1127,9 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp, ...@@ -1127,15 +1127,9 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp,
} }
uresp.db_page_addr = usr_db; uresp.db_page_addr = usr_db;
uresp.db_page_size = dev->nic_info.db_page_size; uresp.db_page_size = dev->nic_info.db_page_size;
if (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
uresp.db_sq_offset = OCRDMA_DB_GEN2_SQ_OFFSET; uresp.db_sq_offset = OCRDMA_DB_GEN2_SQ_OFFSET;
uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ_OFFSET; uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ_OFFSET;
uresp.db_shift = 24; uresp.db_shift = OCRDMA_DB_RQ_SHIFT;
} else {
uresp.db_sq_offset = OCRDMA_DB_SQ_OFFSET;
uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET;
uresp.db_shift = 16;
}
if (qp->dpp_enabled) { if (qp->dpp_enabled) {
uresp.dpp_credit = dpp_credit_lmt; uresp.dpp_credit = dpp_credit_lmt;
...@@ -1308,7 +1302,7 @@ static void ocrdma_flush_rq_db(struct ocrdma_qp *qp) ...@@ -1308,7 +1302,7 @@ static void ocrdma_flush_rq_db(struct ocrdma_qp *qp)
{ {
if (qp->db_cache) { if (qp->db_cache) {
u32 val = qp->rq.dbid | (qp->db_cache << u32 val = qp->rq.dbid | (qp->db_cache <<
ocrdma_get_num_posted_shift(qp)); OCRDMA_DB_RQ_SHIFT);
iowrite32(val, qp->rq_db); iowrite32(val, qp->rq_db);
qp->db_cache = 0; qp->db_cache = 0;
} }
...@@ -2052,7 +2046,7 @@ static int ocrdma_build_fr(struct ocrdma_qp *qp, struct ocrdma_hdr_wqe *hdr, ...@@ -2052,7 +2046,7 @@ static int ocrdma_build_fr(struct ocrdma_qp *qp, struct ocrdma_hdr_wqe *hdr,
static void ocrdma_ring_sq_db(struct ocrdma_qp *qp) static void ocrdma_ring_sq_db(struct ocrdma_qp *qp)
{ {
u32 val = qp->sq.dbid | (1 << 16); u32 val = qp->sq.dbid | (1 << OCRDMA_DB_SQ_SHIFT);
iowrite32(val, qp->sq_db); iowrite32(val, qp->sq_db);
} }
...@@ -2157,12 +2151,9 @@ int ocrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, ...@@ -2157,12 +2151,9 @@ int ocrdma_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
static void ocrdma_ring_rq_db(struct ocrdma_qp *qp) static void ocrdma_ring_rq_db(struct ocrdma_qp *qp)
{ {
u32 val = qp->rq.dbid | (1 << ocrdma_get_num_posted_shift(qp)); u32 val = qp->rq.dbid | (1 << OCRDMA_DB_RQ_SHIFT);
if (qp->state != OCRDMA_QPS_INIT)
iowrite32(val, qp->rq_db); iowrite32(val, qp->rq_db);
else
qp->db_cache++;
} }
static void ocrdma_build_rqe(struct ocrdma_hdr_wqe *rqe, struct ib_recv_wr *wr, static void ocrdma_build_rqe(struct ocrdma_hdr_wqe *rqe, struct ib_recv_wr *wr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册