]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
librdmacm/rstream: Set rsocket nonblocking for base tests
authorSean Hefty <sean.hefty@intel.com>
Fri, 11 May 2012 17:33:13 +0000 (10:33 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 16 May 2012 22:54:55 +0000 (15:54 -0700)
The base set of rstream tests want nonblocking rsockets, but don't
actually set the rsocket to nonblocking.  It instead relies on the
MSG_DONTWAIT flag.  Make the code match the expected behavior and
set the rsocket to nonblocking and make nonblocking the default.

Provide a test option to switch it back to blocking mode.  We keep
the existing nonblocking test option for compatibility.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
examples/rstream.c
man/rstream.1

index a313fdb4159e82d44a0e2efc1bf25e45de1c5a0a..825c4deeef513c6fdb48a79cdc8d00b7d5de2aa3 100644 (file)
@@ -56,7 +56,7 @@ static int test_size[] = {
 static int use_rs = 1;
 static int use_async;
 static int verify;
-static int flags;
+static int flags = MSG_DONTWAIT;
 static int custom;
 static int iterations = 1;
 static int transfer_size = 1000;
@@ -150,7 +150,6 @@ static void init_latency_test(int size)
 {
        size_str(test_name, size);
        sprintf(test_name, "%s_lat", test_name);
-       flags |= MSG_DONTWAIT;
        transfer_count = 1;
        transfer_size = size;
        iterations = size_to_count(transfer_size);
@@ -160,7 +159,6 @@ static void init_bandwidth_test(int size)
 {
        size_str(test_name, size);
        sprintf(test_name, "%s_bw", test_name);
-       flags |= MSG_DONTWAIT;
        iterations = 1;
        transfer_size = size;
        transfer_count = size_to_count(transfer_size);
@@ -485,6 +483,10 @@ static int set_test_opt(char *optarg)
                case 'a':
                        use_async = 1;
                        break;
+               case 'b':
+                       flags &= ~MSG_DONTWAIT;
+                       no_delay = 0;
+                       break;
                case 'n':
                        flags |= MSG_DONTWAIT;
                        break;
@@ -499,6 +501,9 @@ static int set_test_opt(char *optarg)
                        use_rs = 0;
                } else if (!strncasecmp("async", optarg, 5)) {
                        use_async = 1;
+               } else if (!strncasecmp("block", optarg, 5)) {
+                       flags &= ~MSG_DONTWAIT;
+                       no_delay = 0;
                } else if (!strncasecmp("nonblock", optarg, 8)) {
                        flags |= MSG_DONTWAIT;
                } else if (!strncasecmp("verify", optarg, 6)) {
@@ -552,6 +557,7 @@ int main(int argc, char **argv)
                        printf("\t[-T test_option]\n");
                        printf("\t    s|sockets - use standard tcp/ip sockets\n");
                        printf("\t    a|async - asynchronous operation\n");
+                       printf("\t    b|blocking - use blocking calls\n");
                        printf("\t    n|nonblocking - use nonblocking calls\n");
                        printf("\t    v|verify - verify data\n");
                        exit(1);
index 701db3ad45b7bc57538152d06ba344f2de8739bf..58bd7e3c3e3ac543e69f30d6746eac5bcc888f0d 100644 (file)
@@ -42,6 +42,8 @@ s | socket  - uses standard socket calls to transfer data
 .P
 a | async - uses asynchronous operation (e.g. select / poll)
 .P
+b | blocking - uses blocking calls
+.P
 n | nonblocking - uses non-blocking calls
 .P
 v | verify - verifies data transfers