user_mode = !user_mode;
}
- cq = create_cq(pd, entries, comp_vector, proxy, user_mode);
+ cq = create_cq(pd, entries, comp_vector, proxy, user_mode, user_flags);
if (IS_ERR(cq))
return (struct ib_cq *)cq;
struct sif_cq *create_cq(struct sif_pd *pd, int entries,
int comp_vector,
enum sif_proxy_type proxy,
- bool user_mode)
+ bool user_mode,
+ enum sif_vendor_flags user_flags)
{
struct sif_dev *sdev = to_sdev(pd->ibpd.device);
struct sif_cq_sw *cq_sw;
u64 alloc_sz;
int ret;
int index = sif_alloc_cq_hw_idx(pd);
+ int headroom = 1;
if (index < 0) {
ecq = ERR_PTR(-ENOMEM);
/* Make sure we never fill the CQ completely on rev 1-3 - Bug #3657.
* bug #4074 - add SIF_SW_RESERVED_DUL_CQE 768 entries to avoid worst case
* duplicate completions that can be generated by HW and 1 entry for the
- * fence completion.
+ * fence completion. (This extra headroom can be disabled for test purposes
+ * only using the no_x_cqe vendor_flag)
*/
+ if (!sif_vendor_enable(no_x_cqe, user_flags))
+ headroom = SIF_SW_RESERVED_DUL_CQE + SIF_SW_RESERVED_LAST_CQE;
+
if (PSIF_REVISION(sdev) <= 3)
- entries += (SIF_SW_RESERVED_DUL_CQE + SIF_SW_RESERVED_LAST_CQE);
+ entries += headroom;
cq->entries = roundup_pow_of_two(entries);
cq->ibcq.cqe = cq->entries;
/* Adjust available cqes on rev 1-3 - Bug #3657 and #4074. */
if (PSIF_REVISION(sdev) <= 3)
- cq->ibcq.cqe -= (SIF_SW_RESERVED_DUL_CQE + SIF_SW_RESERVED_LAST_CQE);
+ cq->ibcq.cqe -= headroom;
/* See #2965: 5 bit size_log2 field in cq desc
* but counter is 32 bit. For simplicity to distinguish full from empty
/* CQ */
cq = create_cq(sdev->pd,
init_attr.cap.max_send_wr + init_attr.cap.max_recv_wr,
- 1, SIFPX_OFF, false);
+ 1, SIFPX_OFF, false, 0);
if (IS_ERR(cq)) {
sif_log(sdev, SIF_INFO, "Failed to create CQ for flush_retry QP port %d", port);
return -EINVAL;
tsu_qosl = 0x10, /* Value to use for the qosl bit in the qp state */
no_checksum = 0x20, /* No csum for qp, wqe.wr.csum = qp.magic */
dynamic_mtu = 0x40, /* dynamic MTU - use 256B instead of the path MTU */
+ no_x_cqe = 0x80, /* Don't allocate room in the CQs to avoid overflow due to #4074 */
};
enum sif_mem_type {