-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for RDMA Atomics + Support for user-defined initiator and responder resources on connect/accept #51
base: master
Are you sure you want to change the base?
Changes from 3 commits
14ee342
0e7f403
402d8a5
f96a00c
759e282
09a75a0
642ed59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -409,7 +409,7 @@ JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1connect( | |
|
||
if (cm_listen_id != NULL) { | ||
memset(&conn_param, 0, sizeof(conn_param)); | ||
conn_param.initiator_depth = dev_attr.max_qp_rd_atom; | ||
conn_param.initiator_depth = dev_attr.max_qp_init_rd_atom; | ||
conn_param.responder_resources = dev_attr.max_qp_rd_atom; | ||
conn_param.retry_count = (unsigned char)retry; | ||
conn_param.rnr_retry_count = (unsigned char)rnr_retry; | ||
|
@@ -430,6 +430,41 @@ JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1connect( | |
} | ||
} | ||
|
||
/* | ||
* Class: com_ibm_disni_verbs_impl_NativeDispatcher | ||
* Method: _connectV2 | ||
* Signature: (JJ)V | ||
*/ | ||
JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1connectV2( | ||
JNIEnv *env, jobject obj, jlong id, jlong param) { | ||
struct rdma_cm_id *cm_listen_id = NULL; | ||
struct rdma_conn_param *conn_param = NULL; | ||
|
||
cm_listen_id = (struct rdma_cm_id *)id; | ||
conn_param = (struct rdma_conn_param *)param; | ||
|
||
if (cm_listen_id != NULL && conn_param!=NULL) { | ||
int ret = rdma_connect(cm_listen_id, conn_param); | ||
if (ret == 0) { | ||
log("j2c::connect: ret %i, guid %" PRIu64 "\n", ret, | ||
ibv_get_device_guid(cm_listen_id->verbs->device)); | ||
} else { | ||
log("j2c::connect: rdma_connect failed\n"); | ||
JNU_ThrowIOExceptionWithLastError(env, | ||
"j2c::connect: rdma_connect failed"); | ||
} | ||
} else { | ||
if(cm_listen_id == NULL){ | ||
log("j2c:connect: cm_listen_id null\n"); | ||
JNU_ThrowIOException(env, "j2c:connect: cm_listen_id null\n"); | ||
} else { | ||
log("j2c:connect: conn_param null\n"); | ||
JNU_ThrowIOException(env, "j2c:connect: conn_param null\n"); | ||
} | ||
} | ||
} | ||
|
||
|
||
/* | ||
* Class: com_ibm_disni_verbs_impl_NativeDispatcher | ||
* Method: _accept | ||
|
@@ -446,7 +481,7 @@ JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1accept( | |
|
||
if (cm_listen_id != NULL) { | ||
memset(&conn_param, 0, sizeof(conn_param)); | ||
conn_param.initiator_depth = dev_attr.max_qp_rd_atom; | ||
conn_param.initiator_depth = dev_attr.max_qp_init_rd_atom; | ||
conn_param.responder_resources = dev_attr.max_qp_rd_atom; | ||
conn_param.retry_count = (unsigned char)retry; | ||
conn_param.rnr_retry_count = (unsigned char)rnr_retry; | ||
|
@@ -463,6 +498,40 @@ JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1accept( | |
} | ||
} | ||
|
||
/* | ||
* Class: com_ibm_disni_verbs_impl_NativeDispatcher | ||
* Method: _acceptV2 | ||
* Signature: (JJ)V | ||
*/ | ||
JNIEXPORT void JNICALL Java_com_ibm_disni_verbs_impl_NativeDispatcher__1acceptV2( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment to connectV2 |
||
JNIEnv *env, jobject obj, jlong id, jlong param) { | ||
struct rdma_cm_id *cm_listen_id = NULL; | ||
struct rdma_conn_param *conn_param = NULL; | ||
|
||
cm_listen_id = (struct rdma_cm_id *)id; | ||
conn_param = (struct rdma_conn_param *)param; | ||
|
||
if (cm_listen_id != NULL && conn_param!=NULL) { | ||
int ret = rdma_accept(cm_listen_id, conn_param); | ||
if (ret == 0) { | ||
log("j2c::connect: ret %i, guid %" PRIu64 "\n", ret, | ||
ibv_get_device_guid(cm_listen_id->verbs->device)); | ||
} else { | ||
log("j2c::connect: rdma_connect failed\n"); | ||
JNU_ThrowIOExceptionWithLastError(env, | ||
"j2c::connect: rdma_connect failed"); | ||
} | ||
} else { | ||
if(cm_listen_id == NULL){ | ||
log("j2c:connect: cm_listen_id null\n"); | ||
JNU_ThrowIOException(env, "j2c:connect: cm_listen_id null\n"); | ||
} else { | ||
log("j2c:connect: conn_param null\n"); | ||
JNU_ThrowIOException(env, "j2c:connect: conn_param null\n"); | ||
} | ||
} | ||
} | ||
|
||
/* | ||
* Class: com_ibm_disni_verbs_impl_NativeDispatcher | ||
* Method: _ackCmEvent | ||
|
@@ -823,6 +892,59 @@ Java_com_ibm_disni_verbs_impl_NativeDispatcher__1queryOdpSupport(JNIEnv *env, | |
return ret; | ||
} | ||
|
||
/* | ||
* Class: com_ibm_disni_verbs_impl_NativeDispatcher | ||
* Method: _queryMaxResponderResources | ||
* Signature: (J)I | ||
*/ | ||
JNIEXPORT jint JNICALL | ||
Java_com_ibm_disni_verbs_impl_NativeDispatcher__1queryMaxResponderResources( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is not what I had in mind. I would like to be able to get all device attributes in Java. Otherwise we will be adding new JNI functions for every member of the struct along the way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. it was just more work. |
||
JNIEnv *env, | ||
jobject obj, | ||
jlong id) { | ||
jint ret = -1; | ||
struct ibv_context *context = (struct ibv_context *)id; | ||
|
||
struct ibv_device_attr dev_attr; | ||
ret = ibv_query_device(context, &dev_attr); | ||
|
||
if(ret == 0) { | ||
ret = dev_attr.max_qp_rd_atom; | ||
} else { | ||
log("j2c::queryMaxResponderResources: ibv_query_device failed, error %s\n", | ||
strerror(ret)); | ||
ret = -1; | ||
JNU_ThrowIOExceptionWithLastError(env, "j2c::queryMaxResponderResources: ibv_query_device failed"); | ||
} | ||
return ret; | ||
} | ||
|
||
/* | ||
* Class: com_ibm_disni_verbs_impl_NativeDispatcher | ||
* Method: _queryMaxInitiatorDepth | ||
* Signature: (J)I | ||
*/ | ||
JNIEXPORT jint JNICALL | ||
Java_com_ibm_disni_verbs_impl_NativeDispatcher__1queryMaxInitiatorDepth(JNIEnv *env, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment queryMaxResponderResources |
||
jobject obj, | ||
jlong id) { | ||
jint ret = -1; | ||
struct ibv_context *context = (struct ibv_context *)id; | ||
|
||
struct ibv_device_attr dev_attr; | ||
ret = ibv_query_device(context, &dev_attr); | ||
|
||
if(ret == 0) { | ||
ret = dev_attr.max_qp_init_rd_atom; | ||
} else { | ||
log("j2c::queryMaxInitiatorDepth: ibv_query_device failed, error %s\n", | ||
strerror(ret)); | ||
ret = -1; | ||
JNU_ThrowIOExceptionWithLastError(env, "j2c::queryMaxInitiatorDepth: ibv_query_device failed"); | ||
} | ||
return ret; | ||
} | ||
|
||
/* | ||
* Class: com_ibm_disni_verbs_impl_NativeDispatcher | ||
* Method: _expPrefetchMr | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the idea of multiple connect implementations. Why not only keep V2 and expose query_device to Java. This solves multiple problems at once: 1) setting initiator/responder resource without knowing what the max are 2) two implementations of the same function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. However, since the libdisni is shipped separately, it may force some developers to recompile their java code which uses the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be ok. Developers can always choose to use an old version of the library if needed.