[openib-general] [PATCH] uverbs pingpong test

Michael S. Tsirkin mst at mellanox.co.il
Wed Mar 30 00:48:04 PST 2005


Hi, Roland!
I've run into a problem with the pingpong test: sometimes
I am getting completions with error for the first message it sends.

My analysis is that it takes time for the QP to get to RTR,
and if one side is already in RTS it can start sending and
will get an error.
Therefore we must re-synchronise both sides over a socket
(by calling pp_client_exch_dest) after QP is in RTS on both sides.
Reusing pp_client_exch_dest here is a bit ugly (since we already have all
the data). Let me know what do you think.

The problem goes away after applying the following patch.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: pingpong.c
===================================================================
--- pingpong.c	(revision 2064)
+++ pingpong.c	(working copy)
@@ -427,7 +427,7 @@ int main(int argc, char *argv[])
 	struct ibv_device 	*ib_dev;
 	struct pingpong_context *ctx;
 	struct pingpong_dest     my_dest;
-	struct pingpong_dest    *rem_dest;
+	struct pingpong_dest    *rem_dest, *tmp;
 	struct timeval           start, end;
 	char                    *ib_devname = NULL;
 	char                    *servername = NULL;
@@ -565,6 +565,17 @@ int main(int argc, char *argv[])
 	if (pp_connect_ctx(ctx, ib_port, my_dest.psn, rem_dest))
 		return 1;
 
+	/* Resynch to make sure both sides are in RTR */
+	if (servername)
+		tmp = pp_client_exch_dest(servername, port, &my_dest);
+	else
+		tmp = pp_server_exch_dest(port, &my_dest);
+
+	if (!tmp)
+		return 1;
+
+	free(tmp);
+
 	if (use_event)
 		if (ibv_req_notify_cq(ctx->cq, 0)) {
 			fprintf(stderr, "Couldn't request CQ notification\n");

-- 
MST - Michael S. Tsirkin



More information about the general mailing list