| NVIDIA DOCA SDK | Data Center on a Chip Framework Documentation |

Modules | |
| DOCA Device Emulation - Virtio IO Context | |
| DOCA Device Emulation - Virtio Device Types | |
Typedefs | |
| typedef void(* | doca_devemu_virtio_dev_event_reset_handler_cb_t) (struct doca_devemu_virtio_dev *virtio_dev, union doca_data event_user_data) |
| Function to be executed on Virtio device reset. The event handler will enable users to quiesce, flush and reset the necessary resources associated with the emulated Virtio device. Upon event, all PCI I/O transactions to/from the host memory are disabled. Additionally, the user should flush all the outstanding resources associated with the emulated Virtio device, which were initially owned by the Virtio device and moved the the ownership of the user. After flushing all the outstanding resources, the user should call doca_devemu_virtio_dev_reset_complete(). More... | |
| typedef void(* | doca_devemu_virtio_queue_stats_list_populate_done_cb_t) (struct doca_devemu_virtio_queue_stats **stats_list, union doca_data user_data, doca_error_t err) |
| Function to be executed upon finishing asynchronous population of Virtio queue statistics list. More... | |
Functions | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_device_features_63_0 (const struct doca_devemu_virtio_dev *virtio_dev, uint64_t *features) |
| Get the Virtio device_feature bits (0-63) according to Virtio specification. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_set_device_features_63_0 (struct doca_devemu_virtio_dev *virtio_dev, uint64_t features) |
| Set the Virtio device_feature bits (0-63) according to Virtio specification. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_driver_features_63_0 (const struct doca_devemu_virtio_dev *virtio_dev, uint64_t *features) |
| Get the Virtio driver_feature bits (0-63) according to Virtio specification. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_config_msix_vector (const struct doca_devemu_virtio_dev *virtio_dev, uint16_t *config_msix_vector) |
| Get the Virtio config_msix_vector register according to Virtio specification. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_num_queues (const struct doca_devemu_virtio_dev *virtio_dev, uint16_t *num_queues) |
| Get the Virtio device num_queues register from common configuration structure according to Virtio specification. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_set_num_queues (struct doca_devemu_virtio_dev *virtio_dev, uint16_t num_queues) |
| Set the Virtio device num_queues register in common configuration structure according to Virtio specification. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_num_enabled_queues (const struct doca_devemu_virtio_dev *virtio_dev, uint16_t *num_queues) |
| Get the number of enabled Virtio device queues by the driver. The driver enables a queue by setting the corresponding queue index to the queue_select register and setting the queue_enable register to 1. The return value of num_queues is valid only if DRIVER_OK status bit was set by the driver. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_device_status (const struct doca_devemu_virtio_dev *virtio_dev, uint8_t *device_status) |
| Get the Virtio device_status register from common configuration structure according to Virtio specification. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_config_generation (const struct doca_devemu_virtio_dev *virtio_dev, uint8_t *config_generation) |
| Get the Virtio config_generation register from common configuration structure according to Virtio specification. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_queue_size (const struct doca_devemu_virtio_dev *virtio_dev, uint16_t *queue_size) |
| Get the Virtio max queue size for all Virtio queues. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_set_queue_size (struct doca_devemu_virtio_dev *virtio_dev, uint16_t queue_size) |
| Set the Virtio max queue size for all Virtio queues. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_get_num_required_running_virtio_io_ctxs (const struct doca_devemu_virtio_dev *virtio_dev, uint32_t *num_virtio_io) |
| Get the number of required running Virtio io context's to be bounded to the Virtio device context. The Virtio device context will not move to a "running" state before having this amount of running Virtio IO context's bounded to it. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_set_num_required_running_virtio_io_ctxs (struct doca_devemu_virtio_dev *virtio_dev, uint32_t num_virtio_io) |
| Set the number of required running Virtio IO context's to be bounded to the Virtio device context. The Virtio device context will not move to a "running" state before having this amount of running Virtio IO context's bounded to it. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_reset_complete (struct doca_devemu_virtio_dev *virtio_dev) |
| Complete the Virtio device reset handling. Prior to calling this function, the user must ensure that all the resources associated with the Virtio device are flushed back to the ownership of the device. More... | |
| DOCA_EXPERIMENTAL struct doca_ctx * | doca_devemu_virtio_dev_as_ctx (struct doca_devemu_virtio_dev *virtio_dev) |
| Convert DOCA Virtio device instance into DOCA context. More... | |
| DOCA_EXPERIMENTAL struct doca_devemu_pci_dev * | doca_devemu_virtio_dev_as_pci_dev (struct doca_devemu_virtio_dev *virtio_dev) |
| Convert DOCA Virtio device instance into DOCA devemu PCI device. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_dev_event_reset_register (struct doca_devemu_virtio_dev *virtio_dev, doca_devemu_virtio_dev_event_reset_handler_cb_t handler, union doca_data user_data) |
| Register to Virtio device reset event. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_create_list (struct doca_devemu_virtio_dev *virtio_dev, struct doca_devemu_virtio_queue_stats ***stats_list, uint32_t *num_stats) |
| Create an empty list of statistics for Virtio device queues. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_destroy_list (struct doca_devemu_virtio_queue_stats **stats_list) |
| Destroy a list of Virtio queue statistics structures. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_populate_list (struct doca_devemu_virtio_queue_stats **stats_list, doca_devemu_virtio_queue_stats_list_populate_done_cb_t done, union doca_data user_data) |
| Issue an asynchronous population of a list of Virtio queue statistics structures. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_get_id (struct doca_devemu_virtio_queue_stats *stats, uint16_t *id) |
| Retrieve the Virtio queue index from its statistics structure. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_get_size (struct doca_devemu_virtio_queue_stats *stats, uint16_t *size) |
| Retrieve the Virtio queue size (depth) from its statistics structure. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_get_inflights (struct doca_devemu_virtio_queue_stats *stats, uint16_t *inflights) |
| Retrieve the number of in-flight requests for a Virtio queue from its statistics structure. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_get_hw_avail_idx (struct doca_devemu_virtio_queue_stats *stats, uint16_t *idx) |
| Retrieve the available index of a Virtio queue as seen by the device from its statistics structure. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_get_driver_avail_idx (struct doca_devemu_virtio_queue_stats *stats, uint16_t *idx) |
| Retrieve the available index of a Virtio queue as seen by the driver from its statistics structure. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_get_hw_used_idx (struct doca_devemu_virtio_queue_stats *stats, uint16_t *idx) |
| Retrieve the used index of a Virtio queue as seen by the device from its statistics structure. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_get_driver_used_idx (struct doca_devemu_virtio_queue_stats *stats, uint16_t *idx) |
| Retrieve the used index of a Virtio queue as seen by the driver from its statistics structure. More... | |
| DOCA_EXPERIMENTAL doca_error_t | doca_devemu_virtio_queue_stats_get_enabled (struct doca_devemu_virtio_queue_stats *stats, uint8_t *enabled) |
| Retrieve the enabled status of a Virtio queue from its statistics structure. More... | |
DOCA library for emulated virtio devices logic
| typedef void(* doca_devemu_virtio_dev_event_reset_handler_cb_t) (struct doca_devemu_virtio_dev *virtio_dev, union doca_data event_user_data) |
Function to be executed on Virtio device reset. The event handler will enable users to quiesce, flush and reset the necessary resources associated with the emulated Virtio device. Upon event, all PCI I/O transactions to/from the host memory are disabled. Additionally, the user should flush all the outstanding resources associated with the emulated Virtio device, which were initially owned by the Virtio device and moved the the ownership of the user. After flushing all the outstanding resources, the user should call doca_devemu_virtio_dev_reset_complete().
| [in] | virtio_dev | DOCA Virtio device instance. |
| [in] | event_user_data | Same user data that was provided in doca_devemu_virtio_dev_event_reset_register(). |
Definition at line 336 of file doca_devemu_virtio.h.
| typedef void(* doca_devemu_virtio_queue_stats_list_populate_done_cb_t) (struct doca_devemu_virtio_queue_stats **stats_list, union doca_data user_data, doca_error_t err) |
Function to be executed upon finishing asynchronous population of Virtio queue statistics list.
| [in] | stats_list | Populated list of Virtio queue statistics structures. |
| [in] | user_data | Same user data that was provided in doca_devemu_virtio_queue_stats_populate_list(). |
| [in] | err | DOCA_SUCCESS - in case of successful population. Error code - in case of failure. |
Definition at line 415 of file doca_devemu_virtio.h.
| DOCA_EXPERIMENTAL struct doca_ctx* doca_devemu_virtio_dev_as_ctx | ( | struct doca_devemu_virtio_dev * | virtio_dev | ) |
Convert DOCA Virtio device instance into DOCA context.
| [in] | virtio_dev | DOCA Virtio device instance. This must remain valid until after the DOCA context is no longer required. |
| DOCA_EXPERIMENTAL struct doca_devemu_pci_dev* doca_devemu_virtio_dev_as_pci_dev | ( | struct doca_devemu_virtio_dev * | virtio_dev | ) |
Convert DOCA Virtio device instance into DOCA devemu PCI device.
| [in] | virtio_dev | DOCA Virtio device instance. This must remain valid until after the DOCA devemu PCI device is no longer required. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_event_reset_register | ( | struct doca_devemu_virtio_dev * | virtio_dev, |
| doca_devemu_virtio_dev_event_reset_handler_cb_t | handler, | ||
| union doca_data | user_data | ||
| ) |
Register to Virtio device reset event.
Registration can be done only if the Virtio device ctx is idle. If called multiple times then only the last call will take effect.
| [in] | virtio_dev | The DOCA Virtio dev context to be associated to the event. Must be idle. |
| [in] | handler | Method that is invoked once event is triggered. |
| [in] | user_data | User data that will be provided to the handler once invoked. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_config_generation | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint8_t * | config_generation | ||
| ) |
Get the Virtio config_generation register from common configuration structure according to Virtio specification.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | config_generation | The value of the config_generation register. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_config_msix_vector | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint16_t * | config_msix_vector | ||
| ) |
Get the Virtio config_msix_vector register according to Virtio specification.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | config_msix_vector | The value of the config_msix_vector register according to Virtio specification. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_device_features_63_0 | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint64_t * | features | ||
| ) |
Get the Virtio device_feature bits (0-63) according to Virtio specification.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | features | The device_feature (bits 0-63) according to Virtio specification. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_device_status | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint8_t * | device_status | ||
| ) |
Get the Virtio device_status register from common configuration structure according to Virtio specification.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | device_status | The value of the device_status register. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_driver_features_63_0 | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint64_t * | features | ||
| ) |
Get the Virtio driver_feature bits (0-63) according to Virtio specification.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | features | The driver_feature (bits 0-63) according to Virtio specification. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_num_enabled_queues | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint16_t * | num_queues | ||
| ) |
Get the number of enabled Virtio device queues by the driver. The driver enables a queue by setting the corresponding queue index to the queue_select register and setting the queue_enable register to 1. The return value of num_queues is valid only if DRIVER_OK status bit was set by the driver.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | num_queues | The number of enable Virtio queues for the virtio device. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_num_queues | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint16_t * | num_queues | ||
| ) |
Get the Virtio device num_queues register from common configuration structure according to Virtio specification.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | num_queues | The value of the num_queues register. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_num_required_running_virtio_io_ctxs | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint32_t * | num_virtio_io | ||
| ) |
Get the number of required running Virtio io context's to be bounded to the Virtio device context. The Virtio device context will not move to a "running" state before having this amount of running Virtio IO context's bounded to it.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | num_virtio_io | The number of required running Virtio IO ctx's to be bounded to the device. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_get_queue_size | ( | const struct doca_devemu_virtio_dev * | virtio_dev, |
| uint16_t * | queue_size | ||
| ) |
Get the Virtio max queue size for all Virtio queues.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [out] | queue_size | The maximal queue size for all Virtio queues. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_reset_complete | ( | struct doca_devemu_virtio_dev * | virtio_dev | ) |
Complete the Virtio device reset handling. Prior to calling this function, the user must ensure that all the resources associated with the Virtio device are flushed back to the ownership of the device.
| [in] | virtio_dev | DOCA Virtio device instance. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_set_device_features_63_0 | ( | struct doca_devemu_virtio_dev * | virtio_dev, |
| uint64_t | features | ||
| ) |
Set the Virtio device_feature bits (0-63) according to Virtio specification.
| [in] | virtio_dev | The DOCA Virtio device instance to modify. |
| [in] | features | The device_feature (bits 0-63) according to Virtio specification. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_set_num_queues | ( | struct doca_devemu_virtio_dev * | virtio_dev, |
| uint16_t | num_queues | ||
| ) |
Set the Virtio device num_queues register in common configuration structure according to Virtio specification.
| [in] | virtio_dev | The DOCA Virtio device instance to modify. |
| [in] | num_queues | The device common num_queues register. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_set_num_required_running_virtio_io_ctxs | ( | struct doca_devemu_virtio_dev * | virtio_dev, |
| uint32_t | num_virtio_io | ||
| ) |
Set the number of required running Virtio IO context's to be bounded to the Virtio device context. The Virtio device context will not move to a "running" state before having this amount of running Virtio IO context's bounded to it.
| [in] | virtio_dev | The DOCA Virtio device instance to modify. |
| [in] | num_virtio_io | The number of required running Virtio IO ctx's to be bounded. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_dev_set_queue_size | ( | struct doca_devemu_virtio_dev * | virtio_dev, |
| uint16_t | queue_size | ||
| ) |
Set the Virtio max queue size for all Virtio queues.
| [in] | virtio_dev | The DOCA Virtio device instance to query. |
| [in] | queue_size | The maximal queue size for all Virtio queues. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_create_list | ( | struct doca_devemu_virtio_dev * | virtio_dev, |
| struct doca_devemu_virtio_queue_stats *** | stats_list, | ||
| uint32_t * | num_stats | ||
| ) |
Create an empty list of statistics for Virtio device queues.
Allocates an unpopulated list (array) of queue statistics structures for the queues of a Virtio device.
| [in] | virtio_dev | The DOCA devemu Virtio device. Must be started. |
| [out] | stats_list | The newly created list of DOCA devemu Virtio queue statistics structures. After a successful call, the list can be accessed as (*stats_list)[idx], where idx ranges from 0 to (*num_stats) - 1. |
| [out] | num_stats | The length of the stats_list. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_destroy_list | ( | struct doca_devemu_virtio_queue_stats ** | stats_list | ) |
Destroy a list of Virtio queue statistics structures.
Deallocates the memory associated with a list of Virtio queue statistics structures.
| [in] | stats_list | List to be destroyed. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_get_driver_avail_idx | ( | struct doca_devemu_virtio_queue_stats * | stats, |
| uint16_t * | idx | ||
| ) |
Retrieve the available index of a Virtio queue as seen by the driver from its statistics structure.
| [in] | stats | The DOCA devemu Virtio queue statistics instance to query. It must have been previously successfully populated. |
| [out] | idx | The available index of a Virtio queue as seen by the driver. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_get_driver_used_idx | ( | struct doca_devemu_virtio_queue_stats * | stats, |
| uint16_t * | idx | ||
| ) |
Retrieve the used index of a Virtio queue as seen by the driver from its statistics structure.
| [in] | stats | The DOCA devemu Virtio queue statistics instance to query. It must have been previously successfully populated. |
| [out] | idx | The used index of a Virtio queue as seen by the driver. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_get_enabled | ( | struct doca_devemu_virtio_queue_stats * | stats, |
| uint8_t * | enabled | ||
| ) |
Retrieve the enabled status of a Virtio queue from its statistics structure.
| [in] | stats | The DOCA devemu Virtio queue statistics instance to query. It must have been previously successfully populated. |
| [out] | enabled | 1 if the Virtio queue is enabled, 0 otherwise. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_get_hw_avail_idx | ( | struct doca_devemu_virtio_queue_stats * | stats, |
| uint16_t * | idx | ||
| ) |
Retrieve the available index of a Virtio queue as seen by the device from its statistics structure.
| [in] | stats | The DOCA devemu Virtio queue statistics instance to query. It must have been previously successfully populated. |
| [out] | idx | The available index of a Virtio queue as seen by the device. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_get_hw_used_idx | ( | struct doca_devemu_virtio_queue_stats * | stats, |
| uint16_t * | idx | ||
| ) |
Retrieve the used index of a Virtio queue as seen by the device from its statistics structure.
| [in] | stats | The DOCA devemu Virtio queue statistics instance to query. It must have been previously successfully populated. |
| [out] | idx | The used index of a Virtio queue as seen by the device. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_get_id | ( | struct doca_devemu_virtio_queue_stats * | stats, |
| uint16_t * | id | ||
| ) |
Retrieve the Virtio queue index from its statistics structure.
| [in] | stats | The DOCA devemu Virtio queue statistics instance to query. It must have been previously successfully populated. |
| [out] | id | The index of the Virtio queue. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_get_inflights | ( | struct doca_devemu_virtio_queue_stats * | stats, |
| uint16_t * | inflights | ||
| ) |
Retrieve the number of in-flight requests for a Virtio queue from its statistics structure.
| [in] | stats | The DOCA devemu Virtio queue statistics instance to query. It must have been previously successfully populated. |
| [out] | inflights | The amount of in-flight requests associated with Virtio queue. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_get_size | ( | struct doca_devemu_virtio_queue_stats * | stats, |
| uint16_t * | size | ||
| ) |
Retrieve the Virtio queue size (depth) from its statistics structure.
| [in] | stats | The DOCA devemu Virtio queue statistics instance to query. It must have been previously successfully populated. |
| [out] | size | The size of the Virtio queue. |
| DOCA_EXPERIMENTAL doca_error_t doca_devemu_virtio_queue_stats_populate_list | ( | struct doca_devemu_virtio_queue_stats ** | stats_list, |
| doca_devemu_virtio_queue_stats_list_populate_done_cb_t | done, | ||
| union doca_data | user_data | ||
| ) |
Issue an asynchronous population of a list of Virtio queue statistics structures.
Initiates the asynchronous population of a list of Virtio queue statistics structures. Only one population operation can be in progress at any given time for the associated DOCA devemu Virtio device, which must be started.
| [in] | stats_list | The list to be populated. |
| [in] | done | The callback to be invoked upon finishing population of Virtio queue statistics list. This callback will only be called if the return value of this function is DOCA_SUCCESS. |
| [in] | user_data | User data that will be provided to the done callback once invoked. |