API References for DOCA 2.6.0

2. Modules

Here is a list of all modules:

Flex IO SDK host API for DPA programs. Mostly used for DPA resource management and invocation of DPA programs.

Classes

struct flexio_affinity
struct flexio_app_attr
struct flexio_cmdq_attr
struct flexio_cq_attr
struct flexio_event_handler_attr
struct flexio_heap_mem_info
struct flexio_mkey_attr
struct flexio_msg_stream_attr_t
struct flexio_outbox_attr
struct flexio_process_attr
struct flexio_qmem
struct flexio_qp_attr
struct flexio_qp_attr_opt_param_mask
struct flexio_wq_attr
struct flexio_wq_sq_attr

Defines

#define FLEXIO_MAX_NAME_LEN (256)

Typedefs

typedef void(  flexio_func_arg_pack_fn_t
Callback function to pack the arguments for a function.
typedef void(  flexio_func_t
typedef uint32_t  flexio_uar_device_id
typedef uint64_t  flexio_uintptr_t

Enumerations

enum flexio_affinity_type
enum flexio_cmdq_state
enum flexio_cq_period_mode
enum flexio_cqe_comp_type
enum flexio_err_status
enum flexio_log_lvl_t
enum flexio_memtype
enum flexio_msg_dev_sync_mode
enum flexio_qp_op_types
enum flexio_qp_qpc_mtu
enum flexio_qp_state
enum flexio_qp_transport_type
enum flexio_status
enum flexio_tracer_transport

Functions

flexio_status flexio_app_create ( flexio_app_attr* fattr, flexio_app** app )
Create a container for a FlexIO App.
flexio_status flexio_app_destroy ( flexio_app* app )
Destroy a flexio app.
flexio_status flexio_app_get_elf ( flexio_app* app, uint64_t* bin_buff, size_t bin_size )
Retrieve ELF binary associated with application.
size_t flexio_app_get_elf_size ( flexio_app* app )
Gets a Flex IO application size.
flexio_status flexio_app_get_list ( flexio_app*** app_list, uint32_t* num_apps )
Get a list of FlexIO Apps that are available.
const char* flexio_app_get_name ( flexio_app* app )
Gets a Flex IO application name.
flexio_status flexio_app_list_free ( flexio_app** apps_list )
Free the list of flexio apps.
flexio_status flexio_buf_dev_alloc ( flexio_process* process, size_t buff_bsize, flexio_uintptr_t* dest_daddr_p )
Allocates a buffer on Flex IO heap memory.
flexio_status flexio_buf_dev_free ( flexio_process* process, flexio_uintptr_t daddr )
Deallocates Flex IO heap memory buffer.
flexio_status flexio_buf_dev_memset ( flexio_process* process, int  value, size_t buff_bsize, flexio_uintptr_t dest_daddr )
Sets DPA heap memory buffer to a given value.
flexio_status flexio_cmdq_create ( flexio_process* process, flexio_cmdq_attr* fattr, flexio_cmdq** cmdq )
Create asynchronous rpc command queue.
flexio_status flexio_cmdq_destroy ( flexio_cmdq* cmdq )
Destroy the command queue infrastructure.
int  flexio_cmdq_is_empty ( flexio_cmdq* cmdq )
Check if command queue is empty.
flexio_status flexio_cmdq_state_running ( flexio_cmdq* cmdq )
Move command queue to running state.
flexio_status flexio_cmdq_task_add ( flexio_cmdq* cmdq, flexio_func_t* host_func, uint64_t arg )
Add a task to the asynchronous rpc command queue.
flexio_status flexio_copy_from_host ( flexio_process* process, void* src_haddr, size_t buff_bsize, flexio_uintptr_t* dest_daddr_p )
Copy from host memory to Flex IO heap memory buffer.
flexio_status flexio_coredump_create ( flexio_process* process, const char* outfile )
Create a DPA core dump of the process.
flexio_status flexio_cq_create ( flexio_process* process, ibv_context* ibv_ctx, const flexio_cq_attr* fattr, flexio_cq** cq )
Creates a Flex IO CQ.
flexio_status flexio_cq_destroy ( flexio_cq* cq )
Destroys a Flex IO CQ.
uint32_t flexio_cq_get_cq_num ( flexio_cq* cq )
Gets the Flex IO CQ number.
flexio_status flexio_cq_modify_moderation ( flexio_cq* cq, uint16_t max_count, uint16_t period, uint16_t mode )
Modifies a Flex IO CQ moderation configuration.
flexio_status flexio_cq_query_moderation ( flexio_cq* cq, uint16_t* max_count, uint16_t* period, uint16_t* mode )
Queries a Flex IO CQ moderation configuration.
flexio_status flexio_crash_data ( flexio_process* process, const char* outfile )
Provide crash info in textual form.
flexio_status flexio_device_mkey_create ( flexio_process* process, flexio_mkey_attr* fattr, flexio_mkey** mkey )
Creates an Mkey to the process device UMEM.
flexio_status flexio_device_mkey_destroy ( flexio_mkey* mkey )
destroys an MKey object containing the given ID
int  flexio_err_handler_fd ( flexio_process* process )
Get file descriptor for error handler.
flexio_err_status flexio_err_status_get ( flexio_process* process )
Check if unrecoverable error occurred.
flexio_status flexio_event_handler_create ( flexio_process* process, flexio_event_handler_attr* fattr, flexio_event_handler** event_handler_ptr )
Creates a Flex IO event handler.
flexio_status flexio_event_handler_destroy ( flexio_event_handler* event_handler )
Destroys a Flex IO event handler.
uint32_t flexio_event_handler_get_id ( flexio_event_handler* event_handler )
Gets the ID from a Flex IO event handler's thread metadata.
uint32_t flexio_event_handler_get_obj_id ( flexio_event_handler* event_handler )
Gets the object ID of a Flex IO event handler.
flexio_thread* flexio_event_handler_get_thread ( flexio_event_handler* event_handler )
Gets a Flex IO thread object from a Flex IO event handler.
flexio_status flexio_event_handler_run ( flexio_event_handler* event_handler, uint64_t user_arg )
Run a Flex IO event handler.
flexio_status flexio_func_get_register_info ( flexio_app* app, flexio_func_t* host_stub_func_addr, uint32_t* pup, char* dev_func_name, char* dev_unpack_func_name, size_t func_name_size, size_t* argbuf_size, flexio_func_arg_pack_fn_t** host_pack_func, flexio_uintptr_t* dev_func_addr, flexio_uintptr_t* dev_unpack_func_addr )
Obtain info for previously registered function.
flexio_status flexio_func_pup_register ( flexio_app* app, const char* dev_func_name, const char* dev_unpack_func_name, flexio_func_t* host_stub_func_addr, size_t argbuf_size, flexio_func_arg_pack_fn_t* host_pack_func )
Register a function name at application start.
flexio_status flexio_func_register ( flexio_app* app, const char* dev_func_name, flexio_func_t** out_func )
Register a function to be used later.
flexio_status flexio_host2dev_memcpy ( flexio_process* process, void* src_haddr, size_t buff_bsize, flexio_uintptr_t dest_daddr )
Copy from host memory to a pre-allocted Flex IO heap memory buffer.
flexio_status flexio_log_dev_destroy ( flexio_process* process )
Destroys a flexio device messaging default stream environment.
flexio_status flexio_log_dev_flush ( flexio_process* process )
Flush the default msg stream's buffer in case of asynchronous messaging mode.
flexio_status flexio_log_dev_init ( flexio_process* process, flexio_msg_stream_attr_t* stream_fattr, FILE* out, pthread_t* ppthread )
Create environment to support messages output from DPA.
enum flexio_log_lvl flexio_log_lvl_set ( enum flexio_log_lvl lvl )
Sets host SDK logging level.
uint32_t flexio_mkey_get_id ( flexio_mkey* mkey )
Gets the Flex IO MKey ID.
flexio_status flexio_msg_stream_create ( flexio_process* process, flexio_msg_stream_attr_t* stream_fattr, FILE* out, pthread_t* ppthread, flexio_msg_stream** stream )
Create a Flex IO msg stream that can contain output messages sent from the DPA.
flexio_status flexio_msg_stream_destroy ( flexio_msg_stream* stream )
Destroys a Flex IO msg stream.
flexio_status flexio_msg_stream_flush ( flexio_msg_stream* stream )
Flush a msg stream's buffer in case of asynchronous messaging mode.
int  flexio_msg_stream_get_id ( flexio_msg_stream* stream )
Gets the Flex IO device message stream's ID (aka file descriptor).
flexio_status flexio_msg_stream_level_set ( flexio_msg_stream* stream, flexio_msg_dev_level level )
Change the provided device message stream's level.
flexio_status flexio_outbox_create ( flexio_process* process, flexio_outbox_attr* fattr, flexio_outbox** outbox )
Creates a Flex IO outbox.
flexio_status flexio_outbox_destroy ( flexio_outbox* outbox )
Destroys a Flex IO outbox.
uint32_t flexio_outbox_get_id ( flexio_outbox* outbox )
Gets the Flex IO outbox ID.
flexio_uar* flexio_outbox_get_uar ( flexio_outbox* outbox )
Gets a Flex IO UAR object from a Flex IO outbox.
flexio_status flexio_process_call ( flexio_process* process, flexio_func_t* host_func, uint64_t* func_ret, ... )
Calls a Flex IO process.
flexio_status flexio_process_create ( ibv_context* ibv_ctx, flexio_app* app, const flexio_process_attr* process_attr, flexio_process** process_ptr )
Create a new Flex IO process.
flexio_status flexio_process_destroy ( flexio_process* process )
Destroys a Flex IO process.
flexio_status flexio_process_error_handler_set ( flexio_process* process, flexio_func_t* error_handler )
Set the Flexio process error handler.
uint32_t flexio_process_get_dumem_id ( flexio_process* process )
Gets the Flex IO process DUMEM ID.
ibv_pd* flexio_process_get_pd ( flexio_process* process )
Gets a Flex IO IBV PD object from a Flex IO process.
flexio_uar* flexio_process_get_uar ( flexio_process* process )
Gets a Flex IO UAR object from a Flex IO process.
flexio_status flexio_process_mem_info_get ( const flexio_process* process, flexio_heap_mem_info* info )
Get process memory info.
uint64_t flexio_process_udbg_token_get ( flexio_process* process )
Get token for Flex IO process debug access.
flexio_status flexio_qp_create ( flexio_process* process, ibv_context* ibv_ctx, flexio_qp_attr* qp_fattr, flexio_qp** qp_ptr )
Creates a Flex IO QP.
flexio_status flexio_qp_destroy ( flexio_qp* qp )
Destroys a Flex IO QP.
uint32_t flexio_qp_get_qp_num ( flexio_qp* qp )
Gets the Flex IO QP number.
flexio_status flexio_qp_modify ( flexio_qp* qp, flexio_qp_attr* fattr, flexio_qp_attr_opt_param_mask* mask )
Modify Flex IO QP.
flexio_qp_state flexio_qp_state_get ( flexio_qp* qp )
retrieve the device QP state.
flexio_status flexio_rmp_create ( flexio_process* process, ibv_context* ibv_ctx, const flexio_wq_attr* fattr, flexio_rmp** flexio_rmp_ptr )
Creates a Flex IO RMP.
flexio_status flexio_rmp_destroy ( flexio_rmp* flexio_rmp )
Destroys a Flex IO RMP.
uint32_t flexio_rmp_get_wq_num ( flexio_rmp* rmp )
Gets the Flex IO RMP number.
flexio_status flexio_rq_create ( flexio_process* process, ibv_context* ibv_ctx, uint32_t cq_num, const flexio_wq_attr* fattr, flexio_rq** flexio_rq_ptr )
Creates a Flex IO RQ.
flexio_status flexio_rq_destroy ( flexio_rq* flexio_rq )
Destroys a Flex IO RQ.
mlx5dv_devx_obj* flexio_rq_get_tir ( flexio_rq* rq )
Gets the Flex IO RQ TIR object.
uint32_t flexio_rq_get_wq_num ( flexio_rq* rq )
Gets the Flex IO RQ number.
flexio_status flexio_rq_set_err_state ( flexio_rq* rq )
Sets a Flex IO RQ to error state.
flexio_status flexio_sq_create ( flexio_process* process, ibv_context* ibv_ctx, uint32_t cq_num, const flexio_wq_attr* fattr, flexio_sq** flexio_sq_ptr )
Creates a Flex IO SQ.
flexio_status flexio_sq_destroy ( flexio_sq* flexio_sq )
Destroys a Flex IO SQ.
uint32_t flexio_sq_get_wq_num ( flexio_sq* sq )
Gets the Flex IO SQ number.
flexio_status flexio_uar_create ( flexio_process* process, flexio_uar** flexio_uar )
Creates a Flex IO UAR object.
flexio_status flexio_uar_destroy ( flexio_uar* uar )
destroys a Flex IO UAR object
flexio_status flexio_uar_extend ( flexio_uar* in_uar, ibv_context* to_extend, flexio_uar** extended )
Extend UAR to an ibv context.
flexio_uar_device_id flexio_uar_get_extended_id ( flexio_uar* uar )
Gets the Flex IO extended UAR ID.
uint32_t flexio_uar_get_id ( flexio_uar* uar )
Gets the Flex IO UAR ID.
flexio_status flexio_window_create ( flexio_process* process, ibv_pd* pd, flexio_window** window )
Creates a Flex IO window.
flexio_status flexio_window_destroy ( flexio_window* window )
Destroys a Flex IO window.
uint32_t flexio_window_get_id ( flexio_window* window )
Gets the Flex IO window ID.

Defines

#define FLEXIO_MAX_NAME_LEN (256)

Maximum length of application and device function names

Typedefs

typedef void( flexio_func_arg_pack_fn_t

Callback function to pack the arguments for a function. This function is called internally from the FlexIO runtime upon user making a call (e.g., flexio_process_call). It packs the arguments for a user function into the argument buffer provided in `argbuf`. The argument list can be arbitrarily long and is represented by `ap`. The correct usage of this function requires the caller to initialize the list using `va_start`.

typedef void( flexio_func_t

Flex IO application function prototype.

typedef uint32_t flexio_uar_device_id

Flex IO UAR extension ID prototype.

typedef uint64_t flexio_uintptr_t

Flex IO address type.

Enumerations

enum flexio_affinity_type

Flex IO thread affinity types.

Values
FLEXIO_AFFINITY_NONE = 0
FLEXIO_AFFINITY_STRICT
FLEXIO_AFFINITY_GROUP

enum flexio_cmdq_state

Flex IO command queue states.

Values
FLEXIO_CMDQ_STATE_PENDING = 0
FLEXIO_CMDQ_STATE_RUNNING = 1

enum flexio_cq_period_mode

Flex IO CQ CQE compression period modes.

Values
FLEXIO_CQ_PERIOD_MODE_EVENT = 0x0
FLEXIO_CQ_PERIOD_MODE_CQE = 0x1

enum flexio_cqe_comp_type

Flex IO CQ CQE compression modes.

Values
FLEXIO_CQE_COMP_NONE = 0x0
FLEXIO_CQE_COMP_BASIC = 0x1
FLEXIO_CQE_COMP_ENH = 0x2

enum flexio_err_status

Flex IO DEV error status.

Values
FLEXIO_DEV_NO_ERROR = 0
FLEXIO_DEV_FATAL_ERROR = 1
FLEXIO_DEV_USER_ERROR = 2

enum flexio_log_lvl_t

Flex IO SDK host logging levels

Values
FLEXIO_LOG_LVL_ERR = 0
FLEXIO_LOG_LVL_WARN = 1
FLEXIO_LOG_LVL_INFO = 2
FLEXIO_LOG_LVL_DBG = 3

enum flexio_memtype

Flex IO memory types.

Values
FLEXIO_MEMTYPE_DPA = 0
FLEXIO_MEMTYPE_HOST = 1

enum flexio_msg_dev_sync_mode

Flex IO device messaging synchronization modes.

Values
FLEXIO_LOG_DEV_SYNC_MODE_SYNC = 0
FLEXIO_LOG_DEV_SYNC_MODE_ASYNC = 1
FLEXIO_LOG_DEV_SYNC_MODE_BATCH = 2
FLEXIO_LOG_DEV_SYNC_MODE_TRACER = 3

enum flexio_qp_op_types

Flex IO QP operation types.

Values
FLEXIO_QP_WR_RDMA_WRITE = 0x4
FLEXIO_QP_WR_RDMA_READ = 0x8
FLEXIO_QP_WR_ATOMIC_CMP_AND_SWAP = 0x10

enum flexio_qp_qpc_mtu

Flex IO QP possible MTU values.

Values
FLEXIO_QP_QPC_MTU_BYTES_256 = 0x1
FLEXIO_QP_QPC_MTU_BYTES_512 = 0x2
FLEXIO_QP_QPC_MTU_BYTES_1K = 0x3
FLEXIO_QP_QPC_MTU_BYTES_2K = 0x4
FLEXIO_QP_QPC_MTU_BYTES_4K = 0x5

enum flexio_qp_state

Flex IO QP states.

Values
FLEXIO_QP_STATE_RST = 0x0
FLEXIO_QP_STATE_INIT = 0x1
FLEXIO_QP_STATE_RTR = 0x2
FLEXIO_QP_STATE_RTS = 0x3
FLEXIO_QP_STATE_ERR = 0x6

enum flexio_qp_transport_type

Flex IO QP states.

Values
FLEXIO_QPC_ST_RC = 0x0
FLEXIO_QPC_ST_UC = 0x1
FLEXIO_QPC_ST_UD = 0x2
FLEXIO_QPC_ST_XRC = 0x3
FLEXIO_QPC_ST_IBL2 = 0x4
FLEXIO_QPC_ST_DCI = 0x5
FLEXIO_QPC_ST_QP0 = 0x7
FLEXIO_QPC_ST_QP1 = 0x8
FLEXIO_QPC_ST_RAW_DATAGRAM = 0x9
FLEXIO_QPC_ST_REG_UMR = 0xc
FLEXIO_QPC_ST_DC_CNAK = 0x10

enum flexio_status

Flex IO API function return codes.

Values
FLEXIO_STATUS_SUCCESS = 0
FLEXIO_STATUS_FAILED = 1
FLEXIO_STATUS_TIMEOUT = 2
FLEXIO_STATUS_FATAL_ERR = 3

enum flexio_tracer_transport

Flex IO device messaging tracer transport modes.

Values
FLEXIO_TRACER_TRANSPORT_QP = 0
FLEXIO_TRACER_TRANSPORT_WINDOW = 1

Functions

flexio_status flexio_app_create ( flexio_app_attr* fattr, flexio_app** app )
Create a container for a FlexIO App.
Parameters
fattr
- A pointer to the application attributes struct.
app

Returns

flexio status value.

Description

This function creates a named app with a given ELF buffer. It is called from within the constructor generated by the compiler.

flexio_status flexio_app_destroy ( flexio_app* app )
Destroy a flexio app.
Parameters
app
- App that was created before.

Returns

flexio status value.

Description

This function destroys the state associated with the app and all registered functions. This function will free the internal elf buffer. It is called from within the destructor generated by the compiler.

flexio_status flexio_app_get_elf ( flexio_app* app, uint64_t* bin_buff, size_t bin_size )
Retrieve ELF binary associated with application.
Parameters
app
- App that created before.
bin_buff
- Pointer to buffer to copy ELF binary.
bin_size
- Size of buffer pointed by bin_buff. If parameter is smaller than ELF binary size function will fail.

Returns

flexio status value.

Description

This function registers the function name, stub address with the runtime. Compiler calls this from within the constructor.

size_t flexio_app_get_elf_size ( flexio_app* app )
Gets a Flex IO application size.
Parameters
app
- A pointer to a Flex IO application.

Returns

the application's size (bytes) or NULL on error.

Description

flexio_status flexio_app_get_list ( flexio_app*** app_list, uint32_t* num_apps )
Get a list of FlexIO Apps that are available.
Parameters
app_list
- A list of apps that are available.
num_apps

Returns

flexio status value.

Description

This function returns a list of Flex IO apps that are loaded.

const char* flexio_app_get_name ( flexio_app* app )
Gets a Flex IO application name.
Parameters
app
- A pointer to a Flex IO application.

Returns

the application's name or NULL on error.

Description

flexio_status flexio_app_list_free ( flexio_app** apps_list )
Free the list of flexio apps.
Returns

flexio status value.

Description

This function frees the list of apps obtained from `flexio_app_get_list`.

flexio_status flexio_buf_dev_alloc ( flexio_process* process, size_t buff_bsize, flexio_uintptr_t* dest_daddr_p )
Allocates a buffer on Flex IO heap memory.
Parameters
process
- A pointer to the Flex IO process context.
buff_bsize
- The size of the buffer to allocate.
dest_daddr_p
- A pointer to the Flex IO address, where the buffer was allocated.

Returns

flexio status value.

Description

This function allocates a buffer with the requested size on the Flex IO heap memory. On success - sets dest_daddr_p to the start address of the allocated buffer. On Failure - sets dest_daddr_p to 0x0.

flexio_status flexio_buf_dev_free ( flexio_process* process, flexio_uintptr_t daddr )
Deallocates Flex IO heap memory buffer.
Parameters
process
- A pointer to the Flex IO process context.
daddr
- A pointer to an address of allocated memory on the Flex IO heap. Zero value is valid argument.

Returns

flexio status value.

Description

This function frees Flex IO heap memory buffer by address.

flexio_status flexio_buf_dev_memset ( flexio_process* process, int  value, size_t buff_bsize, flexio_uintptr_t dest_daddr )
Sets DPA heap memory buffer to a given value.
Parameters
process
- A pointer to the Flex IO process context.
value
- A value to set the DPA heap memory buffer to.
buff_bsize
- The size of the Flex IO heap memory buffer.
dest_daddr
- Flex IO heap memory buffer address to set.

Returns

flexio status value.

Description

flexio_status flexio_cmdq_create ( flexio_process* process, flexio_cmdq_attr* fattr, flexio_cmdq** cmdq )
Create asynchronous rpc command queue.
Parameters
process
- A pointer to the process context.
fattr
- A pointer to the command queue attributes struct.
cmdq
- A pointer to the created command queue context pointer.

Returns

flexio status value.

Description

This function creates the asynchronous rpc command queue infrastructure allowing background tasks execution.

flexio_status flexio_cmdq_destroy ( flexio_cmdq* cmdq )
Destroy the command queue infrastructure.
Parameters
cmdq
- A pointer to the command queue context.

Returns

flexio status value.

Description

This function destroy the command queue infrastructure and release all its resources.

int flexio_cmdq_is_empty ( flexio_cmdq* cmdq )
Check if command queue is empty.
Parameters
cmdq
- A pointer to the command queue context.

Returns

boolean.

Description

This function checks if the command queue is empty and all jobs up to this point where performed.

flexio_status flexio_cmdq_state_running ( flexio_cmdq* cmdq )
Move command queue to running state.
Parameters
cmdq
- A pointer to the command queue context.

Returns

flexio status value.

Description

This function moves the command queue to running state in the case the queue was create in pending state. Otherwise has no affect.

flexio_status flexio_cmdq_task_add ( flexio_cmdq* cmdq, flexio_func_t* host_func, uint64_t arg )
Add a task to the asynchronous rpc command queue.
Parameters
cmdq
- A pointer to the command queue context.
host_func
- host stub function for DPA function to execute.
arg
- user argument to function.

Returns

flexio status value.

Description

This function adds a task to the asynchronous rpc command queue to be executed by DPA in background. allowing background jobs execution.

flexio_status flexio_copy_from_host ( flexio_process* process, void* src_haddr, size_t buff_bsize, flexio_uintptr_t* dest_daddr_p )
Copy from host memory to Flex IO heap memory buffer.
Parameters
process
- A pointer to the Flex IO process context.
src_haddr
- An address of the buffer on the host memory.
buff_bsize
- The size of the buffer to copy.
dest_daddr_p
- A pointer to the Flex IO address, where the buffer was copied to.

Returns

flexio status value.

Description

This function copies data from a buffer on the host memory to the Flex IO memory. The function allocates memory on the device heap which dest_address points to. It is the caller responsibility to deallocate this memory when it is no longer used.

flexio_status flexio_coredump_create ( flexio_process* process, const char* outfile )
Create a DPA core dump of the process.
Parameters
process
- A pointer to a flexio_process
outfile
- pathname to write ELF formatted core dump data too. If NULL - filename will be generated in form flexio_dev.NNN.core, where NNN is the process id. If outfile is not NULL - suffix .NNN.core will be added. If outfile starts from slash (/pathname) - it will be passed with suffix described above to fopen() otherwise outfile will be created in the current directory or (if failed) in /tmp directory

Returns

flexio status value.

Description

This function creates a core dump image of a process and all it's threads, and is intended to be used after a fatal error or abnormal termination to allow the user to debug DPA application code.

There must be sufficient free memory to allocate 2-3 times the maximum core file size for intermediate processing before the elf file is written.

Memory windows that may be referenced by DPA code are *not* dumped by this code and must be handled separately if the data is desired.

flexio_status flexio_cq_create ( flexio_process* process, ibv_context* ibv_ctx, const flexio_cq_attr* fattr, flexio_cq** cq )
Creates a Flex IO CQ.
Parameters
process
- A pointer to the Flex IO process.
ibv_ctx
- A pointer to an IBV device context (might be different than process'). If NULL - process' will be used.
fattr
- A pointer to the CQ attributes struct.
cq
- A pointer to the created CQ context pointer.

Returns

flexio status value.

Description

This function creates a Flex IO CQ.

flexio_status flexio_cq_destroy ( flexio_cq* cq )
Destroys a Flex IO CQ.
Parameters
cq
- A pointer to a CQ context.

Returns

flexio status value.

Description

This function destroys a Flex IO CQ.

uint32_t flexio_cq_get_cq_num ( flexio_cq* cq )
Gets the Flex IO CQ number.
Parameters
cq
- A pointer to a Flex IO CQ.

Returns

the CQ number or UINT32_MAX on error.

Description

flexio_status flexio_cq_modify_moderation ( flexio_cq* cq, uint16_t max_count, uint16_t period, uint16_t mode )
Modifies a Flex IO CQ moderation configuration.
Parameters
cq
- A pointer to a CQ context.
max_count
- CQ moderation max count value.
period
- CQ moderation period value.
mode
- CQ moderation mode value.

Returns

flexio status value.

Description

flexio_status flexio_cq_query_moderation ( flexio_cq* cq, uint16_t* max_count, uint16_t* period, uint16_t* mode )
Queries a Flex IO CQ moderation configuration.
Parameters
cq
- A pointer to a CQ context.
max_count
- A pointer to the CQ moderation max count value.
period
- A pointer to the CQ moderation period value.
mode
- A pointer to the CQ moderation mode value.

Returns

flexio status value.

Description

flexio_status flexio_crash_data ( flexio_process* process, const char* outfile )
Provide crash info in textual form.
Parameters
process
- A pointer to a flexio_process
outfile
- pathname to write ELF formatted core dump data too. If NULL - filename will be generated in form flexio_dev.NNN.crash, where NNN is the process id. If outfile is not NULL - suffix .NNN.crash will be added. If outfile starts from slash (/pathname) - it will be passed with suffix described above to fopen() otherwise outfile will be created in the current directory or (if failed) in /tmp directory

Returns

flexio status value.

Description

This function displays useful crash info in textual form. Info will be printed on console and duplicated to outfile

flexio_status flexio_device_mkey_create ( flexio_process* process, flexio_mkey_attr* fattr, flexio_mkey** mkey )
Creates an Mkey to the process device UMEM.
Parameters
process
- A pointer to the Flex IO process context.
fattr
- A pointer to a Flex IO MKey attribute struct.
mkey
- A pointer to a pointer to the created MKey struct.

Returns

flexio status value.

Description

This function creates an MKey over the provided PD for the provided process device UMEM. The mkey_id will point to the field in the containing flexio_mkey object.

flexio_status flexio_device_mkey_destroy ( flexio_mkey* mkey )
destroys an MKey object containing the given ID
Parameters
mkey
- A pointer to the Flex IO MKey to destroy. NULL is a valid value.

Returns

flexio status value.

Description

This function destroys an Mkey object containing the given ID.

int flexio_err_handler_fd ( flexio_process* process )
Get file descriptor for error handler.
Parameters
process
- A pointer to the Flex IO process.

Returns

- file descriptor.

Description

User should get fd in order to monitor for nonrecoverable errors

User can poll all created processes, using select/poll/epoll functions family.

flexio_err_status flexio_err_status_get ( flexio_process* process )
Check if unrecoverable error occurred.
Parameters
process
- A pointer to the Flex IO process. NULL is a valid value.

Returns

- nonzero value if error happen.

Description

It is suggested to check error status after every negotiation with DPA and periodically later.

flexio_status flexio_event_handler_create ( flexio_process* process, flexio_event_handler_attr* fattr, flexio_event_handler** event_handler_ptr )
Creates a Flex IO event handler.
Parameters
process
- A pointer to the Flex IO process.
fattr
- A pointer to the event handler attributes struct.
event_handler_ptr
- A pointer to the created event handler context pointer.

Returns

flexio status value.

Description

This function creates a Flex IO event handler for an existing Flex IO process.

flexio_status flexio_event_handler_destroy ( flexio_event_handler* event_handler )
Destroys a Flex IO event handler.
Parameters
event_handler
- A pointer to an event handler context.

Returns

flexio status value.

Description

This function destroys a Flex IO event handler.

uint32_t flexio_event_handler_get_id ( flexio_event_handler* event_handler )
Gets the ID from a Flex IO event handler's thread metadata.
Parameters
event_handler
- A pointer to a Flex IO event handler.

Returns

the event handler's thread ID or UINT32_MAX on error.

Description

uint32_t flexio_event_handler_get_obj_id ( flexio_event_handler* event_handler )
Gets the object ID of a Flex IO event handler.
Parameters
event_handler
- A pointer to a Flex IO event handler.

Returns

the event handler's thread object ID or UINT32_MAX on error.

Description

flexio_thread* flexio_event_handler_get_thread ( flexio_event_handler* event_handler )
Gets a Flex IO thread object from a Flex IO event handler.
Parameters
event_handler
- A pointer to a Flex IO event handler.

Returns

the event handler's thread or NULL on error.

Description

flexio_status flexio_event_handler_run ( flexio_event_handler* event_handler, uint64_t user_arg )
Run a Flex IO event handler.
Parameters
event_handler
- A pointer to an event handler context.
user_arg
- A 64 bit argument for the event handler's thread.

Returns

flexio status value.

Description

This function makes a Flex IO event handler start running.

flexio_status flexio_func_get_register_info ( flexio_app* app, flexio_func_t* host_stub_func_addr, uint32_t* pup, char* dev_func_name, char* dev_unpack_func_name, size_t func_name_size, size_t* argbuf_size, flexio_func_arg_pack_fn_t** host_pack_func, flexio_uintptr_t* dev_func_addr, flexio_uintptr_t* dev_unpack_func_addr )
Obtain info for previously registered function.
Parameters
app
- FlexIO app.
host_stub_func_addr
- Known host stub func addr.
pup
- Whether function has been registered with pack/unpack support (0: No, 1:Yes).
dev_func_name
- Name of device function.
dev_unpack_func_name
- Name of unpack routine on device, NA if pup == 0.
func_name_size
- Size of function name len allocated.
argbuf_size
- Size of argument buffer, NA if pup == 0.
host_pack_func
- Function pointer to host packing routine, NA if pup == 0.
dev_func_addr
- address of device function.
dev_unpack_func_addr
- address of device unpack function.

Returns

flexio status value.

Description

This function is used to obtain info about a previously registered function. It is used to compose higher-level libraries on top of DPACC / FlexIO interface. It is not intended to be used directly by the user.

The caller must ensure that the string pointers have been allocated and are at least `FLEXIO_MAX_NAME_LEN + 1` long to ensure that the call doesn’t fail to copy full function name.

flexio_status flexio_func_pup_register ( flexio_app* app, const char* dev_func_name, const char* dev_unpack_func_name, flexio_func_t* host_stub_func_addr, size_t argbuf_size, flexio_func_arg_pack_fn_t* host_pack_func )
Register a function name at application start.
Parameters
app
- App that created before.
dev_func_name
- The device function name (entry point). Length of name should be up to FLEXIO_MAX_NAME_LEN bytes.
dev_unpack_func_name
- The device wrapper function that unpacks the argument buffer. Length of name should be up to FLEXIO_MAX_NAME_LEN bytes.
host_stub_func_addr
- The host stub function that is used by the application to reference the device function.
argbuf_size
- Size of the argument buffer required by this function.
host_pack_func
- Host callback function that packs the arguments.

Returns

flexio status value.

Description

This function registers the function name, stub address with the runtime. It is called from within the constructor generated by the compiler.

flexio_status flexio_func_register ( flexio_app* app, const char* dev_func_name, flexio_func_t** out_func )
Register a function to be used later.
Parameters
app
- previously created flexio app.
dev_func_name
- name of flexio function on device that will be called. Length of name should be up to FLEXIO_MAX_NAME_LEN bytes.
out_func
- opaque handle to use with flexio_process_call(), flexio_event_handler_create(), …

Returns

flexio status value.

Description

This function is intended to be called directly by user in the situation where they don’t desire pack/unpack support that is typically done by the compiler interface.

It is the user’s responsibility to ensure that a function was annotated for event handler with __dpa_global__. The runtime will not provide any type checking. A mismatched call will result in undefined behavior.

flexio_status flexio_host2dev_memcpy ( flexio_process* process, void* src_haddr, size_t buff_bsize, flexio_uintptr_t dest_daddr )
Copy from host memory to a pre-allocted Flex IO heap memory buffer.
Parameters
process
- A pointer to the Flex IO process context.
src_haddr
- An address of the buffer on the host memory.
buff_bsize
- The size of the buffer to copy.
dest_daddr
- Flex IO heap memory buffer address to copy to.

Returns

flexio status value.

Description

This function copies data from a buffer on the host memory to a buffer on the Flex IO heap memory.

flexio_status flexio_log_dev_destroy ( flexio_process* process )
Destroys a flexio device messaging default stream environment.
Parameters
process
- A pointer to the Flex IO process.

Returns

flexio status value.

Description

This function destroys and releases all resources, allocated for process messaging needs, which were allocated by flexio_log_dev_init() in purpose of serving the default stream.

flexio_status flexio_log_dev_flush ( flexio_process* process )
Flush the default msg stream's buffer in case of asynchronous messaging mode.
Parameters
process
- A pointer to the Flex IO process.

Returns

flexio status value.

Description

All data from the default msg stream buffer will be flushed to the file defined in flexio_log_dev_init().

In case of synchronous device messaging this functions does nothing. This function allocates resources to support messaging from Flex IO to HOST.

flexio_status flexio_log_dev_init ( flexio_process* process, flexio_msg_stream_attr_t* stream_fattr, FILE* out, pthread_t* ppthread )
Create environment to support messages output from DPA.
Parameters
process
- A pointer to the Flex IO process.
stream_fattr
- A pointer to the messaging attributes struct.
out
- file to save data from Flex IO. Use stdout if you want receive data on HOST's console
ppthread
- A pointer to receive pthread ID of created thread. May be NULL if user doesn't need it.

Returns

flexio status value.

Description

This function allocates resources to support messages output from Flex IO to HOST. It can only allocate and create the default stream.

Device messaging works in the following modes: synchronous or asynchronous. Under synchronous mode, a dedicated thread starts to receive data and outputs it immediately. When asynchronous mode is in operation, all message stream buffers will be flushed by flexio_log_dev_flush(). Buffer can be overrun.

This function doesn't have a "destroy" procedure. All messaging infrastructure will be closed and the resources will be released using the flexio_process_destroy() function.

enum flexio_log_lvl flexio_log_lvl_set ( enum flexio_log_lvl lvl )
Sets host SDK logging level.
Parameters
lvl
- logging level to set. All entries with this or higher priority level will be printed.

Returns

the previous host logging level.

Description

This function sets the host logging level. Changing the logging level may change the visibility of some logging entries in the SDK code.

uint32_t flexio_mkey_get_id ( flexio_mkey* mkey )
Gets the Flex IO MKey ID.
Parameters
mkey
- A pointer to a Flex IO MKey.

Returns

the Flex IO mkey ID or UINT32_MAX on error.

Description

flexio_status flexio_msg_stream_create ( flexio_process* process, flexio_msg_stream_attr_t* stream_fattr, FILE* out, pthread_t* ppthread, flexio_msg_stream** stream )
Create a Flex IO msg stream that can contain output messages sent from the DPA.
Parameters
process
- A pointer to the Flex IO process.
stream_fattr
- A pointer to the flexio_msg_stream attributes struct.
out
- file to save data from Flex IO. Use stdout if you want receive data on HOST's console
ppthread
- A pointer to receive pthread ID of created thread. May be NULL if user doesn't need it.
stream
- A pointer to the created stream context pointer.

Returns

flexio status value.

Description

This function can create a flexio_msg_stream that could have device messages directed to it. Directing messages from the device to the host, could be done to any and all open streams, including the default stream.

The function creates the same resources created in flexio_log_dev_init for any new stream. It can also create the default stream. It creates it with the FLEXIO_MSG_DEV_INFO stream level, and that could be modified using flexio_msg_stream_level_set.

flexio_status flexio_msg_stream_destroy ( flexio_msg_stream* stream )
Destroys a Flex IO msg stream.
Parameters
stream
- A pointer to the stream context.

Returns

flexio status value.

Description

This function destroys any Flex IO msg stream.

flexio_status flexio_msg_stream_flush ( flexio_msg_stream* stream )
Flush a msg stream's buffer in case of asynchronous messaging mode.
Parameters
stream
- A pointer to the Flex IO msg stream.

Returns

flexio status value.

Description

All data from the msg stream buffer will be flushed to the file defined in flexio_msg_stream_create().

In case of synchronous device messaging this functions does nothing. This function allocates resources to support messaging from Flex IO to HOST.

int flexio_msg_stream_get_id ( flexio_msg_stream* stream )
Gets the Flex IO device message stream's ID (aka file descriptor).
Parameters
stream
- A pointer to a Flex IO message stream.

Returns

the stream_id or -1 in case of error.

Description

Using this function on a destroyed stream will result in unpredictable behavior.

flexio_status flexio_msg_stream_level_set ( flexio_msg_stream* stream, flexio_msg_dev_level level )
Change the provided device message stream's level.
Parameters
stream
- A pointer to a Flex IO message stream.
level
- The new desired level, ranges between FLEXIO_MSG_DEV_NO_PRINT FLEXIO_MSG_DEV_DEBUG. FLEXIO_MSG_DEV_ALWAYS_PRINT cannot be used here.

Returns

flexio status value.

Description

The default stream's level cannot be altered. Note that modifying the stream's level while messages are being sent may result in missing or unwanted messages.

flexio_status flexio_outbox_create ( flexio_process* process, flexio_outbox_attr* fattr, flexio_outbox** outbox )
Creates a Flex IO outbox.
Parameters
process
- A pointer to the Flex IO process.
fattr
- A pointer to the outbox attributes struct.
outbox
- A pointer to the created outbox context pointer.

Returns

flexio status value.

Description

This function Creates a Flex IO outbox for the given process.

flexio_status flexio_outbox_destroy ( flexio_outbox* outbox )
Destroys a Flex IO outbox.
Parameters
outbox
- A pointer to a outbox context.

Returns

flexio status value.

Description

This function destroys a Flex IO outbox.

uint32_t flexio_outbox_get_id ( flexio_outbox* outbox )
Gets the Flex IO outbox ID.
Parameters
outbox
- A pointer to a Flex IO outbox.

Returns

the Flex IO outbox ID or UINT32_MAX on error.

Description

flexio_uar* flexio_outbox_get_uar ( flexio_outbox* outbox )
Gets a Flex IO UAR object from a Flex IO outbox.
Parameters
outbox
- A pointer to a Flex IO outbox.

Returns

the Flex IO outbox UAR object or NULL on error.

Description

flexio_status flexio_process_call ( flexio_process* process, flexio_func_t* host_func, uint64_t* func_ret, ... )
Calls a Flex IO process.
Parameters
process
- A pointer to the Flex IO process to run.
host_func
- The host stub function that is used by the application to reference the device function.
func_ret
- A pointer to the ELF function return value.

Returns

flexio status value.

Description

flexio_status flexio_process_create ( ibv_context* ibv_ctx, flexio_app* app, const flexio_process_attr* process_attr, flexio_process** process_ptr )
Create a new Flex IO process.
Parameters
ibv_ctx
- A pointer to a device context.
app
- Device side application handle.
process_attr
- Optional, process attributes for create. Can be NULL.
process_ptr
- A pointer to the created process pointer.

Returns

flexio status value.

Description

This function creates a new Flex IO process with requested image.

flexio_status flexio_process_destroy ( flexio_process* process )
Destroys a Flex IO process.
Parameters
process
- A pointer to a process. NULL is a valid value.

Returns

flexio status value.

Description

This function destroys a Flex IO process.

flexio_status flexio_process_error_handler_set ( flexio_process* process, flexio_func_t* error_handler )
Set the Flexio process error handler.
Parameters
process
- A pointer to a process
error_handler
- The host stub function that is used as a reference to the error handler function.

Returns

flexio status value.

Description

This function sets the Flex IO process error handler. The error handler must be set after the process is created, and before the first thread is created. The function registered for error handler should be annotated with __dpa_global__.

uint32_t flexio_process_get_dumem_id ( flexio_process* process )
Gets the Flex IO process DUMEM ID.
Parameters
process
- A pointer to a Flex IO process.

Returns

the Flex IO process DUMEM ID or UINT32_MAX on error.

Description

ibv_pd* flexio_process_get_pd ( flexio_process* process )
Gets a Flex IO IBV PD object from a Flex IO process.
Parameters
process
- A pointer to a Flex IO process.

Returns

the process's PD object or NULL on error.

Description

flexio_uar* flexio_process_get_uar ( flexio_process* process )
Gets a Flex IO UAR object from a Flex IO process.
Parameters
process
- A pointer to a Flex IO process.

Returns

the Flex IO process UAR object or NULL on error.

Description

flexio_status flexio_process_mem_info_get ( const flexio_process* process, flexio_heap_mem_info* info )
Get process memory info.
Parameters
process
- A pointer to the Flex IO process context.
info
- A pointer to flexio_heap_mem_info struct to fill info.

Returns

flexio status value.

Description

This function returns the process heap memory base address and its available size.

uint64_t flexio_process_udbg_token_get ( flexio_process* process )
Get token for Flex IO process debug access.
Parameters
process
- A pointer to the Flex IO process context.

Returns

the requested token. Zero value means - User Debug access for the process is not allowed.

Description

This function returns the token, needed for user debug syscalls access.

flexio_status flexio_qp_create ( flexio_process* process, ibv_context* ibv_ctx, flexio_qp_attr* qp_fattr, flexio_qp** qp_ptr )
Creates a Flex IO QP.
Parameters
process
- A pointer to the Flex IO process.
ibv_ctx
- A pointer to an IBV device context (might be different than process'). If NULL - process' will be used.
qp_fattr
- A pointer to the QP attributes struct.
qp_ptr
- A pointer to the created QP context pointer.

Returns

flexio status value.

Description

This function creates a Flex IO QP.

flexio_status flexio_qp_destroy ( flexio_qp* qp )
Destroys a Flex IO QP.
Parameters
qp
- A pointer to the QP context.

Returns

flexio status value.

Description

This function destroys a Flex IO QP.

uint32_t flexio_qp_get_qp_num ( flexio_qp* qp )
Gets the Flex IO QP number.
Parameters
qp
- A pointer to a Flex IO QP.

Returns

the QP number or UINT32_MAX on error.

Description

flexio_status flexio_qp_modify ( flexio_qp* qp, flexio_qp_attr* fattr, flexio_qp_attr_opt_param_mask* mask )
Modify Flex IO QP.
Parameters
qp
- A pointer to the QP context.
fattr
- A pointer to the QP attributes struct that will also define the QP connection.
mask
- A pointer to the optional QP attributes mask.

Returns

flexio status value.

Description

This function modifies Flex IO QP and transition it between states. At the end of the procedure Flex IO QP would have moved from it's current state to to next state, given in the fattr, if the move is a legal transition in the QP's state machine.

flexio_qp_state flexio_qp_state_get ( flexio_qp* qp )
retrieve the device QP state.
Parameters
qp
- A pointer to a Flex IO QP.

Returns

enum flexio_qp_state.

Description

This function return the device QP state it is currently in.

flexio_status flexio_rmp_create ( flexio_process* process, ibv_context* ibv_ctx, const flexio_wq_attr* fattr, flexio_rmp** flexio_rmp_ptr )
Creates a Flex IO RMP.
Parameters
process
- A pointer to the Flex IO process.
ibv_ctx
- A pointer to an IBV device context (might be different than process'). If NULL - process' will be used.
fattr
- A pointer to the WQ attributes struct.
flexio_rmp_ptr
- A pointer to the created RMP context pointer.

Returns

flexio status value.

Description

This function creates a Flex IO RMP.

flexio_status flexio_rmp_destroy ( flexio_rmp* flexio_rmp )
Destroys a Flex IO RMP.
Parameters
flexio_rmp
- A pointer to an RMP context.

Returns

flexio status value.

Description

This function destroys a Flex IO RMP.

uint32_t flexio_rmp_get_wq_num ( flexio_rmp* rmp )
Gets the Flex IO RMP number.
Parameters
rmp
- A pointer to a Flex IO RMP.

Returns

the RQ number or UINT32_MAX on error.

Description

flexio_status flexio_rq_create ( flexio_process* process, ibv_context* ibv_ctx, uint32_t cq_num, const flexio_wq_attr* fattr, flexio_rq** flexio_rq_ptr )
Creates a Flex IO RQ.
Parameters
process
- A pointer to the Flex IO process.
ibv_ctx
- A pointer to an IBV device context (might be different than process'). If NULL - process' will be used.
cq_num
- A CQ number.
fattr
- A pointer to the RQ WQ attributes struct.
flexio_rq_ptr
- A pointer to the created RQ context pointer.

Returns

flexio status value.

Description

This function creates a Flex IO RQ.

flexio_status flexio_rq_destroy ( flexio_rq* flexio_rq )
Destroys a Flex IO RQ.
Parameters
flexio_rq
- A pointer to an RQ context.

Returns

flexio status value.

Description

This function destroys a Flex IO RQ.

mlx5dv_devx_obj* flexio_rq_get_tir ( flexio_rq* rq )
Gets the Flex IO RQ TIR object.
Parameters
rq
- A pointer to a Flex IO RQ.

Returns

the RQ TIR object or NULL on error.

Description

uint32_t flexio_rq_get_wq_num ( flexio_rq* rq )
Gets the Flex IO RQ number.
Parameters
rq
- A pointer to a Flex IO RQ.

Returns

the RQ number or UINT32_MAX on error.

Description

flexio_status flexio_rq_set_err_state ( flexio_rq* rq )
Sets a Flex IO RQ to error state.
Parameters
rq
- A pointer to the RQ context to move to error state.

Returns

flexio status value.

Description

This function sets a Flex IO RQ to error state.

flexio_status flexio_sq_create ( flexio_process* process, ibv_context* ibv_ctx, uint32_t cq_num, const flexio_wq_attr* fattr, flexio_sq** flexio_sq_ptr )
Creates a Flex IO SQ.
Parameters
process
- A pointer to the Flex IO process.
ibv_ctx
- A pointer to an IBV device context (might be different than process'). If NULL - process' will be used.
cq_num
- A CQ number (can be Flex IO or host CQ).
fattr
- A pointer to the SQ attributes struct.
flexio_sq_ptr

Returns

flexio status value.

Description

This function creates a Flex IO SQ.

flexio_status flexio_sq_destroy ( flexio_sq* flexio_sq )
Destroys a Flex IO SQ.
Returns

flexio status value.

Description

This function destroys a Flex IO SQ.

uint32_t flexio_sq_get_wq_num ( flexio_sq* sq )
Gets the Flex IO SQ number.
Parameters
sq
- A pointer to a Flex IO SQ.

Returns

the SQ number or UINT32_MAX on error.

Description

flexio_status flexio_uar_create ( flexio_process* process, flexio_uar** flexio_uar )
Creates a Flex IO UAR object.
Parameters
process
- A pointer to the Flex IO process context.
flexio_uar
- A pointer to a pointer to the created Flex IO UAR struct.

Returns

flexio status value.

Description

This function creates a Flex IO UAR object.

flexio_status flexio_uar_destroy ( flexio_uar* uar )
destroys a Flex IO UAR object
Parameters
uar
- A pointer to the Flex IO UAR to destroy.

Returns

flexio status value.

Description

This function destroys a Flex IO UAR object.

flexio_status flexio_uar_extend ( flexio_uar* in_uar, ibv_context* to_extend, flexio_uar** extended )
Extend UAR to an ibv context.
Parameters
in_uar
- A pointer to the Flex IO uar.
to_extend
- A pointer to an IBV device context to be extended to.
extended
- A pointer to the UAR context pointer.

Returns

flexio status value.

Description

This function extend the UAR to an ibv context to allow handling its queues.

flexio_uar_device_id flexio_uar_get_extended_id ( flexio_uar* uar )
Gets the Flex IO extended UAR ID.
Parameters
uar
- A pointer to a Flex IO extended UAR.

Returns

the Flex IO UAR extended ID or UINT32_MAX on error.

Description

uint32_t flexio_uar_get_id ( flexio_uar* uar )
Gets the Flex IO UAR ID.
Parameters
uar
- A pointer to a Flex IO UAR.

Returns

the Flex IO UAR ID or UINT32_MAX on error.

Description

flexio_status flexio_window_create ( flexio_process* process, ibv_pd* pd, flexio_window** window )
Creates a Flex IO window.
Parameters
process
- A pointer to the Flex IO process.
pd
- A pointer to a protection domain struct to the memory the window should access.
window
- A pointer to the created window context pointer.

Returns

flexio status value.

Description

This function Creates a Flex IO window for the given process.

flexio_status flexio_window_destroy ( flexio_window* window )
Destroys a Flex IO window.
Parameters
window
- A pointer to a window context.

Returns

flexio status value.

Description

This function destroys a Flex IO window.

uint32_t flexio_window_get_id ( flexio_window* window )
Gets the Flex IO window ID.
Parameters
window
- A pointer to a Flex IO window.

Returns

the Flex IO window ID or UINT32_MAX on error.

Description

Flex IO SDK device API for DPA programs. Includes services for DPA programs.

Flex IO SDK message stream device API for DPA programs. Includes message stream services for DPA programs.

Classes

struct flexio_dev_process_tracer_ctx
struct flexio_tracer_msg
struct spinlock_s

Defines

#define flexio_dev_msg_broadcast ( lvl, ... )
Create message entry and outputs from the device to all of the host's open streams. Same as a regular printf but with protection from simultaneous print from different threads.
#define flexio_dev_msg_dflt ( lvl, ... )
Create message entry and outputs from the device to host's default stream. Same as a regular printf but with protection from simultaneous print from different threads.
#define flexio_dev_print ( ... )
Create message entry and outputs from the device to host's default stream, with FLEXIO_MSG_DEV_INFO message level. Same as a regular printf but with protection from simultaneous print from different threads.
#define spin_init ( lock )
Initialize a spinlock mechanism.
#define spin_lock ( lock )
Lock a spinlock mechanism.
#define spin_trylock ( lock )
Atomic try to catch lock.
#define spin_unlock ( lock )
Unlock a spinlock mechanism.

Typedefs

typedef uint64_t(  flexio_dev_arg_unpack_func_t
typedef void(  flexio_dev_async_rpc_handler_t
typedef void(  flexio_dev_event_handler_t
typedef uint64_t(  flexio_dev_rpc_handler_t
typedef uint32_t  flexio_uar_device_id

Enumerations

enum cq_ce_mode
enum flexio_dev_status_t

Functions

uint64_t flexio_dev_get_pcc_table_base ( uint16_t gvmi )
get programable congestion control table base address
int  flexio_dev_get_thread_ctx ( flexio_dev_thread_ctx** dtctx )
Request thread context.
uint32_t flexio_dev_get_thread_id ( flexio_dev_thread_ctx* dtctx )
Get thread ID from thread context.
flexio_uintptr_t flexio_dev_get_thread_local_storage ( flexio_dev_thread_ctx* dtctx )
Get thread local storage address from thread context.
int  flexio_dev_msg ( int  stream_id, flexio_msg_dev_level level, const char* format, ... )
Creates message entry and outputs from the device to the host side. Same as a regular printf but with protection from simultaneous print from different threads.
void flexio_dev_nic_counters_config ( uint32_t* values, uint32_t* counter_ids, uint32_t num_coutners )
Prepare a list of counters to read.
void flexio_dev_nic_counters_sample ( void )
Sample counters according to the prior configuration call.
flexio_dev_status_t flexio_dev_outbox_config ( flexio_dev_thread_ctx* dtctx, uint16_t outbox_config_id )
Config thread outbox object.
void flexio_dev_outbox_config_fast ( flexio_dev_thread_ctx* dtctx, uint16_t outbox_config_id )
Config thread outbox object without any checks.
flexio_dev_status_t flexio_dev_outbox_config_uar_extension ( flexio_dev_thread_ctx* dtctx, flexio_uar_device_id device_id )
set extension ID for outbox
void flexio_dev_process_finish ( void )
Exit flexio process (no errors).
int  flexio_dev_puts ( flexio_dev_thread_ctx* dtctx, char* str )
Put a string to messaging queue.
void flexio_dev_thread_finish ( void )
Exit from a thread, mark it as finished.
void flexio_dev_thread_reschedule ( void )
Exit from a thread, leave process active.
void flexio_dev_thread_retrigger ( void )
Exit from a thread, and retrigger it.
void flexio_dev_trace_0 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id )
Creates trace message entry with no arguments.
void flexio_dev_trace_1 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0 )
Creates trace message entry with 1 arguments.
void flexio_dev_trace_2 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1 )
Creates trace message entry with 2 arguments.
void flexio_dev_trace_3 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1, uint64_t arg2 )
Creates trace message entry with 3 arguments.
void flexio_dev_trace_4 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3 )
Creates trace message entry with 4 arguments.
void flexio_dev_trace_5 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4 )
Creates trace message entry with 5 arguments.
void flexio_dev_trace_6 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5 )
Creates trace message entry with 6 arguments.
void flexio_dev_tracer_flush ( uint8_t tracer_id )
Flush not full buffer.
void flexio_dev_tracer_notify_host ( uint8_t tracer_id, uint32_t num_msg )
Send a tracer buffer to host side.
flexio_dev_status_t flexio_dev_window_config ( flexio_dev_thread_ctx* dtctx, uint16_t window_config_id, uint32_t mkey )
Config thread window object.
flexio_dev_status_t flexio_dev_window_copy_from_host ( flexio_dev_thread_ctx* dtctx, void* daddr, uint64_t haddr, uint32_t size )
Copy a buffer from host memory to device memory.
flexio_dev_status_t flexio_dev_window_copy_to_host ( flexio_dev_thread_ctx* dtctx, uint64_t haddr, const void* daddr, uint32_t size )
Copy a buffer from device memory to host memory.
flexio_dev_status_t flexio_dev_window_mkey_config ( flexio_dev_thread_ctx* dtctx, uint32_t mkey )
Config thread window mkey object.
flexio_dev_status_t flexio_dev_window_ptr_acquire ( flexio_dev_thread_ctx* dtctx, uint64_t haddr, flexio_uintptr_t* daddr )
Generate device address from host allocated memory.
void flexio_dev_yield ( flexio_dev_thread_ctx* dtctx )
exit point for continuable event handler routine

Variables

struct flexio_tracer_msg __packed__
flexio_dev_process_tracer_ctxg_dev_p_tracer_ctx

Defines

#define flexio_dev_msg_broadcast ( lvl, ... )

[in] level - messaging level. [in] ... - format and the parameters. Same as for regular printf.

Value

flexio_dev_msg(FLEXIO_MSG_DEV_BROADCAST_STREAM, lvl, __VA_ARGS__)

#define flexio_dev_msg_dflt ( lvl, ... )

[in] level - messaging level. [in] ... - format and the parameters. Same as for regular printf.

Value

flexio_dev_msg(FLEXIO_MSG_DEV_DEFAULT_STREAM_ID, lvl, __VA_ARGS__)

#define flexio_dev_print ( ... )

[in] ... - format and the parameters. Same as for regular printf.

Value

flexio_dev_msg(FLEXIO_MSG_DEV_DEFAULT_STREAM_ID, FLEXIO_MSG_DEV_INFO, __VA_ARGS__)

#define spin_init ( lock )

Initialize a spinlock mechanism, must be called before use.

Value

__atomic_store_n(&((lock)->locked), 0, __ATOMIC_SEQ_CST)

Parameters
lock
- A pointer to spinlock_s structure.

#define spin_lock ( lock )

Lock a spinlock mechanism.

Value

do { \ while (__atomic_exchange_n(&((lock)->locked), 1, __ATOMIC_SEQ_CST)) {;} \ } while (0)

Parameters
lock
- A pointer to spinlock_s structure.

#define spin_trylock ( lock )

makes attempt to take lock. Returns immediately.

Value

__atomic_exchange_n(&((lock)->locked), 1, __ATOMIC_SEQ_CST)

Parameters
lock
- A pointer to spinlock_s structure.

#define spin_unlock ( lock )

Unlock a spinlock mechanism.

Value

__atomic_store_n(&((lock)->locked), 0, __ATOMIC_SEQ_CST)

Parameters
lock
- A pointer to spinlock_s structure.

Typedefs

typedef uint64_t( flexio_dev_arg_unpack_func_t

Unpack the arguments and call the user function.

This callback function is used at runtime to unpack the arguments from the call on Host and then call the function on DPA. This function is called internally from flexio dev.

argbuf - Argument buffer that was written by Host. func - Function pointer to user function.

return uint64_t - result of the RPC function.

typedef void( flexio_dev_async_rpc_handler_t

Asynchronous RPC handler callback function type.

Defines an RPC handler callback function.

arg - argument of the RPC function.

return void.

typedef void( flexio_dev_event_handler_t

Event handler callback function type.

Defines an event handler callback function. On handler function end, need to call flexio_dev_process_finish() instead of a regular return statement, in order to properly release resources back to the OS.

thread_arg - an argument for the executing thread.

return void.

typedef uint64_t( flexio_dev_rpc_handler_t

RPC handler callback function type.

Defines an RPC handler for most useful callback function.

arg - argument of the RPC function.

return uint64_t - result of the RPC function.

typedef uint32_t flexio_uar_device_id

Flex IO UAR extension ID prototype.

Enumerations

enum cq_ce_mode

Flex IO dev CQ CQE creation modes.

Values
MLX5_CTRL_SEG_CE_CQE_ON_CQE_ERROR = 0x0
MLX5_CTRL_SEG_CE_CQE_ON_FIRST_CQE_ERROR = 0x1
MLX5_CTRL_SEG_CE_CQE_ALWAYS = 0x2
MLX5_CTRL_SEG_CE_CQE_AND_EQE = 0x3

enum flexio_dev_status_t

Return status of Flex IO dev API functions.

Values
FLEXIO_DEV_STATUS_SUCCESS = 0
FLEXIO_DEV_STATUS_FAILED = 1

Functions

uint64_t flexio_dev_get_pcc_table_base ( uint16_t gvmi )
get programable congestion control table base address
Parameters
gvmi
- PCC table GVMI.

Returns

PCC table base address for the given GVMI.

Description

This function gets the programable congestion control table base address.

int flexio_dev_get_thread_ctx ( flexio_dev_thread_ctx** dtctx )
Request thread context.
Parameters
dtctx
- A pointer to a pointer of flexio_dev_thread_ctx structure.

Returns

0 on success negative value on failure.

Description

This function requests the thread context. Should be called for every start of thread.

uint32_t flexio_dev_get_thread_id ( flexio_dev_thread_ctx* dtctx )
Get thread ID from thread context.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.

Returns

thread ID value.

Description

This function queries a thread context for its thread ID (from thread metadata).

flexio_uintptr_t flexio_dev_get_thread_local_storage ( flexio_dev_thread_ctx* dtctx )
Get thread local storage address from thread context.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.

Returns

thread local storage value.

Description

This function queries a thread context for its thread local storage (from thread metadata).

int flexio_dev_msg ( int  stream_id, flexio_msg_dev_level level, const char* format, ... )
Creates message entry and outputs from the device to the host side. Same as a regular printf but with protection from simultaneous print from different threads.
Returns

- same as from regular printf.

Description

[in] stream_id - the relevant msg stream, created and passed from the host. [in] level - messaging level. [in] format, ... - same as for regular printf.

void flexio_dev_nic_counters_config ( uint32_t* values, uint32_t* counter_ids, uint32_t num_coutners )
Prepare a list of counters to read.
Parameters
values
- buffer to store counters values (32b) read by flexio_dev_nic_counters_sample().
counter_ids
- An array of counter ids.
num_coutners

Description

The list is stored in kernel memory. A single counters config per process is supported. Note that arrays memory must be defined in global or heap memory only.

void flexio_dev_nic_counters_sample ( void )
Sample counters according to the prior configuration call.
Description

Sample counter_ids, num_counters and values buffer provided in the last successful call to flexio_dev_config_nic_counters(). This call ensures fastest sampling on a pre-checked counter ids and buffers.

flexio_dev_status_t flexio_dev_outbox_config ( flexio_dev_thread_ctx* dtctx, uint16_t outbox_config_id )
Config thread outbox object.
Parameters
dtctx
- A pointer to flexio_dev_thread_ctx structure.
outbox_config_id
- The outbox object config id.

Returns

flexio_dev_status_t.

Description

This function updates the thread outbox object of the given thread context.

void flexio_dev_outbox_config_fast ( flexio_dev_thread_ctx* dtctx, uint16_t outbox_config_id )
Config thread outbox object without any checks.
Parameters
dtctx
- A pointer to flexio_dev_thread_ctx structure.
outbox_config_id
- The outbox object config id.

Description

This function updates the thread outbox object of the given thread context, but it doesn't check for correctness or redundancy (same ID as current configured).

flexio_dev_status_t flexio_dev_outbox_config_uar_extension ( flexio_dev_thread_ctx* dtctx, flexio_uar_device_id device_id )
set extension ID for outbox
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.
device_id
- The device ID.

Returns

flexio_dev_status_t.

Description

This function sets the GVMI for the outbox to operate on.

void flexio_dev_process_finish ( void )
Exit flexio process (no errors).
Description

This function releases resources back to OS and returns '0x40' in dpa_process_status. All threads for the current process will stop executing and no new threads will be able to trigger for this process. Threads state will NOT be changes to 'finished' (will remain as is).

int flexio_dev_puts ( flexio_dev_thread_ctx* dtctx, char* str )
Put a string to messaging queue.
Parameters
dtctx
- A pointer to a pointer of flexio_dev_thread_ctx structure.
str
- A pointer to string.

Returns

length of messaged string.

Description

This function puts a string to host's default stream messaging queue. This queue has been serviced by host application. Would have no effect, if the host application didn't configure device messaging stream environment. In order to initialize/configure device messaging environment - On HOST side - after flexio_process_create, a stream should be created, therefore flexio_msg_stream_create should be called, and the default stream should be created. On DEV side - before using flexio_dev_puts, the thread context is needed, therefore flexio_dev_get_thread_ctx should be called before.

void flexio_dev_thread_finish ( void )
Exit from a thread, mark it as finished.
Description

This function releases resources back to OS. The thread will be marked as finished so next DUAR will not trigger it.

void flexio_dev_thread_reschedule ( void )
Exit from a thread, leave process active.
Description

This function releases resources back to OS. For the next DUAR the thread will restart from the beginning.

void flexio_dev_thread_retrigger ( void )
Exit from a thread, and retrigger it.
Description

This function asks the OS to retrigger the thread. The thread will not wait for the next DUAR to be triggered but will be triggered immediately.

void flexio_dev_trace_0 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id ) [inline]
Creates trace message entry with no arguments.
Description

Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.

[in] tracer_id - the relevant msg stream id. [in] level - messaging level. [in] format_id -the template format id to print message accordingly.

void flexio_dev_trace_1 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0 ) [inline]
Creates trace message entry with 1 arguments.
Description

Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.

[in] tracer_id - the relevant msg stream id. [in] level - messaging level. [in] format_id -the template format id to print message accordingly. [in] arg0 - argument #0 to format into the template.

void flexio_dev_trace_2 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1 ) [inline]
Creates trace message entry with 2 arguments.
Description

Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.

[in] tracer_id - the relevant msg stream id. [in] level - messaging level. [in] format_id -the template format id to print message accordingly. [in] arg0 - argument #0 to format into the template. [in] arg1 - argument #1 to format into the template.

void flexio_dev_trace_3 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1, uint64_t arg2 ) [inline]
Creates trace message entry with 3 arguments.
Description

Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.

[in] tracer_id - the relevant msg stream id. [in] level - messaging level. [in] format_id -the template format id to print message accordingly. [in] arg0 - argument #0 to format into the template. [in] arg1 - argument #1 to format into the template. [in] arg2 - argument #2 to format into the template.

void flexio_dev_trace_4 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3 ) [inline]
Creates trace message entry with 4 arguments.
Description

Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.

[in] tracer_id - the relevant msg stream id. [in] level - messaging level. [in] format_id -the template format id to print message accordingly. [in] arg0 - argument #0 to format into the template. [in] arg1 - argument #1 to format into the template. [in] arg2 - argument #2 to format into the template. [in] arg3 - argument #3 to format into the template.

void flexio_dev_trace_5 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4 ) [inline]
Creates trace message entry with 5 arguments.
Description

Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.

[in] tracer_id - the relevant msg stream id. [in] level - messaging level. [in] format_id -the template format id to print message accordingly. [in] arg0 - argument #0 to format into the template. [in] arg1 - argument #1 to format into the template. [in] arg2 - argument #2 to format into the template. [in] arg3 - argument #3 to format into the template. [in] arg4 - argument #4 to format into the template.

void flexio_dev_trace_6 ( uint8_t tracer_id, flexio_msg_dev_level level, int  format_id, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5 ) [inline]
Creates trace message entry with 6 arguments.
Description

Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.

[in] tracer_id - the relevant msg stream id. [in] level - messaging level. [in] format_id -the template format id to print message accordingly. [in] arg0 - argument #0 to format into the template. [in] arg1 - argument #1 to format into the template. [in] arg2 - argument #2 to format into the template. [in] arg3 - argument #3 to format into the template. [in] arg4 - argument #4 to format into the template. [in] arg5 - argument #5 to format into the template.

void flexio_dev_tracer_flush ( uint8_t tracer_id )
Flush not full buffer.
Description

As soon as a buffer is fully occupied it is internal sent to host, however user can ask partially occupied buffer to be sent to host. Its intended use is at end of run to flush whatever messages left. Flush is also performed by the host stream destroy call.

NOTE: this call is not thread safe, user responsibility to avoid calling it while any device trace APIs are in use. Frequent call to this API might cause performance issues.

[in] tracer_id - ID of tracer to flush.

void flexio_dev_tracer_notify_host ( uint8_t tracer_id, uint32_t num_msg )
Send a tracer buffer to host side.
Description

Send current used buffer to the host. Main usage is to send a full buffer to not risk writing to the buffer from other threads while sending.

NOTE: this call is not thread safe, user responsibility to avoid calling it while any device trace APIs are in use.

[in] tracer_id - ID of tracer to send a notification for.

flexio_dev_status_t flexio_dev_window_config ( flexio_dev_thread_ctx* dtctx, uint16_t window_config_id, uint32_t mkey )
Config thread window object.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.
window_config_id
- The window object id.
mkey
- mkey object.

Returns

flexio_dev_status_t.

Description

This function updates the thread window object of the given thread context.

flexio_dev_status_t flexio_dev_window_copy_from_host ( flexio_dev_thread_ctx* dtctx, void* daddr, uint64_t haddr, uint32_t size )
Copy a buffer from host memory to device memory.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.
daddr
- A pointer to the device memory buffer.
haddr
- A pointer to the host memory allocated buffer.
size
- Number of bytes to copy.

Returns

flexio_dev_status_t.

Description

This function copies specified number of bytes from host memory to device memory. UNSUPPORTED at this time.

flexio_dev_status_t flexio_dev_window_copy_to_host ( flexio_dev_thread_ctx* dtctx, uint64_t haddr, const void* daddr, uint32_t size )
Copy a buffer from device memory to host memory.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.
haddr
- A pointer to the host memory allocated buffer.
daddr
- A pointer to the device memory buffer.
size
- Number of bytes to copy.

Returns

flexio_dev_status_t.

Description

This function copies specified number of bytes from device memory to host memory.

flexio_dev_status_t flexio_dev_window_mkey_config ( flexio_dev_thread_ctx* dtctx, uint32_t mkey )
Config thread window mkey object.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.
mkey
- mkey object.

Returns

flexio_dev_status_t.

Description

This function updates the thread window mkey object of the given thread context.

flexio_dev_status_t flexio_dev_window_ptr_acquire ( flexio_dev_thread_ctx* dtctx, uint64_t haddr, flexio_uintptr_t* daddr )
Generate device address from host allocated memory.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.
haddr
- Host allocated address.
daddr
- A pointer to write the device generated matching address.

Returns

flexio_dev_status_t.

Description

This function generates a memory address to be used by device to access host side memory, according to already create window object. from a host allocated address.

void flexio_dev_yield ( flexio_dev_thread_ctx* dtctx )
exit point for continuable event handler routine
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.

Description

This function is used to mark the exit point on continuable event handler where user wishes to continue execution on next event. In order to use this API the event handler must be created with continuable flag enabled, otherwise call will have no effect.

Variables

struct flexio_tracer_msg __packed__

Describes Flex IO trace message. This struct is used to communicate the tracer raw data from device to host.

flexio_dev_process_tracer_ctx * g_dev_p_tracer_ctx

Global process tracer context struct instance.

Flex IO SDK device API for DPA programs error handling.

Enumerations

enum flexio_dev_error_t

Functions

 __attribute__ ( (__noreturn__) )
Exit the process and return a user (fatal) error code.
uint64_t flexio_dev_get_and_rst_errno ( flexio_dev_thread_ctx* dtctx )
Get and Reset thread error flag (errno) of recoverable (non fatal) error.
uint64_t flexio_dev_get_errno ( flexio_dev_thread_ctx* dtctx )
Get thread error flag (errno) of recoverable (non fatal) error.
void flexio_dev_rst_errno ( flexio_dev_thread_ctx* dtctx )
Reset thread error flag (errno) of recoverable (non fatal) error.

Enumerations

enum flexio_dev_error_t

Flex IO dev errors.

Values
FLEXIO_DEV_ERROR_ILLEGAL_ERR = 0x42

Functions

__attribute__ ( (__noreturn__) )
Exit the process and return a user (fatal) error code.
Description

Error codes returned to the host in the dpa_process_status field of the DPA_PROCESS object are defined as follows: 0: OK 1-63: RTOS or Firmware errors 64-127: Flexio-SDK errors 129-255: User defined

uint64_t flexio_dev_get_and_rst_errno ( flexio_dev_thread_ctx* dtctx )
Get and Reset thread error flag (errno) of recoverable (non fatal) error.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.

Returns

- void.

Description

uint64_t flexio_dev_get_errno ( flexio_dev_thread_ctx* dtctx )
Get thread error flag (errno) of recoverable (non fatal) error.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.

Returns

thread error code.

Description

This function queries an errno field from thread context.

void flexio_dev_rst_errno ( flexio_dev_thread_ctx* dtctx )
Reset thread error flag (errno) of recoverable (non fatal) error.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.

Description

Flex IO SDK device API for DPA programs queue access. Provides an API for handling networking queues (WQs/CQs).

Enumerations

enum flexio_ctrl_seg_t
enum flexio_dev_cc_db_next_act_t

Functions

flexio_dev_status_t flexio_dev_cc_ring_db ( flexio_dev_thread_ctx* dtctx, uint16_t ccq_id, uint32_t rate, uint32_t rtt_req, flexio_dev_cc_db_next_act_t next_act )
Rings CC doorbell.
flexio_dev_status_t flexio_dev_cq_arm ( flexio_dev_thread_ctx* dtctx, uint32_t ci, uint32_t qnum )
Arm CQ function.
uint32_t flexio_dev_cqe_get_byte_cnt ( flexio_dev_cqe64* cqe )
Get byte count field from CQE function.
uint8_t flexio_dev_cqe_get_csum_ok ( flexio_dev_cqe64* cqe )
Get csum OK field from CQE function.
uint32_t flexio_dev_cqe_get_err_synd ( flexio_dev_cqe64* cqe )
Get error syndrome field from CQE function.
uint8_t flexio_dev_cqe_get_opcode ( flexio_dev_cqe64* cqe )
Get the opcode field from CQE function.
uint8_t flexio_dev_cqe_get_owner ( flexio_dev_cqe64* cqe )
Get owner field from CQE function.
uint32_t flexio_dev_cqe_get_qpn ( flexio_dev_cqe64* cqe )
Get QP number field from CQE function.
uint32_t flexio_dev_cqe_get_user_index ( flexio_dev_cqe64* cqe )
Get the user index field from CQE function.
uint16_t flexio_dev_cqe_get_wqe_counter ( flexio_dev_cqe64* cqe )
Get WQE counter filed from CQE function.
flexio_dev_status_t flexio_dev_db_ctx_arm ( flexio_dev_thread_ctx* dtctx, uint32_t qnum, uint32_t emu_ctx_id )
arm the emulation context
flexio_dev_status_t flexio_dev_db_ctx_force_trigger ( flexio_dev_thread_ctx* dtctx, uint32_t cqn, uint32_t emu_ctx_id )
force trigger of emulation context
flexio_dev_status_t flexio_dev_dbr_cq_set_ci ( uint32_t* cq_dbr, uint32_t ci )
Set consumer index value for a CQ function.
flexio_dev_status_t flexio_dev_dbr_rq_inc_pi ( uint32_t* rq_dbr )
Increment producer index of an RQ by 1 function.
flexio_dev_status_t flexio_dev_eq_update_ci ( flexio_dev_thread_ctx* dtctx, uint32_t ci, uint32_t qnum )
Update an EQ consumer index function.
uint32_t flexio_dev_eqe_get_cqn ( flexio_dev_eqe* eqe )
Get CQ number field from EQE function.
uint8_t flexio_dev_eqe_get_owner ( flexio_dev_eqe* eqe )
Get owner field from EQE function.
flexio_dev_status_t flexio_dev_msix_send ( flexio_dev_thread_ctx* dtctx, uint32_t cqn )
Send msix on the cq linked to the msix eq.
flexio_dev_status_t flexio_dev_qp_sq_ring_db ( flexio_dev_thread_ctx* dtctx, uint16_t pi, uint32_t qnum )
QP/SQ ring doorbell function.
void* flexio_dev_rwqe_get_addr ( flexio_dev_wqe_rcv_data_seg* rwqe )
Get address field from receive WQE function.
flexio_dev_status_t flexio_dev_swqe_seg_atomic_set ( flexio_dev_sqe_seg* swqe, uint64_t swap_or_add_data, uint64_t compare_data )
Fill out an Atomic send queue wqe segment function.
flexio_dev_status_t flexio_dev_swqe_seg_ctrl_set ( flexio_dev_sqe_seg* swqe, uint32_t sq_pi, uint32_t sq_number, uint32_t ce, flexio_ctrl_seg_t ctrl_seg_type )
Fill out a control send queue wqe segment function.
flexio_dev_status_t flexio_dev_swqe_seg_eth_set ( flexio_dev_sqe_seg* swqe, uint16_t cs_swp_flags, uint16_t mss, uint16_t inline_hdr_bsz, uint8_t inline_hdrs[2] )
Fill out an ethernet send queue wqe segment function.
flexio_dev_status_t flexio_dev_swqe_seg_inline_data_set ( flexio_dev_sqe_seg* swqe, uint32_t data_sz, uint32_t* data )
Fill out an inline data send queue wqe segment function.
flexio_dev_status_t flexio_dev_swqe_seg_mem_ptr_data_set ( flexio_dev_sqe_seg* swqe, uint32_t data_sz, uint32_t lkey, uint64_t data_addr )
Fill out a memory pointer data send queue wqe segment function.
flexio_dev_status_t flexio_dev_swqe_seg_rdma_set ( flexio_dev_sqe_seg* swqe, uint32_t rkey, uint64_t raddr )
Fill out an RDMA send queue wqe segment function.
flexio_dev_status_t flexio_dev_swqe_seg_shared_receive_set ( flexio_dev_sqe_seg* swqe, uint16_t next_wqe_index, uint8_t signature )
Fill out a Shared receive queue wqe segment function.
flexio_dev_status_t flexio_dev_swqe_seg_transpose_set ( flexio_dev_sqe_seg* swqe, uint8_t element_size, uint8_t num_of_cols, uint8_t num_of_rows )
Fill out a Transpose send wqe segment function.

Enumerations

enum flexio_ctrl_seg_t

Flex IO dev WQE control segment types.

Values
FLEXIO_CTRL_SEG_SEND_EN = 0
FLEXIO_CTRL_SEG_SEND_RC = 1
FLEXIO_CTRL_SEG_LDMA = 2
FLEXIO_CTRL_SEG_RDMA_WRITE = 3
FLEXIO_CTRL_SEG_RDMA_READ = 4
FLEXIO_CTRL_SEG_ATOMIC_COMPARE_AND_SWAP = 5
FLEXIO_CTRL_SEG_LSO = 6
FLEXIO_CTRL_SEG_NOP = 7
FLEXIO_CTRL_SEG_RDMA_WRITE_IMM = 8
FLEXIO_CTRL_SEG_TRANSPOSE = 9

enum flexio_dev_cc_db_next_act_t

Flex IO dev congestion control next action types.

Values
CC_DB_NEXT_ACT_SINGLE = 0x0
CC_DB_NEXT_ACT_MULTIPLE = 0x1
CC_DB_NEXT_ACT_FW = 0x2

Functions

flexio_dev_status_t flexio_dev_cc_ring_db ( flexio_dev_thread_ctx* dtctx, uint16_t ccq_id, uint32_t rate, uint32_t rtt_req, flexio_dev_cc_db_next_act_t next_act ) [inline]
Rings CC doorbell.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.
ccq_id
- CC queue ID to update.
rate
- Rate to set.
rtt_req
- RTT measure request to set.
next_act
- Next action to set.

Returns

flexio_dev_status_t.

Description

This function rings CC doorbell for the requested CC queue, which sets the requested rate, RTT request and next action.

flexio_dev_status_t flexio_dev_cq_arm ( flexio_dev_thread_ctx* dtctx, uint32_t ci, uint32_t qnum ) [inline]
Arm CQ function.
Parameters
dtctx
- A pointer to a pointer of flexio_dev_thread_ctx structure.
ci
- Current CQ consumer index.
qnum
- Number of the CQ to arm.

Returns

flexio_dev_status_t.

Description

Moves a CQ to 'armed' state. This means that next CQE created for this CQ will result in an EQE on the relevant EQ.

uint32_t flexio_dev_cqe_get_byte_cnt ( flexio_dev_cqe64* cqe ) [inline]
Get byte count field from CQE function.
Parameters
cqe
- CQE to parse.

Returns

uint32_t - Byte count field value of the CQE.

Description

Parse a CQE for its byte count field.

uint8_t flexio_dev_cqe_get_csum_ok ( flexio_dev_cqe64* cqe ) [inline]
Get csum OK field from CQE function.
Parameters
cqe
- CQE to parse.

Returns

uint8_t - csum_ok field value of the CQE.

Description

Parse a CQE for its csum OK field.

uint32_t flexio_dev_cqe_get_err_synd ( flexio_dev_cqe64* cqe ) [inline]
Get error syndrome field from CQE function.
Parameters
cqe
- CQE to parse.

Returns

uint32_t - Error syndrome field value of the CQE.

Description

Parse a CQE for its error syndrome field.

uint8_t flexio_dev_cqe_get_opcode ( flexio_dev_cqe64* cqe ) [inline]
Get the opcode field from CQE function.
Parameters
cqe
- CQE to parse.

Returns

uint8_t - Opcode field value of the CQE.

Description

uint8_t flexio_dev_cqe_get_owner ( flexio_dev_cqe64* cqe ) [inline]
Get owner field from CQE function.
Parameters
cqe
- CQE to parse.

Returns

uint8_t - Owner field value of the CQE.

Description

Parse a CQE for its owner field.

uint32_t flexio_dev_cqe_get_qpn ( flexio_dev_cqe64* cqe ) [inline]
Get QP number field from CQE function.
Parameters
cqe
- CQE to parse.

Returns

uint32_t - QP number field value of the CQE.

Description

Parse a CQE for its QP number field.

uint32_t flexio_dev_cqe_get_user_index ( flexio_dev_cqe64* cqe ) [inline]
Get the user index field from CQE function.
Parameters
cqe
- CQE to parse.

Returns

uint32_t - User index field value of the CQE.

Description

uint16_t flexio_dev_cqe_get_wqe_counter ( flexio_dev_cqe64* cqe ) [inline]
Get WQE counter filed from CQE function.
Parameters
cqe
- CQE to parse.

Returns

uint16_t - WQE counter field value of the CQE.

Description

Parse a CQE for its WQE counter field.

flexio_dev_status_t flexio_dev_db_ctx_arm ( flexio_dev_thread_ctx* dtctx, uint32_t qnum, uint32_t emu_ctx_id ) [inline]
arm the emulation context
Parameters
dtctx
- A pointer to a pointer of flexio_dev_thread_ctx structure.
qnum
emu_ctx_id
- Emulation context ID, provided by a call on the host to flexio_emu_db_to_cq_ctx_get_id.

Description

flexio_dev_status_t flexio_dev_db_ctx_force_trigger ( flexio_dev_thread_ctx* dtctx, uint32_t cqn, uint32_t emu_ctx_id ) [inline]
force trigger of emulation context
Parameters
dtctx
cqn
- CQ number provided by host.
emu_ctx_id
- Emulation context ID, provided by a call on the host to flexio_emu_db_to_cq_ctx_get_id.

Description

flexio_dev_status_t flexio_dev_dbr_cq_set_ci ( uint32_t* cq_dbr, uint32_t ci ) [inline]
Set consumer index value for a CQ function.
Parameters
cq_dbr
- A pointer to the CQ's doorbell record address.
ci
- The consumer index value to update.

Returns

flexio_dev_status_t.

Description

Writes an updated consumer index number to a CQ's doorbell record

flexio_dev_status_t flexio_dev_dbr_rq_inc_pi ( uint32_t* rq_dbr ) [inline]
Increment producer index of an RQ by 1 function.
Parameters
rq_dbr
- A pointer to the CQ's doorbell record address.

Returns

flexio_dev_status_t.

Description

Mark a WQE for reuse by incrementing the relevant RQ producer index by 1

flexio_dev_status_t flexio_dev_eq_update_ci ( flexio_dev_thread_ctx* dtctx, uint32_t ci, uint32_t qnum ) [inline]
Update an EQ consumer index function.
Parameters
dtctx
- A pointer to a pointer of flexio_dev_thread_ctx structure.
ci
- Current EQ consumer index.
qnum
- Number of the EQ to update.

Returns

flexio_dev_status_t.

Description

Updates the consumer index of an EQ after handling an EQE.

uint32_t flexio_dev_eqe_get_cqn ( flexio_dev_eqe* eqe ) [inline]
Get CQ number field from EQE function.
Parameters
eqe
- EQE to parse.

Returns

uint32_t - CQ number field value of the EQE.

Description

Parse an EQE for its CQ number field.

uint8_t flexio_dev_eqe_get_owner ( flexio_dev_eqe* eqe ) [inline]
Get owner field from EQE function.
Parameters
eqe
- EQE to parse.

Returns

uint32_t - owner field value of the EQE.

Description

Parse an EQE for its owner field.

flexio_dev_status_t flexio_dev_msix_send ( flexio_dev_thread_ctx* dtctx, uint32_t cqn ) [inline]
Send msix on the cq linked to the msix eq.
Parameters
dtctx
- A pointer to a flexio_dev_thread_ctx structure.
cqn
- CQ number to trigger db on. Trigger is done via currently configured outbox, this can be changed with outbox config API according to CQ.

Returns

flexio_dev_status_t.

Description

This function trigger msix on the given cq.

flexio_dev_status_t flexio_dev_qp_sq_ring_db ( flexio_dev_thread_ctx* dtctx, uint16_t pi, uint32_t qnum ) [inline]
QP/SQ ring doorbell function.
Parameters
dtctx
- A pointer to a pointer of flexio_dev_thread_ctx structure.
pi
- Current queue producer index.
qnum
- Number of the queue to update.

Returns

flexio_dev_status_t.

Description

Rings the doorbell of a QP or SQ in order to alert the HW of pending work.

void* flexio_dev_rwqe_get_addr ( flexio_dev_wqe_rcv_data_seg* rwqe ) [inline]
Get address field from receive WQE function.
Parameters
rwqe
- WQE to parse.

Returns

void* - Address field value of the receive WQE.

Description

Parse a receive WQE for its address field.

flexio_dev_status_t flexio_dev_swqe_seg_atomic_set ( flexio_dev_sqe_seg* swqe, uint64_t swap_or_add_data, uint64_t compare_data ) [inline]
Fill out an Atomic send queue wqe segment function.
Parameters
swqe
- Send WQE segment to fill.
swap_or_add_data
- The data that will be swapped in or the data that will be added.
compare_data
- The data that will be compared with. Unused in fetch & add operation.

Returns

flexio_dev_status_t.

Description

Fill the fields of a send WQE segment (2 DWORDs) with Atomic segment information. This segment can service a compare & swap or fetch & add operation.

flexio_dev_status_t flexio_dev_swqe_seg_ctrl_set ( flexio_dev_sqe_seg* swqe, uint32_t sq_pi, uint32_t sq_number, uint32_t ce, flexio_ctrl_seg_t ctrl_seg_type ) [inline]
Fill out a control send queue wqe segment function.
Parameters
swqe
- Send WQE segment to fill.
sq_pi
- Producer index of the send WQE.
sq_number
- SQ number that holds the WQE.
ce
- wanted CQ policy for CQEs. Value is taken from cq_ce_mode enum.
ctrl_seg_type
- Type of control segment.

Returns

flexio_dev_status_t.

Description

Fill the fields of a send WQE segment (4 DWORDs) with control segment information. This should always be the 1st segment of the WQE.

flexio_dev_status_t flexio_dev_swqe_seg_eth_set ( flexio_dev_sqe_seg* swqe, uint16_t cs_swp_flags, uint16_t mss, uint16_t inline_hdr_bsz, uint8_t inline_hdrs[2] ) [inline]
Fill out an ethernet send queue wqe segment function.
Parameters
swqe
- Send WQE segment to fill.
cs_swp_flags
- Flags for checksum and swap, see PRM section 8.9.4.2, Send WQE Construction Summary.
mss
- Maximum Segment Size - For LSO WQEs - the number of bytes in the TCP payload to be transmitted in each packet. Must be 0 on non LSO WQEs.
inline_hdr_bsz
- Length of inlined packet headers in bytes. This includes the headers in the inline_data segment as well.
inline_hdrs
- First 2 bytes of the inlined packet headers.

Returns

flexio_dev_status_t.

Description

Fill the fields of a send WQE segment (4 DWORDs) with Ethernet segment information.

flexio_dev_status_t flexio_dev_swqe_seg_inline_data_set ( flexio_dev_sqe_seg* swqe, uint32_t data_sz, uint32_t* data ) [inline]
Fill out an inline data send queue wqe segment function.
Parameters
swqe
- Send WQE segment to fill.
data_sz
- Size of the data.
data
- Inline data array (3 DWORDs).

Returns

flexio_dev_status_t.

Description

Fill the fields of a send WQE segment (4 DWORDs) with inline data segment information.

flexio_dev_status_t flexio_dev_swqe_seg_mem_ptr_data_set ( flexio_dev_sqe_seg* swqe, uint32_t data_sz, uint32_t lkey, uint64_t data_addr ) [inline]
Fill out a memory pointer data send queue wqe segment function.
Parameters
swqe
- Send WQE segment to fill.
data_sz
- Size of the data.
lkey
- Local memory access key for the data operation.
data_addr
- Address of the data for the data operation.

Returns

flexio_dev_status_t.

Description

Fill the fields of a send WQE segment (4 DWORDs) with memory pointer data segment information.

flexio_dev_status_t flexio_dev_swqe_seg_rdma_set ( flexio_dev_sqe_seg* swqe, uint32_t rkey, uint64_t raddr ) [inline]
Fill out an RDMA send queue wqe segment function.
Parameters
swqe
- Send WQE segment to fill.
rkey
- Remote memory access key for the RDMA operation.
raddr

Returns

flexio_dev_status_t.

Description

Fill the fields of a send WQE segment (4 DWORDs) with RDMA segment information.

flexio_dev_status_t flexio_dev_swqe_seg_shared_receive_set ( flexio_dev_sqe_seg* swqe, uint16_t next_wqe_index, uint8_t signature ) [inline]
Fill out a Shared receive queue wqe segment function.
Parameters
swqe
- Send WQE segment to fill.
next_wqe_index
- The next wqe index.
signature
- The signature.

Returns

flexio_dev_status_t.

Description

Fill the fields of a linked list shared receive WQE segment.

flexio_dev_status_t flexio_dev_swqe_seg_transpose_set ( flexio_dev_sqe_seg* swqe, uint8_t element_size, uint8_t num_of_cols, uint8_t num_of_rows ) [inline]
Fill out a Transpose send wqe segment function.
Parameters
swqe
- Send WQE segment to fill.
element_size
- The Matrix element_size.
num_of_cols
- Number of columns in the matrix.
num_of_rows
- Number of rows in the matrix.

Returns

flexio_dev_status_t.

Description

Fill the fields of a send WQE segment (4 DWORDs) with Transpose segment information.

© Copyright 2024, NVIDIA. Last updated on Apr 3, 2024.