#include <arpa/inet.h>
#include <errno.h>
#include <getopt.h>
#include <inttypes.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <rte_branch_prediction.h>
#include <rte_common.h>
#include <rte_cycles.h>
#include <rte_dmadev.h>
#include <rte_vfio.h>
#include <dao_dma.h>
#include <dao_log.h>
#include <dao_pem.h>
#include <dao_virtio_netdev.h>
Go to the source code of this file.
DAO platform abstraction library
Definition in file dao_pal.h.
◆ dao_pal_global_conf_t
DAO PAL library initialization data structure format
◆ dao_pal_lcore_dma_id_t
Worker to DMA mapping list data structure format
◆ dao_pal_global_init()
DAO PAL library initialization function
- Parameters
-
conf | Pointer to library initialization data structure. |
- Returns
- 0 on success, -1 on failure
◆ dao_pal_dma_lcore_mem2dev_autofree_set()
int dao_pal_dma_lcore_mem2dev_autofree_set |
( |
uint32_t |
wrk_id, |
|
|
bool |
enable |
|
) |
| |
Enable or Disable auto free on a mem2dev dma device's vchan of a given lcore for all virtio devices.
- Parameters
-
wrk_id | Worker ID to fetch mapped memory to device DMA ID. |
enable | Flag |
- Returns
- Zero on success, -1 on failure.
◆ dao_pal_thread_init()
int dao_pal_thread_init |
( |
uint32_t |
wrk_id | ) |
|
Set device to memory and memory to device DMA devices per lcore to backend.
- Parameters
-
wrk_id | Worker ID to fetch mapped DMA ID's. |
- Returns
- Zero on success, -1 on failure.
◆ dao_pal_dma_vchan_setup()
int dao_pal_dma_vchan_setup |
( |
uint32_t |
devid, |
|
|
uint16_t |
dma_vchan, |
|
|
void * |
pool |
|
) |
| |
Map DMA device's virtual channel to vfio.
- Parameters
-
devid | vfio ID. |
dma_vchan | DMA's virtul channel ID |
pool | This memory pool is valid if no external packet buffer pool is available. |
- Returns
- Zero on success, -1 on failure.
◆ dao_pal_dma_dev_setup()
int dao_pal_dma_dev_setup |
( |
uint64_t |
wrk_mask | ) |
|
Allocate DMA devices per lcore, each for inbound anf outbound.
- Parameters
-
wrk_mask | Worker mask to allocate DMA devices per lcore. |
- Returns
- Zero on success, -1 on failure.
◆ dao_pal_thread_fini()
int dao_pal_thread_fini |
( |
uint32_t |
wrk_id | ) |
|
Unregister current thread with backend.
- Parameters
-
wrk_id | Worker ID to fetch mapped DMA ID's. |
- Returns
- Zero on success, -1 on failure.
◆ dao_pal_dma_ctrl_dev_set()
int dao_pal_dma_ctrl_dev_set |
( |
uint32_t |
wrk_id | ) |
|
Assign DMA devices for control path.
- Parameters
-
wrk_id | Control plain thread ID to fetch mapped DMA ID's. |
- Returns
- Zero on success, -1 on failure.
◆ dao_pal_global_fini()
void dao_pal_global_fini |
( |
void |
| ) |
|
DAO PAL library uninitialization function.
◆ dao_pal_vfio_dma_map()
int dao_pal_vfio_dma_map |
( |
uint64_t |
vaddr, |
|
|
uint64_t |
iova, |
|
|
uint64_t |
len |
|
) |
| |
Perform DMA mapping for devices. for all virtio devices.
- Parameters
-
vaddr | Starting virtual address of memory to be mapped. |
iova | Starting IOVA address of memory to be mapped. |
len | Length of memory segment being mapped. |
- Returns
- 0 if successful <0 if failed
◆ dao_pal_iova_mode()
enum rte_iova_mode dao_pal_iova_mode |
( |
void |
| ) |
|
Get the iova mode
- Returns
- enum rte_iova_mode value.
◆ dao_pal_openlog_stream()
int dao_pal_openlog_stream |
( |
FILE * |
f | ) |
|
Change the stream that will be used by the logging system.
This can be done at any time. The f argument represents the stream to be used to send the logs. If f is NULL, the default output is used (stderr).
- Parameters
-
- Returns
- 0 on success.
- Negative on error.