[openib-general] [PATCH] libmthca stale CQ event handling (was: ibv_get_async_event)
Roland Dreier
rolandd at cisco.com
Tue Sep 6 08:56:56 PDT 2005
Finally, the simple libmthca changes. We just need to split up
destroy_cq and free_cq so that libibverbs can wait to actually free a
CQ structure.
--- libmthca/src/verbs.c (revision 3296)
+++ libmthca/src/verbs.c (working copy)
@@ -247,9 +247,16 @@ int mthca_destroy_cq(struct ibv_cq *cq)
int ret;
ret = ibv_cmd_destroy_cq(cq);
- if (ret)
+ if (ret || cq->need_dead_event)
return ret;
+ mthca_free_cq(cq);
+
+ return 0;
+}
+
+void mthca_free_cq(struct ibv_cq *cq)
+{
if (mthca_is_memfree(cq->context)) {
mthca_free_db(to_mctx(cq->context)->db_tab, MTHCA_DB_TYPE_CQ_SET_CI,
to_mcq(cq)->set_ci_db_index);
@@ -261,8 +268,6 @@ int mthca_destroy_cq(struct ibv_cq *cq)
free(to_mcq(cq)->buf);
free(to_mcq(cq));
-
- return 0;
}
static int align_queue_size(struct ibv_context *context, int size, int spare)
--- libmthca/src/mthca.h (revision 3296)
+++ libmthca/src/mthca.h (working copy)
@@ -299,6 +299,7 @@ extern int mthca_dereg_mr(struct ibv_mr
extern struct ibv_cq *mthca_create_cq(struct ibv_context *context, int cqe);
extern int mthca_destroy_cq(struct ibv_cq *cq);
+extern void mthca_free_cq(struct ibv_cq *cq);
extern int mthca_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc);
extern int mthca_tavor_arm_cq(struct ibv_cq *cq, int solicited);
extern int mthca_arbel_arm_cq(struct ibv_cq *cq, int solicited);
--- libmthca/src/mthca.c (revision 3296)
+++ libmthca/src/mthca.c (working copy)
@@ -108,6 +108,7 @@ static struct ibv_context_ops mthca_ctx_
.create_cq = mthca_create_cq,
.poll_cq = mthca_poll_cq,
.destroy_cq = mthca_destroy_cq,
+ .free_cq = mthca_free_cq,
.create_srq = mthca_create_srq,
.destroy_srq = mthca_destroy_srq,
.create_qp = mthca_create_qp,
--- libmthca/ChangeLog (revision 3296)
+++ libmthca/ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2005-09-04 Roland Dreier <roland at cisco.com>
+
+ * src/mthca.c, src/mthca.h, src/verbs.c: Update for new kernel
+ ABI, which generates synthetic "CQ dead" events. To handle this
+ we need to split freeing the userspace CQ from the destroy CQ
+ operation.
+
2005-08-31 Roland Dreier <roland at cisco.com>
* src/memfree.c (mthca_free_db): When we free a doorbell record,
More information about the general
mailing list