diff options
author | Michael S. Tsirkin <mst@mellanox.co.il> | 2005-09-13 17:37:16 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 19:57:02 -0800 |
commit | 03cce79a860f8ba6980bf57349d300fc011cac18 (patch) | |
tree | 201c53fc9cc2ef9411541cbde4007d0cec5b757a | |
parent | 90f6e9e1ad8026bf4f3c2d6337b0928c7825597a (diff) | |
download | libmthca-03cce79a860f8ba6980bf57349d300fc011cac18.tar.gz |
Link WQEs properly
Fix posting of the first work request for memfree hardware.
Also simplify code for Tavor-mode hardware.
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/qp.c | 45 | ||||
-rw-r--r-- | src/srq.c | 13 | ||||
-rw-r--r-- | src/verbs.c | 3 |
4 files changed, 36 insertions, 34 deletions
@@ -1,3 +1,12 @@ +2005-09-13 Roland Dreier <roland@cisco.com> + + * src/qp.c (mthca_tavor_post_send, mthca_tavor_post_recv, + mthca_arbel_post_send), src/srq.c (mthca_tavor_post_srq_recv): + Apply Michael S. Tsirkin's patch to fix linking of WQEs on + mem-free HCAs. While we're at it, simplify the Tavor WQE posting + code as well -- there's no need for a conditional, just always lik + the previous WQE. + 2005-09-07 Roland Dreier <roland@cisco.com> * src/mthca.h: Get rid of ntohll() and htonll() now that @@ -259,15 +259,13 @@ int mthca_tavor_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr, goto out; } - if (prev_wqe) { - ((struct mthca_next_seg *) prev_wqe)->nda_op = - htonl(((ind << qp->sq.wqe_shift) + - qp->send_wqe_offset) | - mthca_opcode[wr->opcode]); - - ((struct mthca_next_seg *) prev_wqe)->ee_nds = - htonl((size0 ? 0 : MTHCA_NEXT_DBD) | size); - } + ((struct mthca_next_seg *) prev_wqe)->nda_op = + htonl(((ind << qp->sq.wqe_shift) + + qp->send_wqe_offset) | + mthca_opcode[wr->opcode]); + + ((struct mthca_next_seg *) prev_wqe)->ee_nds = + htonl((size0 ? 0 : MTHCA_NEXT_DBD) | size); if (!size0) { size0 = size; @@ -353,12 +351,10 @@ int mthca_tavor_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr, qp->wrid[ind] = wr->wr_id; - if (prev_wqe) { - ((struct mthca_next_seg *) prev_wqe)->nda_op = - htonl((ind << qp->rq.wqe_shift) | 1); - ((struct mthca_next_seg *) prev_wqe)->ee_nds = - htonl(MTHCA_NEXT_DBD | size); - } + ((struct mthca_next_seg *) prev_wqe)->nda_op = + htonl((ind << qp->rq.wqe_shift) | 1); + ((struct mthca_next_seg *) prev_wqe)->ee_nds = + htonl(MTHCA_NEXT_DBD | size); if (!size0) size0 = size; @@ -562,15 +558,13 @@ int mthca_arbel_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr, goto out; } - if (prev_wqe) { - ((struct mthca_next_seg *) prev_wqe)->nda_op = - htonl(((ind << qp->sq.wqe_shift) + - qp->send_wqe_offset) | - mthca_opcode[wr->opcode]); - mb(); - ((struct mthca_next_seg *) prev_wqe)->ee_nds = - htonl(MTHCA_NEXT_DBD | size); - } + ((struct mthca_next_seg *) prev_wqe)->nda_op = + htonl(((ind << qp->sq.wqe_shift) + + qp->send_wqe_offset) | + mthca_opcode[wr->opcode]); + mb(); + ((struct mthca_next_seg *) prev_wqe)->ee_nds = + htonl(MTHCA_NEXT_DBD | size); if (!size0) { size0 = size; @@ -767,6 +761,9 @@ int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap, } } + qp->sq.last = get_send_wqe(qp, qp->sq.max - 1); + qp->rq.last = get_recv_wqe(qp, qp->sq.max - 1); + return 0; } @@ -142,13 +142,11 @@ int mthca_tavor_post_srq_recv(struct ibv_srq *ibsrq, ((struct mthca_data_seg *) wqe)->addr = 0; } - if (prev_wqe) { - ((struct mthca_next_seg *) prev_wqe)->nda_op = - htonl((ind << srq->wqe_shift) | 1); - mb(); - ((struct mthca_next_seg *) prev_wqe)->ee_nds = - htonl(MTHCA_NEXT_DBD); - } + ((struct mthca_next_seg *) prev_wqe)->nda_op = + htonl((ind << srq->wqe_shift) | 1); + mb(); + ((struct mthca_next_seg *) prev_wqe)->ee_nds = + htonl(MTHCA_NEXT_DBD); srq->wrid[ind] = wr->wr_id; srq->first_free = next_ind; @@ -294,6 +292,7 @@ int mthca_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr, srq->first_free = 0; srq->last_free = srq->max - 1; + srq->last = get_wqe(srq, srq->max - 1); return 0; } diff --git a/src/verbs.c b/src/verbs.c index e8cfc22..3fe7e80 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -306,7 +306,6 @@ struct ibv_srq *mthca_create_srq(struct ibv_pd *pd, srq->max = align_queue_size(pd->context, attr->attr.max_wr, 1); srq->max_gs = attr->attr.max_sge; - srq->last = NULL; srq->counter = 0; if (mthca_alloc_srq_buf(pd, &attr->attr, srq)) @@ -413,14 +412,12 @@ struct ibv_qp *mthca_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr) qp->sq.last_comp = qp->sq.max - 1; qp->sq.head = 0; qp->sq.tail = 0; - qp->sq.last = NULL; qp->rq.max = align_queue_size(pd->context, attr->cap.max_recv_wr, 0); qp->rq.next_ind = 0; qp->rq.last_comp = qp->rq.max - 1; qp->rq.head = 0; qp->rq.tail = 0; - qp->rq.last = NULL; if (mthca_alloc_qp_buf(pd, &attr->cap, qp)) goto err; |