CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
adapter_efa_rx.c File Reference

This file contains definitions and functions for the EFA Rx adapter. More...

#include "adapter_efa.h"
#include "endpoint_manager.h"
#include "internal_log.h"
#include "internal_tx.h"
#include "private.h"
#include "cdi_os_api.h"

Functions

static bool PostRxBuffer (EfaEndpointState *endpoint_state_ptr, const struct iovec *msg_iov_ptr, bool more_to_post)
 
static bool Poll (EfaEndpointState *efa_endpoint_ptr)
 
static bool CreatePacketPool (EfaEndpointState *endpoint_state_ptr, int packet_size, int packet_count)
 
static void FreePacketPool (EfaEndpointState *endpoint_state_ptr)
 
CdiReturnStatus EfaRxEndpointOpen (EfaEndpointState *endpoint_state_ptr)
 
CdiReturnStatus EfaRxEndpointPoll (EfaEndpointState *endpoint_state_ptr)
 
CdiReturnStatus EfaRxEndpointReset (EfaEndpointState *endpoint_state_ptr)
 
CdiReturnStatus EfaRxEndpointClose (EfaEndpointState *endpoint_state_ptr)
 
CdiReturnStatus EfaRxEndpointRxBuffersFree (const AdapterEndpointHandle handle, const CdiSgList *sgl_ptr)
 
CdiReturnStatus EfaRxPacketPoolCreate (EfaEndpointState *endpoint_state_ptr)
 
void EfaRxPacketPoolFree (EfaEndpointState *endpoint_state_ptr)
 

Variables

static const int packet_buffer_alignment = 8
 Align each receive buffer to start at an address evenly divisible by 8.
 

Detailed Description

This file contains definitions and functions for the EFA Rx adapter.

Function Documentation

◆ CreatePacketPool()

static bool CreatePacketPool ( EfaEndpointState * endpoint_state_ptr,
int packet_size,
int packet_count )
static

Allocates a hunk of memory, registers it with libfabric, and posts packet sized portions of the allocation as receive buffers.

Parameters
endpoint_state_ptrPointer to endpoint.
packet_sizeThe size of each packet.
packet_countHow many packets to allocate.
Returns
On success returns 0 on failure returns codes in accordance with libfabric rdma/fi_errno.h.

◆ EfaRxEndpointClose()

CdiReturnStatus EfaRxEndpointClose ( EfaEndpointState * endpoint_ptr)

◆ EfaRxEndpointOpen()

CdiReturnStatus EfaRxEndpointOpen ( EfaEndpointState * endpoint_ptr)

◆ EfaRxEndpointPoll()

CdiReturnStatus EfaRxEndpointPoll ( EfaEndpointState * endpoint_ptr)

◆ EfaRxEndpointReset()

CdiReturnStatus EfaRxEndpointReset ( EfaEndpointState * endpoint_ptr)

◆ EfaRxEndpointRxBuffersFree()

CdiReturnStatus EfaRxEndpointRxBuffersFree ( const AdapterEndpointHandle handle,
const CdiSgList * sgl_ptr )

◆ EfaRxPacketPoolCreate()

CdiReturnStatus EfaRxPacketPoolCreate ( EfaEndpointState * endpoint_state_ptr)

Create pool of Rx packet buffers for the endpoint.

Parameters
endpoint_state_ptrPointer to endpoint.
Returns
kCdiStatusOk if successful, otherwise a value that indicates the nature of the failure is returned.

◆ EfaRxPacketPoolFree()

void EfaRxPacketPoolFree ( EfaEndpointState * endpoint_ptr)

Frees the previously allocated receive packet buffer pool for the endpoint.

Parameters
endpoint_ptrPointer to EFA endpoint state data.

◆ FreePacketPool()

static void FreePacketPool ( EfaEndpointState * endpoint_state_ptr)
static

Frees the previously allocated receive packet buffer pool for the endpoint.

Parameters
endpoint_state_ptrPointer to the endpoint whose receive packet buffer pool is to be freed.

◆ Poll()

static bool Poll ( EfaEndpointState * efa_endpoint_ptr)
static

Used to poll for any pending Rx completion events and process them.

Parameters
efa_endpoint_ptrPointer to EFA endpoint state data.
Returns
true if useful work was done, false if the function did nothing productive.

◆ PostRxBuffer()

static bool PostRxBuffer ( EfaEndpointState * endpoint_state_ptr,
const struct iovec * msg_iov_ptr,
bool more_to_post )
static

Posts a Rx data buffer to the receive queue of the corresponding endpoint. Posted receives are searched in the order in which they were posted in order to match sends. Message boundaries are maintained. The order in which the receives complete is dependent on the endpoint type and protocol.

Parameters
endpoint_state_ptrPointer to endpoint state data.
msg_iov_ptrAn iovec structure with the address and size of the packet buffer to give to libfabric for use as a receive packet buffer.
more_to_postSet this to true if this function will be immediately called again to post another packet buffer. This allows libfabric to process packet buffers in an optimized fashion.
Returns
Returns true if no error, otherwise false is returned.