Data Accelerator Offload
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
dao_pal.h File Reference
#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.

Data Structures

struct  dao_pal_global_conf
 
struct  dao_pal_lcore_dma_id
 

Typedefs

typedef struct dao_pal_global_conf dao_pal_global_conf_t
 
typedef struct dao_pal_lcore_dma_id dao_pal_lcore_dma_id_t
 

Functions

int dao_pal_global_init (dao_pal_global_conf_t *conf)
 
int dao_pal_dma_lcore_mem2dev_autofree_set (uint32_t wrk_id, bool enable)
 
int dao_pal_thread_init (uint32_t wrk_id)
 
int dao_pal_dma_vchan_setup (uint32_t devid, uint16_t dma_vchan, void *pool)
 
int dao_pal_dma_dev_setup (uint64_t wrk_mask)
 
int dao_pal_thread_fini (uint32_t wrk_id)
 
int dao_pal_dma_ctrl_dev_set (uint32_t wrk_id)
 
void dao_pal_global_fini (void)
 
int dao_pal_vfio_dma_map (uint64_t vaddr, uint64_t iova, uint64_t len)
 
enum rte_iova_mode dao_pal_iova_mode (void)
 
int dao_pal_openlog_stream (FILE *f)
 

Detailed Description

DAO platform abstraction library

Definition in file dao_pal.h.

Typedef Documentation

◆ 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

Function Documentation

◆ dao_pal_global_init()

int dao_pal_global_init ( dao_pal_global_conf_t conf)

DAO PAL library initialization function

Parameters
confPointer 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_idWorker ID to fetch mapped memory to device DMA ID.
enableFlag
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_idWorker 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
devidvfio ID.
dma_vchanDMA's virtul channel ID
poolThis 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_maskWorker 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_idWorker 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_idControl 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
vaddrStarting virtual address of memory to be mapped.
iovaStarting IOVA address of memory to be mapped.
lenLength 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
fPointer to the stream.
Returns
  • 0 on success.
  • Negative on error.