NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
DOCA DPA Device - Device Emulation for PCI devices
Collaboration diagram for DOCA DPA Device - Device Emulation for PCI devices:

Functions

DOCA_EXPERIMENTAL int doca_dpa_dev_devemu_pci_get_db_completion (doca_dpa_dev_devemu_pci_db_completion_t comp, doca_dpa_dev_devemu_pci_db_completion_element_t *comp_element)
 Get Devemu PCI Device DB completion element. More...
 
DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_db_completion_ack (doca_dpa_dev_devemu_pci_db_completion_t comp, uint64_t num_comp)
 Acknowledge that the completions have been read on the Devemu PCI Device DB completion context. More...
 
DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_db_completion_request_notification (doca_dpa_dev_devemu_pci_db_completion_t comp)
 Request notification on the Devemu PCI Device DB completion context. More...
 
DOCA_EXPERIMENTAL int doca_dpa_dev_devemu_pci_db_completion_bind_db (doca_dpa_dev_devemu_pci_db_completion_t comp, doca_dpa_dev_devemu_pci_db_t db)
 Bind Devemu PCI Device DB handle to the Devemu PCI Device DB completion context. More...
 
DOCA_EXPERIMENTAL int doca_dpa_dev_devemu_pci_db_completion_unbind_db (doca_dpa_dev_devemu_pci_db_completion_t comp, doca_dpa_dev_devemu_pci_db_t db)
 Unbind Devemu PCI Device DB handle from the Devemu PCI Device DB completion context. More...
 
DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_db_completion_element_get_db_properties (doca_dpa_dev_devemu_pci_db_completion_t comp, doca_dpa_dev_devemu_pci_db_completion_element_t comp_element, doca_dpa_dev_devemu_pci_db_t *db, doca_dpa_dev_uintptr_t *db_user_data)
 Get Devemu PCI Device DB properties from DB completion element. More...
 
DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_db_request_notification (doca_dpa_dev_devemu_pci_db_t db)
 Request notification on the Devemu PCI Device DB context. More...
 
DOCA_EXPERIMENTAL uint32_t doca_dpa_dev_devemu_pci_db_get_value (doca_dpa_dev_devemu_pci_db_t db)
 Get value written to the doorbell. More...
 
DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_msix_raise (doca_dpa_dev_devemu_pci_msix_t msix)
 Raise MSIX notification towards the driver. More...
 
DOCA_EXPERIMENTAL doca_dpa_dev_uintptr_t doca_dpa_dev_devemu_pci_msix_get_user_data (doca_dpa_dev_devemu_pci_msix_t msix)
 Get MSIX handle user data. More...
 

Variables

__dpa_global__ typedef uint64_t doca_dpa_dev_devemu_pci_db_completion_t
 DPA Devemu PCI Device DB Completion handle type definition. More...
 
__dpa_global__ typedef uint64_t doca_dpa_dev_devemu_pci_db_completion_element_t
 DPA Devemu PCI Device DB Completion Element handle type definition. More...
 
__dpa_global__ typedef uint64_t doca_dpa_dev_devemu_pci_db_t
 DPA Devemu PCI Device DB handle type definition. More...
 
__dpa_global__ typedef uint64_t doca_dpa_dev_devemu_pci_msix_t
 DPA Devemu PCI Device MSI-X handle type definition. More...
 

Detailed Description

DOCA DPA Device - Device Emulation for PCI devices

Function Documentation

◆ doca_dpa_dev_devemu_pci_db_completion_ack()

DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_db_completion_ack ( doca_dpa_dev_devemu_pci_db_completion_t  comp,
uint64_t  num_comp 
)

Acknowledge that the completions have been read on the Devemu PCI Device DB completion context.

Acks a number of completions that were previously received using doca_dpa_dev_devemu_pci_get_db_completion After this operation the acked completions are no longer valid

Parameters
[in]comp- DPA Devemu PCI Device DB completion handle
[in]num_comp- Number of completion elements which have been read

◆ doca_dpa_dev_devemu_pci_db_completion_bind_db()

DOCA_EXPERIMENTAL int doca_dpa_dev_devemu_pci_db_completion_bind_db ( doca_dpa_dev_devemu_pci_db_completion_t  comp,
doca_dpa_dev_devemu_pci_db_t  db 
)

Bind Devemu PCI Device DB handle to the Devemu PCI Device DB completion context.

Parameters
[in]comp- DPA Devemu PCI Device DB completion handle
[in]db- DPA Devemu PCI Device DB handle

This function creates an association between a DB handle and the DB completion context that will be receiving notifications for this DB. These notifications will generate DB completion element that can be retrieved by doca_dpa_dev_devemu_pci_get_db_completion(). It is recommended to bind a DB to a DB completion context prior allowing any notifications to arrive for this DB.

Returns
This function returns 0 on success. Otherwise returns a negative value.

◆ doca_dpa_dev_devemu_pci_db_completion_element_get_db_properties()

DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_db_completion_element_get_db_properties ( doca_dpa_dev_devemu_pci_db_completion_t  comp,
doca_dpa_dev_devemu_pci_db_completion_element_t  comp_element,
doca_dpa_dev_devemu_pci_db_t db,
doca_dpa_dev_uintptr_t db_user_data 
)

Get Devemu PCI Device DB properties from DB completion element.

Parameters
[in]comp- DPA Devemu PCI Device DB completion handle
[in]comp_element- DPA Devemu PCI Device DB completion element
[out]db- DPA Devemu PCI Device DB handle
[out]db_user_data- DB handle user data

◆ doca_dpa_dev_devemu_pci_db_completion_request_notification()

DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_db_completion_request_notification ( doca_dpa_dev_devemu_pci_db_completion_t  comp)

Request notification on the Devemu PCI Device DB completion context.

Use this method in case you want the associated DPA thread to wake up once any new completion element is available

Parameters
[in]comp- DPA Devemu PCI Device DB completion handle

◆ doca_dpa_dev_devemu_pci_db_completion_unbind_db()

DOCA_EXPERIMENTAL int doca_dpa_dev_devemu_pci_db_completion_unbind_db ( doca_dpa_dev_devemu_pci_db_completion_t  comp,
doca_dpa_dev_devemu_pci_db_t  db 
)

Unbind Devemu PCI Device DB handle from the Devemu PCI Device DB completion context.

Parameters
[in]comp- DPA Devemu PCI Device DB completion handle
[in]db- DPA Devemu PCI Device DB handle

This function destroys the association between a DB handle and the associated DB completion context. An unbinded DB will not generate any DB completion element that can be retrieved by doca_dpa_dev_devemu_pci_get_db_completion(). It is recommended to unbind a DB from a DB completion context after disallowing any notifications to arrive for this DB.

Returns
This function returns 0 on success. Otherwise returns a negative value.

◆ doca_dpa_dev_devemu_pci_db_get_value()

DOCA_EXPERIMENTAL uint32_t doca_dpa_dev_devemu_pci_db_get_value ( doca_dpa_dev_devemu_pci_db_t  db)

Get value written to the doorbell.

This will return the current value written to the doorbell This API must be called only after doca_dpa_dev_devemu_pci_db_request_notification(), otherwise the behavior is undefined

Note
: The DPA handler can be invoked more than once for the same DB value, if a DB value is written by the device driver after doca_dpa_dev_devemu_pci_db_request_notification(), but before doca_dpa_dev_devemu_pci_db_get_value()
Parameters
[in]db- DPA Devemu PCI Device DB handle
Returns
Returns the value written to this doorbell

◆ doca_dpa_dev_devemu_pci_db_request_notification()

DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_db_request_notification ( doca_dpa_dev_devemu_pci_db_t  db)

Request notification on the Devemu PCI Device DB context.

Use this method in case you want the associated doca_dpa_dev_devemu_pci_db_completion_t to generate a completion once a new doorbell value is written

Note
need to make sure that previous completion element related to this DB has already been acked
Parameters
[in]db- DPA Devemu PCI Device DB handle

◆ doca_dpa_dev_devemu_pci_get_db_completion()

DOCA_EXPERIMENTAL int doca_dpa_dev_devemu_pci_get_db_completion ( doca_dpa_dev_devemu_pci_db_completion_t  comp,
doca_dpa_dev_devemu_pci_db_completion_element_t comp_element 
)

Get Devemu PCI Device DB completion element.

The returned completion element will stay valid until it is acked using - doca_dpa_dev_devemu_pci_db_completion_ack Once it is acked then the element should not be used, using it will cause undefined behavior

The expected flow for single DB is as follows:

  1. if doca_dpa_dev_devemu_pci_get_db_completion() != 0: 1.1. doca_dpa_dev_devemu_pci_db_completion_element_get_db_properties(&db) 1.2. doca_dpa_dev_devemu_pci_db_completion_ack(1) 1.3. doca_dpa_dev_devemu_pci_db_completion_request_notification() 1.4. doca_dpa_dev_devemu_pci_db_request_notification(db) 1.5. doca_dpa_dev_devemu_pci_db_get_value(db)

The expected flow for multiple DBs is as follows:

  1. doca_dpa_dev_devemu_pci_db_t dbs[MAX_NUM_DBS]
  2. num_completions = 0
  3. while doca_dpa_dev_devemu_pci_get_db_completion() != 0: 3.1. doca_dpa_dev_devemu_pci_db_completion_element_get_db_properties(&dbs[num_completions++])
  4. doca_dpa_dev_devemu_pci_db_completion_ack(num_completions)
  5. doca_dpa_dev_devemu_pci_db_completion_request_notification()
  6. for db in dbs: (safe to assume that dbs holds unique DBs) 6.1. doca_dpa_dev_devemu_pci_db_request_notification(db) 6.2. doca_dpa_dev_devemu_pci_db_get_value(db)

Failure to follow these steps may result in some unexpected behavior

Parameters
[in]comp- DPA Devemu PCI Device DB completion handle
[out]comp_element- DPA Devemu PCI Device DB completion element
Returns
This function returns 1 if there is completion element to return. Otherwise returns 0

◆ doca_dpa_dev_devemu_pci_msix_get_user_data()

DOCA_EXPERIMENTAL doca_dpa_dev_uintptr_t doca_dpa_dev_devemu_pci_msix_get_user_data ( doca_dpa_dev_devemu_pci_msix_t  msix)

Get MSIX handle user data.

Parameters
[in]msix- DPA Devemu PCI Device MSIX handle
Returns
Return the user data for the MSIX handle

◆ doca_dpa_dev_devemu_pci_msix_raise()

DOCA_EXPERIMENTAL void doca_dpa_dev_devemu_pci_msix_raise ( doca_dpa_dev_devemu_pci_msix_t  msix)

Raise MSIX notification towards the driver.

Parameters
[in]msix- DPA Devemu PCI Device MSIX handle

Variable Documentation

◆ doca_dpa_dev_devemu_pci_db_completion_element_t

__dpa_global__ typedef uint64_t doca_dpa_dev_devemu_pci_db_completion_element_t

DPA Devemu PCI Device DB Completion Element handle type definition.

Definition at line 40 of file doca_dpa_dev_devemu_pci.h.

◆ doca_dpa_dev_devemu_pci_db_completion_t

DPA Devemu PCI Device DB Completion handle type definition.

Definition at line 35 of file doca_dpa_dev_devemu_pci.h.

◆ doca_dpa_dev_devemu_pci_db_t

DPA Devemu PCI Device DB handle type definition.

Definition at line 45 of file doca_dpa_dev_devemu_pci.h.

◆ doca_dpa_dev_devemu_pci_msix_t

DPA Devemu PCI Device MSI-X handle type definition.

Definition at line 50 of file doca_dpa_dev_devemu_pci.h.