libmlx4: fix possible inline size
PATCH v2 1/1 libmlx4: fix possible inline size
The current driver checks required inline size by making sure it does not exceed 1024. This is wrong since the whole WQE is limited to 1008 bytes. Moreover, a more careful claculation is required to avoid cases where the application requests inline support in a certain size that when used later could cause connections to stall due to bad WQEs. This patch takes into account the size of the WQE, the segements used to create a WQE and the overhead incured by the inline segments themselves.
---
Changes from previous version:
Use the existing num_inline_segs() function in clacualting the max possible inline size in verify_sizes()
Use a macro to define the max WQE size.
There is a complementary patch following this one that fixes yet another problem related to inline cacluation.
src/mlx4.h | 5 +++++ src/qp.c | 2 +- src/verbs.c | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 50 insertions(+), 6 deletions(-)
src/mlx4.h +5 -0
@@ -130,6 +130,10 @@ enum { MLX4_CQE_OPCODE_RESIZE = 0x16, }; +enum { +MLX4_MAX_WQE_SIZE =1008 +}; +struct mlx4_device {struct ibv_device ibv_dev;int page_size;
@@ -349,6 +353,7 @@ int mlx4_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr, struct ibv_recv_wr **bad_wr);void mlx4_calc_sq_wqe_size (struct ibv_qp_cap *cap,enum ibv_qp_type type,struct mlx4_qp *qp); +int num_inline_segs (int data,enum ibv_qp_type type);int mlx4_alloc_qp_buf (struct ibv_pd *pd,struct ibv_qp_cap *cap,enum ibv_qp_type type,struct mlx4_qp *qp); void mlx4_set_sq_sizes(struct mlx4_qp *qp, struct ibv_qp_cap *cap,
src/qp.c +1 -1
@@ -495,7 +495,7 @@ out:return ret; } -static int num_inline_segs (int data,enum ibv_qp_type type) +int num_inline_segs (int data,enum ibv_qp_type type) {/* * Inline data segments are not allowed to cross 64 byte
src/verbs.c +44 -5
61 lines not on this page · raw message
Signature · 6 lines
1.7.3 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html