NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
DOCA Device Emulation - Virtio FS Devices
Collaboration diagram for DOCA Device Emulation - Virtio FS Devices:

Modules

 DOCA Device Emulation - Virtio FS IO Context
 
 DOCA Device Emulation - Virtio FS Device Types
 

Macros

#define DOCA_VFS_TAG_SIZE   21
 Size, in bytes, of the virtio FS tag in DOCA. According to the specification this is the name associated with the file system. The tag is encoded in UTF-8 and padded with NULL bytes if shorter than the available space. This field is not NULL terminated according to the Virtio specification. In DOCA, the tag encoding is shorter than in the Virtio specification and must be NULL terminated (only first 20 bytes are allowed to be encoded with non-NULL bytes). More...
 

Functions

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_init (struct doca_devemu_vfs_cfg *cfg)
 Initialize the DOCA devemu Virtio FS. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_teardown (void)
 Teardown the DOCA devemu Virtio FS. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_create (struct doca_devemu_vfs_cfg **cfg)
 Create DOCA devemu Virtio FS configuration structure. The new structure is populated with the default configuration. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_destroy (struct doca_devemu_vfs_cfg *cfg)
 Destroy DOCA devemu Virtio FS configuration structure. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_get_vfs_req_user_data_size (const struct doca_devemu_vfs_cfg *cfg, uint32_t *req_user_data_size)
 Get the size of the user data buffer that will be allocated for each doca_devemu_vfs_req on behalf of the user. This buffer will be valid and used by the user upon receiving new doca_devemu_vfs_req. The buffer will become invalid after doca_devemu_vfs_req completion. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_set_vfs_req_user_data_size (struct doca_devemu_vfs_cfg *cfg, uint32_t req_user_data_size)
 Set the size of the user data buffer that will be allocated for each doca_devemu_vfs_req on behalf of the user. This buffer will be valid and used by the user upon receiving new doca_devemu_vfs_req. The buffer will become invalid after doca_devemu_vfs_req completion. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_get_notification_req_user_data_size (const struct doca_devemu_vfs_cfg *cfg, uint32_t *req_user_data_size)
 Get the size of the user data buffer that will be allocated for each doca_devemu_vfs_notification_req on behalf of the user. This buffer will be valid and used by the user upon receiving new doca_devemu_vfs_notification_req. The buffer will become invalid after doca_devemu_vfs_notification_req completion. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_set_notification_req_user_data_size (struct doca_devemu_vfs_cfg *cfg, uint32_t req_user_data_size)
 Set the size of the user data buffer that will be allocated for each doca_devemu_vfs_notification_req on behalf of the user. This buffer will be valid and used by the user upon receiving new doca_devemu_vfs_notification_req. The buffer will become invalid after doca_devemu_vfs_notification_req completion. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_create (struct doca_devemu_vfs_type *vfs_type, struct doca_dev_rep *dev_rep, struct doca_pe *progress_engine, struct doca_devemu_vfs_dev **vfs_dev)
 Allocate DOCA Virtio FS device. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_destroy (struct doca_devemu_vfs_dev *vfs_dev)
 Free a DOCA Virtio FS device object. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_get_tag (const struct doca_devemu_vfs_dev *vfs_dev, char tag[DOCA_VFS_TAG_SIZE])
 Get the value of the Virtio FS device tag. According to the specification the tag is encoded in UTF-8 and padded with NULL bytes if shorter than the available space of 36 bytes and is not NULL-terminated if the encoded bytes take up the entire field of 36 bytes. In DOCA, the tag is always NULL terminated and is shorter than the Virtio specification definition. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_set_tag (struct doca_devemu_vfs_dev *vfs_dev, const char tag[DOCA_VFS_TAG_SIZE])
 Set the value of the Virtio FS device tag. According to the specification the tag is encoded in UTF-8 and padded with NULL bytes if shorter than the available space of 36 bytes and is not NULL-terminated if the encoded bytes take up the entire field of 36 bytes. In DOCA, the tag is always NULL terminated and is shorter than the Virtio specification definition. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_get_num_request_queues (const struct doca_devemu_vfs_dev *vfs_dev, uint32_t *num_request_queues)
 Get the value of the VIRTIO FS Device num_request_queues register. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_set_num_request_queues (struct doca_devemu_vfs_dev *vfs_dev, uint32_t num_request_queues)
 Set the value of the VIRTIO FS Device num_request_queues register. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_get_notify_buf_size (const struct doca_devemu_vfs_dev *vfs_dev, uint32_t *notify_buf_size)
 Get the value of the VIRTIO FS Device notify_buf_size register. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_set_notify_buf_size (struct doca_devemu_vfs_dev *vfs_dev, uint32_t notify_buf_size)
 Set the value of the VIRTIO FS Device notify_buf_size register. More...
 
DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_get_req_src_domain_id_range (const struct doca_devemu_vfs_dev *vfs_dev, uint16_t *min_src_domain_id, uint16_t *max_src_domain_id)
 Get the range of source domain identifiers for requests associated with a DOCA VIRTIO FS device. More...
 
DOCA_EXPERIMENTAL struct doca_ctx * doca_devemu_vfs_dev_as_ctx (struct doca_devemu_vfs_dev *vfs_dev)
 Convert DOCA Virtio FS device instance into DOCA context. More...
 
DOCA_EXPERIMENTAL struct doca_devemu_virtio_dev * doca_devemu_vfs_dev_as_virtio_dev (struct doca_devemu_vfs_dev *vfs_dev)
 Convert DOCA Virtio FS device instance into DOCA Virtio device. More...
 
DOCA_EXPERIMENTAL struct doca_devemu_pci_dev * doca_devemu_vfs_dev_as_pci_dev (struct doca_devemu_vfs_dev *vfs_dev)
 Convert DOCA Virtio FS device instance into DOCA devemu PCI device. More...
 

Detailed Description

DOCA library for emulated virtio FS devices

Macro Definition Documentation

◆ DOCA_VFS_TAG_SIZE

#define DOCA_VFS_TAG_SIZE   21

Size, in bytes, of the virtio FS tag in DOCA. According to the specification this is the name associated with the file system. The tag is encoded in UTF-8 and padded with NULL bytes if shorter than the available space. This field is not NULL terminated according to the Virtio specification. In DOCA, the tag encoding is shorter than in the Virtio specification and must be NULL terminated (only first 20 bytes are allowed to be encoded with non-NULL bytes).

Definition at line 88 of file doca_devemu_vfs.h.

Function Documentation

◆ doca_devemu_vfs_cfg_create()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_create ( struct doca_devemu_vfs_cfg **  cfg)

Create DOCA devemu Virtio FS configuration structure. The new structure is populated with the default configuration.

Parameters
[out]cfgDOCA devemu Virtio FS configuration structure.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure. see doca_error_t.

◆ doca_devemu_vfs_cfg_destroy()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_destroy ( struct doca_devemu_vfs_cfg *  cfg)

Destroy DOCA devemu Virtio FS configuration structure.

Parameters
[in]cfgThe DOCA devemu Virtio FS configuration structure to destroy.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure. see doca_error_t.

◆ doca_devemu_vfs_cfg_get_notification_req_user_data_size()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_get_notification_req_user_data_size ( const struct doca_devemu_vfs_cfg *  cfg,
uint32_t *  req_user_data_size 
)

Get the size of the user data buffer that will be allocated for each doca_devemu_vfs_notification_req on behalf of the user. This buffer will be valid and used by the user upon receiving new doca_devemu_vfs_notification_req. The buffer will become invalid after doca_devemu_vfs_notification_req completion.

Parameters
[in]cfgThe DOCA devemu Virtio FS configuration structure to query.
[out]req_user_data_sizeSize, in bytes, of the user data buffer to be allocated on behalf of the user for each doca_devemu_vfs_notification_req.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure. see doca_error_t.

◆ doca_devemu_vfs_cfg_get_vfs_req_user_data_size()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_get_vfs_req_user_data_size ( const struct doca_devemu_vfs_cfg *  cfg,
uint32_t *  req_user_data_size 
)

Get the size of the user data buffer that will be allocated for each doca_devemu_vfs_req on behalf of the user. This buffer will be valid and used by the user upon receiving new doca_devemu_vfs_req. The buffer will become invalid after doca_devemu_vfs_req completion.

Parameters
[in]cfgThe DOCA devemu Virtio FS configuration structure to query.
[out]req_user_data_sizeSize, in bytes, of the user data buffer to be allocated on behalf of the user for each doca_devemu_vfs_req.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'cfg' or 'req_user_data_size' is NULL

◆ doca_devemu_vfs_cfg_set_notification_req_user_data_size()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_set_notification_req_user_data_size ( struct doca_devemu_vfs_cfg *  cfg,
uint32_t  req_user_data_size 
)

Set the size of the user data buffer that will be allocated for each doca_devemu_vfs_notification_req on behalf of the user. This buffer will be valid and used by the user upon receiving new doca_devemu_vfs_notification_req. The buffer will become invalid after doca_devemu_vfs_notification_req completion.

Parameters
[in]cfgThe DOCA devemu Virtio FS configuration structure to modify.
[in]req_user_data_sizeSize, in bytes, of the user data buffer to be allocated on behalf of the user for each doca_devemu_vfs_notification_req.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure. see doca_error_t.

◆ doca_devemu_vfs_cfg_set_vfs_req_user_data_size()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_cfg_set_vfs_req_user_data_size ( struct doca_devemu_vfs_cfg *  cfg,
uint32_t  req_user_data_size 
)

Set the size of the user data buffer that will be allocated for each doca_devemu_vfs_req on behalf of the user. This buffer will be valid and used by the user upon receiving new doca_devemu_vfs_req. The buffer will become invalid after doca_devemu_vfs_req completion.

Parameters
[in]cfgThe DOCA devemu Virtio FS configuration structure to modify.
[in]req_user_data_sizeSize, in bytes, of the user data buffer to be allocated on behalf of the user for each doca_devemu_vfs_req.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'cfg' is NULL

◆ doca_devemu_vfs_dev_as_ctx()

DOCA_EXPERIMENTAL struct doca_ctx* doca_devemu_vfs_dev_as_ctx ( struct doca_devemu_vfs_dev *  vfs_dev)

Convert DOCA Virtio FS device instance into DOCA context.

Parameters
[in]vfs_devDOCA Virtio FS device instance. This must remain valid until after the DOCA context is no longer required.
Returns
doca ctx upon success, NULL otherwise.

◆ doca_devemu_vfs_dev_as_pci_dev()

DOCA_EXPERIMENTAL struct doca_devemu_pci_dev* doca_devemu_vfs_dev_as_pci_dev ( struct doca_devemu_vfs_dev *  vfs_dev)

Convert DOCA Virtio FS device instance into DOCA devemu PCI device.

Parameters
[in]vfs_devDOCA Virtio FS device instance. This must remain valid until after the DOCA devemu PCI device is no longer required.
Returns
DOCA devemu pci device upon success, NULL otherwise.

◆ doca_devemu_vfs_dev_as_virtio_dev()

DOCA_EXPERIMENTAL struct doca_devemu_virtio_dev* doca_devemu_vfs_dev_as_virtio_dev ( struct doca_devemu_vfs_dev *  vfs_dev)

Convert DOCA Virtio FS device instance into DOCA Virtio device.

Parameters
[in]vfs_devDOCA Virtio FS device instance. This must remain valid until after the DOCA Virtio device is no longer required.
Returns
doca virtio device upon success, NULL otherwise.

◆ doca_devemu_vfs_dev_create()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_create ( struct doca_devemu_vfs_type *  vfs_type,
struct doca_dev_rep *  dev_rep,
struct doca_pe *  progress_engine,
struct doca_devemu_vfs_dev **  vfs_dev 
)

Allocate DOCA Virtio FS device.

Parameters
[in]vfs_typeThe DOCA Virtio FS type to be associated to the device. Must be started.
[in]dev_repRepresentor DOCA device.
[in]progress_engineThe progress engine that will be used to receive events and task completions.
[out]vfs_devThe newly created DOCA Virtio FS device.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure. see doca_error_t.

◆ doca_devemu_vfs_dev_destroy()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_destroy ( struct doca_devemu_vfs_dev *  vfs_dev)

Free a DOCA Virtio FS device object.

Parameters
[in]vfs_devThe previously created DOCA Virtio FS device. Must be idle.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'vfs_dev' is NULL
  • DOCA_ERROR_BAD_STATE - device is not idle. Use doca_ctx_stop() to stop it

◆ doca_devemu_vfs_dev_get_notify_buf_size()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_get_notify_buf_size ( const struct doca_devemu_vfs_dev *  vfs_dev,
uint32_t *  notify_buf_size 
)

Get the value of the VIRTIO FS Device notify_buf_size register.

The notify_buf_size value will be used only if VIRTIO_FS_F_NOTIFICATION feature bit is set. Therefore, the notify_buf_size value must comply with VIRTIO_FS_F_NOTIFICATION feature bit before starting the associated vfs_dev.

Parameters
[in]vfs_devThe DOCA Virtio FS device instance to query.
[out]notify_buf_sizeThe value of virtio_fs_config:notify_buf_size register according to virtio specification.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'vfs_dev' or 'notify_buf_size' is NULL

◆ doca_devemu_vfs_dev_get_num_request_queues()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_get_num_request_queues ( const struct doca_devemu_vfs_dev *  vfs_dev,
uint32_t *  num_request_queues 
)

Get the value of the VIRTIO FS Device num_request_queues register.

Parameters
[in]vfs_devThe DOCA Virtio FS device instance to query.
[out]num_request_queuesThe value of Device virtio_fs_config:num_request_queues register according to virtio specification.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'vfs_dev' or 'num_request_queues' is NULL

◆ doca_devemu_vfs_dev_get_req_src_domain_id_range()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_get_req_src_domain_id_range ( const struct doca_devemu_vfs_dev *  vfs_dev,
uint16_t *  min_src_domain_id,
uint16_t *  max_src_domain_id 
)

Get the range of source domain identifiers for requests associated with a DOCA VIRTIO FS device.

Retrieves the minimum and maximum source domain identifier values that can be returned by any doca_devemu_vfs_*req_get_src_domain_id() function for the specified vfs_dev. All valid source domain identifiers for this device will fall within this range, inclusive.

Source domain identifier ranges are guaranteed not to overlap for DOCA VIRTIO FS devices sharing the same Virtio FS tag.

Source domain identifier range may change if the characteristics of the DOCA Virtio FS device are modified.

Requests arriving from a specific source domain will be processed on a single core for the duration that the associated DOCA Virtio FS device is running.

Requests from different source domains may have overlapping request identifier values.

Parameters
[in]vfs_devThe DOCA Virtio FS device instance to query. Must not be NULL.
[out]min_src_domain_idThe minimum source domain identifier value. Must not be NULL.
[out]max_src_domain_idThe maximum source domain identifier value. Must not be NULL.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - if any of 'vfs_dev', 'min_src_domain_id', or 'max_src_domain_id' is NULL.

◆ doca_devemu_vfs_dev_get_tag()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_get_tag ( const struct doca_devemu_vfs_dev *  vfs_dev,
char  tag[DOCA_VFS_TAG_SIZE] 
)

Get the value of the Virtio FS device tag. According to the specification the tag is encoded in UTF-8 and padded with NULL bytes if shorter than the available space of 36 bytes and is not NULL-terminated if the encoded bytes take up the entire field of 36 bytes. In DOCA, the tag is always NULL terminated and is shorter than the Virtio specification definition.

Parameters
[in]vfs_devThe DOCA Virtio FS device instance to query.
[out]tagThe value of the Virtio FS Device virtio_fs_config:tag according to Virtio specification (with NULL termination).
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'vfs_dev' or 'tag' is NULL

◆ doca_devemu_vfs_dev_set_notify_buf_size()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_set_notify_buf_size ( struct doca_devemu_vfs_dev *  vfs_dev,
uint32_t  notify_buf_size 
)

Set the value of the VIRTIO FS Device notify_buf_size register.

The notify_buf_size value will be used only if VIRTIO_FS_F_NOTIFICATION feature bit is set. Therefore, the notify_buf_size value must comply with VIRTIO_FS_F_NOTIFICATION feature bit before starting the associated vfs_dev.

Parameters
[in]vfs_devThe DOCA Virtio FS device instance to modify. Must be idle.
[in]notify_buf_sizeThe value of virtio_fs_config:notify_buf_size register according to virtio specification. This value must be power of 2 if the VIRTIO_FS_F_NOTIFICATION bit is set. If the VIRTIO_FS_F_NOTIFICATION feature bit is unset, a value of 0 can be used. The compliance between notify_buf_size and VIRTIO_FS_F_NOTIFICATION will be verified upon starting the associated vfs_dev.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'vfs_dev' is NULL or notify_buf_size value is invalid.
  • DOCA_ERROR_BAD_STATE - device is not idle

◆ doca_devemu_vfs_dev_set_num_request_queues()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_set_num_request_queues ( struct doca_devemu_vfs_dev *  vfs_dev,
uint32_t  num_request_queues 
)

Set the value of the VIRTIO FS Device num_request_queues register.

Parameters
[in]vfs_devThe DOCA Virtio FS device instance to modify. Must be idle.
[in]num_request_queuesThe value of Device virtio_fs_config:num_request_queues register according to virtio specification.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'vfs_dev' is NULL
  • DOCA_ERROR_BAD_STATE - device is not idle

◆ doca_devemu_vfs_dev_set_tag()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_dev_set_tag ( struct doca_devemu_vfs_dev *  vfs_dev,
const char  tag[DOCA_VFS_TAG_SIZE] 
)

Set the value of the Virtio FS device tag. According to the specification the tag is encoded in UTF-8 and padded with NULL bytes if shorter than the available space of 36 bytes and is not NULL-terminated if the encoded bytes take up the entire field of 36 bytes. In DOCA, the tag is always NULL terminated and is shorter than the Virtio specification definition.

Parameters
[in]vfs_devThe DOCA Virtio FS device instance to modify. Must be idle.
[in]tagThe value of the Virtio FS Device virtio_fs_config:tag according to Virtio specification (with NULL termination).
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure:
  • DOCA_ERROR_INVALID_VALUE - 'vfs_dev' or 'tag' is NULL
  • DOCA_ERROR_BAD_STATE - device is not idle
  • DOCA_ERROR_TOO_BIG - tag is greater than 20 bytes

◆ doca_devemu_vfs_init()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_init ( struct doca_devemu_vfs_cfg *  cfg)

Initialize the DOCA devemu Virtio FS.

This is the global initialization function for DOCA devemu Virtio FS. Must be invoked before creating Virtio FS devices, functions and IO context's. This is a one time call, used for initialization and global configurations.

Parameters
[in]cfgDOCA devemu Virtio FS configuration structure.
Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure. see doca_error_t.

◆ doca_devemu_vfs_teardown()

DOCA_EXPERIMENTAL doca_error_t doca_devemu_vfs_teardown ( void  )

Teardown the DOCA devemu Virtio FS.

Release all the resources initialized by doca_devemu_vfs_init(). Must be invoked at the teardown stage of the Virtio FS device emulation application, before it exits.

Returns
DOCA_SUCCESS - in case of success. Error code - in case of failure. see doca_error_t.