__rte_experimentalintrte_gpu_init(size_tdev_max)WarningEXPERIMENTAL: this API may change without prior notice.
Initialize the device array before probing devices. If not called, the maximum of probed devices is
RTE_GPU_DEFAULT_MAX.
Parametersdev_max Maximum number of devices.
Returns
0 on success, -rte_errno otherwise:
• ENOMEM if out of memory
• EINVAL if 0 size
• EBUSY if already initialized
__rte_experimentaluint16_trte_gpu_count_avail(void)WarningEXPERIMENTAL: this API may change without prior notice.
Return the number of GPU detected and associated to DPDK.
Returns
The number of available computing devices.
__rte_experimentalboolrte_gpu_is_valid(int16_tdev_id)WarningEXPERIMENTAL: this API may change without prior notice.
Check if the device is valid and initialized in DPDK.
Parametersdev_id The input device ID.
Returns
• True if dev_id is a valid and initialized computing device.
• False otherwise.
__rte_experimentalint16_trte_gpu_add_child(constchar*name,int16_tparent,uint64_tchild_context)WarningEXPERIMENTAL: this API may change without prior notice.
Create a virtual device representing a context in the parent device.
Parametersname Unique string to identify the device.
parent Device ID of the parent.
child_context Opaque context handler.
Returns
Device ID of the new created child, -rte_errno otherwise:
• EINVAL if empty name
• ENAMETOOLONG if long name
• EEXIST if existing device name
• ENODEV if invalid parent
• EPERM if secondary process
• ENOENT if too many devices
• ENOMEM if out of space
__rte_experimentalint16_trte_gpu_find_next(int16_tdev_id,int16_tparent)WarningEXPERIMENTAL: this API may change without prior notice.
Get the ID of the next valid GPU initialized in DPDK.
Parametersdev_id The initial device ID to start the research.
parent The device ID of the parent. RTE_GPU_ID_NONE means no parent. RTE_GPU_ID_ANY means no or any
parent.
Returns
Next device ID corresponding to a valid and initialized computing device, RTE_GPU_ID_NONE if there is
none.
__rte_experimentalintrte_gpu_close(int16_tdev_id)WarningEXPERIMENTAL: this API may change without prior notice.
Close device or child context. All resources are released.
Parametersdev_id Device ID to close.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• EPERM if driver error
__rte_experimentalintrte_gpu_callback_register(int16_tdev_id,enumrte_gpu_eventevent,rte_gpu_callback_t*function,void*user_data)WarningEXPERIMENTAL: this API may change without prior notice.
Register a function as event callback. A function may be registered multiple times for different events.
Parametersdev_id Device ID to get notified about. RTE_GPU_ID_ANY means all devices.
event Device event to be registered for.
function Callback function to be called on event.
user_data Optional parameter passed in the callback.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• EINVAL if NULL function
• ENOMEM if out of memory
__rte_experimentalintrte_gpu_callback_unregister(int16_tdev_id,enumrte_gpu_eventevent,rte_gpu_callback_t*function,void*user_data)WarningEXPERIMENTAL: this API may change without prior notice.
Unregister for an event.
Parametersdev_id Device ID to be silenced. RTE_GPU_ID_ANY means all devices.
event Registered event.
function Registered function.
user_data Optional parameter as registered. RTE_GPU_CALLBACK_ANY_DATA is a catch-all.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• EINVAL if NULL function
__rte_experimentalintrte_gpu_info_get(int16_tdev_id,structrte_gpu_info*info)WarningEXPERIMENTAL: this API may change without prior notice.
Return device specific info.
Parametersdev_id Device ID to get info.
info Memory structure to fill with the info.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• EINVAL if NULL info
• EPERM if driver error
__rte_experimentalvoid*rte_gpu_mem_alloc(int16_tdev_id,size_tsize,unsignedintalign)WarningEXPERIMENTAL: this API may change without prior notice.
Allocate a chunk of memory in the device.
Parametersdev_id Device ID requiring allocated memory.
size Number of bytes to allocate. Requesting 0 will do nothing.
align If 0, the return is a pointer that is suitably aligned for any kind of variable (in the same
manner as malloc()). Otherwise, the return is a pointer that is a multiple of align. In this case, it
must obviously be a power of two.
Returns
A pointer to the allocated memory, otherwise NULL and rte_errno is set:
• ENODEV if invalid dev_id
• EINVAL if align is not a power of two
• ENOTSUP if operation not supported by the driver
• E2BIG if size is higher than limit
• ENOMEM if out of space
• EPERM if driver error
__rte_experimentalintrte_gpu_mem_free(int16_tdev_id,void*ptr)WarningEXPERIMENTAL: this API may change without prior notice.
Deallocate a chunk of memory allocated with rte_gpu_mem_alloc().
Parametersdev_id Reference device ID.
ptr Pointer to the memory area to be deallocated. NULL is a no-op accepted value.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• ENOTSUP if operation not supported by the driver
• EPERM if driver error
__rte_experimentalintrte_gpu_mem_register(int16_tdev_id,size_tsize,void*ptr)WarningEXPERIMENTAL: this API may change without prior notice.
Register a chunk of memory on the CPU usable by the device.
Parametersdev_id Device ID requiring allocated memory.
size Number of bytes to allocate. Requesting 0 will do nothing.
ptr Pointer to the memory area to be registered. NULL is a no-op accepted value.
Returns
A pointer to the allocated memory, otherwise NULL and rte_errno is set:
• ENODEV if invalid dev_id
• EINVAL if reserved flags
• ENOTSUP if operation not supported by the driver
• E2BIG if size is higher than limit
• ENOMEM if out of space
• EPERM if driver error
__rte_experimentalintrte_gpu_mem_unregister(int16_tdev_id,void*ptr)WarningEXPERIMENTAL: this API may change without prior notice.
Deregister a chunk of memory previously registered with rte_gpu_mem_register()Parametersdev_id Reference device ID.
ptr Pointer to the memory area to be unregistered. NULL is a no-op accepted value.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• ENOTSUP if operation not supported by the driver
• EPERM if driver error
__rte_experimentalvoid*rte_gpu_mem_cpu_map(int16_tdev_id,size_tsize,void*ptr)WarningEXPERIMENTAL: this API may change without prior notice.
Map a chunk of GPU memory to make it accessible from the CPU using the memory pointer returned by the
function. GPU memory has to be allocated via rte_gpu_mem_alloc().
Parametersdev_id Device ID requiring mapped memory.
size Number of bytes to map. Requesting 0 will do nothing.
ptr Pointer to the GPU memory area to be mapped. NULL is a no-op accepted value.
Returns
A pointer to the mapped GPU memory usable by the CPU, otherwise NULL and rte_errno is set:
• ENODEV if invalid dev_id
• ENOTSUP if operation not supported by the driver
• E2BIG if size is higher than limit
• ENOMEM if out of space
• EPERM if driver error
__rte_experimentalintrte_gpu_mem_cpu_unmap(int16_tdev_id,void*ptr)WarningEXPERIMENTAL: this API may change without prior notice.
Unmap a chunk of GPU memory previously mapped with rte_gpu_mem_cpu_map()Parametersdev_id Reference device ID.
ptr Pointer to the GPU memory area to be unmapped. NULL is a no-op accepted value.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• ENOTSUP if operation not supported by the driver
• EPERM if driver error
__rte_experimentalintrte_gpu_wmb(int16_tdev_id)WarningEXPERIMENTAL: this API may change without prior notice.
Enforce a GPU write memory barrier.
Parametersdev_id Reference device ID.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• ENOTSUP if operation not supported by the driver
• EPERM if driver error
__rte_experimentalintrte_gpu_comm_create_flag(uint16_tdev_id,structrte_gpu_comm_flag*devflag,enumrte_gpu_comm_flag_typemtype)WarningEXPERIMENTAL: this API may change without prior notice.
Create a communication flag that can be shared between CPU threads and device workload to exchange some
status info (e.g. work is done, processing can start, etc..).
Parametersdev_id Reference device ID.
devflag Pointer to the memory area of the devflag structure.
mtype Type of memory to allocate the communication flag.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• EINVAL if invalid inputs
• ENOTSUP if operation not supported by the driver
• ENOMEM if out of space
• EPERM if driver error
__rte_experimentalintrte_gpu_comm_destroy_flag(structrte_gpu_comm_flag*devflag)WarningEXPERIMENTAL: this API may change without prior notice.
Deallocate a communication flag.
Parametersdevflag Pointer to the memory area of the devflag structure.
Returns
0 on success, -rte_errno otherwise:
• ENODEV if invalid dev_id
• EINVAL if NULL devflag
• ENOTSUP if operation not supported by the driver
• EPERM if driver error
__rte_experimentalintrte_gpu_comm_set_flag(structrte_gpu_comm_flag*devflag,uint32_tval)WarningEXPERIMENTAL: this API may change without prior notice.
Set the value of a communication flag as the input value. Flag memory area is treated as volatile. The
flag must have been allocated with RTE_GPU_COMM_FLAG_CPU.
Parametersdevflag Pointer to the memory area of the devflag structure.
val Value to set in the flag.
Returns
0 on success, -rte_errno otherwise:
• EINVAL if invalid input params
__rte_experimentalintrte_gpu_comm_get_flag_value(structrte_gpu_comm_flag*devflag,uint32_t*val)WarningEXPERIMENTAL: this API may change without prior notice.
Get the value of the communication flag. Flag memory area is treated as volatile. The flag must have been
allocated with RTE_GPU_COMM_FLAG_CPU.
Parametersdevflag Pointer to the memory area of the devflag structure.
val Flag output value.
Returns
0 on success, -rte_errno otherwise:
• EINVAL if invalid input params
__rte_experimentalstructrte_gpu_comm_list*rte_gpu_comm_create_list(uint16_tdev_id,uint32_tnum_comm_items)WarningEXPERIMENTAL: this API may change without prior notice.
Create a communication list that can be used to share packets between CPU and device. Each element of the
list contains:
• a packet list of RTE_GPU_COMM_LIST_PKTS_MAX elements
• number of packets in the list
• a status flag to communicate if the packet list is FREE, READY to be processed, DONE with processing.
The list is allocated in CPU-visible memory. At creation time, every list is in FREE state.
Parametersdev_id Reference device ID.
num_comm_items Number of items in the communication list.
Returns
A pointer to the allocated list, otherwise NULL and rte_errno is set:
• EINVAL if invalid input params
__rte_experimentalintrte_gpu_comm_destroy_list(structrte_gpu_comm_list*comm_list,uint32_tnum_comm_items)WarningEXPERIMENTAL: this API may change without prior notice.
Destroy a communication list.
Parameterscomm_list Communication list to be destroyed.
num_comm_items Number of items in the communication list.
Returns
0 on success, -rte_errno otherwise:
• EINVAL if invalid input params
__rte_experimentalintrte_gpu_comm_populate_list_pkts(structrte_gpu_comm_list*comm_list_item,structrte_mbuf**mbufs,uint32_tnum_mbufs)WarningEXPERIMENTAL: this API may change without prior notice.
Populate the packets list of the communication item with info from a list of mbufs. Status flag of that
packet list is set to READY.
Parameterscomm_list_item Communication list item to fill.
mbufs List of mbufs.
num_mbufs Number of mbufs.
Returns
0 on success, -rte_errno otherwise:
• EINVAL if invalid input params
• ENOTSUP if mbufs are chained (multiple segments)
__rte_experimentalintrte_gpu_comm_set_status(structrte_gpu_comm_list*comm_list_item,enumrte_gpu_comm_list_statusstatus)WarningEXPERIMENTAL: this API may change without prior notice.
Set status flag value of a communication list item.
Parameterscomm_list_item Communication list item to query.
status Status value to set.
Returns
0 on success, -rte_errno otherwise:
• EINVAL if invalid input params
__rte_experimentalintrte_gpu_comm_get_status(structrte_gpu_comm_list*comm_list_item,enumrte_gpu_comm_list_status*status)WarningEXPERIMENTAL: this API may change without prior notice.
Get status flag value of a communication list item.
Parameterscomm_list_item Communication list item to query. Input parameter.
status Communication list item status flag value. Output parameter.
Returns
0 on success, -rte_errno otherwise:
• EINVAL if invalid input params
__rte_experimentalintrte_gpu_comm_cleanup_list(structrte_gpu_comm_list*comm_list_item)WarningEXPERIMENTAL: this API may change without prior notice.
Reset a communication list item to the original state. The status flag set to FREE and mbufs are returned
to the pool.
Parameterscomm_list_item Communication list item to reset.
Returns
0 on success, -rte_errno otherwise:
• EINVAL if invalid input params