Capability Checking
Applications using a DOCA Device rely on a specific subset of features to function correctly. Therefore, it is recommended to verify whether the required features are available on the selected DOCA Device.
To facilitate this, the DOCA SDK provides capability APIs, a set of standardized APIs designed for querying feature support. These APIs should be used before initializing any resources to detect unsupported features early, allowing applications to implement fallback mechanisms instead of encountering unexpected errors during execution.
Applications using DOCA Core APIs may need to determine whether a specific DOCA Device supports required capabilities.
To achieve this, the doca_devinfo
and doca_devinfo_rep
APIs expose capabilities using the following prefixes:
doca_devinfo_cap_*
doca_devinfo_rep_cap_*
Examples:
doca_error_t doca_devinfo_cap_is_hotplug_manager_supported(const
struct
doca_devinfo *devinfo, uint8_t *is_hotplug_manager);
doca_error_t doca_devinfo_rep_cap_is_filter_emulated_supported(const
struct
doca_devinfo *devinfo, uint8_t *filter_emulated_supported);
Each DOCA library provides capability APIs for:
Querying valid configuration property limits (e.g., maximum/minimum values)
Verifying whether a specific library task is supported on a given DOCA Device
All library capability APIs follow the naming convention doca_<library_name>_cap_*.
Additionally:
Configuration limitation capability APIs use the prefix
doca_<library_name>_cap_[task_<task_type>]_get_min/max_*
Task support capability APIs use the naming template
doca_<library_name>_cap_task_<task_type>_is_supported
Examples from DOCA DMA:
doca_error_t doca_dma_cap_task_memcpy_is_supported(const
struct
doca_devinfo *devinfo);
doca_error_t doca_dma_cap_get_max_num_tasks(struct
doca_dma *dma, uint32_t *max_num_tasks);
doca_error_t doca_dma_cap_task_memcpy_get_max_buf_size(const
struct
doca_devinfo *devinfo, uint64_t *buf_size);
Like other DOCA libraries, DOCA Core modules expose capability APIs to check feature availability.
Examples:
A hotplugging application can verify if a DOCA Device supports hotplugging emulated PCIe functions using:
doca_error_t doca_devinfo_cap_is_hotplug_manager_supported(
const
struct
doca_devinfo *devinfo, uint8_t *is_hotplug_manager);An application using DOCA mmap for memory sharing between a host and BlueField must export the
doca_mmap
from the host and import it on BlueField. Before proceeding, the application can verify if these operations are supported for a given adoca_devinfo
using:doca_error_t doca_mmap_cap_is_export_pci_supported(
const
struct
doca_devinfo *devinfo, uint8_t *mmap_export); doca_error_t doca_mmap_cap_is_create_from_export_pci_supported(const
struct
doca_devinfo *devinfo, uint8_t *from_export);