/*
 * Copyright (c) 2015  AZQ
 */

package ac.ncic.syssw.jni;

import java.nio.ByteBuffer;

public final class JniRdma {
	static {
		System.loadLibrary("jnirdma");
	}

	/**
	 * Get IB ready to send/receive and return a RDMA memory registered
	 * DirectByteBuffer.
	 *
	 * <p>
	 * This native method first parses user configuration, then initializes
	 * IB context (PD, MR, CQ, QP, etc.) and exchanges RDMA connection
	 * information using native sockets.
	 *
	 * <p>
	 * After this native method is done, IB is ready to performance RDMA
	 * operations and a DirectByteBuffer is returned.
	 *
	 * <p>
	 * This is still early demo, and is just for peer-to-peer test. For a
	 * buffer of size <code>bufferSize</code>, a native buffer of size
	 * <code>bufferSize*2</code> is actually allocated, with the first half
	 * for write and second half for read.
	 *
	 * @param userConfig user configuration data.
	 *
	 * @return an MR DirectByteBuffer.
	 */
	public static native ByteBuffer rdmaInit(RdmaUserConfig userConfig) throws RdmaException;

	/**
	 * Perform RDMA write operation.
	 */
	public static native void rdmaWrite() throws RdmaException;

	/**
	 * Perform asynchronous RDMA write operation.
	 */
	public static native void rdmaWriteAsync(int offset, int length) throws RdmaException;

	/**
	 * Poll CQ entries.
	 */
	public static native void rdmaPollCq(int numEntries) throws RdmaException;

	/**
	 * Free/destroy RDMA resources.
	 */
	public static native void rdmaFree();

	/**
	 * A simple native invocation micro-benchmark.
	 */
	public static native long nativeEmpty(long param1, long param2, long param3, long param4, long param5);
}

@@ -661,196 +661,9 @@
 est.
- For a%0A%09 * buffer of size %3Ccode%3EbufferSize%3C/code%3E, a native buffer of size%0A%09 * %3Ccode%3EbufferSize*2%3C/code%3E is actually allocated, with the first half%0A%09 * for write and second half for read.
 %0A
+
 %09 *%0A
@@ -730,12 +730,19 @@
 rn a
-n MR
+ registered
  Dir
@@ -976,16 +976,17 @@
 Perform 
+%22
 asynchro
@@ -989,16 +989,17 @@
 chronous
+%22
  RDMA wr
@@ -1302,169 +1302,6 @@
 );%0A%0A
-%09/**%0A%09 * A simple native invocation micro-benchmark.%0A%09 */%0A%09public static native long nativeEmpty(long param1, long param2, long param3, long param4, long param5);%0A
 %7D%0A

remove that empty JNI call test.