[ofa-general] Re: [PATCH] libmlx4: fix qp capabilities
Roland Dreier
rdreier at cisco.com
Tue May 29 11:27:46 PDT 2007
thanks, that bug looks familiar from libmthca. I prefer to fix it
like as below, though, since that gives the true capabilities of the
QP being created.
Also, how did you create your patch?
> --- libmlx4.orig/src/qp.c 2007-05-29 13:13:57.000000000 +0300
> +++ libmlx4/src/qp.c 2007-05-29 14:41:33.000000000 +0300
> @@ -396,12 +396,13 @@ int mlx4_alloc_qp_buf(struct ibv_pd *pd,
> cap->max_send_sge = 1;
I couldn't find that context line in any version of src/qp.c that I had.
diff --git a/src/qp.c b/src/qp.c
index fa20dfa..8e2a3d3 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -390,7 +390,6 @@ int mlx4_alloc_qp_buf(struct ibv_pd *pd, struct ibv_qp_cap *cap,
int max_sq_sge;
qp->rq.max_gs = cap->max_recv_sge;
- qp->sq.max_gs = cap->max_send_sge;
max_sq_sge = align(cap->max_inline_data + sizeof (struct mlx4_wqe_inline_seg),
sizeof (struct mlx4_wqe_data_seg)) / sizeof (struct mlx4_wqe_data_seg);
if (max_sq_sge < cap->max_send_sge)
@@ -478,7 +477,7 @@ void mlx4_set_sq_sizes(struct mlx4_qp *qp, struct ibv_qp_cap *cap,
{
int wqe_size;
- wqe_size = 1 << qp->sq.wqe_shift;
+ wqe_size = (1 << qp->sq.wqe_shift) - sizeof (struct mlx4_wqe_ctrl_seg);
switch (type) {
case IBV_QPT_UD:
wqe_size -= sizeof (struct mlx4_wqe_datagram_seg);
@@ -493,7 +492,7 @@ void mlx4_set_sq_sizes(struct mlx4_qp *qp, struct ibv_qp_cap *cap,
break;
}
- qp->sq.max_gs = wqe_size / sizeof (struct mlx4_wqe_data_seg);
+ qp->sq.max_gs = wqe_size / sizeof (struct mlx4_wqe_data_seg);
cap->max_send_sge = qp->sq.max_gs;
qp->max_inline_data = wqe_size - sizeof (struct mlx4_wqe_inline_seg);
cap->max_inline_data = qp->max_inline_data;
More information about the general
mailing list