From 9c97e8faa0d9592163ad516b921df31f0f64ae32 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Sun, 27 May 2012 14:07:42 -0700 Subject: [PATCH] rstream: Use separate connections for latency/bw tests Optimize each connection for either latency or bandwidth results. Signed-off-by: Sean Hefty --- examples/rstream.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/examples/rstream.c b/examples/rstream.c index 7fa537e5..e8b03240 100644 --- a/examples/rstream.c +++ b/examples/rstream.c @@ -71,12 +71,19 @@ static struct test_size_param test_size[] = { }; #define TEST_CNT (sizeof test_size / sizeof test_size[0]) +enum rs_optimization { + opt_mixed, + opt_latency, + opt_bandwidth +}; + static int use_rs = 1; static int use_async; static int verify; static int flags = MSG_DONTWAIT; static int poll_timeout = 0; static int custom; +static enum rs_optimization optimization; static int size_option; static int iterations = 1; static int transfer_size = 1000; @@ -185,6 +192,7 @@ static int size_to_count(int size) static void init_latency_test(int size) { + optimization = opt_latency; size_str(test_name, size); sprintf(test_name, "%s_lat", test_name); transfer_count = 1; @@ -194,6 +202,7 @@ static void init_latency_test(int size) static void init_bandwidth_test(int size) { + optimization = opt_bandwidth; size_str(test_name, size); sprintf(test_name, "%s_bw", test_name); iterations = 1; @@ -376,8 +385,19 @@ static void set_options(int rs) val = 1; rs_setsockopt(rs, IPPROTO_TCP, TCP_NODELAY, (void *) &val, sizeof(val)); - if (flags & MSG_DONTWAIT) { + if (flags & MSG_DONTWAIT) rs_fcntl(rs, F_SETFL, O_NONBLOCK); + + if (use_rs) { + /* Inline size based on experimental data */ + if (optimization == opt_latency) + val = 384; + else if (optimization == opt_bandwidth) + val = 0; + else + val = 64; + + rs_setsockopt(rs, SOL_RDMA, RDMA_INLINE, &val, sizeof val); } } -- 2.45.2