-
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 2 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 | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
package com.ibm.disni.verbs; | ||
|
||
import java.io.IOException; | ||
import java.nio.ByteBuffer; | ||
import java.nio.ByteOrder; | ||
|
||
// TODO: Auto-generated Javadoc | ||
//struct rdma_conn_param { | ||
|
@@ -51,6 +53,8 @@ public class RdmaConnParam { | |
protected byte srq; | ||
protected int qp_num; | ||
|
||
public static int CSIZE = 24; | ||
|
||
public RdmaConnParam() { | ||
this.private_data_addr = 0; | ||
this.private_data_len = 0; | ||
|
@@ -111,7 +115,7 @@ public byte getResponder_resources() { | |
* @param responder_resources the new responder resources. | ||
*/ | ||
public void setResponder_resources(byte responder_resources) throws IOException { | ||
throw new IOException("Operation currently not supported"); | ||
this.responder_resources = responder_resources; | ||
} | ||
|
||
/** | ||
|
@@ -129,7 +133,7 @@ public byte getInitiator_depth() { | |
* @param initiator_depth the new initiater depth. | ||
*/ | ||
public void setInitiator_depth(byte initiator_depth) throws IOException { | ||
throw new IOException("Operation currently not supported"); | ||
this.initiator_depth = initiator_depth; | ||
} | ||
|
||
/** | ||
|
@@ -221,4 +225,23 @@ public int getQp_num() { | |
public void setQp_num(int qp_num) throws IOException { | ||
throw new IOException("Operation currently not supported"); | ||
} | ||
|
||
|
||
public void writeBack(ByteBuffer buffer) { | ||
buffer.order(ByteOrder.LITTLE_ENDIAN); | ||
buffer.putLong(private_data_addr); | ||
TaranovK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
buffer.order(ByteOrder.nativeOrder()); | ||
buffer.put(private_data_len); | ||
buffer.put(responder_resources); | ||
buffer.put(initiator_depth); | ||
buffer.put(flow_control); | ||
buffer.put(retry_count); | ||
buffer.put(rnr_retry_count); | ||
buffer.put(srq); | ||
buffer.put((byte)0); | ||
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. cq_num is u32 not u8, so this should be putInt(0) 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. here I do not agree. Actually, buffer.put((byte)0); is a padding. cq_num field is 8 byte aligned. To add cq_num the code should be: buffer.put(srq); buffer.put((byte)0); buffer.putInt(cq_num); 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. Makes sense. |
||
} | ||
|
||
public int size() { | ||
return CSIZE; | ||
} | ||
} |
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.