diff mbox

[perftest,v2] Bug fix write latency

Message ID 1488727361-23364-1-git-send-email-Ram.Amrani@cavium.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Amrani, Ram March 5, 2017, 3:22 p.m. UTC
Avoid setting the value '1' in the MR. If this does happen then the
server will send two consecutive packets, regardless of the client's
state. This can cause the application to hang. If the client reaches
the busy-wait loop after the second write then it'll hang in the loop
forever, waiting for the value of the first write.

Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
---
 src/perftest_resources.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Amrani, Ram March 5, 2017, 3:41 p.m. UTC | #1
> Do you familiar with Perftest Git-hub repository ?
> 	https://github.com/linux-rdma/perftest
> you can use it to push patches as well.

I wasn't familiar with it.
I'll use it next time.

Thanks,
Ram

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/perftest_resources.c b/src/perftest_resources.c
index afae5f2..21ff972 100755
--- a/src/perftest_resources.c
+++ b/src/perftest_resources.c
@@ -1252,7 +1252,11 @@  int create_single_mr(struct pingpong_context *ctx, struct perftest_parameters *u
 	/* Initialize buffer with random numbers */
 	srand(time(NULL));
 	for (i = 0; i < ctx->buff_size; i++) {
-		((char*)ctx->buf[qp_index])[i] = (char)rand();
+		/* prevent the value 1 from being written into the buffer so in,
+		 * e.g., write latency test, the server won't send two packets
+		 * consecutively without receiving a packet from the client first.
+		 */ 
+		((char*)ctx->buf[qp_index])[i] = 2 + ((unsigned char)rand() % 255);
 	}
 
 	return 0;