[ofa-general] [PATCH] libmlx4: Optimize QP stamping

Eli Cohen eli at mellanox.co.il
Mon Jun 16 07:59:34 PDT 2008


>From d377b7289a192670dc670663253df8ac2da0bc96 Mon Sep 17 00:00:00 2001
From: Eli Cohen <eli at mellanox.co.il>
Date: Mon, 2 Jun 2008 11:20:14 +0300
Subject: [PATCH] libmlx4: Optimize QP stamping

Optimize samping by reading the value of the DS field just before we
stamp, which would give the effective size of the descriptor as used
in the previous post and. Then we stamp only that area, since the rest
of the descriptor is already stamped.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
 src/qp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/qp.c b/src/qp.c
index 4322513..f3cf839 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -74,8 +74,9 @@ static void stamp_send_wqe(struct mlx4_qp *qp, int n)
 {
 	uint32_t *wqe = get_send_wqe(qp, n);
 	int i;
+	int ds = (((struct mlx4_wqe_ctrl_seg *)wqe)->fence_size & 0x3f) << 2;
 
-	for (i = 16; i < 1 << (qp->sq.wqe_shift - 2); i += 16)
+	for (i = 16; i < ds; i += 16)
 		wqe[i] = 0xffffffff;
 }
 
@@ -95,6 +96,7 @@ void mlx4_qp_init_sq_ownership(struct mlx4_qp *qp)
 	for (i = 0; i < qp->sq.wqe_cnt; ++i) {
 		ctrl = get_send_wqe(qp, i);
 		ctrl->owner_opcode = htonl(1 << 31);
+		ctrl->fence_size = 1 << (qp->sq.wqe_shift - 4);
 
 		stamp_send_wqe(qp, i);
 	}
-- 
1.5.5.1





--
Eli Cohen
Mellanox Technologies LTD.
SW- Linux
Phone: +972 (4) 909 7200 (ext 276)
Mobile: +972 (54) 650 1206
E-mail: eli at mellanox.co.il

----------------------------------------------------------------------
Emails belong on computers, trees belong in forests; if you must print
this, do it on recycled paper.
http://www.greenpeace.org/international/
----------------------------------------------------------------------


Disclaimer added by CodeTwo Exchange Rules
http://www.codetwo.com



More information about the general mailing list