NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
DOCA Device
Collaboration diagram for DOCA Device:

Macros

#define DOCA_DEVINFO_VUID_SIZE   128
 Buffer size to hold VUID. Including a null terminator. More...
 
#define DOCA_DEVINFO_IPV4_ADDR_SIZE   4
 Length of IPv4 address. More...
 
#define DOCA_DEVINFO_IPV6_ADDR_SIZE   16
 Length of IPv6 address. More...
 
#define DOCA_DEVINFO_MAC_ADDR_SIZE   6
 Length of MAC address. More...
 
#define DOCA_DEVINFO_IFACE_NAME_SIZE   256
 Buffer size to hold network interface name. Including a null terminator. More...
 
#define DOCA_DEVINFO_IBDEV_NAME_SIZE   64
 Buffer size to hold Infiniband/RoCE device name. Including a null terminator. More...
 
#define DOCA_DEVINFO_PCI_ADDR_SIZE   13
 Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator. More...
 
#define DOCA_DEVINFO_PCI_BDF_SIZE   8
 Buffer size to hold PCI BDF format: "XX:XX.X". Including a null terminator. More...
 
#define DOCA_DEVINFO_REP_VUID_SIZE   128
 Buffer size to hold VUID. Including a null terminator. More...
 
#define DOCA_DEVINFO_REP_PCI_ADDR_SIZE   13
 Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator. More...
 
#define DOCA_DEVINFO_REP_PCI_BDF_SIZE   8
 Buffer size to hold PCI BDF format: "XX:XX.X". Including a null terminator. More...
 

Enumerations

enum  doca_devinfo_rep_filter { DOCA_DEVINFO_REP_FILTER_ALL = 0 , DOCA_DEVINFO_REP_FILTER_NET = 1 << 1 , DOCA_DEVINFO_REP_FILTER_EMULATED = 1 << 2 }
 

Functions

DOCA_STABLE doca_error_t doca_devinfo_create_list (struct doca_devinfo ***dev_list, uint32_t *nb_devs)
 Creates list of all available local devices. More...
 
DOCA_STABLE doca_error_t doca_devinfo_destroy_list (struct doca_devinfo **dev_list)
 Destroy list of local device info structures. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_create_list (struct doca_dev *dev, int filter, struct doca_devinfo_rep ***dev_list_rep, uint32_t *nb_devs_rep)
 Create list of available representor devices accessible by dev. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_destroy_list (struct doca_devinfo_rep **dev_list_rep)
 Destroy list of representor device info structures. More...
 
DOCA_STABLE doca_error_t doca_dev_open (struct doca_devinfo *devinfo, struct doca_dev **dev)
 Initialize local device for use. More...
 
DOCA_STABLE doca_error_t doca_dev_close (struct doca_dev *dev)
 Destroy allocated local device instance. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_dev_accelerate_resource_reclaim (struct doca_dev *dev)
 Accelerates the reclaim process for a local device instance. More...
 
DOCA_STABLE doca_error_t doca_dev_rep_open (struct doca_devinfo_rep *devinfo, struct doca_dev_rep **dev_rep)
 Initialize representor device for use. More...
 
DOCA_STABLE doca_error_t doca_dev_rep_close (struct doca_dev_rep *dev)
 Destroy allocated representor device instance. More...
 
DOCA_STABLE struct doca_devinfo * doca_dev_as_devinfo (const struct doca_dev *dev)
 Get local device info from device. This should be useful when wanting to query information about device after opening it, and destroying the devinfo list. More...
 
DOCA_STABLE struct doca_devinfo_rep * doca_dev_rep_as_devinfo (struct doca_dev_rep *dev_rep)
 Get representor device info from device. This should be useful when wanting to query information about device after opening it, and destroying the devinfo list. More...
 
DOCA_STABLE doca_error_t doca_devinfo_get_pci_addr_str (const struct doca_devinfo *devinfo, char *pci_addr_str)
 Get the PCI address of a DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_is_equal_pci_addr (const struct doca_devinfo *devinfo, const char *pci_addr_str, uint8_t *is_equal)
 Check if a PCI address belongs to a DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_get_ipv4_addr (const struct doca_devinfo *devinfo, uint8_t *ipv4_addr, uint32_t size)
 Get the IPv4 address of a DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_get_ipv6_addr (const struct doca_devinfo *devinfo, uint8_t *ipv6_addr, uint32_t size)
 Get the IPv6 address of a DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_get_mac_addr (const struct doca_devinfo *devinfo, uint8_t *mac_addr, uint32_t size)
 Get the MAC address of a DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_get_iface_name (const struct doca_devinfo *devinfo, char *iface_name, uint32_t size)
 Get the name of the ethernet interface of a DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_get_ibdev_name (const struct doca_devinfo *devinfo, char *ibdev_name, uint32_t size)
 Get the name of the IB device represented by a DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_get_lid (const struct doca_devinfo *devinfo, uint16_t *lid)
 Get the port LID of a DOCA devinfo. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_get_active_rate (const struct doca_devinfo *devinfo, uint64_t *active_rate)
 Get the active rate of a DOCA devinfo. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_get_vhca_id (const struct doca_devinfo *devinfo, uint16_t *vhca_id)
 Get vhca id of a device. More...
 
DOCA_STABLE doca_error_t doca_devinfo_cap_is_hotplug_manager_supported (const struct doca_devinfo *devinfo, uint8_t *is_hotplug_manager)
 Get the hotplug manager capability of a DOCA devinfo. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_cap_is_notification_moderation_supported (const struct doca_devinfo *devinfo, uint8_t *is_notification_moderation_supported)
 Check if notification moderation is supported for a device. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_all_supported (const struct doca_devinfo *devinfo, uint8_t *filter_all_supported)
 Get the representor devices discovery capability of the device. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_net_supported (const struct doca_devinfo *devinfo, uint8_t *filter_net_supported)
 Get the remote net discovery capability of the device. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_emulated_supported (const struct doca_devinfo *devinfo, uint8_t *filter_emulated_supported)
 Get the remote emulated device discovery capability of the device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_cap_is_accelerate_resource_reclaim_supported (const struct doca_devinfo *devinfo, uint8_t *is_accelerate_resource_reclaim)
 Get the accelerate resource reclaim capability of a DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_get_vuid (const struct doca_devinfo_rep *devinfo_rep, char *rep_vuid, uint32_t size)
 Get the Vendor Unique ID of a representor DOCA devinfo. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_get_pci_addr_str (const struct doca_devinfo_rep *devinfo_rep, char *pci_addr_str)
 Get the PCI address of a DOCA devinfo_rep. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_get_pci_func_type (const struct doca_devinfo_rep *devinfo_rep, enum doca_pci_func_type *pci_func_type)
 Get the PCI function type of a DOCA devinfo_rep. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_get_is_hotplug (const struct doca_devinfo_rep *devinfo_rep, uint8_t *is_hotplug)
 Query whether the representor device is a hotplugged device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_rep_get_iface_name (const struct doca_devinfo_rep *devinfo_rep, char *iface_name, uint32_t size)
 Get the name of the ethernet interface of a DOCA devinfo_rep. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devinfo_rep_get_vhca_id (const struct doca_devinfo_rep *devinfo_rep, uint16_t *vhca_id)
 Get vhca id of a DOCA devinfo_rep. More...
 
DOCA_STABLE doca_error_t doca_devinfo_rep_is_equal_pci_addr (const struct doca_devinfo_rep *devinfo_rep, const char *pci_addr_str, uint8_t *is_equal)
 Check if a PCI address belongs to a DOCA devinfo_rep. More...
 

Detailed Description

The DOCA device represents an available processing unit backed by the HW or SW implementation.

Macro Definition Documentation

◆ DOCA_DEVINFO_IBDEV_NAME_SIZE

#define DOCA_DEVINFO_IBDEV_NAME_SIZE   64

Buffer size to hold Infiniband/RoCE device name. Including a null terminator.

Definition at line 309 of file doca_dev.h.

◆ DOCA_DEVINFO_IFACE_NAME_SIZE

#define DOCA_DEVINFO_IFACE_NAME_SIZE   256

Buffer size to hold network interface name. Including a null terminator.

Definition at line 305 of file doca_dev.h.

◆ DOCA_DEVINFO_IPV4_ADDR_SIZE

#define DOCA_DEVINFO_IPV4_ADDR_SIZE   4

Length of IPv4 address.

Definition at line 293 of file doca_dev.h.

◆ DOCA_DEVINFO_IPV6_ADDR_SIZE

#define DOCA_DEVINFO_IPV6_ADDR_SIZE   16

Length of IPv6 address.

Definition at line 297 of file doca_dev.h.

◆ DOCA_DEVINFO_MAC_ADDR_SIZE

#define DOCA_DEVINFO_MAC_ADDR_SIZE   6

Length of MAC address.

Definition at line 301 of file doca_dev.h.

◆ DOCA_DEVINFO_PCI_ADDR_SIZE

#define DOCA_DEVINFO_PCI_ADDR_SIZE   13

Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator.

Definition at line 313 of file doca_dev.h.

◆ DOCA_DEVINFO_PCI_BDF_SIZE

#define DOCA_DEVINFO_PCI_BDF_SIZE   8

Buffer size to hold PCI BDF format: "XX:XX.X". Including a null terminator.

Definition at line 317 of file doca_dev.h.

◆ DOCA_DEVINFO_REP_PCI_ADDR_SIZE

#define DOCA_DEVINFO_REP_PCI_ADDR_SIZE   13

Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator.

Definition at line 665 of file doca_dev.h.

◆ DOCA_DEVINFO_REP_PCI_BDF_SIZE

#define DOCA_DEVINFO_REP_PCI_BDF_SIZE   8

Buffer size to hold PCI BDF format: "XX:XX.X". Including a null terminator.

Definition at line 669 of file doca_dev.h.

◆ DOCA_DEVINFO_REP_VUID_SIZE

#define DOCA_DEVINFO_REP_VUID_SIZE   128

Buffer size to hold VUID. Including a null terminator.

Definition at line 661 of file doca_dev.h.

◆ DOCA_DEVINFO_VUID_SIZE

#define DOCA_DEVINFO_VUID_SIZE   128

Buffer size to hold VUID. Including a null terminator.

Definition at line 289 of file doca_dev.h.

Enumeration Type Documentation

◆ doca_devinfo_rep_filter

Representor device filter by flavor

Multiple options possible but some are mutually exclusive.

Enumerator
DOCA_DEVINFO_REP_FILTER_ALL 
DOCA_DEVINFO_REP_FILTER_NET 
DOCA_DEVINFO_REP_FILTER_EMULATED 

Definition at line 65 of file doca_dev.h.

Function Documentation

◆ doca_dev_accelerate_resource_reclaim()

DOCA_EXPERIMENTAL doca_error_t doca_dev_accelerate_resource_reclaim ( struct doca_dev *  dev)

Accelerates the reclaim process for a local device instance.

This function optimizes the reclaim time by retaining critical resources in the cache upon closure, allowing them to be reused when restarting. It should be invoked before initiating device resource cleanup, including resources tied to the device, such as DOCA Flow switch ports and their associated components. For scenarios where a fast reclaim is needed, even in the event of a process crash, this function should be called periodically (e.g., once per second) to ensure readiness.

Parameters
[in]devPointer to the local DOCA device instance.
Returns
  • DOCA_SUCCESS on success.
  • Appropriate error code on failure:
    • DOCA_ERROR_INVALID_VALUE - if the input is invalid.
    • DOCA_ERROR_DRIVER - if there is a driver-related error.
    • DOCA_ERROR_AGAIN - if the operation should be retried.
    • DOCA_ERROR_NOT_SUPPORTED - the accelerate resource reclaim capability is unsupported.

◆ doca_dev_as_devinfo()

DOCA_STABLE struct doca_devinfo* doca_dev_as_devinfo ( const struct doca_dev *  dev)

Get local device info from device. This should be useful when wanting to query information about device after opening it, and destroying the devinfo list.

Parameters
[in]devThe doca device instance.
Returns
The matching doca_devinfo instance in case of success, NULL in case dev is invalid.

◆ doca_dev_close()

DOCA_STABLE doca_error_t doca_dev_close ( struct doca_dev *  dev)

Destroy allocated local device instance.

Closes device or decrements its refcount by One. In case the same device was opened multiple times, then only the last call to close will attempt to destroy device.

Parameters
[in]devThe local doca device instance.
Returns
DOCA_SUCCESS - in case of success.
  • DOCA_ERROR_IN_USE - failed to deallocate device resources.

◆ doca_dev_open()

DOCA_STABLE doca_error_t doca_dev_open ( struct doca_devinfo *  devinfo,
struct doca_dev **  dev 
)

Initialize local device for use.

Opens device or increments its refcount by One. The device can later be used by other libraries. For every call to doca_dev_open() there should be a call to doca_dev_close().

Parameters
[in]devinfoThe devinfo structure of the requested device.
[out]devInitialized local doca device instance on success. Valid on success only.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_NO_MEMORY - failed to allocate protection domain for device.
  • DOCA_ERROR_NOT_CONNECTED - failed to open device.
  • DOCA_ERROR_INITIALIZATION - maximum number of open devices was exceeded.
  • DOCA_ERROR_NOT_SUPPORTED - devinfo was created by doca_rdma_bridge_open_dev_from_pd().

◆ doca_dev_rep_as_devinfo()

DOCA_STABLE struct doca_devinfo_rep* doca_dev_rep_as_devinfo ( struct doca_dev_rep *  dev_rep)

Get representor device info from device. This should be useful when wanting to query information about device after opening it, and destroying the devinfo list.

Parameters
[in]dev_repThe representor doca device instance.
Returns
The matching doca_devinfo_rep instance in case of success, NULL in case dev_rep is invalid.

◆ doca_dev_rep_close()

DOCA_STABLE doca_error_t doca_dev_rep_close ( struct doca_dev_rep *  dev)

Destroy allocated representor device instance.

Parameters
[in]devThe representor doca device instance.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_IN_USE - failed to deallocate device resources.

◆ doca_dev_rep_open()

DOCA_STABLE doca_error_t doca_dev_rep_open ( struct doca_devinfo_rep *  devinfo,
struct doca_dev_rep **  dev_rep 
)

Initialize representor device for use.

Parameters
[in]devinfoThe devinfo structure of the requested device.
[out]dev_repInitialized representor doca device instance on success. Valid on success only.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_NO_MEMORY - failed to allocate memory for device.

◆ doca_devinfo_cap_is_accelerate_resource_reclaim_supported()

DOCA_EXPERIMENTAL doca_error_t doca_devinfo_cap_is_accelerate_resource_reclaim_supported ( const struct doca_devinfo *  devinfo,
uint8_t *  is_accelerate_resource_reclaim 
)

Get the accelerate resource reclaim capability of a DOCA devinfo.

The accelerate resource reclaim property type: uint8_t*.

Parameters
[in]devinfoThe device to query.
[out]is_accelerate_resource_reclaim1 if the accelerate resource reclaim capability is supported, 0 otherwise.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query capability support.

◆ doca_devinfo_cap_is_hotplug_manager_supported()

DOCA_STABLE doca_error_t doca_devinfo_cap_is_hotplug_manager_supported ( const struct doca_devinfo *  devinfo,
uint8_t *  is_hotplug_manager 
)

Get the hotplug manager capability of a DOCA devinfo.

The hotplug manager property type: uint8_t*.

Parameters
[in]devinfoThe device to query.
[out]is_hotplug_manager1 if the hotplug manager capability is supported, 0 otherwise.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query capability support.

◆ doca_devinfo_cap_is_notification_moderation_supported()

DOCA_EXPERIMENTAL doca_error_t doca_devinfo_cap_is_notification_moderation_supported ( const struct doca_devinfo *  devinfo,
uint8_t *  is_notification_moderation_supported 
)

Check if notification moderation is supported for a device.

The notification moderation supported type: uint8_t*.

Parameters
[in]devinfoThe device to query.
[out]is_notification_moderation_supported1 if the device supports notification moderation
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query capability support.

◆ doca_devinfo_create_list()

DOCA_STABLE doca_error_t doca_devinfo_create_list ( struct doca_devinfo ***  dev_list,
uint32_t *  nb_devs 
)

Creates list of all available local devices.

Lists information about available devices, to start using the device you first have to call doca_dev_open(), while passing an element of this list. List elements become invalid once it has been destroyed.

Parameters
[out]dev_listPointer to array of pointers. Output can then be accessed as follows (*dev_list)[idx].
[out]nb_devsNumber of available local devices.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_NO_MEMORY - failed to allocate enough space.
  • DOCA_ERROR_NOT_FOUND - failed to get RDMA devices list
Note
Returned list must be destroyed using doca_devinfo_destroy_list()

◆ doca_devinfo_destroy_list()

DOCA_STABLE doca_error_t doca_devinfo_destroy_list ( struct doca_devinfo **  dev_list)

Destroy list of local device info structures.

Destroys the list of device information, once the list has been destroyed, all elements become invalid.

Parameters
[in]dev_listList to be destroyed.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_IN_USE - at least one device in the list is in a corrupted state.

◆ doca_devinfo_get_active_rate()

DOCA_EXPERIMENTAL doca_error_t doca_devinfo_get_active_rate ( const struct doca_devinfo *  devinfo,
uint64_t *  active_rate 
)

Get the active rate of a DOCA devinfo.

Parameters
[in]devinfoThe device to query.
[out]active_rateThe active rate of the given port on the device. Given in units of bits/s.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query port rate.

◆ doca_devinfo_get_ibdev_name()

DOCA_STABLE doca_error_t doca_devinfo_get_ibdev_name ( const struct doca_devinfo *  devinfo,
char *  ibdev_name,
uint32_t  size 
)

Get the name of the IB device represented by a DOCA devinfo.

The name of the IB device type: char[DOCA_DEVINFO_IBDEV_NAME_SIZE].

Parameters
[in]devinfoThe device to query.
[out]ibdev_nameThe name of the IB device represented by devinfo.
[in]sizeThe size of the input ibdev_name buffer, must be at least DOCA_DEVINFO_IBDEV_NAME_SIZE which includes the null terminating byte.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.

◆ doca_devinfo_get_iface_name()

DOCA_STABLE doca_error_t doca_devinfo_get_iface_name ( const struct doca_devinfo *  devinfo,
char *  iface_name,
uint32_t  size 
)

Get the name of the ethernet interface of a DOCA devinfo.

The name of the ethernet interface is the same as it's name in ifconfig. The name of the ethernet interface type: char[DOCA_DEVINFO_IFACE_NAME_SIZE].

Parameters
[in]devinfoThe device to query.
[out]iface_nameThe name of the ethernet interface of devinfo.
[in]sizeThe size of the input iface_name buffer, must be at least DOCA_DEVINFO_IFACE_NAME_SIZE which includes the null terminating byte.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_OPERATING_SYSTEM - failed to acquire the interface name from the OS

◆ doca_devinfo_get_ipv4_addr()

DOCA_STABLE doca_error_t doca_devinfo_get_ipv4_addr ( const struct doca_devinfo *  devinfo,
uint8_t *  ipv4_addr,
uint32_t  size 
)

Get the IPv4 address of a DOCA devinfo.

The IPv4 address type: uint8_t[DOCA_DEVINFO_IPV4_ADDR_SIZE].

Parameters
[in]devinfoThe device to query.
[out]ipv4_addrThe IPv4 address of devinfo.
[in]sizeThe size of the input ipv4_addr buffer, must be at least DOCA_DEVINFO_IPV4_ADDR_SIZE
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_NOT_FOUND - no IPv4 address was assigned
  • DOCA_ERROR_OPERATING_SYSTEM - failed to acquire the IPv4 address from the OS

◆ doca_devinfo_get_ipv6_addr()

DOCA_STABLE doca_error_t doca_devinfo_get_ipv6_addr ( const struct doca_devinfo *  devinfo,
uint8_t *  ipv6_addr,
uint32_t  size 
)

Get the IPv6 address of a DOCA devinfo.

The IPv6 address type: uint8_t[DOCA_DEVINFO_IPV6_ADDR_SIZE].

Parameters
[in]devinfoThe device to query.
[out]ipv6_addrThe IPv6 address of devinfo.
[in]sizeThe size of the input ipv6_addr buffer, must be at least DOCA_DEVINFO_IPV6_ADDR_SIZE
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_OPERATING_SYSTEM - failed to acquire the IPv6 address from the OS

◆ doca_devinfo_get_lid()

DOCA_STABLE doca_error_t doca_devinfo_get_lid ( const struct doca_devinfo *  devinfo,
uint16_t *  lid 
)

Get the port LID of a DOCA devinfo.

The port LID type: uint16_t *.

Parameters
[in]devinfoThe device to query.
[out]lidThe port LID of devinfo.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query port LID.
  • DOCA_ERROR_NOT_SUPPORTED - the device port's link layer is not IB.

◆ doca_devinfo_get_mac_addr()

DOCA_STABLE doca_error_t doca_devinfo_get_mac_addr ( const struct doca_devinfo *  devinfo,
uint8_t *  mac_addr,
uint32_t  size 
)

Get the MAC address of a DOCA devinfo.

The MAC address type: uint8_t[DOCA_DEVINFO_MAC_ADDR_SIZE].

Parameters
[in]devinfoThe device to query.
[out]mac_addrThe MAC address of devinfo.
[in]sizeThe size of the input mac_addr buffer, must be at least DOCA_DEVINFO_MAC_ADDR_SIZE
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_NOT_SUPPORTED - the device port's link layer is not RoCE.

◆ doca_devinfo_get_pci_addr_str()

DOCA_STABLE doca_error_t doca_devinfo_get_pci_addr_str ( const struct doca_devinfo *  devinfo,
char *  pci_addr_str 
)

Get the PCI address of a DOCA devinfo.

The PCI address string format is "Domain:Bus:Device.Function", such that each value is represented by HEX digits, e.g., "0000:3a:00.0"

Parameters
[in]devinfoThe device to query.
[out]pci_addr_strThe PCI address of devinfo, should be of size DOCA_DEVINFO_PCI_ADDR_SIZE at least.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_OPERATING_SYSTEM - failed to acquire the PCI address from the OS

◆ doca_devinfo_get_vhca_id()

DOCA_EXPERIMENTAL doca_error_t doca_devinfo_get_vhca_id ( const struct doca_devinfo *  devinfo,
uint16_t *  vhca_id 
)

Get vhca id of a device.

Parameters
[in]devinfoThe device to query.
[out]vhca_idReturned vhca id of the device
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query capability support.

◆ doca_devinfo_is_equal_pci_addr()

DOCA_STABLE doca_error_t doca_devinfo_is_equal_pci_addr ( const struct doca_devinfo *  devinfo,
const char *  pci_addr_str,
uint8_t *  is_equal 
)

Check if a PCI address belongs to a DOCA devinfo.

Parameters
[in]devinfoThe device to query.
[in]pci_addr_strThe PCI address to check, should be as one of the following formats:
  • "Domain:Bus:Device.Function", e.g., "0000:3a:00.0" (size DOCA_DEVINFO_PCI_ADDR_SIZE including a null terminator).
  • "Bus:Device.Function", e.g., "3a:00.0" (size DOCA_DEVINFO_PCI_BDF_SIZE including a null terminator), Domain is assumed to be "0000" (i.e. "0000:<pci_addr_str>").
[out]is_equal1 if pci_addr_str belongs to devinfo, 0 otherwise. In case of an error, no certain value is guaranteed.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_OPERATING_SYSTEM - failed to acquire the actual PCI address from the OS for comparison.

◆ doca_devinfo_rep_cap_is_filter_all_supported()

DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_all_supported ( const struct doca_devinfo *  devinfo,
uint8_t *  filter_all_supported 
)

Get the representor devices discovery capability of the device.

Get uint8_t value defining if the device can be used to create list of representor devices. In case true is returned, then this device supports at least one representor type. See doca_devinfo_rep_create_list(). true - device can be used with the remote list create API with filter DOCA_DEVINFO_REP_FILTER_ALL. false - providing DOCA_DEVINFO_REP_FILTER_ALL is guaranteed to fail with DOCA_ERROR_NOT_SUPPORTED.

Parameters
[in]devinfoThe device to query.
[out]filter_all_supported1 if the rep list all capability is supported, 0 otherwise.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query capability support.
  • DOCA_ERROR_NOT_SUPPORTED - local device does not expose representor devices.

◆ doca_devinfo_rep_cap_is_filter_emulated_supported()

DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_emulated_supported ( const struct doca_devinfo *  devinfo,
uint8_t *  filter_emulated_supported 
)

Get the remote emulated device discovery capability of the device.

Get uint8_t value defining if the device can be used to create list of emulated representor devices. See doca_devinfo_rep_create_list(). true - device can be used with the remote list create API with filter DOCA_DEVINFO_REP_FILTER_EMULATED. false - providing DOCA_DEVINFO_REP_FILTER_EMULATED is guaranteed to fail with DOCA_ERROR_NOT_SUPPORTED.

Parameters
[in]devinfoThe device to query.
[out]filter_emulated_supported1 if the list emulated capability is supported, 0 otherwise.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query capability support.
  • DOCA_ERROR_NOT_SUPPORTED - local device does not expose representor devices.

◆ doca_devinfo_rep_cap_is_filter_net_supported()

DOCA_STABLE doca_error_t doca_devinfo_rep_cap_is_filter_net_supported ( const struct doca_devinfo *  devinfo,
uint8_t *  filter_net_supported 
)

Get the remote net discovery capability of the device.

Get uint8_t value defining if the device can be used to create list of net remote devices. See doca_devinfo_remote_list_create(). true - device can be used with the remote list create API with filter DOCA_DEV_REMOTE_FILTER_NET. false - providing DOCA_DEV_REMOTE_FILTER_NET is guaranteed to fail with DOCA_ERROR_NOT_SUPPORTED.

Parameters
[in]devinfoThe device to query.
[out]filter_net_supported1 if the rep list net capability is supported, 0 otherwise.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_DRIVER - failed to query capability support.
  • DOCA_ERROR_NOT_SUPPORTED - local device does not expose representor devices.

◆ doca_devinfo_rep_create_list()

DOCA_STABLE doca_error_t doca_devinfo_rep_create_list ( struct doca_dev *  dev,
int  filter,
struct doca_devinfo_rep ***  dev_list_rep,
uint32_t *  nb_devs_rep 
)

Create list of available representor devices accessible by dev.

Returns all representors managed by the provided device. The provided device must be a local device. The representor may represent a network function attached to the host, or it can represent an emulated function attached to the host.

Parameters
[in]devLocal device with access to representors.
[in]filterBitmap filter of representor types. See enum doca_devinfo_rep_filter for more details.
[out]dev_list_repPointer to array of pointers. Output can then be accessed as follows (*dev_list_rep)[idx].
[out]nb_devs_repNumber of available representor devices.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_NO_MEMORY - failed to allocate memory for list.
  • DOCA_ERROR_DRIVER - Failed to query driver.
  • DOCA_ERROR_NOT_SUPPORTED - local device does not expose representor devices
Note
Returned list must be destroyed using doca_devinfo_rep_destroy_list()

◆ doca_devinfo_rep_destroy_list()

DOCA_STABLE doca_error_t doca_devinfo_rep_destroy_list ( struct doca_devinfo_rep **  dev_list_rep)

Destroy list of representor device info structures.

Destroy list of representor device information, once the list has been destroyed, all elements of the list are considered invalid.

Parameters
[in]dev_list_repList to be destroyed.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_IN_USE - the doca_dev that created the list is in a corrupted state.

◆ doca_devinfo_rep_get_iface_name()

DOCA_EXPERIMENTAL doca_error_t doca_devinfo_rep_get_iface_name ( const struct doca_devinfo_rep *  devinfo_rep,
char *  iface_name,
uint32_t  size 
)

Get the name of the ethernet interface of a DOCA devinfo_rep.

The name of the ethernet interface is the same as it's name in ifconfig. The name of the ethernet interface type: char[DOCA_DEVINFO_IFACE_NAME_SIZE].

Parameters
[in]devinfo_repRepresentor device info
[out]iface_nameThe name of the ethernet interface of devinfo_rep.
[in]sizeThe size of the input iface_name buffer, must be at least DOCA_DEVINFO_IFACE_NAME_SIZE which includes the null terminating byte.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_OPERATING_SYSTEM - failed to acquire the interface name from the OS

◆ doca_devinfo_rep_get_is_hotplug()

DOCA_STABLE doca_error_t doca_devinfo_rep_get_is_hotplug ( const struct doca_devinfo_rep *  devinfo_rep,
uint8_t *  is_hotplug 
)

Query whether the representor device is a hotplugged device.

Parameters
[in]devinfo_reprepresentor device info
[out]is_hotplug1 if the representor device is a hotplugged device. 0 if representor device is statically plugged.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.

◆ doca_devinfo_rep_get_pci_addr_str()

DOCA_STABLE doca_error_t doca_devinfo_rep_get_pci_addr_str ( const struct doca_devinfo_rep *  devinfo_rep,
char *  pci_addr_str 
)

Get the PCI address of a DOCA devinfo_rep.

The PCI address string format is "Domain:Bus:Device.Function", such that each value is represented by HEX digits, e.g., "0000:3a:00.0".

Parameters
[in]devinfo_repThe device to query.
[out]pci_addr_strThe PCI address of devinfo_rep, should be of size DOCA_DEVINFO_REP_PCI_ADDR_SIZE at least.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_NO_MEMORY - not enough memory to generate the stringed PCI address.
  • DOCA_ERROR_UNEXPECTED - an unexpected error occurred.

◆ doca_devinfo_rep_get_pci_func_type()

DOCA_STABLE doca_error_t doca_devinfo_rep_get_pci_func_type ( const struct doca_devinfo_rep *  devinfo_rep,
enum doca_pci_func_type pci_func_type 
)

Get the PCI function type of a DOCA devinfo_rep.

The pci function type: enum doca_pci_func_type.

Parameters
[in]devinfo_repThe representor of device to query.
[out]pci_func_typeThe PCI function type of the devinfo_rep.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.

◆ doca_devinfo_rep_get_vhca_id()

DOCA_EXPERIMENTAL doca_error_t doca_devinfo_rep_get_vhca_id ( const struct doca_devinfo_rep *  devinfo_rep,
uint16_t *  vhca_id 
)

Get vhca id of a DOCA devinfo_rep.

Parameters
[in]devinfo_repRepresentor device info.
[out]vhca_idReturned vhca id of the devinfo_rep.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.

◆ doca_devinfo_rep_get_vuid()

DOCA_STABLE doca_error_t doca_devinfo_rep_get_vuid ( const struct doca_devinfo_rep *  devinfo_rep,
char *  rep_vuid,
uint32_t  size 
)

Get the Vendor Unique ID of a representor DOCA devinfo.

The Vendor Unique ID is used as stable ID of a VF/PF. The Vendor Unique ID type: char[DOCA_DEVINFO_VUID_SIZE].

Parameters
[in]devinfo_repThe representor device to query.
[out]rep_vuidThe Vendor Unique ID of devinfo_rep.
[in]sizeThe size of the vuid buffer, including the terminating null byte ('\0').
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.

◆ doca_devinfo_rep_is_equal_pci_addr()

DOCA_STABLE doca_error_t doca_devinfo_rep_is_equal_pci_addr ( const struct doca_devinfo_rep *  devinfo_rep,
const char *  pci_addr_str,
uint8_t *  is_equal 
)

Check if a PCI address belongs to a DOCA devinfo_rep.

Parameters
[in]devinfo_repThe representor of device to query.
[in]pci_addr_strThe PCI address to check, should be as one of the following formats:
  • "Domain:Bus:Device.Function", e.g., "0000:3a:00.0" (size DOCA_DEVINFO_PCI_ADDR_SIZE including a null terminator).
  • "Bus:Device.Function", e.g., "3a:00.0" (size DOCA_DEVINFO_PCI_BDF_SIZE including a null terminator). Domain is assumed to be "0000" (i.e. "0000:<pci_addr_str>").
[out]is_equal1 if pci_addr_str belongs to devinfo_rep, 0 otherwise.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - received invalid input.
  • DOCA_ERROR_NO_MEMORY - not enough memory to generate devinfo_rep PCI address for comparison.
  • DOCA_ERROR_UNEXPECTED - an unexpected error occurred.