The declarations in this header file correspond to the definitions in adapter.c.
More...
#include <stdbool.h>
#include <stdint.h>
#include "endpoint_manager.h"
#include "cdi_raw_api.h"
Go to the source code of this file.
|
typedef struct ControlInterfaceState * | ControlInterfaceHandle |
| Forward reference.
|
|
typedef void(* | MessageFromEndpoint) (void *param_ptr, Packet *packet_ptr, EndpointMessageType message_type) |
| Prototype of function used to process packet messages from the endpoint.
|
|
typedef struct AdapterEndpointState * | AdapterEndpointHandle |
| Forward declaration to create pointer to adapter endpoint state when used.
|
|
typedef struct AdapterConnectionState * | AdapterConnectionHandle |
| Forward declaration to create pointer to adapter connection state when used.
|
|
|
enum | AdapterPacketAckStatus { kAdapterPacketStatusOk
, kAdapterPacketStatusFailed
, kAdapterPacketStatusNotConnected
} |
| Values used for adapter packet acknowledgment status. More...
|
|
enum | EndpointDirection { kEndpointDirectionSend
, kEndpointDirectionReceive
, kEndpointDirectionBidirectional
} |
| The direction of packets that an endpoint will be used for. More...
|
|
enum | EndpointDataType { kEndpointTypeData
, kEndpointTypeControl
} |
| The type of transmission data that an endpoint will be used for. More...
|
|
enum | EndpointTransmitQueueLevel { kEndpointTransmitQueueEmpty
, kEndpointTransmitQueueIntermediate
, kEndpointTransmitQueueFull
, kEndpointTransmitQueueNa
} |
|
enum | EndpointMessageType { kEndpointMessageTypePacketSent
, kEndpointMessageTypePacketReceived
} |
|
enum | PollState { kPollStart
, kPollRunning
, kPollStopping
, kPollStopped
} |
| Values used to determine current running state of a poll thread. More...
|
|
The declarations in this header file correspond to the definitions in adapter.c.
◆ MessageFromEndpoint
Prototype of function used to process packet messages from the endpoint.
- Parameters
-
param_ptr | A pointer to data used by the function. |
packet_ptr | A pointer to packet state data. |
message_type | Endpoint message type. |
◆ AdapterPacketAckStatus
Values used for adapter packet acknowledgment status.
Enumerator |
---|
kAdapterPacketStatusOk | The transmitted packet was acknowledged to have been received.
|
kAdapterPacketStatusFailed | The packet transmission resulted in an error.
|
kAdapterPacketStatusNotConnected | The packet could not be sent because the adapter endpoint isn't connected.
|
◆ EndpointDataType
The type of transmission data that an endpoint will be used for.
Enumerator |
---|
kEndpointTypeData | Endpoint used for normal data transmission.
|
kEndpointTypeControl | Endpoint used for control command transmission (uses sockets).
|
◆ EndpointDirection
The direction of packets that an endpoint will be used for.
Enumerator |
---|
kEndpointDirectionSend | Endpoint can send packets to its remote host.
|
kEndpointDirectionReceive | Endpoint can receive packets from its remote host.
|
kEndpointDirectionBidirectional | Endpoint can send packets to and receive from the remote host.
|
◆ EndpointMessageType
Enumeration of possible values used to specify the type of message generated from an endpoint using the MessageFromEndpoint callback function.
Enumerator |
---|
kEndpointMessageTypePacketSent | Packet was sent.
|
kEndpointMessageTypePacketReceived | Packet was received.
|
◆ EndpointTransmitQueueLevel
Enumeration of possible values that can be returned from the EfaGetTransmitQueueLevel() adapter API function.
Enumerator |
---|
kEndpointTransmitQueueEmpty | Transmit queue has no packets in it.
|
kEndpointTransmitQueueIntermediate | Transmit queue is somewhere between empty and full.
|
kEndpointTransmitQueueFull | Transmit queue has room for no more packets.
|
kEndpointTransmitQueueNa | Endpoint is not a polled mode driver.
|
◆ PollState
Values used to determine current running state of a poll thread.
Enumerator |
---|
kPollStart | Poll thread is starting and has not ran through a pool loop yet.
|
kPollRunning | Poll thread has ran through at least one poll loop.
|
kPollStopping | Poll thread is stopping.
|
kPollStopped | Poll thread stopped.
|
◆ CdiAdapterCloseEndpoint()
Close an endpoint and free its resources.
- Parameters
-
handle | The handle of the endpoint which is to be closed. |
- Returns
- CdiReturnStatus kCdiStatusOk upon success otherwise an indication of the failure.
◆ CdiAdapterCreateConnection()
Create an adapter connection. An endpoint is a one-way communications channel on which packets can be sent to or received from a remote host whose address and port number are specified here.
NOTE: This API only creates resources used by the endpoint. The CdiAdapterStartEndpoint() function must be used to start it.
- Parameters
-
config_data_ptr | Pointer to adapter endpoint config data. |
return_handle_ptr | The address of a location to have the newly opened endpoint's handle written. |
- Returns
- CdiReturnStatus kCdiStatusOk upon successful open otherwise an indication of the failure.
◆ CdiAdapterDestroyConnection()
Destroy a connnection closing related open endpoints, freeing their resources.
- Parameters
-
handle | The handle of the connection which is to be closed. |
- Returns
- CdiReturnStatus kCdiStatusOk upon success otherwise an indication of the failure.
◆ CdiAdapterEnqueueSendPacket()
Add a single packet to the send packet queue. The packet will be sent to the remote host for the specified endpoint. Only valid for endpoints that were open for sending. NOTE: This function is called by the main payload thread TxPayloadThread() as well as by EFA probe control. MEMORY NOTE: The Packet structure is not copied, it is merely referenced. Its storage must come from a pool.
- Parameters
-
handle | The handle of the endpoint through which to send the packet. |
destination_address_ptr | Pointer to destination address data (sockaddr_in). |
packet_ptr | The address of the packet to enqueue for sending to the connected endpoint. |
- Returns
- CdiReturnStatus kCdiStatusOk if the packet was successfully queued for sending or a value that indicates the nature of the failure.
◆ CdiAdapterEnqueueSendPackets()
Add a list of packets to the send packet queue. The packets will be sent to the remote host for the specified endpoint. Only valid for endpoints that were open for sending. NOTE: This function is called by the main payload thread TxPayloadThread() as well as by EFA probe control. MEMORY NOTE: While the packet_list_ptr's contents are copied, the Packet structures referenced by it are not copied. Their storage must come from a pool.
- Parameters
-
handle | The handle of the endpoint through which to send the packet. |
packet_list_ptr | The address of the list of packets to enqueue for sending to the connected endpoint. |
- Returns
- CdiReturnStatus kCdiStatusOk if the packet was successfully queued for sending or kCdiStatusQueueFull if the packet could not be queued on account of the queue being full.
◆ CdiAdapterFreeBuffer()
Free a buffer that was provided by the endpoint in a received packet through the queue function. The resources returned to the endpoint include the SGList structure, all of the SGL entries in the list, and the memory buffers addressed by the entries.
- Parameters
-
handle | The handle of the endpoint from which the packet was received. |
sgl_ptr | The SGL describing the resources to be returned to the endpoint. |
- Returns
- CdiReturnStatus kCdiStatusOk if the packet buffer memory was successfully freed or a value that indicates the nature of the failure.
◆ CdiAdapterGetPort()
Gets the number of the port to which the specified endpoint is using.
- Parameters
-
handle | The handle of the endpoint to get the port number from. |
port_number_ptr | Address of where the port number will be written. |
- Returns
- CdiReturnStatus kCdiStatusOk if the packet buffer memory was successfully freed or a value that indicates the nature of the failure.
◆ CdiAdapterGetTransmitQueueLevel()
Checks transmitter queue level. A polled mode endpoint will return kEndpointTransmitBufferFull when its transmit queue is full while awaiting acknowledgements. Non-polled endpoints always return kEndpointTransmitBufferNa.
- Parameters
-
handle | The handle of the endpoint for which to check its transmit queue level. |
- Returns
- EndpointTransmitQueueLevel a value indicating the current fullness of the transmit queue.
◆ CdiAdapterOpenEndpoint()
Opens an endpoint for the specified connection. An endpoint is a one-way communications channel on which packets can be sent to or received from a remote host whose address and port number are specified here.
NOTE: This function only creates resources used by the endpoint. The CdiAdapterStartEndpoint() function must be used to start it.
- Parameters
-
config_data_ptr | Pointer to adapter endpoint config data. |
return_handle_ptr | The address of a location to have the newly opened endpoint's handle written. |
- Returns
- CdiReturnStatus kCdiStatusOk upon successful open otherwise an indication of the failure.
◆ CdiAdapterPollEndpoint()
While a connection is open, this API function must be called on a regular basis to perform poll mode processing without having to create additional adapter worker threads.
- Parameters
-
handle | The handle of the endpoint to poll. |
- Returns
- either kCdiStatusInternalIdle or kCdiStatusOk if successful, otherwise a value that indicates the nature of the failure is returned. kCdiStatusInternalIdle means that the function performed no productive work while kCdiStatusOk says that did.
◆ CdiAdapterPollThreadFlushResources()
Flush resources associate with PollThread(). NOTE: This function should only be called after the thread has been paused using EndpointManagerThreadWait().
- Parameters
-
handle | The handle of the endpoint to flush resources. |
◆ CdiAdapterResetEndpoint()
Reset an endpoint and free its resources.
- Parameters
-
handle | The handle of the endpoint to reset. |
- Returns
- CdiReturnStatus kCdiStatusOk upon success otherwise an indication of the failure.
◆ CdiAdapterShutdown()
Shut down the adapter and free all of the resources associated with it. The caller must not use the adapter's handle for any purpose after this function returns.
- Parameters
-
adapter | A handle to the adapter to close. |
- Returns
- CdiReturnStatus kCdiStatusOk if the close operation was successfully or a value that indicates the nature of the failure.
◆ CdiAdapterStartEndpoint()
Starts an endpoint for the specified connection.
- Parameters
-
handle | The handle of the endpoint to started. |
- Returns
- CdiReturnStatus kCdiStatusOk upon successful open otherwise an indication of the failure.
◆ CdiAdapterStopConnection()
Stop a connection, shutting down thread resources.
- Parameters
-
handle | The handle of the connection which is to be stopped. |
- Returns
- CdiReturnStatus kCdiStatusOk upon success otherwise an indication of the failure.
◆ CdiAdapterTxPacketComplete()
Tx packet has ACKed.
- Parameters
-
handle | The handle of the endpoint that a Tx packet is related to. |
packet_ptr | Pointer to packet. |
◆ EfaNetworkAdapterInitialize()
Initializes an EFA adapter specified by the values in the provided CdiAdapterState structure.
- Parameters
-
adapter_state_ptr | The address of the generic adapter state preinitialized with the generic values including the CdiAdapterData structure which contains the values provided to the SDK by the user program. |
is_socket_based | Specifies whether the adapter is socket-based (true) or EFA-based (false). |
- Returns
- CdiReturnStatus kCdiStausOk if successful, otherwise a value indicating the nature of failure.
◆ SocketNetworkAdapterInitialize()
Initializes socket based adapter specified by the values in the provided CdiAdapterState structure.
- Parameters
-
adapter_state_ptr | The address of the generic adapter state preinitialized with the generic values including the CdiAdapterData structure which contains the values provided to the SDK by the user program. |
- Returns
- CdiReturnStatus kCdiStausOk if successful, otherwise a value indicating the nature of failure.