Commit f11220ee authored by Naresh Gottumukkala's avatar Naresh Gottumukkala Committed by Roland Dreier

RDMA/ocrdma: For ERX2 irrespective of Qid, num_posted offset is 24

1) All RQ doorbells are handled by ERX2 and doorbell->num_posted
   offset is constant to bit offset 24 for ERX2 irrspective of Q id.

2) Fixed RESET to INIT state change (from ERR->RST->INIT->RTR case).
Signed-off-by: default avatarNaresh Gottumukkala <bgottumukkala@emulex.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent c88bd03f
...@@ -256,11 +256,11 @@ static int ocrdma_get_mbx_cqe_errno(u16 cqe_status) ...@@ -256,11 +256,11 @@ static int ocrdma_get_mbx_cqe_errno(u16 cqe_status)
break; break;
case OCRDMA_MBX_CQE_STATUS_INSUFFICIENT_RESOURCES: case OCRDMA_MBX_CQE_STATUS_INSUFFICIENT_RESOURCES:
case OCRDMA_MBX_CQE_STATUS_QUEUE_FLUSHING: case OCRDMA_MBX_CQE_STATUS_QUEUE_FLUSHING:
err_num = -EAGAIN; err_num = -EINVAL;
break; break;
case OCRDMA_MBX_CQE_STATUS_DMA_FAILED: case OCRDMA_MBX_CQE_STATUS_DMA_FAILED:
default: default:
err_num = -EIO; err_num = -EINVAL;
break; break;
} }
return err_num; return err_num;
...@@ -1654,6 +1654,14 @@ void ocrdma_flush_qp(struct ocrdma_qp *qp) ...@@ -1654,6 +1654,14 @@ void ocrdma_flush_qp(struct ocrdma_qp *qp)
spin_unlock_irqrestore(&qp->dev->flush_q_lock, flags); spin_unlock_irqrestore(&qp->dev->flush_q_lock, flags);
} }
static void ocrdma_init_hwq_ptr(struct ocrdma_qp *qp)
{
qp->sq.head = 0;
qp->sq.tail = 0;
qp->rq.head = 0;
qp->rq.tail = 0;
}
int ocrdma_qp_state_change(struct ocrdma_qp *qp, enum ib_qp_state new_ib_state, int ocrdma_qp_state_change(struct ocrdma_qp *qp, enum ib_qp_state new_ib_state,
enum ib_qp_state *old_ib_state) enum ib_qp_state *old_ib_state)
{ {
...@@ -1673,8 +1681,12 @@ int ocrdma_qp_state_change(struct ocrdma_qp *qp, enum ib_qp_state new_ib_state, ...@@ -1673,8 +1681,12 @@ int ocrdma_qp_state_change(struct ocrdma_qp *qp, enum ib_qp_state new_ib_state,
} }
if (new_state == OCRDMA_QPS_ERR) if (new_state == OCRDMA_QPS_INIT) {
ocrdma_init_hwq_ptr(qp);
ocrdma_del_flush_qp(qp);
} else if (new_state == OCRDMA_QPS_ERR) {
ocrdma_flush_qp(qp); ocrdma_flush_qp(qp);
}
qp->state = new_state; qp->state = new_state;
...@@ -2317,7 +2329,8 @@ int ocrdma_mbx_modify_srq(struct ocrdma_srq *srq, struct ib_srq_attr *srq_attr) ...@@ -2317,7 +2329,8 @@ int ocrdma_mbx_modify_srq(struct ocrdma_srq *srq, struct ib_srq_attr *srq_attr)
{ {
int status = -ENOMEM; int status = -ENOMEM;
struct ocrdma_modify_srq *cmd; struct ocrdma_modify_srq *cmd;
struct ocrdma_dev *dev = get_ocrdma_dev(srq->ibsrq.device); struct ocrdma_pd *pd = srq->pd;
struct ocrdma_dev *dev = get_ocrdma_dev(pd->ibpd.device);
cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_CREATE_SRQ, sizeof(*cmd)); cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_CREATE_SRQ, sizeof(*cmd));
if (!cmd) if (!cmd)
......
...@@ -95,12 +95,11 @@ enum { ...@@ -95,12 +95,11 @@ enum {
enum { enum {
OCRDMA_DB_RQ_OFFSET = 0xE0, OCRDMA_DB_RQ_OFFSET = 0xE0,
OCRDMA_DB_GEN2_RQ1_OFFSET = 0x100, OCRDMA_DB_GEN2_RQ_OFFSET = 0x100,
OCRDMA_DB_GEN2_RQ2_OFFSET = 0xC0,
OCRDMA_DB_SQ_OFFSET = 0x60, OCRDMA_DB_SQ_OFFSET = 0x60,
OCRDMA_DB_GEN2_SQ_OFFSET = 0x1C0, OCRDMA_DB_GEN2_SQ_OFFSET = 0x1C0,
OCRDMA_DB_SRQ_OFFSET = OCRDMA_DB_RQ_OFFSET, OCRDMA_DB_SRQ_OFFSET = OCRDMA_DB_RQ_OFFSET,
OCRDMA_DB_GEN2_SRQ_OFFSET = OCRDMA_DB_GEN2_RQ1_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
......
...@@ -930,9 +930,8 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp, ...@@ -930,9 +930,8 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp,
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) { 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 = ((qp->id & 0xFFFF) < 128) ? uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ_OFFSET;
OCRDMA_DB_GEN2_RQ1_OFFSET : OCRDMA_DB_GEN2_RQ2_OFFSET; uresp.db_shift = 24;
uresp.db_shift = (qp->id < 128) ? 24 : 16;
} else { } else {
uresp.db_sq_offset = OCRDMA_DB_SQ_OFFSET; uresp.db_sq_offset = OCRDMA_DB_SQ_OFFSET;
uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET; uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET;
...@@ -975,8 +974,7 @@ static void ocrdma_set_qp_db(struct ocrdma_dev *dev, struct ocrdma_qp *qp, ...@@ -975,8 +974,7 @@ static void ocrdma_set_qp_db(struct ocrdma_dev *dev, struct ocrdma_qp *qp,
OCRDMA_DB_GEN2_SQ_OFFSET; OCRDMA_DB_GEN2_SQ_OFFSET;
qp->rq_db = dev->nic_info.db + qp->rq_db = dev->nic_info.db +
(pd->id * dev->nic_info.db_page_size) + (pd->id * dev->nic_info.db_page_size) +
((qp->id < 128) ? OCRDMA_DB_GEN2_RQ_OFFSET;
OCRDMA_DB_GEN2_RQ1_OFFSET : OCRDMA_DB_GEN2_RQ2_OFFSET);
} else { } else {
qp->sq_db = dev->nic_info.db + qp->sq_db = dev->nic_info.db +
(pd->id * dev->nic_info.db_page_size) + (pd->id * dev->nic_info.db_page_size) +
...@@ -1399,7 +1397,7 @@ static void ocrdma_discard_cqes(struct ocrdma_qp *qp, struct ocrdma_cq *cq) ...@@ -1399,7 +1397,7 @@ static void ocrdma_discard_cqes(struct ocrdma_qp *qp, struct ocrdma_cq *cq)
spin_unlock_irqrestore(&cq->cq_lock, cq_flags); spin_unlock_irqrestore(&cq->cq_lock, cq_flags);
} }
static void ocrdma_del_flush_qp(struct ocrdma_qp *qp) void ocrdma_del_flush_qp(struct ocrdma_qp *qp)
{ {
int found = false; int found = false;
unsigned long flags; unsigned long flags;
...@@ -1496,7 +1494,7 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_dev *dev, struct ocrdma_srq *srq, ...@@ -1496,7 +1494,7 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_dev *dev, struct ocrdma_srq *srq,
uresp.db_page_size = dev->nic_info.db_page_size; uresp.db_page_size = dev->nic_info.db_page_size;
uresp.num_rqe_allocated = srq->rq.max_cnt; uresp.num_rqe_allocated = srq->rq.max_cnt;
if (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) { if (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ1_OFFSET; uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ_OFFSET;
uresp.db_shift = 24; uresp.db_shift = 24;
} else { } else {
uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET; uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET;
......
...@@ -72,6 +72,7 @@ int ocrdma_query_qp(struct ib_qp *, ...@@ -72,6 +72,7 @@ int ocrdma_query_qp(struct ib_qp *,
struct ib_qp_attr *qp_attr, struct ib_qp_attr *qp_attr,
int qp_attr_mask, struct ib_qp_init_attr *); int qp_attr_mask, struct ib_qp_init_attr *);
int ocrdma_destroy_qp(struct ib_qp *); int ocrdma_destroy_qp(struct ib_qp *);
void ocrdma_del_flush_qp(struct ocrdma_qp *qp);
struct ib_srq *ocrdma_create_srq(struct ib_pd *, struct ib_srq_init_attr *, struct ib_srq *ocrdma_create_srq(struct ib_pd *, struct ib_srq_init_attr *,
struct ib_udata *); struct ib_udata *);
......
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