[ofa-general] [PATCH] ib/mlx4_ib: Optimize stamping in mlx4

Eli Cohen eli at mellanox.co.il
Wed Jan 16 07:14:25 PST 2008


Optimize stamping in mlx4

We can check how much of the WQE was used in the previous time
and stamp only what was used.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>

The same fix can be done also in userspace.
---
 drivers/infiniband/hw/mlx4/qp.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index fc4811c..3138c5e 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -123,8 +123,11 @@ static void stamp_send_wqe(struct mlx4_ib_qp *qp, int n)
 {
 	u32 *wqe = get_send_wqe(qp, n);
 	int i;
+	struct mlx4_wqe_ctrl_seg *ctrl = wqe;
+	int stamp_limit;
 
-	for (i = 16; i < 1 << (qp->sq.wqe_shift - 2); i += 16)
+	stamp_limit = (ctrl->fence_size & 0x3f) << 2;
+	for (i = 16; i < stamp_limit; i += 16)
 		wqe[i] = 0xffffffff;
 }
 
@@ -928,6 +931,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
 		for (i = 0; i < qp->sq.wqe_cnt; ++i) {
 			ctrl = get_send_wqe(qp, i);
 			ctrl->owner_opcode = cpu_to_be32(1 << 31);
+			ctrl->fence_size = 1 << (qp->sq.wqe_shift - 4);
 
 			stamp_send_wqe(qp, i);
 		}
-- 
1.5.3.8





More information about the general mailing list