Michael> The following patch fixes system hangs I am sometimes
    Michael> seeing when ipoib is brought down and back up.

Thanks, applied and queued for 2.6.15.

    Michael> Should something similiar be done in libmthca?

I think so -- like this?

--- libmthca/src/qp.c   (revision 4128)
+++ libmthca/src/qp.c   (working copy)
@@ -65,6 +65,21 @@ static void *get_send_wqe(struct mthca_q
        return qp->buf + qp->send_wqe_offset + (n << qp->sq.wqe_shift);
 }
 
+void mthca_init_qp_indices(struct mthca_qp *qp)
+{
+       qp->sq.next_ind  = 0;
+       qp->sq.last_comp = qp->sq.max - 1;
+       qp->sq.head      = 0;
+       qp->sq.tail      = 0;
+       qp->sq.last      = get_send_wqe(qp, qp->sq.max - 1);
+
+       qp->rq.next_ind  = 0;
+       qp->rq.last_comp = qp->rq.max - 1;
+       qp->rq.head      = 0;
+       qp->rq.tail      = 0;
+       qp->rq.last      = get_recv_wqe(qp, qp->rq.max - 1);
+}
+
 static inline int wq_overflow(struct mthca_wq *wq, int nreq, struct mthca_cq 
*cq)
 {
        unsigned cur;
--- libmthca/src/verbs.c        (revision 4128)
+++ libmthca/src/verbs.c        (working copy)
@@ -394,19 +394,6 @@ int mthca_destroy_srq(struct ibv_srq *sr
        return 0;
 }
 
-static void mthca_init_qp_indices(struct mthca_qp *qp)
-{
-       qp->sq.next_ind  = 0;
-       qp->sq.last_comp = qp->sq.max - 1;
-       qp->sq.head      = 0;
-       qp->sq.tail      = 0;
-
-       qp->rq.next_ind  = 0;
-       qp->rq.last_comp = qp->rq.max - 1;
-       qp->rq.head      = 0;
-       qp->rq.tail      = 0;
-}
-
 struct ibv_qp *mthca_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr 
*attr)
 {
        struct mthca_create_qp cmd;
@@ -427,11 +414,12 @@ struct ibv_qp *mthca_create_qp(struct ib
 
        qp->sq.max = align_queue_size(pd->context, attr->cap.max_send_wr, 0);
        qp->rq.max = align_queue_size(pd->context, attr->cap.max_recv_wr, 0);
-       mthca_init_qp_indices(qp);
 
        if (mthca_alloc_qp_buf(pd, &attr->cap, attr->qp_type, qp))
                goto err;
 
+       mthca_init_qp_indices(qp);
+
        if (pthread_spin_init(&qp->sq.lock, PTHREAD_PROCESS_PRIVATE) ||
            pthread_spin_init(&qp->rq.lock, PTHREAD_PROCESS_PRIVATE))
                goto err_free;
--- libmthca/src/mthca.h        (revision 4128)
+++ libmthca/src/mthca.h        (working copy)
@@ -310,6 +310,7 @@ extern struct ibv_qp *mthca_create_qp(st
 extern int mthca_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
                           enum ibv_qp_attr_mask attr_mask);
 extern int mthca_destroy_qp(struct ibv_qp *qp);
+extern void mthca_init_qp_indices(struct mthca_qp *qp);
 extern int mthca_tavor_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
                                 struct ibv_send_wr **bad_wr);
 extern int mthca_tavor_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
--- libmthca/ChangeLog  (revision 4128)
+++ libmthca/ChangeLog  (working copy)
@@ -1,3 +1,9 @@
+2005-11-28  Roland Dreier  <[EMAIL PROTECTED]>
+
+       * src/qp.c (mthca_init_qp_indices): Set qp->sq.last and
+       qp->rq.last so that QP is fully reset when the indices are
+       reinited on transition to RESET state.
+
 2005-11-09  Roland Dreier  <[EMAIL PROTECTED]>
 
        * src/srq.c (mthca_tavor_post_srq_recv), src/qp.c
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to