changeset 54952:1e1db86ea836 rsocket-branch

rsocket-branch: Review comments from Brian, A, B, and D Contributed-by: Lucy Lu <yingqi.lu@intel.com>
author chegar
date Thu, 31 Jan 2019 14:12:49 +0000
parents 919516f93dcf
children 3e1ebe33554c
files src/jdk.net/linux/native/libextnet/LinuxRdmaSocketDispatcherImpl.c src/jdk.net/linux/native/libextnet/rdma_util_md.c src/jdk.net/linux/native/libextnet/rdma_util_md.h
diffstat 3 files changed, 9 insertions(+), 75 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.net/linux/native/libextnet/LinuxRdmaSocketDispatcherImpl.c	Wed Jan 30 14:24:11 2019 +0000
+++ b/src/jdk.net/linux/native/libextnet/LinuxRdmaSocketDispatcherImpl.c	Thu Jan 31 14:12:49 2019 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,23 +87,7 @@
         jclass clazz, jobject fdo, jlong address, jint len) {
     jint fd = (*env)->GetIntField(env, fdo, fd_fdID);
     void *buf = (void *)jlong_to_ptr(address);
-    jint result = convertReturnVal(env, rs_read(fd, buf, len), JNI_TRUE);
-/*
-    if (result == IOS_UNAVAILABLE
-            && (rs_fcntl(fd, F_GETFL, 0) & O_NONBLOCK) == 0) {  // blocking
-        struct pollfd pfd[1];
-        pfd[0].fd = fd;
-        pfd[0].events = POLLIN;
-        rs_poll(pfd, 1, -1);
-        if (pfd[0].revents & POLLIN)
-            result = convertReturnVal(env, rs_read(fd, buf, len), JNI_TRUE);
-        else {
-            JNU_ThrowIOExceptionWithLastError(env, "Read failed");
-            return IOS_THROWN;
-        }
-    }
-*/
-    return result;
+    return convertReturnVal(env, rs_read(fd, buf, len), JNI_TRUE);
 }
 
 JNIEXPORT jlong JNICALL
@@ -111,23 +95,7 @@
         jclass clazz, jobject fdo, jlong address, jint len) {
     jint fd = (*env)->GetIntField(env, fdo, fd_fdID);
     struct iovec *iov = (struct iovec *)jlong_to_ptr(address);
-    jlong result = convertLongReturnVal(env, rs_readv(fd, iov, len), JNI_TRUE);
-/*
-    if (result == IOS_UNAVAILABLE
-            && (rs_fcntl(fd, F_GETFL, 0) & O_NONBLOCK) == 0) {  // blocking
-        struct pollfd pfd[1];
-        pfd[0].fd = fd;
-        pfd[0].events = POLLIN;
-        rs_poll(pfd, 1, -1);
-        if (pfd[0].revents & POLLIN)
-            result = convertLongReturnVal(env, rs_readv(fd, iov, len), JNI_TRUE);
-        else {
-            JNU_ThrowIOExceptionWithLastError(env, "Read failed");
-            return IOS_THROWN;
-        }
-    }
-*/
-    return result;
+    return convertLongReturnVal(env, rs_readv(fd, iov, len), JNI_TRUE);
 }
 
 JNIEXPORT jint JNICALL
@@ -135,23 +103,7 @@
         jclass clazz, jobject fdo, jlong address, jint len) {
     jint fd = (*env)->GetIntField(env, fdo, fd_fdID);
     void *buf = (void *)jlong_to_ptr(address);
-    jint result = convertReturnVal(env, rs_write(fd, buf, len), JNI_FALSE);
-/*
-    if (result == IOS_UNAVAILABLE
-            && (rs_fcntl(fd, F_GETFL, 0) & O_NONBLOCK) == 0) {  // blocking
-        struct pollfd pfd[1];
-        pfd[0].fd = fd;
-        pfd[0].events = POLLOUT;
-        rs_poll(pfd, 1, -1);
-        if (pfd[0].revents & POLLOUT)
-            result = convertReturnVal(env, rs_write(fd, buf, len), JNI_FALSE);
-        else {
-            JNU_ThrowIOExceptionWithLastError(env, "Write failed");
-            return IOS_THROWN;
-        }
-    }
-*/
-    return result;
+    return convertReturnVal(env, rs_write(fd, buf, len), JNI_FALSE);
 }
 
 JNIEXPORT jlong JNICALL
@@ -159,24 +111,7 @@
         jclass clazz, jobject fdo, jlong address, jint len) {
     jint fd = (*env)->GetIntField(env, fdo, fd_fdID);
     struct iovec *iov = (struct iovec *)jlong_to_ptr(address);
-    jlong result = convertLongReturnVal(env, rs_writev(fd, iov, len),
-            JNI_FALSE);
-/*
-    if (result == IOS_UNAVAILABLE
-            && (rs_fcntl(fd, F_GETFL, 0) & O_NONBLOCK) == 0) {  // blocking
-        struct pollfd pfd[1];
-        pfd[0].fd = fd;
-        pfd[0].events = POLLOUT;
-        rs_poll(pfd, 1, -1);
-        if (pfd[0].revents & POLLOUT)
-            result = convertLongReturnVal(env, rs_writev(fd, iov, len), JNI_FALSE);
-        else {
-            JNU_ThrowIOExceptionWithLastError(env, "Write failed");
-            return IOS_THROWN;
-        }
-    }
-*/
-    return result;
+    return convertLongReturnVal(env, rs_writev(fd, iov, len), JNI_FALSE);
 }
 
 static void closeFileDescriptor(JNIEnv *env, int fd) {
--- a/src/jdk.net/linux/native/libextnet/rdma_util_md.c	Wed Jan 30 14:24:11 2019 +0000
+++ b/src/jdk.net/linux/native/libextnet/rdma_util_md.c	Thu Jan 31 14:12:49 2019 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -225,6 +225,7 @@
     int rv, s;
     s = rs_socket(PF_INET, SOCK_STREAM, 0);
     if (s < 0) {
+        rs_close(s);
         return JNI_FALSE;
     }
     return JNI_TRUE;
@@ -331,7 +332,7 @@
         if (read_rv > 0) {
           break;
         }
-      } 
+      }
     return (nanoTimeout / NET_NSEC_PER_MSEC);
 }
 
--- a/src/jdk.net/linux/native/libextnet/rdma_util_md.h	Wed Jan 30 14:24:11 2019 +0000
+++ b/src/jdk.net/linux/native/libextnet/rdma_util_md.h	Thu Jan 31 14:12:49 2019 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,6 @@
                  struct sockaddr *from, socklen_t *fromlen);
 int RDMA_ReadV(int s, const struct iovec * vector, int count);
 int RDMA_Send(int s, void *msg, int len, unsigned int flags);
-int RDMA_SendTo(int s, const void *msg, int len,  unsigned  int
-               flags, const struct sockaddr *to, int tolen);
 int RDMA_Writev(int s, const struct iovec * vector, int count);
 int RDMA_Connect(int s, struct sockaddr *addr, int addrlen);
 int RDMA_Accept(int s, struct sockaddr *addr, socklen_t *addrlen);