[openib-general] [PATCH 2/2] libmthca: max_inline_data support
Michael S. Tsirkin
mst at mellanox.co.il
Mon May 9 07:16:31 PDT 2005
Userspace part of a patch: support max_inline_data capability.
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
Index: libmthca/src/qp.c
===================================================================
--- libmthca/src/qp.c (revision 2235)
+++ libmthca/src/qp.c (working copy)
@@ -718,10 +718,18 @@ out:
return ret;
}
-int mthca_alloc_qp_buf(struct ibv_pd *pd, struct mthca_qp *qp)
+int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap,
+ struct mthca_qp *qp)
{
int size;
+ qp->rq.max_gs = cap->max_recv_sge;
+ qp->sq.max_gs = align(cap->max_inline_data +
+ sizeof (struct mthca_inline_seg),
+ sizeof (struct mthca_data_seg));
+ if (qp->sq.max_gs < cap->max_send_sge)
+ qp->sq.max_gs = cap->max_send_sge;
+
qp->wrid = malloc((qp->rq.max + qp->sq.max) * sizeof (uint64_t));
if (!qp->wrid)
return -1;
Index: libmthca/src/mthca.h
===================================================================
--- libmthca/src/mthca.h (revision 2235)
+++ libmthca/src/mthca.h (working copy)
@@ -284,7 +284,8 @@ extern int mthca_arbel_post_send(struct
struct ibv_send_wr **bad_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 mthca_qp *qp);
+extern int mthca_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *,
+ struct mthca_qp *qp);
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);
Index: libmthca/src/verbs.c
===================================================================
--- libmthca/src/verbs.c (revision 2235)
+++ libmthca/src/verbs.c (working copy)
@@ -270,7 +270,6 @@ struct ibv_qp *mthca_create_qp(struct ib
qp->qpt = attr->qp_type;
qp->sq.max = align_qp_size(pd->context, attr->cap.max_send_wr);
- qp->sq.max_gs = attr->cap.max_send_sge;
qp->sq.next_ind = 0;
qp->sq.last_comp = qp->sq.max - 1;
qp->sq.head = 0;
@@ -278,14 +277,13 @@ struct ibv_qp *mthca_create_qp(struct ib
qp->sq.last = NULL;
qp->rq.max = align_qp_size(pd->context, attr->cap.max_recv_wr);
- qp->rq.max_gs = attr->cap.max_recv_sge;
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, qp))
+ if (mthca_alloc_qp_buf(pd, &attr->cap, qp))
goto err;
if (pthread_spin_init(&qp->sq.lock, PTHREAD_PROCESS_PRIVATE) ||
--
MST - Michael S. Tsirkin
More information about the general
mailing list