providers/irdma: Release SRQ slots during CQ scrub
When the CQ is scrubbed during QP destroy, any unpolled SRQ
completions are invalidated, which causes those SRQ slots to
be leaked because the SRQ tail only advances when completions
are polled.
Fix this by releasing the SRQ slots whenever an SRQ CQE is scrubbed
during QP destroy as well as during the small window prior to CQ
scrub where the QP is marked as "destroy_pending".
In practice, the leak only matters if a consumer posts new buffers
to replace the ones tied to the discarded completions, but releasing
the slots keeps the driver's SRQ accounting correct.
Fixes: 32c9f6947cdd ("providers/irdma: Add SRQ support")
Signed-off-by: Jacob Moroni <jmoroni@google.com>
diff --git a/providers/irdma/uk.c b/providers/irdma/uk.c
index ea67d10..dc863a4 100644
--- a/providers/irdma/uk.c
+++ b/providers/irdma/uk.c
@@ -1913,8 +1913,12 @@
if (cq->avoid_mem_cflct && FIELD_GET(IRDMA_CQ_SRQ, qword3)) {
get_64bit_val(cqe, 40, &comp_ctx);
- if ((struct irdma_qp_uk *)(uintptr_t)comp_ctx == qp)
+ if ((struct irdma_qp_uk *)(uintptr_t)comp_ctx == qp) {
+ if (qp->srq_uk &&
+ FIELD_GET(IRDMA_CQ_SQ, qword3) == IRDMA_CQE_QTYPE_RQ)
+ irdma_srq_release_wqe(qp->srq_uk);
set_64bit_val(cqe, 40, 0);
+ }
} else {
get_64bit_val(cqe, 8, &comp_ctx);
if ((struct irdma_qp_uk *)(uintptr_t)comp_ctx == qp)