diff options
author | Roland Dreier <rolandd@cisco.com> | 2007-05-29 11:31:04 -0700 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-05-29 11:31:04 -0700 |
commit | fdb57ccf86432dd8994c726eb2bf419766eed5b2 (patch) | |
tree | abe4bd3fa16d153e6770a00084bb0989f27ebcc5 | |
parent | af7707cecdfd5ca8a38b4d855070ebfc310a339f (diff) | |
download | libmlx4-fdb57ccf86432dd8994c726eb2bf419766eed5b2.tar.gz |
Fix max_send_sge and max_inline_data returned from create QP
Fix the calulation of max_inline_data and max_send_sge returned to the
user. Without this fix, the size of the SQ WQEs may increase every
time create QP is called using values returned from a previous call.
For example, here is a quote from the output of the test showing the
problem with a UD QP:
request: cap.max_send_sge = 1, cap.max_inline_data = 0
got: cap.max_send_sge = 5, cap.max_inline_data = 76
request: cap.max_send_sge = 5, cap.max_inline_data = 76
got: cap. max_send_sge = 13, cap.max_inline_data = 204
The problem is that we forgot to subtract the size of the control
segment in mlx4_set_sq_sizes().
Pointed out by Eli Cohen <eli@mellanox.co.il>.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | src/qp.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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; |