com.ibm.net.rdma.jverbs.endpoints
Class RdmaEndpoint
- java.lang.Object
-
- com.ibm.net.rdma.jverbs.endpoints.RdmaEndpoint
-
- Direct Known Subclasses:
- RdmaActiveEndpoint
public class RdmaEndpoint extends java.lang.ObjectThis class represents an RDMA endpoint similar to Socket. Conceptually, endpoints behave like sockets for control operations (e.g., connect(), disconnect()), but behave like RDMA ConnectionId's once connected (offering preparePostSend(), preparePostRecv(), registerMemory()). The default queue pair created assumes MAX_SGE as 10 and MAX_WR as 400. To create queue pair with preferred size override createQueuePair of RdmaActiveEndpointGroup class by extending as custom EndPointGroup class
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Close this endpoint.voidconnect(java.net.SocketAddress destinationAddress, int timeout)Connect this endpoint to a remote server endpoint.voidderegisterMemory(MemoryRegion memoryRegion)Deregister memory.ConnectionIdgetConnectionId()Gets the connection id of this endpoint.java.net.SocketAddressgetDestinationAddress()Gets the destination address of this endpoint.intgetDestinationPort()Gets the destination port of this endpoint.ProtectionDomaingetProtectionDomain()Returns the protection domain.QueuePairgetQueuePair()Gets the Queue Pair (QP) of this connection.java.net.SocketAddressgetSourceAddress()Gets the source address of this endpoint.intgetSourcePort()Gets the source port of this endpoint.booleanisClosed()Checks if the endpoint is closed.booleanisConnected()Checks if the endpoint is connected.PostReceiveMethodpreparePostReceive(java.util.List<ReceiveWorkRequest> receiveList)Post a receive operation on this endpoint.PostSendMethodpreparePostSend(java.util.List<SendWorkRequest> sendList)Post a send operation on this endpoint.RegisterMemoryRegionMethodregisterMemory(java.nio.ByteBuffer buffer)Register memory on this endpoint.
-
-
-
Method Detail
-
close
public void close() throws java.io.IOExceptionClose this endpoint. This closes the connection and free's all the resources like queue pair.- Throws:
java.io.IOException- If an I/O error occurs
-
connect
public void connect(java.net.SocketAddress destinationAddress, int timeout) throws java.lang.IllegalArgumentException, java.io.IOExceptionConnect this endpoint to a remote server endpoint. This method does resolve address and route before making connection.- Parameters:
destinationAddress- the IP address of the remote server endpoint.timeout- not supported.- Throws:
java.io.IOException- If an I/O error occurs like Address or Route can not be resolved.java.lang.IllegalArgumentException- If the value of any of the parameter is invalid
-
deregisterMemory
public void deregisterMemory(MemoryRegion memoryRegion) throws java.lang.IllegalArgumentException, java.io.IOException
Deregister memory.- Parameters:
memoryRegion- the memory region to be de-registered.- Throws:
java.lang.IllegalArgumentExceptionjava.io.IOException
-
getConnectionId
public ConnectionId getConnectionId()
Gets the connection id of this endpoint.- Returns:
- the RDMA connection identifier.
-
getDestinationAddress
public java.net.SocketAddress getDestinationAddress() throws java.io.IOExceptionGets the destination address of this endpoint.- Returns:
- the dst addr.
- Throws:
java.io.IOException
-
getDestinationPort
public int getDestinationPort() throws java.io.IOExceptionGets the destination port of this endpoint.- Returns:
- the dst port.
- Throws:
java.io.IOException
-
getProtectionDomain
public ProtectionDomain getProtectionDomain()
Returns the protection domain.- Returns:
- the protection domain..
-
getQueuePair
public QueuePair getQueuePair()
Gets the Queue Pair (QP) of this connection.- Returns:
- the Queue Pair (QP).
-
getSourceAddress
public java.net.SocketAddress getSourceAddress() throws java.io.IOExceptionGets the source address of this endpoint.- Returns:
- the src addr.
- Throws:
java.io.IOException- If an I/O error occurs
-
getSourcePort
public int getSourcePort() throws java.io.IOExceptionGets the source port of this endpoint.- Returns:
- the src port.
- Throws:
java.io.IOException
-
isClosed
public boolean isClosed()
Checks if the endpoint is closed.- Returns:
- true, if is closed
-
isConnected
public boolean isConnected()
Checks if the endpoint is connected.- Returns:
- true, if is connected
-
preparePostReceive
public PostReceiveMethod preparePostReceive(java.util.List<ReceiveWorkRequest> receiveList) throws java.lang.IllegalArgumentException, java.io.IOException
Post a receive operation on this endpoint.- Parameters:
receiveList- list of receive requests.- Returns:
- a stateful verb method (SVM) ready to execute the receive operations.
- Throws:
java.lang.IllegalArgumentExceptionjava.io.IOException
-
preparePostSend
public PostSendMethod preparePostSend(java.util.List<SendWorkRequest> sendList) throws java.lang.IllegalArgumentException, java.io.IOException
Post a send operation on this endpoint.- Parameters:
sendList- list of send requests.- Returns:
- a stateful verb method (SVM) ready to execute the send operations.
- Throws:
java.lang.IllegalArgumentExceptionjava.io.IOException
-
registerMemory
public RegisterMemoryRegionMethod registerMemory(java.nio.ByteBuffer buffer) throws java.lang.IllegalArgumentException, java.io.IOException
Register memory on this endpoint.- Parameters:
buffer- the buffer to be registered. The buffer needs to represent off-heap memory.- Returns:
- a stateful verb method (SVM) ready to execute the memory registration.
- Throws:
java.lang.IllegalArgumentExceptionjava.io.IOException
-
-