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.h
Go to the documentation of this file.
1// -------------------------------------------------------------------------------------------
2// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
3// This file is part of the AWS CDI-SDK, licensed under the BSD 2-Clause "Simplified" License.
4// License details at: https://github.com/aws/aws-cdi-sdk/blob/mainline/LICENSE
5// -------------------------------------------------------------------------------------------
6
13#ifndef ADAPTER_EFA_H__
14#define ADAPTER_EFA_H___
15
16// Enable this define so we can use libfabric header files. With _GNU_SOURCE enabled, the following defines will be set
17// by the system include files:
18//__USE_XOPEN2K, __USE_XOPEN2K8, __USE_MISC, __USE_GNU, __USE_SVID, __USE_XOPEN_EXTENDED, __USE_POSIX199309
19#define _GNU_SOURCE
20
21#include "adapter_api.h"
23#include "adapter_efa_probe.h"
24#include "cdi_raw_api.h"
25#include "private.h"
26
27#include "rdma/fabric.h"
28#include "rdma/fi_cm.h"
29#include "rdma/fi_endpoint.h"
30
31//*********************************************************************************************************************
32//***************************************** START OF DEFINITIONS AND TYPES ********************************************
33//*********************************************************************************************************************
34
39typedef struct {
40 uint32_t version_major;
41 uint32_t version_minor;
42 uint32_t (*fi_version)(void);
43 struct fi_info* (*fi_allocinfo)(void);
44 int (*fi_av_insert)(struct fid_av *av, const void *addr, size_t count,
45 fi_addr_t *fi_addr, uint64_t flags, void *context);
46
47 int (*fi_av_open)(struct fid_domain *domain, struct fi_av_attr *attr,
48 struct fid_av **av, void *context);
49 int (*fi_av_remove)(struct fid_av *av, fi_addr_t *fi_addr, size_t count, uint64_t flags);
50 int (*fi_close)(struct fid *fid);
51 int (*fi_cq_open)(struct fid_domain *domain, struct fi_cq_attr *attr,
52 struct fid_cq **cq, void *context);
53 ssize_t (*fi_cq_read)(struct fid_cq *cq, void *buf, size_t count);
54 ssize_t (*fi_cq_readerr)(struct fid_cq *cq, struct fi_cq_err_entry *buf, uint64_t flags);
55 int (*fi_domain)(struct fid_fabric *fabric, struct fi_info *info,
56 struct fid_domain **domain, void *context);
57 int (*fi_enable)(struct fid_ep *ep);
58 int (*fi_endpoint)(struct fid_domain *domain, struct fi_info *info,
59 struct fid_ep **ep, void *context);
60 int (*fi_ep_bind)(struct fid_ep *ep, struct fid *bfid, uint64_t flags);
61 int (*fi_fabric)(struct fi_fabric_attr *attr, struct fid_fabric **fabric, void *context);
62 void (*fi_freeinfo)(struct fi_info *info);
63 int (*fi_getinfo)(uint32_t version, const char *node, const char *service,
64 uint64_t flags, const struct fi_info *hints,
65 struct fi_info **info);
66 int (*fi_getname)(fid_t fid, void *addr, size_t *addrlen);
67 int (*fi_mr_reg)(struct fid_domain *domain, const void *buf, size_t len,
68 uint64_t access, uint64_t offset, uint64_t requested_key,
69 uint64_t flags, struct fid_mr **mr, void *context);
70 void* (*fi_mr_desc)(struct fid_mr *mr);
71 ssize_t (*fi_recvmsg)(struct fid_ep *ep, const struct fi_msg *msg, uint64_t flags);
72 ssize_t (*fi_sendmsg)(struct fid_ep *ep, const struct fi_msg *msg, uint64_t flags);
73 const char* (*fi_strerror)(int errnum);
75
89
102
142
149
150//*********************************************************************************************************************
151//******************************************* START OF PUBLIC FUNCTIONS ***********************************************
152//*********************************************************************************************************************
153
163 ProbeEndpointHandle* ret_probe_handle);
164
174
183
184// EFA Tx functions
185
187CdiReturnStatus EfaTxEndpointOpen(EfaEndpointState* endpoint_ptr, const char* remote_address_str, int dest_port);
188
191
194
197
200
202CdiReturnStatus EfaTxEndpointSend(const AdapterEndpointHandle handle, const Packet* packet_ptr, bool flush_packets);
203
206
208void EfaTxEndpointStop(EfaEndpointState* endpoint_ptr);
209
210// EFA Rx functions
211
214
217
220
223
226
235
241void EfaRxPacketPoolFree(EfaEndpointState* endpoint_ptr);
242
252bool EfaAdapterEndpointProtocolVersionSet(EfaEndpointState* endpoint_ptr, const CdiProtocolVersionNumber* remote_version_ptr);
253
254#endif // ADAPTER_EFA_H__
The declarations in this header file correspond to the definitions in adapter.c.
EndpointTransmitQueueLevel
Definition adapter_api.h:82
The declarations in this header file correspond to the definitions in adapter.c.
CdiReturnStatus EfaTxEndpointPoll(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_tx.c:242
EndpointTransmitQueueLevel EfaGetTransmitQueueLevel(const AdapterEndpointHandle handle)
Definition adapter_efa_tx.c:268
bool EfaAdapterEndpointProtocolVersionSet(EfaEndpointState *endpoint_ptr, const CdiProtocolVersionNumber *remote_version_ptr)
Set the protocol version for the specified endpoint. The protocol version actually used is negotiated...
Definition adapter_efa.c:1197
CdiReturnStatus EfaRxPacketPoolCreate(EfaEndpointState *endpoint_state_ptr)
Definition adapter_efa_rx.c:378
CdiReturnStatus EfaRxEndpointRxBuffersFree(const AdapterEndpointHandle handle, const CdiSgList *sgl_ptr)
Definition adapter_efa_rx.c:343
CdiReturnStatus EfaRxEndpointPoll(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_rx.c:305
CdiReturnStatus EfaTxEndpointStart(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_tx.c:319
CdiReturnStatus EfaTxEndpointSend(const AdapterEndpointHandle handle, const Packet *packet_ptr, bool flush_packets)
Definition adapter_efa_tx.c:280
void EfaRxPacketPoolFree(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_rx.c:393
CdiReturnStatus EfaRxEndpointReset(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_rx.c:310
CdiReturnStatus EfaTxEndpointOpen(EfaEndpointState *endpoint_ptr, const char *remote_address_str, int dest_port)
Definition adapter_efa_tx.c:233
CdiAdapterHandle EfaAdapterGetAdapterControlInterface(AdapterConnectionState *adapter_con_state_ptr)
Definition adapter_efa.c:1191
CdiReturnStatus EfaRxEndpointOpen(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_rx.c:278
CdiReturnStatus EfaAdapterProbeEndpointCreate(EfaEndpointState *endpoint_ptr, ProbeEndpointHandle *ret_probe_handle)
Definition adapter_efa.c:1170
CdiReturnStatus EfaAdapterEndpointStart(EfaEndpointState *endpoint_ptr)
Definition adapter_efa.c:1180
CdiReturnStatus EfaTxEndpointClose(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_tx.c:257
CdiReturnStatus EfaRxEndpointClose(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_rx.c:327
CdiReturnStatus EfaTxEndpointReset(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_tx.c:247
void EfaTxEndpointStop(EfaEndpointState *endpoint_ptr)
Definition adapter_efa_tx.c:345
The declarations in this header file correspond to the definitions in adapter_efa_probe....
CdiReturnStatus
Values used for API function return codes.
Definition cdi_core_api.h:189
struct CdiSignalType_t * CdiSignalType
Define portable signal type. Don't use void* here, which prevents the compiler from type checking.
Definition cdi_os_api.h:189
This file declares the public API data types, structures and functions that comprise the CDI Raw payl...
#define MAX_IPV6_GID_LENGTH
Maximum EFA device GID length. Contains GID + QPN (see efa_ep_addr).
Definition configuration.h:89
This header file contains definitions of types and the one global variable used internally by the SDK...
Structure used to hold adapter connection state.
Definition adapter_api.h:254
Structure used to hold adapter endpoint state.
Definition adapter_api.h:110
Structure definition behind the handles shared with the user's application program....
Definition adapter_api.h:384
This structure represents the current state of a memory pool.
Definition pool.c:46
CDI header used to identify protocol version number information.
Definition protocol.h:38
This structure defines a scatter-gather list (SGL) which is used to represent an array of data compri...
Definition cdi_core_api.h:728
Structure used to hold EFA connection state data.
Definition adapter_efa.h:146
AdapterConnectionState * adapter_con_ptr
Pointer to adapter connection data.
Definition adapter_efa.h:147
Structure used to hold EFA endpoint state data.
Definition adapter_efa.h:106
ProbeEndpointHandle probe_endpoint_handle
Handle of probe for this endpoint.
Definition adapter_efa.h:117
struct fid_cq * completion_queue_ptr
Data for completion events. Used by PollThread().
Definition adapter_efa.h:120
LibfabricApi * libfabric_api_ptr
Pointer to current libfabric API V-table.
Definition adapter_efa.h:140
struct fi_info * fabric_info_ptr
Pointer to libfabric structures used by the endpoint.
Definition adapter_efa.h:123
fi_addr_t remote_fi_addr
Remote memory address (we don't use so it is always FI_ADDR_UNSPEC)
Definition adapter_efa.h:128
struct fid_fabric * fabric_ptr
Pointer to fabric provider.
Definition adapter_efa.h:124
uint64_t mr_key
Key used for memory registration. Must be unique for each fi_mr_reg(). Only used if FI_MR_PROV_KEY fo...
Definition adapter_efa.h:133
int tx_control_dest_port
Transmitter control interface destination port.
Definition adapter_efa.h:115
LibfabricApi * libfabric_api_next_ptr
Pointer to next version of libfabric API V-table to use.
Definition adapter_efa.h:139
struct fid_av * address_vector_ptr
Pointer to address vector map (high-level to fabric address map)
Definition adapter_efa.h:127
volatile bool fabric_initialized
True of libfabric has been initialized.
Definition adapter_efa.h:129
struct fid_ep * endpoint_ptr
Pointer to fabric endpoint (transport level communication portal)
Definition adapter_efa.h:126
EfaRxState rx_state
The internal state of the structure if adapter_endpoint_ptr->direction is kEndpointDirectionReceive.
Definition adapter_efa.h:112
EfaTxState tx_state
The internal state of the structure if adapter_endpoint_ptr->direction is kEndpointDirectionSend.
Definition adapter_efa.h:110
AdapterEndpointState * adapter_endpoint_ptr
Pointer to adapter endpoint data (here for convenience).
Definition adapter_efa.h:107
struct fid_domain * domain_ptr
Pointer to fabric access domain.
Definition adapter_efa.h:125
int dest_control_port
Definition adapter_efa.h:137
This defines a structure that contains all of the state information that is specific to the Rx side o...
Definition adapter_efa.h:94
bool allocated_buffer_was_from_heap
True if no huge pages were available; needed for freeing.
Definition adapter_efa.h:99
struct fid_mr * memory_region_ptr
Pointer to Rx memory region.
Definition adapter_efa.h:100
CdiPoolHandle packet_sgl_entries_pool_handle
Memory pool for Rx packet SGL entries (CdiSglEntry). Not thread-safe.
Definition adapter_efa.h:96
void * allocated_buffer_ptr
Address of receive packets memory buffer; needed for freeing.
Definition adapter_efa.h:97
int allocated_buffer_size
Total size of allocated packets buffer; needed for freeing.
Definition adapter_efa.h:98
This defines a structure that contains all of the state information that is specific to the Tx side o...
Definition adapter_efa.h:80
struct fid_mr * tx_user_payload_memory_region_ptr
Pointer to Tx user payload data memory region.
Definition adapter_efa.h:82
int tx_packets_in_process
Definition adapter_efa.h:87
struct fid_mr * tx_internal_memory_region_ptr
Pointer to Tx internal packet header data memory region.
Definition adapter_efa.h:83
CdiSignalType tx_start_signal
Signal used to wakeup the thread to do work.
Definition adapter_efa.h:81
uint16_t tx_packets_sent_since_flush
Definition adapter_efa.h:84
V-table interface to the libfabric API. This allows multiple versions of libfabric to be used within ...
Definition adapter_efa.h:39
uint32_t version_minor
Statically compiled libfabric minor version number.
Definition adapter_efa.h:41
uint32_t version_major
Statically compiled libfabric major version number.
Definition adapter_efa.h:40
Definition adapter_api.h:42
This defines a structure that contains all of the state information for the sending side of a single ...
Definition adapter_efa_probe.h:121