2. Modules
Flex IO SDK device API for DPA programs. Includes services for DPA programs.
Modules
-
Flex IO SDK dev error handling
-
Flex IO SDK dev queue access
-
Flex IO SDK dev queue types
-
Flex IO SDK message stream
Classes
-
struct spinlock_s
Defines
- #define FLEXIO_DEV_EXPERIMENTAL
- To set a Symbol (or specifically a function) as experimental.
- #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_nic_counter_ids
- enum flexio_dev_status_t
- enum flexio_window_entity
Functions
- flexio_dev_status_t flexio_dev_cross_device_ring_db ( flexio_uar_device_id device_id, uint32_t qpn, uint32_t pi )
- send a doorbell to a QP on another device ID
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_event_handler_activate ( uint32_t activation_id )
- Activate an event handler thread.
- const FLEXIO_DEV_EXPERIMENTAL char* flexio_dev_get_current_thread_name ( void )
- Get thread name pointer.
- FLEXIO_DEV_EXPERIMENTAL uint64_t flexio_dev_get_pcc_table_base ( uint16_t vhca_id )
- get programable congestion control table base address
- FLEXIO_DEV_EXPERIMENTAL int flexio_dev_get_thread_ctx ( flexio_dev_thread_ctx** dtctx )
- Request thread context.
- FLEXIO_DEV_EXPERIMENTAL uint32_t flexio_dev_get_thread_id ( flexio_dev_thread_ctx* dtctx )
- Get thread ID from thread context.
- FLEXIO_DEV_EXPERIMENTAL flexio_uintptr_t flexio_dev_get_thread_local_storage ( flexio_dev_thread_ctx* dtctx )
- Get thread local storage address from thread context.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_memcpy16 ( uint16_t* dest, const uint16_t* src, uint64_t n )
- 2 bytes alignment memory copy
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_memcpy32 ( uint32_t* dest, const uint32_t* src, uint64_t n )
- 4 bytes alignment memory copy
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_memcpy64 ( uint64_t* dest, const uint64_t* src, uint64_t n )
- 8 bytes alignment memory copy
- FLEXIO_DEV_EXPERIMENTAL 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.
- flexio_dev_status_t flexio_dev_multi_window_config ( flexio_window_entity win_entity, uint16_t window_config_id, uint32_t mkey )
- Config thread window object.
- flexio_dev_status_t flexio_dev_multi_window_copy_from_host ( flexio_window_entity win_entity, void* daddr, uint64_t haddr, uint32_t size )
- Copy a buffer from host memory to device memory.
- flexio_dev_status_t flexio_dev_multi_window_copy_to_host ( flexio_window_entity win_entity, uint64_t haddr, const void* daddr, uint32_t size )
- Copy a buffer from device memory to host memory.
- flexio_dev_status_t flexio_dev_multi_window_mkey_config ( flexio_window_entity win_entity, uint32_t mkey )
- Config thread window mkey object.
- flexio_dev_status_t flexio_dev_multi_window_ptr_acquire ( flexio_window_entity win_entity, uint64_t haddr, flexio_uintptr_t* daddr )
- Generate device address from host allocated memory.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_nic_counters_config ( uint32_t* counter_values, uint32_t* counter_ids, uint32_t num_counters )
- Prepare a list of counters to read.
- FLEXIO_DEV_EXPERIMENTAL 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.
- FLEXIO_DEV_EXPERIMENTAL 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
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_process_finish ( void )
- Exit flexio process (no errors).
- FLEXIO_DEV_EXPERIMENTAL int flexio_dev_puts ( flexio_dev_thread_ctx* dtctx, char* str )
- Put a string to messaging queue.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_thread_finish ( void )
- Exit from a thread, mark it as finished.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_thread_reschedule ( void )
- Exit from a thread, leave process active.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_thread_retrigger ( void )
- Exit from a thread, and retrigger it.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_yield ( flexio_dev_thread_ctx* dtctx )
- exit point for continuable event handler routine
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_yield_and_retrigger ( void )
- exit point for retriggered continuable event handler routine
Defines
- #define FLEXIO_DEV_EXPERIMENTAL
-
Value
__attribute__((deprecated("Symbol is defined as experimental"), \ section(".text.experimental"))) \ FLEXIO_DEV_STABLE
- #define flexio_dev_msg_broadcast ( lvl, ... )
-
Value
flexio_dev_msg(FLEXIO_MSG_DEV_BROADCAST_STREAM, lvl, __VA_ARGS__)
Parameters
- lvl
- - messaging level.
- ...
- - va_args parameters. Same as for regular vsprintf.
- #define flexio_dev_msg_dflt ( lvl, ... )
-
Value
flexio_dev_msg(FLEXIO_MSG_DEV_DEFAULT_STREAM_ID, lvl, __VA_ARGS__)
Parameters
- lvl
- - messaging level.
- ...
- - format and the parameters. Same as for regular printf.
- #define flexio_dev_print ( ... )
-
Value
flexio_dev_msg(FLEXIO_MSG_DEV_DEFAULT_STREAM_ID, FLEXIO_MSG_DEV_INFO, __VA_ARGS__)
Parameters
- ...
- - format and the parameters. Same as for regular printf.
- #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_nic_counter_ids
Flex IO dev NIC counters ID enumeration.
Values
- FLEXIO_DEV_NIC_COUNTER_PORT0_RX_BYTES = 0x10
- FLEXIO_DEV_NIC_COUNTER_PORT1_RX_BYTES = 0x11
- FLEXIO_DEV_NIC_COUNTER_PORT2_RX_BYTES = 0x12
- FLEXIO_DEV_NIC_COUNTER_PORT3_RX_BYTES = 0x13
- FLEXIO_DEV_NIC_COUNTER_PORT0_TX_BYTES = 0x20
- FLEXIO_DEV_NIC_COUNTER_PORT1_TX_BYTES = 0x21
- FLEXIO_DEV_NIC_COUNTER_PORT2_TX_BYTES = 0x22
- FLEXIO_DEV_NIC_COUNTER_PORT3_TX_BYTES = 0x23
- enum flexio_dev_status_t
Return status of Flex IO dev API functions.
Values
- FLEXIO_DEV_STATUS_SUCCESS = 0
- FLEXIO_DEV_STATUS_FAILED = 1
- enum flexio_window_entity
Flex IO dev windows entity.
Values
- FLEXIO_DEV_WINDOW_ENTITY_0 = 0
- FLEXIO_DEV_WINDOW_ENTITY_1 = 1
- FLEXIO_DEV_WINDOW_ENTITY_NUM = 2
Functions
- flexio_dev_status_t flexio_dev_cross_device_ring_db ( flexio_uar_device_id device_id, uint32_t qpn, uint32_t pi )
-
send a doorbell to a QP on another device ID
Parameters
- device_id
- - The device ID.
- qpn
- - QP number to send doorbell on.
- pi
- - doorbell producer index.
Returns
flexio_dev_status_t
Description
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_event_handler_activate ( uint32_t activation_id )
-
Activate an event handler thread.
Parameters
- activation_id
- - The event handler activation ID.
Returns
void.
Description
Using activation id, activate (trigger) the event handler with that activation id. Note that the activated event handler must be of same process as the activating thread.
- const FLEXIO_DEV_EXPERIMENTAL char* flexio_dev_get_current_thread_name ( void )
-
Get thread name pointer.
Returns
pointer to thread name string.
Description
This function queries the thread context for its thread name (from thread metadata).
- FLEXIO_DEV_EXPERIMENTAL uint64_t flexio_dev_get_pcc_table_base ( uint16_t vhca_id )
-
get programable congestion control table base address
Parameters
- vhca_id
- - PCC table VHCA_ID.
Returns
PCC table base address for the given VHCA_ID.
Description
This function gets the programable congestion control table base address.
- FLEXIO_DEV_EXPERIMENTAL 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.
- FLEXIO_DEV_EXPERIMENTAL 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_DEV_EXPERIMENTAL 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).
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_memcpy16 ( uint16_t* dest, const uint16_t* src, uint64_t n ) [inline]
-
2 bytes alignment memory copy
Parameters
- dest
- - pointer to destination buffer.
- src
- - pointer to source buffer.
- n
- - number of bytes to copy.
Returns
void.
Description
2 bytes alignment memory copy. User responsibility that address and size are 2 bytes aligned.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_memcpy32 ( uint32_t* dest, const uint32_t* src, uint64_t n ) [inline]
-
4 bytes alignment memory copy
Parameters
- dest
- - pointer to destination buffer.
- src
- - pointer to source buffer.
- n
- - number of bytes to copy.
Returns
void.
Description
4 bytes alignment memory copy. User responsibility that address and size are 4 bytes aligned.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_memcpy64 ( uint64_t* dest, const uint64_t* src, uint64_t n ) [inline]
-
8 bytes alignment memory copy
Parameters
- dest
- - pointer to destination buffer.
- src
- - pointer to source buffer.
- n
- - number of bytes to copy.
Returns
void.
Description
8 bytes alignment memory copy. User responsibility that address and size are 8 bytes aligned.
- FLEXIO_DEV_EXPERIMENTAL 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.
Parameters
- stream_id
- - the relevant msg stream, created and passed from the host.
- level
- - messaging level.
- format
- - same as for regular printf.
Returns
- same as from regular printf.
Description
Same as a regular printf but with protection from simultaneous print from different threads.
- flexio_dev_status_t flexio_dev_multi_window_config ( flexio_window_entity win_entity, uint16_t window_config_id, uint32_t mkey )
-
Config thread window object.
Parameters
- win_entity
- - The window entity to configure.
- window_config_id
- - The window object id.
- mkey
- - The mkey id.
Returns
flexio_dev_status_t.
Description
This function updates the thread window object of the given thread context.
- flexio_dev_status_t flexio_dev_multi_window_copy_from_host ( flexio_window_entity win_entity, void* daddr, uint64_t haddr, uint32_t size )
-
Copy a buffer from host memory to device memory.
Parameters
- win_entity
- - The window entity to configure.
- 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_multi_window_copy_to_host ( flexio_window_entity win_entity, uint64_t haddr, const void* daddr, uint32_t size )
-
Copy a buffer from device memory to host memory.
Parameters
- win_entity
- - The window entity to configure.
- 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_multi_window_mkey_config ( flexio_window_entity win_entity, uint32_t mkey )
-
Config thread window mkey object.
Parameters
- win_entity
- - The window entity to configure.
- mkey
- - The mkey id.
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_multi_window_ptr_acquire ( flexio_window_entity win_entity, uint64_t haddr, flexio_uintptr_t* daddr )
-
Generate device address from host allocated memory.
Parameters
- win_entity
- - The window entity to configure.
- 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.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_nic_counters_config ( uint32_t* counter_values, uint32_t* counter_ids, uint32_t num_counters )
-
Prepare a list of counters to read.
Parameters
- counter_values
- - buffer to store counters values (32b) read by flexio_dev_nic_counters_sample().
- counter_ids
- - An array of counter ids.
- num_counters
- - number of counters in the counter_ids array.
Returns
void process crashes in case of: counters_ids too large bad pointers of values, counter_ids unknown counter
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.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_nic_counters_sample ( void )
-
Sample counters according to the prior configuration call.
Returns
void. process crashes in case of: flexio_dev_config_nic_counters() never called
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.
- FLEXIO_DEV_EXPERIMENTAL 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.
Returns
void.
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 device ID for the outbox to operate on.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_process_finish ( void )
-
Exit flexio process (no errors).
Returns
void.
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).
- FLEXIO_DEV_EXPERIMENTAL 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.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_thread_finish ( void )
-
Exit from a thread, mark it as finished.
Returns
void.
Description
This function releases resources back to OS. The thread will be marked as finished so next DUAR will not trigger it.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_thread_reschedule ( void )
-
Exit from a thread, leave process active.
Returns
void.
Description
This function releases resources back to OS. For the next DUAR the thread will restart from the beginning.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_thread_retrigger ( void )
-
Exit from a thread, and retrigger it.
Returns
void.
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.
- FLEXIO_DEV_EXPERIMENTAL 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.
Returns
void.
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.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_yield_and_retrigger ( void )
-
exit point for retriggered continuable event handler routine
Returns
void.
Description
This function is used to mark the exit point on continuable event handler where user wishes to continue execution on next event. Before exiting, an event is generated for the calling thread to retrigger it immediately upon exit. In order to use this API the event handler must be created with continuable flag enabled, otherwise call will have no effect.
Flex IO SDK dev error handling
Flex IO SDK dev queue access
Flex IO SDK dev queue types
Flex IO SDK message stream
2.1.1. Flex IO SDK dev error handling
[ Flex IO SDK dev ]
Flex IO SDK device API for DPA programs error handling.
Enumerations
- enum flexio_dev_error_t
Functions
- FLEXIO_DEV_EXPERIMENTAL __attribute__ ( (__noreturn__) )
- Exit the process and return a user (fatal) error code.
- FLEXIO_DEV_EXPERIMENTAL 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.
- FLEXIO_DEV_EXPERIMENTAL uint64_t flexio_dev_get_errno ( flexio_dev_thread_ctx* dtctx )
- Get thread error flag (errno) of recoverable (non fatal) error.
- FLEXIO_DEV_EXPERIMENTAL 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
- Illegal user error code
Functions
- FLEXIO_DEV_EXPERIMENTAL __attribute__ ( (__noreturn__) )
-
Exit the process and return a user (fatal) error code.
Returns
- function does not return
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 128-255: User defined
- FLEXIO_DEV_EXPERIMENTAL 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
- thread error code.
Description
- FLEXIO_DEV_EXPERIMENTAL 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.
- FLEXIO_DEV_EXPERIMENTAL 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.
Returns
- void.
Description
2.1.2. Flex IO SDK dev queue access
[ Flex IO SDK dev ]
Flex IO SDK device API for DPA programs queue access. Provides an API for handling networking queues (WQs/CQs).
Defines
- #define FLEXIO_DEV_COMP_CQE_GET_RX_HASH_RESULT ( _x )
- Get the RX hash result from a mini CQE.
- #define flexio_dev_msix_send ( cqn ) flexio_dev_zcqe_gen(cqn)
- Generate an MSI-X from the given CQ.
Enumerations
- enum flexio_ctrl_seg
- enum flexio_dev_cc_db_next_act
Functions
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_high64bit ( uint64_t value )
- Write to high 64 bits of CC doorbell register.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_low64bit ( uint64_t value )
- Write to low 64 bits of CC doorbell register.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_v3 ( uint16_t ccq_id, uint32_t rate, uint32_t rtt_req, flexio_dev_cc_db_next_act next_act, uint32_t probe_type, uint32_t probe_req )
- Rings CC doorbell.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_comp_cq_init ( flexio_dev_cqe64* cqe, int num_cqes, uint8_t validity_iteration_count )
- init CQEs according to compressed feature requirement.
- FLEXIO_DEV_ALWAYS_INLINE uint64_t flexio_dev_comp_cqe_get_comp_cqe ( flexio_dev_cqe64* cqe, int comp_cqe_index )
- Get a mini CQE from CQE.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_get_num_comp_cqes ( flexio_dev_cqe64* cqe )
- Get number of mini CQEs in CQE.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_get_validity_byte ( flexio_dev_cqe64* cqe )
- Get the validity iteration count byte value from CQE.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_is_comp_cqe_array ( flexio_dev_cqe64* cqe )
- returns true if CQE is a mini CQE array
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cq_arm ( uint32_t ci, uint32_t qnum )
- Arm CQ function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_byte_cnt ( flexio_dev_cqe64* cqe )
- Get byte count field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint16_t flexio_dev_cqe_get_csum_ok ( flexio_dev_cqe64* cqe )
- Get csum OK field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_err_synd ( flexio_dev_cqe64* cqe )
- Get error syndrome field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_hw_err_synd ( flexio_dev_cqe64* cqe )
- Get HW error syndrome field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_opcode ( flexio_dev_cqe64* cqe )
- Get the opcode field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_owner ( flexio_dev_cqe64* cqe )
- Get owner field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_qpn ( flexio_dev_cqe64* cqe )
- Get QP number field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_type ( flexio_dev_cqe64* cqe )
- Get the type of CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_user_index ( flexio_dev_cqe64* cqe )
- Get the user index field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_vendor_err_synd ( flexio_dev_cqe64* cqe )
- Get vendor error syndrome field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint16_t flexio_dev_cqe_get_wqe_counter ( flexio_dev_cqe64* cqe )
- Get WQE counter filed from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_db_ctx_arm ( uint32_t qnum, uint32_t emu_ctx_id )
- arm the emulation context
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_db_ctx_force_trigger ( 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_ALWAYS_INLINE void flexio_dev_eq_update_ci ( uint32_t ci, uint32_t qnum )
- Update an EQ consumer index function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_eqe_get_cqn ( flexio_dev_eqe* eqe )
- Get CQ number field from EQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_eqe_get_owner ( flexio_dev_eqe* eqe )
- Get owner field from EQE function.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_qp_sq_ring_db ( uint16_t pi, uint32_t qnum )
- QP/SQ ring doorbell function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_read_db_value ( uint64_t emu_ctx_id )
- Read the outbox DB.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- void flexio_dev_swqe_seg_av1_set ( flexio_dev_sqe_seg* swqe, uint32_t qkey, uint32_t dqp, uint8_t ext, uint8_t stat_rate_sl, uint8_t fl_mlid, uint16_t rlid_sport )
- Fill out a Datagram wqe first segment function.
- void flexio_dev_swqe_seg_av2_set ( flexio_dev_sqe_seg* swqe, uint8_t* rmac, uint8_t tclass, uint8_t hop_limit, uint32_t grh_gid_fl )
- Fill out a Datagram wqe second segment function.
- void flexio_dev_swqe_seg_av3_set ( flexio_dev_sqe_seg* swqe, uint8_t* rgid )
- Fill out a Datagram wqe third 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 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.
- flexio_dev_status_t flexio_dev_swqe_seg_wait_on_data_data_set ( flexio_dev_sqe_seg* swqe, uint64_t data, uint64_t data_mask )
- Fill out a wait on data wqe segment function, data portion.
- flexio_dev_status_t flexio_dev_swqe_seg_wait_on_data_set ( flexio_dev_sqe_seg* swqe, uint8_t operation, uint8_t inv, uint32_t lkey, uint64_t addr, uint8_t action_on_fail )
- Fill out a wait on data wqe segment function, control portion.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_zcqe_gen ( uint32_t cqn )
- Generate a zero CQE on the given CQ.
Defines
- #define FLEXIO_DEV_COMP_CQE_GET_RX_HASH_RESULT ( _x )
-
Value
be32_to_cpu((uint32_t)((_x) & 0xFFFFFFFFULL))
Parameters
- _x
- - mini CQE value.
- #define flexio_dev_msix_send ( cqn ) flexio_dev_zcqe_gen(cqn)
This function trigger an MSI-X interrupt connected to the given CQ.
Parameters
- cqn
- - CQ number to trigger. Trigger is done via currently configured outbox, this can be changed with outbox config API according to CQ.
Enumerations
- enum flexio_ctrl_seg
Flex IO dev WQE control segment types.
Values
- FLEXIO_CTRL_SEG_SEND_EN = 0
- FLEXIO_CTRL_SEG_SEND_RC = 1
- FLEXIO_CTRL_SEG_SEND_UC = 1
- FLEXIO_CTRL_SEG_SEND_UD = 2
- FLEXIO_CTRL_SEG_LDMA = 3
- FLEXIO_CTRL_SEG_RDMA_WRITE = 4
- FLEXIO_CTRL_SEG_RDMA_READ = 5
- FLEXIO_CTRL_SEG_LSO = 6
- FLEXIO_CTRL_SEG_NOP = 7
- FLEXIO_CTRL_SEG_RDMA_WRITE_IMM = 8
- FLEXIO_CTRL_SEG_TRANSPOSE = 9
- FLEXIO_CTRL_SEG_WAIT_ON_DATA = 10
- FLEXIO_CTRL_SEG_ATOMIC_COMPARE_AND_SWAP = 11
- FLEXIO_CTRL_SEG_ATOMIC_FETCH_AND_ADD = 12
- enum flexio_dev_cc_db_next_act
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_ALWAYS_INLINE void flexio_dev_cc_ring_db_high64bit ( uint64_t value )
-
Write to high 64 bits of CC doorbell register.
Parameters
- value
- - 64 bits value to write.
Returns
void.
Description
This function writes to high 64 bits of CC doorbell register. Register value should be prepared by caller according to register layout.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_low64bit ( uint64_t value )
-
Write to low 64 bits of CC doorbell register.
Parameters
- value
- - 64 bits value to write.
Returns
void.
Description
This function writes to low 64 bits of CC doorbell register. Register value should be prepared by caller according to register layout.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_v3 ( uint16_t ccq_id, uint32_t rate, uint32_t rtt_req, flexio_dev_cc_db_next_act next_act, uint32_t probe_type, uint32_t probe_req )
-
Rings CC doorbell.
Parameters
- ccq_id
- - CC queue ID to update.
- rate
- - Rate to set.
- rtt_req
- - RTT measure request to set.
- next_act
- - Next action to set.
- probe_type
- - Probe type to set.
- probe_req
- - Probe req to set.
Returns
void.
Description
This function rings CC doorbell for the requested CC queue, which sets the requested rate, RTT request and next action.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_comp_cq_init ( flexio_dev_cqe64* cqe, int num_cqes, uint8_t validity_iteration_count )
-
init CQEs according to compressed feature requirement.
Parameters
- cqe
- - first CQE in range to init.
- num_cqes
- - Number of CQEs in range.
- validity_iteration_count
- - validity_iteration_count field value to init.
Returns
void.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint64_t flexio_dev_comp_cqe_get_comp_cqe ( flexio_dev_cqe64* cqe, int comp_cqe_index )
-
Get a mini CQE from CQE.
Parameters
- cqe
- - CQE to parse.
- comp_cqe_index
- - index of mini CQE to return from array.
Returns
uint64_t - the mini CQE value.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_get_num_comp_cqes ( flexio_dev_cqe64* cqe )
-
Get number of mini CQEs in CQE.
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - number of mini CQEs in array.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_get_validity_byte ( flexio_dev_cqe64* cqe )
-
Get the validity iteration count byte value from CQE.
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - validity byte value.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_is_comp_cqe_array ( flexio_dev_cqe64* cqe )
-
returns true if CQE is a mini CQE array
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - true for mini cqe array.
Description
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cq_arm ( uint32_t ci, uint32_t qnum )
-
Arm CQ function.
Parameters
- ci
- - Current CQ consumer index.
- qnum
- - Number of the CQ to arm.
Returns
void.
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.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_byte_cnt ( flexio_dev_cqe64* cqe )
-
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.
- FLEXIO_DEV_ALWAYS_INLINE uint16_t flexio_dev_cqe_get_csum_ok ( flexio_dev_cqe64* cqe )
-
Get csum OK field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint16_t - csum_ok field value of the CQE.
Description
Parse a CQE for its csum OK field.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_err_synd ( flexio_dev_cqe64* cqe )
-
Get error syndrome field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint32_t - Error syndrome.
Description
Parse a CQE for its error syndrome field.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_hw_err_synd ( flexio_dev_cqe64* cqe )
-
Get HW error syndrome field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint32_t - HE error syndrome.
Description
Parse a CQE for its HW error syndrome field.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_opcode ( flexio_dev_cqe64* cqe )
-
Get the opcode field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - Opcode field value of the CQE.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_owner ( flexio_dev_cqe64* cqe )
-
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.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_qpn ( flexio_dev_cqe64* cqe )
-
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.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_type ( flexio_dev_cqe64* cqe )
-
Get the type of CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - the type of the CQE. 0 - no inline data 1 - inline data in the data 32 segment 2 - inline data in the data 64 segment 3 - Compressed CQE
Description
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_user_index ( flexio_dev_cqe64* cqe )
-
Get the user index field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint32_t - User index field value of the CQE.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_vendor_err_synd ( flexio_dev_cqe64* cqe )
-
Get vendor error syndrome field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint32_t - Vendor error syndrome.
Description
Parse a CQE for its vendor error syndrome field.
- FLEXIO_DEV_ALWAYS_INLINE uint16_t flexio_dev_cqe_get_wqe_counter ( flexio_dev_cqe64* cqe )
-
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_ALWAYS_INLINE void flexio_dev_db_ctx_arm ( uint32_t qnum, uint32_t emu_ctx_id )
-
arm the emulation context
Parameters
- qnum
- - Number of the queue 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.
Returns
void.
Description
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_db_ctx_force_trigger ( uint32_t cqn, uint32_t emu_ctx_id )
-
force trigger of emulation context
Parameters
- 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.
Returns
void.
Description
- 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.
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 )
-
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_ALWAYS_INLINE void flexio_dev_eq_update_ci ( uint32_t ci, uint32_t qnum )
-
Update an EQ consumer index function.
Parameters
- ci
- - Current EQ consumer index.
- qnum
- - Number of the EQ to update.
Returns
void.
Description
Updates the consumer index of an EQ after handling an EQE.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_eqe_get_cqn ( flexio_dev_eqe* eqe )
-
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.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_eqe_get_owner ( flexio_dev_eqe* eqe )
-
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_ALWAYS_INLINE void flexio_dev_qp_sq_ring_db ( uint16_t pi, uint32_t qnum )
-
QP/SQ ring doorbell function.
Parameters
- pi
- - Current queue producer index.
- qnum
- - Number of the queue to update.
Returns
void.
Description
Rings the doorbell of a QP or SQ in order to alert the HW of pending work.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_read_db_value ( uint64_t emu_ctx_id )
-
Read the outbox DB.
Parameters
- emu_ctx_id
- - the context id to read
Returns
the doorbell value.
Description
This function reads the outbox doorbell.
- FLEXIO_DEV_ALWAYS_INLINE void* flexio_dev_rwqe_get_addr ( flexio_dev_wqe_rcv_data_seg* rwqe )
-
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 )
-
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.
- void flexio_dev_swqe_seg_av1_set ( flexio_dev_sqe_seg* swqe, uint32_t qkey, uint32_t dqp, uint8_t ext, uint8_t stat_rate_sl, uint8_t fl_mlid, uint16_t rlid_sport ) [inline]
-
Fill out a Datagram wqe first segment function.
Parameters
- swqe
- - Send WQE segment to fill.
- qkey
- - Queue key (q_key) of destination QP.
- dqp
- - Destination QP number for UD and DCT for DC.
- ext
- - Address vector extension (0x0 or 0x1).
- stat_rate_sl
- - Maximum static rate control, SL/ethernet priority.
- fl_mlid
- - Force loopback (MSB) and source LID for IB.
- rlid_sport
- - Remote LID (IB) udp source port (RoCE)
Description
Datagram segment can be built from one or three segments. This function aimed to fill the first one.
- void flexio_dev_swqe_seg_av2_set ( flexio_dev_sqe_seg* swqe, uint8_t* rmac, uint8_t tclass, uint8_t hop_limit, uint32_t grh_gid_fl ) [inline]
-
Fill out a Datagram wqe second segment function.
Parameters
- swqe
- - Send WQE segment to fill.
- rmac
- - Remote MAC
- tclass
- - GRH tclass/IPv6 tclass/IPv4 ToS
- hop_limit
- - GRH hop limit/IPv6 hop limit/IPv4 TTL
- grh_gid_fl
- - GRH, source GID address and IPv6 flow label.
Description
Extended datagram segment built from three segments. This function aimed to fill the second one.
- void flexio_dev_swqe_seg_av3_set ( flexio_dev_sqe_seg* swqe, uint8_t* rgid ) [inline]
-
Fill out a Datagram wqe third segment function.
Parameters
- swqe
- - Send WQE segment to fill.
- rgid
- - Remote GID/IP address.
Description
Extended datagram segment built from three segments. This function aimed to fill the last one.
- 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 ctrl_seg_type )
-
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. Note: For RDMA write immediate WQE - user should fill the immediate data information in the control segment.
- 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.
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 )
-
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 )
-
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 )
-
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
- - Address of the data for the RDMA operation.
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 )
-
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 )
-
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.
- flexio_dev_status_t flexio_dev_swqe_seg_wait_on_data_data_set ( flexio_dev_sqe_seg* swqe, uint64_t data, uint64_t data_mask )
-
Fill out a wait on data wqe segment function, data portion.
Parameters
- swqe
- - Send WQE segment to fill.
- data
- - Data value to use for data comparison.
- data_mask
Returns
flexio_dev_status_t.
Description
Fill the fields of the data portion of a wait on data WQE segment (4 DWORDs) Supported when wait_on_data cap is set, it is user responsibility to validate it. Note, data should be provided according to host endianness and wait_on_data_big_endian capability.
- flexio_dev_status_t flexio_dev_swqe_seg_wait_on_data_set ( flexio_dev_sqe_seg* swqe, uint8_t operation, uint8_t inv, uint32_t lkey, uint64_t addr, uint8_t action_on_fail )
-
Fill out a wait on data wqe segment function, control portion.
Parameters
- swqe
- - Send WQE segment to fill.
- operation
- - operation to perform of the data.
- inv
- - invert the operation.
- lkey
- - lkey of address.
- addr
- - address to perform operation on.
- action_on_fail
- - action on fail.
Returns
flexio_dev_status_t.
Description
Fill the fields of the control portion of a wait on data WQE segment (4 DWORDs). Supported when wait_on_data cap is set, it is user responsibility to validate it.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_zcqe_gen ( uint32_t cqn )
-
Generate a zero CQE on the given CQ.
Parameters
- cqn
- - CQ number to trigger. Trigger is done via currently configured outbox, this can be changed with outbox config API according to CQ.
Returns
void.
Description
This function trigger the given CQ by creating a zero CQE on it. In turn, this may activate any handler connected to the CQ, most commonly another thread or an EQ (and MSIX).
2.1.3. Flex IO SDK dev queue types
[ Flex IO SDK dev ]
Flex IO SDK device queue types for DPA programs. Defines basic networking elements structure.
Classes
-
struct flexio_dev_cqe64
-
struct flexio_dev_eqe
-
struct flexio_dev_mini_cqe64
-
union flexio_dev_sqe_seg
-
struct flexio_dev_wqe_atomic_seg
-
struct flexio_dev_wqe_ctrl_seg
-
struct flexio_dev_wqe_datagram_seg
-
struct flexio_dev_wqe_eth_seg
-
struct flexio_dev_wqe_inline_data_seg
-
struct flexio_dev_wqe_inline_send_data_seg
-
struct flexio_dev_wqe_mem_ptr_send_data_seg
-
struct flexio_dev_wqe_rcv_data_seg
-
struct flexio_dev_wqe_rdma_seg
-
struct flexio_dev_wqe_shared_receive_seg
-
struct flexio_dev_wqe_transpose_seg
-
struct flexio_dev_wqe_wait_on_data_data_seg
-
struct flexio_dev_wqe_wait_on_data_seg
Defines
- #define LOG_SQE_NUM_SEGS 2
Enumerations
Variables
- struct flexio_dev_eqe packed
Defines
- #define LOG_SQE_NUM_SEGS 2
SQ depth (log_sq_depth) is measured in WQEBBs, each one is 64B. We have to understand difference between wqe_idx and seg_idx. For example wqe with index 5 built from 4 segments with indexes 20, 21, 22 and 23.
Enumerations
- enum flexio_dev_wqe_eth_seg_cs_swp_flags_t
Flex IO dev ethernet segment bitmask for CS / SWP flags
Values
- FLEXIO_ETH_SEG_L4CS = 0x8000
- FLEXIO_ETH_SEG_L3CS = 0x4000
- FLEXIO_ETH_SEG_L4CS_INNER = 0x2000
- FLEXIO_ETH_SEG_L3CS_INNER = 0x1000
- FLEXIO_ETH_SEG_TRAILER_ALIGN = 0x0200
- FLEXIO_ETH_SEG_SWP_OUTER_L4_TYPE = 0x0040
- FLEXIO_ETH_SEG_SWP_OUTER_L3_TYPE = 0x0020
- FLEXIO_ETH_SEG_SWP_INNER_L4_TYPE = 0x0002
- FLEXIO_ETH_SEG_SWP_INNER_L3_TYPE = 0x0001
Variables
- struct flexio_dev_eqe packed
Describes Flex IO dev EQE.
Describes Flex IO dev CQE.
Describes Flex IO dev compressed CQE.
Describes Flex IO dev WQE memory pointer send data segment.
Describes Flex IO dev WQE inline send data segment.
Describes Flex IO dev WQE receive data segment.
Describes Flex IO dev shared receive WQE.
Describes Flex IO dev WQE control segment.
Describes Flex IO dev WQE ethernet segment.
Describes Flex IO dev WQE inline data segment.
Describes Flex IO dev WQE RDMA segment.
Describes Flex IO dev WQE ATOMIC segment.
Describes Flex IO dev WQE transpose segment.
Describes Flex IO dev wait on data WQE.
Describes Flex IO dev wait on data WQE - data portion.
Describes Flex IO dev WQE Address Vector (Datagram segment) (for UD packets). From infiniband/mlx5dv.h
2.1.4. Flex IO SDK message stream
[ Flex IO SDK dev ]
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
Functions
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_trace_0 ( uint8_t tracer_id, flexio_msg_dev_level level, int format_id )
- Creates trace message entry with no arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_tracer_flush ( uint8_t tracer_id )
- Flush not full buffer.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_tracer_notify_host ( uint8_t tracer_id, uint32_t num_msg )
- Send a tracer buffer to host side.
Variables
Functions
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_trace_0 ( uint8_t tracer_id, flexio_msg_dev_level level, int format_id )
-
Creates trace message entry with no arguments.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
- arg2
- - argument #2 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
- arg2
- - argument #2 to format into the template.
- arg3
- - argument #3 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
- arg2
- - argument #2 to format into the template.
- arg3
- - argument #3 to format into the template.
- arg4
- - argument #4 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
- arg2
- - argument #2 to format into the template.
- arg3
- - argument #3 to format into the template.
- arg4
- - argument #4 to format into the template.
- arg5
- - argument #5 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_tracer_flush ( uint8_t tracer_id )
-
Flush not full buffer.
Parameters
- tracer_id
- - ID of tracer to flush.
Returns
Function does not return.
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.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_tracer_notify_host ( uint8_t tracer_id, uint32_t num_msg )
-
Send a tracer buffer to host side.
Parameters
- tracer_id
- - ID of tracer to send a notification for.
- num_msg
- - number of messages.
Returns
Function does not return.
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.
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.
2.1.1. Flex IO SDK dev error handling
[ Flex IO SDK dev ]
Flex IO SDK device API for DPA programs error handling.
Enumerations
- enum flexio_dev_error_t
Functions
- FLEXIO_DEV_EXPERIMENTAL __attribute__ ( (__noreturn__) )
- Exit the process and return a user (fatal) error code.
- FLEXIO_DEV_EXPERIMENTAL 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.
- FLEXIO_DEV_EXPERIMENTAL uint64_t flexio_dev_get_errno ( flexio_dev_thread_ctx* dtctx )
- Get thread error flag (errno) of recoverable (non fatal) error.
- FLEXIO_DEV_EXPERIMENTAL 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
- Illegal user error code
Functions
- FLEXIO_DEV_EXPERIMENTAL __attribute__ ( (__noreturn__) )
-
Exit the process and return a user (fatal) error code.
Returns
- function does not return
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 128-255: User defined
- FLEXIO_DEV_EXPERIMENTAL 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
- thread error code.
Description
- FLEXIO_DEV_EXPERIMENTAL 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.
- FLEXIO_DEV_EXPERIMENTAL 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.
Returns
- void.
Description
2.1.2. Flex IO SDK dev queue access
[ Flex IO SDK dev ]
Flex IO SDK device API for DPA programs queue access. Provides an API for handling networking queues (WQs/CQs).
Defines
- #define FLEXIO_DEV_COMP_CQE_GET_RX_HASH_RESULT ( _x )
- Get the RX hash result from a mini CQE.
- #define flexio_dev_msix_send ( cqn ) flexio_dev_zcqe_gen(cqn)
- Generate an MSI-X from the given CQ.
Enumerations
- enum flexio_ctrl_seg
- enum flexio_dev_cc_db_next_act
Functions
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_high64bit ( uint64_t value )
- Write to high 64 bits of CC doorbell register.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_low64bit ( uint64_t value )
- Write to low 64 bits of CC doorbell register.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_v3 ( uint16_t ccq_id, uint32_t rate, uint32_t rtt_req, flexio_dev_cc_db_next_act next_act, uint32_t probe_type, uint32_t probe_req )
- Rings CC doorbell.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_comp_cq_init ( flexio_dev_cqe64* cqe, int num_cqes, uint8_t validity_iteration_count )
- init CQEs according to compressed feature requirement.
- FLEXIO_DEV_ALWAYS_INLINE uint64_t flexio_dev_comp_cqe_get_comp_cqe ( flexio_dev_cqe64* cqe, int comp_cqe_index )
- Get a mini CQE from CQE.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_get_num_comp_cqes ( flexio_dev_cqe64* cqe )
- Get number of mini CQEs in CQE.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_get_validity_byte ( flexio_dev_cqe64* cqe )
- Get the validity iteration count byte value from CQE.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_is_comp_cqe_array ( flexio_dev_cqe64* cqe )
- returns true if CQE is a mini CQE array
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cq_arm ( uint32_t ci, uint32_t qnum )
- Arm CQ function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_byte_cnt ( flexio_dev_cqe64* cqe )
- Get byte count field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint16_t flexio_dev_cqe_get_csum_ok ( flexio_dev_cqe64* cqe )
- Get csum OK field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_err_synd ( flexio_dev_cqe64* cqe )
- Get error syndrome field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_hw_err_synd ( flexio_dev_cqe64* cqe )
- Get HW error syndrome field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_opcode ( flexio_dev_cqe64* cqe )
- Get the opcode field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_owner ( flexio_dev_cqe64* cqe )
- Get owner field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_qpn ( flexio_dev_cqe64* cqe )
- Get QP number field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_type ( flexio_dev_cqe64* cqe )
- Get the type of CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_user_index ( flexio_dev_cqe64* cqe )
- Get the user index field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_vendor_err_synd ( flexio_dev_cqe64* cqe )
- Get vendor error syndrome field from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint16_t flexio_dev_cqe_get_wqe_counter ( flexio_dev_cqe64* cqe )
- Get WQE counter filed from CQE function.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_db_ctx_arm ( uint32_t qnum, uint32_t emu_ctx_id )
- arm the emulation context
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_db_ctx_force_trigger ( 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_ALWAYS_INLINE void flexio_dev_eq_update_ci ( uint32_t ci, uint32_t qnum )
- Update an EQ consumer index function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_eqe_get_cqn ( flexio_dev_eqe* eqe )
- Get CQ number field from EQE function.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_eqe_get_owner ( flexio_dev_eqe* eqe )
- Get owner field from EQE function.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_qp_sq_ring_db ( uint16_t pi, uint32_t qnum )
- QP/SQ ring doorbell function.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_read_db_value ( uint64_t emu_ctx_id )
- Read the outbox DB.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- void flexio_dev_swqe_seg_av1_set ( flexio_dev_sqe_seg* swqe, uint32_t qkey, uint32_t dqp, uint8_t ext, uint8_t stat_rate_sl, uint8_t fl_mlid, uint16_t rlid_sport )
- Fill out a Datagram wqe first segment function.
- void flexio_dev_swqe_seg_av2_set ( flexio_dev_sqe_seg* swqe, uint8_t* rmac, uint8_t tclass, uint8_t hop_limit, uint32_t grh_gid_fl )
- Fill out a Datagram wqe second segment function.
- void flexio_dev_swqe_seg_av3_set ( flexio_dev_sqe_seg* swqe, uint8_t* rgid )
- Fill out a Datagram wqe third 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 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.
- flexio_dev_status_t flexio_dev_swqe_seg_wait_on_data_data_set ( flexio_dev_sqe_seg* swqe, uint64_t data, uint64_t data_mask )
- Fill out a wait on data wqe segment function, data portion.
- flexio_dev_status_t flexio_dev_swqe_seg_wait_on_data_set ( flexio_dev_sqe_seg* swqe, uint8_t operation, uint8_t inv, uint32_t lkey, uint64_t addr, uint8_t action_on_fail )
- Fill out a wait on data wqe segment function, control portion.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_zcqe_gen ( uint32_t cqn )
- Generate a zero CQE on the given CQ.
Defines
- #define FLEXIO_DEV_COMP_CQE_GET_RX_HASH_RESULT ( _x )
-
Value
be32_to_cpu((uint32_t)((_x) & 0xFFFFFFFFULL))
Parameters
- _x
- - mini CQE value.
- #define flexio_dev_msix_send ( cqn ) flexio_dev_zcqe_gen(cqn)
This function trigger an MSI-X interrupt connected to the given CQ.
Parameters
- cqn
- - CQ number to trigger. Trigger is done via currently configured outbox, this can be changed with outbox config API according to CQ.
Enumerations
- enum flexio_ctrl_seg
Flex IO dev WQE control segment types.
Values
- FLEXIO_CTRL_SEG_SEND_EN = 0
- FLEXIO_CTRL_SEG_SEND_RC = 1
- FLEXIO_CTRL_SEG_SEND_UC = 1
- FLEXIO_CTRL_SEG_SEND_UD = 2
- FLEXIO_CTRL_SEG_LDMA = 3
- FLEXIO_CTRL_SEG_RDMA_WRITE = 4
- FLEXIO_CTRL_SEG_RDMA_READ = 5
- FLEXIO_CTRL_SEG_LSO = 6
- FLEXIO_CTRL_SEG_NOP = 7
- FLEXIO_CTRL_SEG_RDMA_WRITE_IMM = 8
- FLEXIO_CTRL_SEG_TRANSPOSE = 9
- FLEXIO_CTRL_SEG_WAIT_ON_DATA = 10
- FLEXIO_CTRL_SEG_ATOMIC_COMPARE_AND_SWAP = 11
- FLEXIO_CTRL_SEG_ATOMIC_FETCH_AND_ADD = 12
- enum flexio_dev_cc_db_next_act
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_ALWAYS_INLINE void flexio_dev_cc_ring_db_high64bit ( uint64_t value )
-
Write to high 64 bits of CC doorbell register.
Parameters
- value
- - 64 bits value to write.
Returns
void.
Description
This function writes to high 64 bits of CC doorbell register. Register value should be prepared by caller according to register layout.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_low64bit ( uint64_t value )
-
Write to low 64 bits of CC doorbell register.
Parameters
- value
- - 64 bits value to write.
Returns
void.
Description
This function writes to low 64 bits of CC doorbell register. Register value should be prepared by caller according to register layout.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cc_ring_db_v3 ( uint16_t ccq_id, uint32_t rate, uint32_t rtt_req, flexio_dev_cc_db_next_act next_act, uint32_t probe_type, uint32_t probe_req )
-
Rings CC doorbell.
Parameters
- ccq_id
- - CC queue ID to update.
- rate
- - Rate to set.
- rtt_req
- - RTT measure request to set.
- next_act
- - Next action to set.
- probe_type
- - Probe type to set.
- probe_req
- - Probe req to set.
Returns
void.
Description
This function rings CC doorbell for the requested CC queue, which sets the requested rate, RTT request and next action.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_comp_cq_init ( flexio_dev_cqe64* cqe, int num_cqes, uint8_t validity_iteration_count )
-
init CQEs according to compressed feature requirement.
Parameters
- cqe
- - first CQE in range to init.
- num_cqes
- - Number of CQEs in range.
- validity_iteration_count
- - validity_iteration_count field value to init.
Returns
void.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint64_t flexio_dev_comp_cqe_get_comp_cqe ( flexio_dev_cqe64* cqe, int comp_cqe_index )
-
Get a mini CQE from CQE.
Parameters
- cqe
- - CQE to parse.
- comp_cqe_index
- - index of mini CQE to return from array.
Returns
uint64_t - the mini CQE value.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_get_num_comp_cqes ( flexio_dev_cqe64* cqe )
-
Get number of mini CQEs in CQE.
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - number of mini CQEs in array.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_get_validity_byte ( flexio_dev_cqe64* cqe )
-
Get the validity iteration count byte value from CQE.
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - validity byte value.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_comp_cqe_is_comp_cqe_array ( flexio_dev_cqe64* cqe )
-
returns true if CQE is a mini CQE array
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - true for mini cqe array.
Description
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_cq_arm ( uint32_t ci, uint32_t qnum )
-
Arm CQ function.
Parameters
- ci
- - Current CQ consumer index.
- qnum
- - Number of the CQ to arm.
Returns
void.
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.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_byte_cnt ( flexio_dev_cqe64* cqe )
-
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.
- FLEXIO_DEV_ALWAYS_INLINE uint16_t flexio_dev_cqe_get_csum_ok ( flexio_dev_cqe64* cqe )
-
Get csum OK field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint16_t - csum_ok field value of the CQE.
Description
Parse a CQE for its csum OK field.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_err_synd ( flexio_dev_cqe64* cqe )
-
Get error syndrome field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint32_t - Error syndrome.
Description
Parse a CQE for its error syndrome field.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_hw_err_synd ( flexio_dev_cqe64* cqe )
-
Get HW error syndrome field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint32_t - HE error syndrome.
Description
Parse a CQE for its HW error syndrome field.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_opcode ( flexio_dev_cqe64* cqe )
-
Get the opcode field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - Opcode field value of the CQE.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_owner ( flexio_dev_cqe64* cqe )
-
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.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_qpn ( flexio_dev_cqe64* cqe )
-
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.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_cqe_get_type ( flexio_dev_cqe64* cqe )
-
Get the type of CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint8_t - the type of the CQE. 0 - no inline data 1 - inline data in the data 32 segment 2 - inline data in the data 64 segment 3 - Compressed CQE
Description
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_user_index ( flexio_dev_cqe64* cqe )
-
Get the user index field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint32_t - User index field value of the CQE.
Description
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_cqe_get_vendor_err_synd ( flexio_dev_cqe64* cqe )
-
Get vendor error syndrome field from CQE function.
Parameters
- cqe
- - CQE to parse.
Returns
uint32_t - Vendor error syndrome.
Description
Parse a CQE for its vendor error syndrome field.
- FLEXIO_DEV_ALWAYS_INLINE uint16_t flexio_dev_cqe_get_wqe_counter ( flexio_dev_cqe64* cqe )
-
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_ALWAYS_INLINE void flexio_dev_db_ctx_arm ( uint32_t qnum, uint32_t emu_ctx_id )
-
arm the emulation context
Parameters
- qnum
- - Number of the queue 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.
Returns
void.
Description
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_db_ctx_force_trigger ( uint32_t cqn, uint32_t emu_ctx_id )
-
force trigger of emulation context
Parameters
- 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.
Returns
void.
Description
- 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.
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 )
-
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_ALWAYS_INLINE void flexio_dev_eq_update_ci ( uint32_t ci, uint32_t qnum )
-
Update an EQ consumer index function.
Parameters
- ci
- - Current EQ consumer index.
- qnum
- - Number of the EQ to update.
Returns
void.
Description
Updates the consumer index of an EQ after handling an EQE.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_eqe_get_cqn ( flexio_dev_eqe* eqe )
-
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.
- FLEXIO_DEV_ALWAYS_INLINE uint8_t flexio_dev_eqe_get_owner ( flexio_dev_eqe* eqe )
-
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_ALWAYS_INLINE void flexio_dev_qp_sq_ring_db ( uint16_t pi, uint32_t qnum )
-
QP/SQ ring doorbell function.
Parameters
- pi
- - Current queue producer index.
- qnum
- - Number of the queue to update.
Returns
void.
Description
Rings the doorbell of a QP or SQ in order to alert the HW of pending work.
- FLEXIO_DEV_ALWAYS_INLINE uint32_t flexio_dev_read_db_value ( uint64_t emu_ctx_id )
-
Read the outbox DB.
Parameters
- emu_ctx_id
- - the context id to read
Returns
the doorbell value.
Description
This function reads the outbox doorbell.
- FLEXIO_DEV_ALWAYS_INLINE void* flexio_dev_rwqe_get_addr ( flexio_dev_wqe_rcv_data_seg* rwqe )
-
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 )
-
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.
- void flexio_dev_swqe_seg_av1_set ( flexio_dev_sqe_seg* swqe, uint32_t qkey, uint32_t dqp, uint8_t ext, uint8_t stat_rate_sl, uint8_t fl_mlid, uint16_t rlid_sport ) [inline]
-
Fill out a Datagram wqe first segment function.
Parameters
- swqe
- - Send WQE segment to fill.
- qkey
- - Queue key (q_key) of destination QP.
- dqp
- - Destination QP number for UD and DCT for DC.
- ext
- - Address vector extension (0x0 or 0x1).
- stat_rate_sl
- - Maximum static rate control, SL/ethernet priority.
- fl_mlid
- - Force loopback (MSB) and source LID for IB.
- rlid_sport
- - Remote LID (IB) udp source port (RoCE)
Description
Datagram segment can be built from one or three segments. This function aimed to fill the first one.
- void flexio_dev_swqe_seg_av2_set ( flexio_dev_sqe_seg* swqe, uint8_t* rmac, uint8_t tclass, uint8_t hop_limit, uint32_t grh_gid_fl ) [inline]
-
Fill out a Datagram wqe second segment function.
Parameters
- swqe
- - Send WQE segment to fill.
- rmac
- - Remote MAC
- tclass
- - GRH tclass/IPv6 tclass/IPv4 ToS
- hop_limit
- - GRH hop limit/IPv6 hop limit/IPv4 TTL
- grh_gid_fl
- - GRH, source GID address and IPv6 flow label.
Description
Extended datagram segment built from three segments. This function aimed to fill the second one.
- void flexio_dev_swqe_seg_av3_set ( flexio_dev_sqe_seg* swqe, uint8_t* rgid ) [inline]
-
Fill out a Datagram wqe third segment function.
Parameters
- swqe
- - Send WQE segment to fill.
- rgid
- - Remote GID/IP address.
Description
Extended datagram segment built from three segments. This function aimed to fill the last one.
- 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 ctrl_seg_type )
-
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. Note: For RDMA write immediate WQE - user should fill the immediate data information in the control segment.
- 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.
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 )
-
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 )
-
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 )
-
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
- - Address of the data for the RDMA operation.
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 )
-
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 )
-
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.
- flexio_dev_status_t flexio_dev_swqe_seg_wait_on_data_data_set ( flexio_dev_sqe_seg* swqe, uint64_t data, uint64_t data_mask )
-
Fill out a wait on data wqe segment function, data portion.
Parameters
- swqe
- - Send WQE segment to fill.
- data
- - Data value to use for data comparison.
- data_mask
Returns
flexio_dev_status_t.
Description
Fill the fields of the data portion of a wait on data WQE segment (4 DWORDs) Supported when wait_on_data cap is set, it is user responsibility to validate it. Note, data should be provided according to host endianness and wait_on_data_big_endian capability.
- flexio_dev_status_t flexio_dev_swqe_seg_wait_on_data_set ( flexio_dev_sqe_seg* swqe, uint8_t operation, uint8_t inv, uint32_t lkey, uint64_t addr, uint8_t action_on_fail )
-
Fill out a wait on data wqe segment function, control portion.
Parameters
- swqe
- - Send WQE segment to fill.
- operation
- - operation to perform of the data.
- inv
- - invert the operation.
- lkey
- - lkey of address.
- addr
- - address to perform operation on.
- action_on_fail
- - action on fail.
Returns
flexio_dev_status_t.
Description
Fill the fields of the control portion of a wait on data WQE segment (4 DWORDs). Supported when wait_on_data cap is set, it is user responsibility to validate it.
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_zcqe_gen ( uint32_t cqn )
-
Generate a zero CQE on the given CQ.
Parameters
- cqn
- - CQ number to trigger. Trigger is done via currently configured outbox, this can be changed with outbox config API according to CQ.
Returns
void.
Description
This function trigger the given CQ by creating a zero CQE on it. In turn, this may activate any handler connected to the CQ, most commonly another thread or an EQ (and MSIX).
2.1.3. Flex IO SDK dev queue types
[ Flex IO SDK dev ]
Flex IO SDK device queue types for DPA programs. Defines basic networking elements structure.
Classes
-
struct flexio_dev_cqe64
-
struct flexio_dev_eqe
-
struct flexio_dev_mini_cqe64
-
union flexio_dev_sqe_seg
-
struct flexio_dev_wqe_atomic_seg
-
struct flexio_dev_wqe_ctrl_seg
-
struct flexio_dev_wqe_datagram_seg
-
struct flexio_dev_wqe_eth_seg
-
struct flexio_dev_wqe_inline_data_seg
-
struct flexio_dev_wqe_inline_send_data_seg
-
struct flexio_dev_wqe_mem_ptr_send_data_seg
-
struct flexio_dev_wqe_rcv_data_seg
-
struct flexio_dev_wqe_rdma_seg
-
struct flexio_dev_wqe_shared_receive_seg
-
struct flexio_dev_wqe_transpose_seg
-
struct flexio_dev_wqe_wait_on_data_data_seg
-
struct flexio_dev_wqe_wait_on_data_seg
Defines
- #define LOG_SQE_NUM_SEGS 2
Enumerations
Variables
- struct flexio_dev_eqe packed
Defines
- #define LOG_SQE_NUM_SEGS 2
SQ depth (log_sq_depth) is measured in WQEBBs, each one is 64B. We have to understand difference between wqe_idx and seg_idx. For example wqe with index 5 built from 4 segments with indexes 20, 21, 22 and 23.
Enumerations
- enum flexio_dev_wqe_eth_seg_cs_swp_flags_t
Flex IO dev ethernet segment bitmask for CS / SWP flags
Values
- FLEXIO_ETH_SEG_L4CS = 0x8000
- FLEXIO_ETH_SEG_L3CS = 0x4000
- FLEXIO_ETH_SEG_L4CS_INNER = 0x2000
- FLEXIO_ETH_SEG_L3CS_INNER = 0x1000
- FLEXIO_ETH_SEG_TRAILER_ALIGN = 0x0200
- FLEXIO_ETH_SEG_SWP_OUTER_L4_TYPE = 0x0040
- FLEXIO_ETH_SEG_SWP_OUTER_L3_TYPE = 0x0020
- FLEXIO_ETH_SEG_SWP_INNER_L4_TYPE = 0x0002
- FLEXIO_ETH_SEG_SWP_INNER_L3_TYPE = 0x0001
Variables
- struct flexio_dev_eqe packed
Describes Flex IO dev EQE.
Describes Flex IO dev CQE.
Describes Flex IO dev compressed CQE.
Describes Flex IO dev WQE memory pointer send data segment.
Describes Flex IO dev WQE inline send data segment.
Describes Flex IO dev WQE receive data segment.
Describes Flex IO dev shared receive WQE.
Describes Flex IO dev WQE control segment.
Describes Flex IO dev WQE ethernet segment.
Describes Flex IO dev WQE inline data segment.
Describes Flex IO dev WQE RDMA segment.
Describes Flex IO dev WQE ATOMIC segment.
Describes Flex IO dev WQE transpose segment.
Describes Flex IO dev wait on data WQE.
Describes Flex IO dev wait on data WQE - data portion.
Describes Flex IO dev WQE Address Vector (Datagram segment) (for UD packets). From infiniband/mlx5dv.h
2.1.4. Flex IO SDK message stream
[ Flex IO SDK dev ]
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
Functions
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_trace_0 ( uint8_t tracer_id, flexio_msg_dev_level level, int format_id )
- Creates trace message entry with no arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_ALWAYS_INLINE 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.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_tracer_flush ( uint8_t tracer_id )
- Flush not full buffer.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_tracer_notify_host ( uint8_t tracer_id, uint32_t num_msg )
- Send a tracer buffer to host side.
Variables
Functions
- FLEXIO_DEV_ALWAYS_INLINE void flexio_dev_trace_0 ( uint8_t tracer_id, flexio_msg_dev_level level, int format_id )
-
Creates trace message entry with no arguments.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
- arg2
- - argument #2 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
- arg2
- - argument #2 to format into the template.
- arg3
- - argument #3 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
- arg2
- - argument #2 to format into the template.
- arg3
- - argument #3 to format into the template.
- arg4
- - argument #4 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_ALWAYS_INLINE 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.
Parameters
- tracer_id
- - the relevant msg stream id.
- level
- - messaging level.
- format_id
- -the template format id to print message accordingly.
- arg0
- - argument #0 to format into the template.
- arg1
- - argument #1 to format into the template.
- arg2
- - argument #2 to format into the template.
- arg3
- - argument #3 to format into the template.
- arg4
- - argument #4 to format into the template.
- arg5
- - argument #5 to format into the template.
Returns
Function does not return.
Description
Using the trace mechanism for fast logging. Call the appropriate function according to number of needed arguments.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_tracer_flush ( uint8_t tracer_id )
-
Flush not full buffer.
Parameters
- tracer_id
- - ID of tracer to flush.
Returns
Function does not return.
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.
- FLEXIO_DEV_EXPERIMENTAL void flexio_dev_tracer_notify_host ( uint8_t tracer_id, uint32_t num_msg )
-
Send a tracer buffer to host side.
Parameters
- tracer_id
- - ID of tracer to send a notification for.
- num_msg
- - number of messages.
Returns
Function does not return.
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.
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.
#include <stdio.h>
Introduction to the Standard IO facilities
This file declares the standard IO facilities that are implemented in flexio-libc. Due to the nature of the underlying hardware, only a limited subset of standard IO is implemented. There is no actual file implementation available, so only device IO can be performed. Since there's no operating system, the application needs to provide enough details about their devices in order to make them usable by the standard IO facilities.
Due to space constraints, some functionality has not been implemented at all (like some of the printf conversions that have been left out). Nevertheless, potential users of this implementation should be warned: the printf and scanf families of functions, although usually associated with presumably simple things like the famous "Hello, world!" program, are actually fairly complex which causes their inclusion to eat up a fair amount of code space. Also, they are not fast due to the nature of interpreting the format string at run-time. Whenever possible, resorting to the (sometimes non-standard) predetermined conversion facilities that are offered by flexio-libc will usually cost much less in terms of speed and code size.
Tunable options for code size vs. feature set
In order to allow programmers a code size vs. functionality tradeoff, the function vfprintf() which is the heart of the printf family can be selected in different flavours using linker options. See the documentation of vfprintf() for a detailed description. The same applies to vfscanf() and the scanf family of functions.
Outline of the chosen API
The standard streams stdin, stdout, and stderr are provided, but contrary to the C standard, since flexio-libc has no knowledge about applicable devices, these streams are not already pre-initialized at application startup. Also, since there is no notion of "file" whatsoever to flexio-libc, there is no function fopen() that could be used to associate a stream to some device. (See note 1.) Instead, the function fdevopen() is provided to associate a stream to a device, where the device needs to provide a function to send a character, to receive a character, or both. There is no differentiation between "text" and "binary" streams inside flexio-libc. Character \n is sent literally down to the device's put() function. If the device requires a carriage return (\n) character to be sent before the linefeed, its put() routine must implement this (see note 2).
As an alternative method to fdevopen(), the macro fdev_setup_stream() might be used to setup a user-supplied FILE structure.
It should be noted that the automatic conversion of a newline character into a carriage return - newline sequence breaks binary transfers. If binary transfers are desired, no automatic conversion should be performed, but instead any string that aims to issue a CR-LF sequence must use "\n" explicitly.
stdin, stdout and stderr are undefined global FILE pointers. If you want to use this, your application must define these variables and initialize them. They are declared 'const' so that you can place them in ROM if you don't need to modify it after startup. FILEs cannot be placed in ROM as they have values which are modified during runtime.
Running stdio without malloc()
By default, fdevopen() requires malloc(). As this is often not desired in the limited environment of a microcontroller, an alternative option is provided to run completely without malloc().
The macro fdev_setup_stream() is provided to prepare a user-supplied FILE buffer for operation with stdio.
Example
#include <stdio.h>
static int uart_putchar(char c, FILE *stream);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
_FDEV_SETUP_WRITE);
static int
uart_putchar(char c, FILE *stream)
{
if (c == '\n')
uart_putchar('\r', stream);
loop_until_bit_is_set(UCSRA, UDRE);
UDR = c;
return 0;
}
int
main(void)
{
init_uart();
stdout = &mystdout;
printf("Hello, world!\n");
return 0;
}
This example uses the initializer form FDEV_SETUP_STREAM() rather than the function-like fdev_setup_stream(), so all data initialization happens during C start-up.
If streams initialized that way are no longer needed, they can be destroyed by first calling the macro fdev_close(), and then destroying the object itself. No call to fclose() should be issued for these streams. While calling fclose() itself is harmless, it will cause an undefined reference to free() and thus cause the linker to link the malloc module into the application.
Notes
Note 1:
It might have been possible to implement a device abstraction that is compatible with fopen() but since this would have required to parse a string, and to take all the information needed either out of this string, or out of an additional table that would need to be provided by the application, this approach was not taken.
Note 2:
This basically follows the Unix approach: if a device such as a terminal needs special handling, it is in the domain of the terminal device driver to provide this functionality. Thus, a simple function suitable as put() for fdevopen() that talks to a UART interface might look like this:
int
uart_putchar(char c, FILE *stream)
{
if (c == '\n')
uart_putchar('\r', stream);
loop_until_bit_is_set(UCSRA, UDRE);
UDR = c;
return 0;
}
Note 3:
This implementation has been chosen because the cost of maintaining an alias is considerably smaller than the cost of maintaining full copies of each stream. Yet, providing an implementation that offers the complete set of standard streams was deemed to be useful. Not only that writing printf() instead of fprintf(mystream, ...) saves typing work, but since the compiler needs to resort to pass all arguments of variadic functions on the stack (as opposed to passing them in registers for functions that take a fixed number of parameters), the ability to pass one parameter less by implying stdin or stdout will also save some execution time.
Defines
- #define EOF (-1)
- #define PICOLIBC_STDIO_GLOBALS
- #define _FDEV_EOF (-2)
- #define _FDEV_ERR (-1)
- #define _FDEV_SETUP_READ __SRD
- #define _FDEV_SETUP_RW (__SRD|__SWR)
- #define _FDEV_SETUP_WRITE __SWR
- #define __FORMAT_ATTRIBUTE__ ( __a, __s, __f )
- #define putc ( __c, __stream ) fputc(__c, __stream)
- #define putchar ( __c ) fputc(__c, stdout)
Functions
- int int int int int int int asprintf ( char** strp, const char* fmt, ... )
- void clearerr ( FILE* __stream )
- int feof ( FILE* __stream )
- int ferror ( FILE* __stream )
- int fflush ( FILE* stream )
- int int int int int int int int int fprintf ( FILE* __stream, const char* __fmt, ... )
- int int int int int int int int int int fputs ( const char* __str, FILE* __stream )
- int printf ( const char* __fmt, ... )
- int puts ( const char* __str )
- int int int int snprintf ( char* __s, size_t __n, const char* __fmt, ... )
- int int int sprintf ( char* __s, const char* __fmt, ... )
- int int int int int int int int vasprintf ( char** strp, const char* fmt, va_list ap )
- int int vprintf ( const char* __fmt, va_list __ap )
- int int int int int int vsnprintf ( char* __s, size_t __n, const char* __fmt, va_list ap )
- int int int int int vsprintf ( char* __s, const char* __fmt, va_list ap )
Variables
Defines
- #define EOF (-1)
EOF declares the value that is returned by various standard IO functions in case of an error. Since the AVR platform (currently) doesn't contain an abstraction for actual files, its origin as "end of file" is somewhat meaningless here.
- #define PICOLIBC_STDIO_GLOBALS
This symbol is defined when stdin/stdout/stderr are global variables. When undefined, the old __iob array is used which contains the pointers instead
- #define _FDEV_EOF (-2)
Return code for an end-of-file condition during device read.
To be used in the get function of fdevopen().
- #define _FDEV_ERR (-1)
Return code for an error condition during device read.
To be used in the get function of fdevopen().
- #define _FDEV_SETUP_READ __SRD
fdev_setup_stream() with read intent
- #define _FDEV_SETUP_RW (__SRD|__SWR)
fdev_setup_stream() with read/write intent
- #define _FDEV_SETUP_WRITE __SWR
fdev_setup_stream() with write intent
- #define __FORMAT_ATTRIBUTE__ ( __a, __s, __f )
vfprintf is the central facility of the printf family of functions. It outputs values to stream under control of a format string passed in fmt. The actual values to print are passed as a variable argument list ap.
vfprintf returns the number of characters written to stream, or EOF in case of an error. Currently, this will only happen if stream has not been opened with write intent.
The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments. Each conversion specification is introduced by the % character. The arguments must properly correspond (after type promotion) with the conversion specifier. After the %, the following appear in sequence:
-
Zero or more of the following flags:
-
# The value should be converted to an "alternate form". For c, d, i, s, and u conversions, this option has no effect. For o conversions, the precision of the number is increased to force the first character of the output string to a zero (except if a zero value is printed with an explicit precision of zero). For x and X conversions, a non-zero result has the string `0x' (or `0X' for X conversions) prepended to it.
-
0 (zero) Zero padding. For all conversions, the converted value is padded on the left with zeros rather than blanks. If a precision is given with a numeric conversion (d, i, o, u, i, x, and X), the 0 flag is ignored.
-
- A negative field width flag; the converted value is to be left adjusted on the field boundary. The converted value is padded on the right with blanks, rather than on the left with blanks or zeros. A - overrides a 0 if both are given.
-
' ' (space) A blank should be left before a positive number produced by a signed conversion (d, or i).
-
+ A sign must always be placed before a number produced by a signed conversion. A + overrides a space if both are used.
-
-
An optional decimal digit string specifying a minimum field width. If the converted value has fewer characters than the field width, it will be padded with spaces on the left (or right, if the left-adjustment flag has been given) to fill out the field width.
-
An optional precision, in the form of a period . followed by an optional digit string. If the digit string is omitted, the precision is taken as zero. This gives the minimum number of digits to appear for d, i, o, u, x, and X conversions, or the maximum number of characters to be printed from a string for s conversions.
-
An optional l or h length modifier, that specifies that the argument for the d, i, o, u, x, or X conversion is a "long int" rather than int. The h is ignored, as "short int" is equivalent to int.
-
A character that specifies the type of conversion to be applied.
The conversion specifiers and their meanings are:
-
diouxX The int (or appropriate variant) argument is converted to signed decimal (d and i), unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal (x and X) notation. The letters "abcdef" are used for x conversions; the letters "ABCDEF" are used for X conversions. The precision, if any, gives the minimum number of digits that must appear; if the converted value requires fewer digits, it is padded on the left with zeros.
-
p The void * argument is taken as an unsigned integer, and converted similarly as a %#x command would do.
-
c The int argument is converted to an "unsigned char", and the resulting character is written.
-
s The "char *" argument is expected to be a pointer to an array of character type (pointer to a string). Characters from the array are written up to (but not including) a terminating NUL character; if a precision is specified, no more than the number specified are written. If a precision is given, no null character need be present; if the precision is not specified, or is greater than the size of the array, the array must contain a terminating NUL character.
-
% A % is written. No argument is converted. The complete conversion specification is "%%".
-
eE The double argument is rounded and converted in the format "[-]d.ddde±dd" where there is one digit before the decimal-point character and the number of digits after it is equal to the precision; if the precision is missing, it is taken as 6; if the precision is zero, no decimal-point character appears. An E conversion uses the letter 'E' (rather than 'e') to introduce the exponent. The exponent always contains two digits; if the value is zero, the exponent is 00.
-
fF The double argument is rounded and converted to decimal notation in the format "[-]ddd.ddd", where the number of digits after the decimal-point character is equal to the precision specification. If the precision is missing, it is taken as 6; if the precision is explicitly zero, no decimal-point character appears. If a decimal point appears, at least one digit appears before it.
-
gG The double argument is converted in style f or e (or F or E for G conversions). The precision specifies the number of significant digits. If the precision is missing, 6 digits are given; if the precision is zero, it is treated as 1. Style e is used if the exponent from its conversion is less than -4 or greater than or equal to the precision. Trailing zeros are removed from the fractional part of the result; a decimal point appears only if it is followed by at least one digit.
-
S Similar to the s format, except the pointer is expected to point to a program-memory (ROM) string instead of a RAM string.
In no case does a non-existent or small field width cause truncation of a numeric field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result.
Since the full implementation of all the mentioned features becomes fairly large, three different flavours of vfprintf() can be selected using linker options. The default vfprintf() implements all the mentioned functionality except floating point conversions. A minimized version of vfprintf() is available that only implements the very basic integer and string conversion facilities, but only the # additional option can be specified using conversion flags (these flags are parsed correctly from the format specification, but then simply ignored). This version can be requested using the following compiler options:
-Wl,-u,vfprintf -lprintf_min
Limitations:
-
The specified width and precision can be at most 255.
Notes:
-
Floating point is not supported in flexio-libc
-
The hh length modifier is ignored (char argument is promouted to int). More exactly, this realization does not check the number of h symbols.
-
But the ll length modifier will to abort the output, as this realization does not operate longlong arguments.
-
The variable width or precision field (an asterisk * symbol) is not realized and will to abort the output.
-
- #define putc ( __c, __stream ) fputc(__c, __stream)
The macro putc used to be a "fast" macro implementation with a functionality identical to fputc(). For space constraints, in flexio-libc, it is just an alias for fputc.
- #define putchar ( __c ) fputc(__c, stdout)
The macro putchar sends character c to stdout.
Functions
- int int int int int int int asprintf ( char** strp, const char* fmt, ... )
-
Description
Variant of printf() that sends the formatted characters to allocated string *strp.
- void clearerr ( FILE* __stream )
-
Description
Clear the error and end-of-file flags of stream.
- int feof ( FILE* __stream )
-
Description
Test the end-of-file flag of stream. This flag can only be cleared by a call to clearerr().
- int ferror ( FILE* __stream )
-
Description
Test the error flag of stream. This flag can only be cleared by a call to clearerr().
- int fflush ( FILE* stream )
-
Description
Flush stream.
If the stream provides a flush hook, use that. Otherwise return 0.
- int int int int int int int int int fprintf ( FILE* __stream, const char* __fmt, ... )
-
Description
The function fprintf performs formatted output to stream. See vfprintf() for details.
- int int int int int int int int int int fputs ( const char* __str, FILE* __stream )
-
Description
Write the string pointed to by str to stream stream.
Returns 0 on success and EOF on error.
- int printf ( const char* __fmt, ... )
-
Description
The function printf performs formatted output to stream stdout. See vfprintf() for details.
- int puts ( const char* __str )
-
Description
Write the string pointed to by str, and a trailing newline character, to stdout.
- int int int int snprintf ( char* __s, size_t __n, const char* __fmt, ... )
-
Description
Like sprintf(), but instead of assuming s to be of infinite size, no more than n characters (including the trailing NUL character) will be converted to s.
Returns the number of characters that would have been written to s if there were enough space.
- int int int sprintf ( char* __s, const char* __fmt, ... )
-
Description
Variant of printf() that sends the formatted characters to string s.
- int int int int int int int int vasprintf ( char** strp, const char* fmt, va_list ap )
-
Description
Variant of vprintf() that sends the formatted characters to allocated string *strp.
- int int vprintf ( const char* __fmt, va_list __ap )
-
Description
The function vprintf performs formatted output to stream stdout, taking a variable argument list as in vfprintf().
See vfprintf() for details.
- int int int int int int vsnprintf ( char* __s, size_t __n, const char* __fmt, va_list ap )
-
Description
Like vsprintf(), but instead of assuming s to be of infinite size, no more than n characters (including the trailing NUL character) will be converted to s.
Returns the number of characters that would have been written to s if there were enough space.
- int int int int int vsprintf ( char* __s, const char* __fmt, va_list ap )
-
Description
Like sprintf() but takes a variable argument list for the arguments.
Variables
- FILE *const stderr
Stream destined for error output. Unless specifically assigned, identical to stdout.
- FILE *const stdin
Stream that will be used as an input stream by the simplified functions that don't take a stream argument.
- FILE * stdout
Stream that will be used as an output stream by the simplified functions that don't take a stream argument.