return -EFAULT;
}
if (!unlikely(wh->used)) {
- if ((sq_seq_num == wh->sq_seq) || (cqe->status == PSIF_WC_STATUS_DUPL_COMPL_ERR)) {
+ if ((sq_seq_num == wh->sq_seq) || (cqe->status == PSIF_WC_STATUS_DUPL_COMPL_ERR))
sif_log(sdev, SIF_WCE,
- "dupl cqe 0x%x for cq %d: got sq_seq 0x%x, last exp.0x%x, sts %d opc 0x%x",
+ "dupl cqe 0x%x for cq %d: got sq_seq 0x%x, last exp.0x%x, sts %d opc 0x%x",
+ cqe->seq_num, cq->index, sq_seq_num, wh->sq_seq,
+ cqe->status, cqe->opcode);
+ else
+ sif_log(sdev, SIF_INFO,
+ "unexp. cqe 0x%x for cq %d: got sq_seq 0x%x, last exp.0x%x, sts %d opc 0x%x",
cqe->seq_num, cq->index, sq_seq_num, wh->sq_seq,
cqe->status, cqe->opcode);
- return -EIO;
- }
- sif_log(sdev, SIF_INFO,
- "unexp. cqe 0x%x for cq %d: got sq_seq 0x%x, last exp.0x%x, sts %d opc 0x%x",
- cqe->seq_num, cq->index, sq_seq_num, wh->sq_seq,
- cqe->status, cqe->opcode);
return -EFAULT;
}
if (unlikely(wh->sq_seq != sq_seq_num)) {
- bool duplicate_comp_wrap_case = (wh->sq_seq - sq_seq_num == sq->entries);
- int log_level = duplicate_comp_wrap_case ? SIF_WCE : SIF_INFO;
+ bool dup_case = (wh->sq_seq - sq_seq_num == sq->entries);
+ int log_level = dup_case ? SIF_WCE : SIF_INFO;
sif_log(sdev, log_level,
- "wrong cqe 0x%x for cq %d: got sq_seq 0x%x, expected 0x%x, sts %d opc 0x%x",
- cqe->seq_num, cq->index, sq_seq_num, wh->sq_seq, cqe->status, cqe->opcode);
- return duplicate_comp_wrap_case ? -EIO : -EFAULT;
+ "%s cqe 0x%x for cq %d: got sq_seq 0x%x, expected 0x%x, sts %d opc 0x%x",
+ dup_case ? "dupl" : "wrong", cqe->seq_num, cq->index, sq_seq_num, wh->sq_seq,
+ cqe->status, cqe->opcode);
+ return -EFAULT;
}
*wr_id = wh->wr_id;
wh->used = false;
wc->wr_id = cqe->wc_id.rq_id;
/* No more work, when QP is gone */
- return cqe->status == PSIF_WC_STATUS_DUPL_COMPL_ERR ? -EIO : 0;
+ return cqe->status == PSIF_WC_STATUS_GEN_TRANSL_COMPL_ERR ? -EFAULT : 0;
}
ret = translate_wr_id(&wc->wr_id, sdev, cq, sq, cqe, sq_seq_num, cqe->qp);
struct sif_cq_sw *cq_sw = get_sif_cq_sw(sdev, cq->index);
u32 seqno;
u32 polled_value;
+ int ret;
int n = 0;
- int ret = 0;
unsigned long flags = 0;
/* If a send completion, handle the wr_id */
ret = translate_wr_id(&wr_id_host_order, sdev, cq, sq, &lcqe,
lcqe.wc_id.sq_id.sq_seq_num, lcqe.qp);
- if (ret == -EIO)
- set_psif_cq_entry__status(cqe, PSIF_WC_STATUS_DUPL_COMPL_ERR);
- else if (ret)
- goto err;
+ if (ret < 0)
+ set_psif_cq_entry__status(cqe, PSIF_WC_STATUS_GEN_TRANSL_COMPL_ERR);
set_psif_cq_entry__wc_id(cqe, wr_id_host_order);
}
ret = n;
-err:
spin_unlock_irqrestore(&cq->lock, flags);
u32 polled_value = 0;
int npolled = 0;
unsigned long flags = 0;
- int ret = 0;
/* TBD: Replace lock with atomic ops */
spin_lock_irqsave(&cq->lock, flags);
break;
if (likely(wc)) {
- ret = handle_wc(sdev, cq, cqe, wc);
- if (unlikely(ret == -EIO)) {
- /* -EIO indicates that this is the duplicate
- * FLUSH-IN-ERR completion generated by the HW.
+ if (unlikely(handle_wc(sdev, cq, cqe, wc) < 0)) {
+ /* poll_cq should not return < 0. Thus, ignore
+ * the CQE if it is duplicate, unexpected or wrong
+ * CQE.
*/
seqno = ++cq_sw->next_seq;
npolled--;
- ret = 0;
continue;
- } else if (ret < 0)
- goto handle_failed;
+ }
wc++;
seqno = ++cq_sw->next_seq;
} else /* peek_cq semantics */
}
}
-handle_failed:
spin_unlock_irqrestore(&cq->lock, flags);
if (npolled)
else
sif_log_rlim(sdev, SIF_POLL, "no completions polled - seq_no of next entry: %d",
polled_value);
- return !ret ? npolled : ret;
+ return npolled;
}