diff options
author | Roland Dreier <rolandd@cisco.com> | 2005-10-23 22:18:03 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 19:57:03 -0800 |
commit | 0ee31c3af2809dec7e549f9d7f23480d332a24aa (patch) | |
tree | b14a4474dcf7c5afcd83293b41cd112d6bb5e2d8 | |
parent | 4b1872a054537a0ab71bf5636c0bf048e3490299 (diff) | |
download | libmthca-0ee31c3af2809dec7e549f9d7f23480d332a24aa.tar.gz |
Pass QP type to functions that need it
Explicitly pass QP type to functions that need it while creating QP.
This fixes breakage with UD QPs introduced when switching to use
ibv_qp.qp_type.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/mthca.h | 4 | ||||
-rw-r--r-- | src/qp.c | 9 | ||||
-rw-r--r-- | src/verbs.c | 4 |
4 files changed, 17 insertions, 8 deletions
@@ -1,3 +1,11 @@ +2005-10-23 Roland Dreier <roland@cisco.com> + + * src/qp.c (mthca_return_cap, mthca_alloc_qp_buf), src/verbs.c + (mthca_create_qp): Explicitly pass QP type to functions used while + creating QP, since we can't rely on ibv_qp.qp_type to be set until + after we return. This fixes breakage with UD QPs introduced in + the last change below. + 2005-10-19 Roland Dreier <roland@cisco.com> * src/mthca.h, src/verbs.c (mthca_create_qp), src/qp.c diff --git a/src/mthca.h b/src/mthca.h index 9ef2fdf..006eada 100644 --- a/src/mthca.h +++ b/src/mthca.h @@ -316,9 +316,9 @@ extern int mthca_arbel_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr, extern int mthca_arbel_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr, struct ibv_recv_wr **bad_wr); extern int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap, - struct mthca_qp *qp); + enum ibv_qp_type type, struct mthca_qp *qp); extern void mthca_return_cap(struct ibv_pd *pd, struct mthca_qp *qp, - struct ibv_qp_cap *cap); + enum ibv_qp_type type, struct ibv_qp_cap *cap); extern struct mthca_qp *mthca_find_qp(struct mthca_context *ctx, uint32_t qpn); extern int mthca_store_qp(struct mthca_context *ctx, uint32_t qpn, struct mthca_qp *qp); extern void mthca_clear_qp(struct mthca_context *ctx, uint32_t qpn); @@ -680,7 +680,7 @@ out: } int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap, - struct mthca_qp *qp) + enum ibv_qp_type type, struct mthca_qp *qp) { int size; @@ -703,7 +703,7 @@ int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap, size = sizeof (struct mthca_next_seg) + qp->sq.max_gs * sizeof (struct mthca_data_seg); - switch (qp->ibv_qp.qp_type) { + switch (type) { case IBV_QPT_UD: if (mthca_is_memfree(pd->context)) size += sizeof (struct mthca_arbel_ud_seg); @@ -767,7 +767,8 @@ int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap, return 0; } -void mthca_return_cap(struct ibv_pd *pd, struct mthca_qp *qp, struct ibv_qp_cap *cap) +void mthca_return_cap(struct ibv_pd *pd, struct mthca_qp *qp, + enum ibv_qp_type type, struct ibv_qp_cap *cap) { /* * Maximum inline data size is the full WQE size less the size @@ -777,7 +778,7 @@ void mthca_return_cap(struct ibv_pd *pd, struct mthca_qp *qp, struct ibv_qp_cap sizeof (struct mthca_next_seg) - sizeof (struct mthca_inline_seg); - switch (qp->ibv_qp.qp_type) { + switch (type) { case IBV_QPT_UD: if (mthca_is_memfree(pd->context)) cap->max_inline_data -= sizeof (struct mthca_arbel_ud_seg); diff --git a/src/verbs.c b/src/verbs.c index e0b38dc..b40532b 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -424,7 +424,7 @@ struct ibv_qp *mthca_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr) qp->rq.head = 0; qp->rq.tail = 0; - if (mthca_alloc_qp_buf(pd, &attr->cap, qp)) + if (mthca_alloc_qp_buf(pd, &attr->cap, attr->qp_type, qp)) goto err; if (pthread_spin_init(&qp->sq.lock, PTHREAD_PROCESS_PRIVATE) || @@ -471,7 +471,7 @@ struct ibv_qp *mthca_create_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr) if (ret) goto err_destroy; - mthca_return_cap(pd, qp, &attr->cap); + mthca_return_cap(pd, qp, attr->qp_type, &attr->cap); return &qp->ibv_qp; |