]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
Refresh of rstream-conn
authorSean Hefty <sean.hefty@intel.com>
Sun, 27 May 2012 21:46:25 +0000 (14:46 -0700)
committerSean Hefty <sean.hefty@intel.com>
Sun, 27 May 2012 21:46:25 +0000 (14:46 -0700)
examples/rstream.c

index 7fa537e5206844c3e91c639e4a32ff3e08c8d574..e8b032402d3828d9379dc3b0fc6fecdb779893fe 100644 (file)
@@ -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);
        }
 }