Data Accelerator Offload
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
dao_dma.h File Reference
#include <rte_eal.h>
#include <rte_dmadev.h>
#include <rte_lcore.h>
#include <rte_vect.h>
#include <dao_config.h>
#include "dao_log.h"

Go to the source code of this file.

Data Structures

struct  dao_dma_cmpl_mdata
 
struct  dao_dma_vchan_state
 
struct  dao_dma_vchan_info
 
struct  dao_dma_vchan_stats
 
struct  dao_dma_stats
 

Macros

#define DAO_DMA_MAX_POINTER   15u
 
#define DAO_DMA_MAX_POINTER_THR_DFLT   8u
 
#define DAO_DMA_MAX_VCHAN_PER_LCORE   128
 
#define DAO_DMA_MAX_INFLIGHT_MDATA   4096
 

Functions

 RTE_DECLARE_PER_LCORE (struct dao_dma_vchan_info *, dao_dma_vchan_info)
 
int dao_dma_flush_submit (void)
 
int dao_dma_stats_get (uint16_t lcore_id, struct dao_dma_stats *stats)
 
int dao_dma_lcore_dev2mem_set (int16_t dma_devid, uint16_t nb_vchans, uint16_t flush_thr)
 
int dao_dma_lcore_mem2dev_set (int16_t dma_devid, uint16_t nb_vchans, uint16_t flush_thr)
 
int dao_dma_lcore_mem2dev_autofree_set (int16_t dma_devid, uint16_t vchan, bool enable)
 
int dao_dma_ctrl_dev_set (int16_t dev2mem_id, int16_t mem2dev_id)
 
int16_t dao_dma_ctrl_dev2mem (void)
 
int16_t dao_dma_ctrl_mem2dev (void)
 
void dao_dma_compl_wait (uint16_t vchan)
 
static __rte_always_inline int dao_dma_has_stats_feature (void)
 
static __rte_always_inline bool dao_dma_op_status (struct dao_dma_vchan_state *vchan, uint16_t op_idx)
 
static __rte_always_inline bool dao_dma_flush (struct dao_dma_vchan_state *vchan, const uint8_t avail)
 
static __rte_always_inline uint16_t dao_dma_avail (struct dao_dma_vchan_state *vchan)
 
static __rte_always_inline struct rte_dma_sge * dao_dma_sge_src (struct dao_dma_vchan_state *vchan)
 
static __rte_always_inline struct rte_dma_sge * dao_dma_sge_dst (struct dao_dma_vchan_state *vchan)
 
static __rte_always_inline void dao_dma_enq_x1 (struct dao_dma_vchan_state *vchan, rte_iova_t src, uint32_t src_len, rte_iova_t dst, uint32_t dst_len)
 
static __rte_always_inline void dao_dma_enq_dst_x1 (struct dao_dma_vchan_state *vchan, rte_iova_t dst, uint32_t dst_len)
 
static __rte_always_inline void dao_dma_enq_src_x1 (struct dao_dma_vchan_state *vchan, rte_iova_t src, uint32_t src_len)
 
static __rte_always_inline uint16_t dao_dma_enq_x4 (struct dao_dma_vchan_state *vchan, uint64x2_t *vsrc, uint64x2_t *vdst)
 
static __rte_always_inline void dao_dma_check_compl (struct dao_dma_vchan_state *vchan)
 
static __rte_always_inline void dao_dma_check_meta_compl (struct dao_dma_vchan_state *vchan, const int mem_order)
 
static __rte_always_inline void dao_dma_update_cmpl_meta (struct dao_dma_vchan_state *vchan, uint16_t *ptr, uint16_t val, uint16_t *pend_ptr, uint16_t pend_val, uint16_t tail)
 

Detailed Description

DAO DMA helper

Definition in file dao_dma.h.

Macro Definition Documentation

◆ DAO_DMA_MAX_POINTER

#define DAO_DMA_MAX_POINTER   15u

DMA MAX pointer

Definition at line 25 of file dao_dma.h.

◆ DAO_DMA_MAX_POINTER_THR_DFLT

#define DAO_DMA_MAX_POINTER_THR_DFLT   8u

DMA pointer flush threshold

Definition at line 28 of file dao_dma.h.

◆ DAO_DMA_MAX_VCHAN_PER_LCORE

#define DAO_DMA_MAX_VCHAN_PER_LCORE   128

DMA Max VCHAN per lcore

Definition at line 31 of file dao_dma.h.

◆ DAO_DMA_MAX_INFLIGHT_MDATA

#define DAO_DMA_MAX_INFLIGHT_MDATA   4096

DMA inflight event meta data

Definition at line 34 of file dao_dma.h.

Function Documentation

◆ RTE_DECLARE_PER_LCORE()

RTE_DECLARE_PER_LCORE ( struct dao_dma_vchan_info ,
dao_dma_vchan_info   
)

DMA per lcore vchan info

◆ dao_dma_flush_submit()

int dao_dma_flush_submit ( void  )

Flush DMA requests and submit ops

Returns
Zero on success.

◆ dao_dma_stats_get()

int dao_dma_stats_get ( uint16_t  lcore_id,
struct dao_dma_stats stats 
)

Get DMA stats from DAO library

Parameters
lcore_idLcore to get stats from.
statsAddress to store stats.
Returns
Zero on success.

◆ dao_dma_lcore_dev2mem_set()

int dao_dma_lcore_dev2mem_set ( int16_t  dma_devid,
uint16_t  nb_vchans,
uint16_t  flush_thr 
)

Assign dev2mem dma device to an lcore.

Parameters
dma_devidDMA device id to assign to lcore.
nb_vchansNumber of vchans available in DMA device
flush_thrFlush threshold.
Returns
Zero on success.

◆ dao_dma_lcore_mem2dev_set()

int dao_dma_lcore_mem2dev_set ( int16_t  dma_devid,
uint16_t  nb_vchans,
uint16_t  flush_thr 
)

Assign mem2dev dma device to an lcore.

Parameters
dma_devidDMA device id to assign to lcore.
nb_vchansNumber of vchans available in DMA device
flush_thrFlush threshold.
Returns
Zero on success.

◆ dao_dma_lcore_mem2dev_autofree_set()

int dao_dma_lcore_mem2dev_autofree_set ( int16_t  dma_devid,
uint16_t  vchan,
bool  enable 
)

Enable or Disable auto free on a mem2dev dma device's vchan of a given lcore.

Parameters
dma_devidDMA device id to assigned to the lcore.
vchanmem2dev vchan of the dma device.
enableFlag
Returns
Zero on success.

◆ dao_dma_ctrl_dev_set()

int dao_dma_ctrl_dev_set ( int16_t  dev2mem_id,
int16_t  mem2dev_id 
)

Assign a global DMA device id for control path.

Parameters
dev2mem_iddev2mem dma device id.
mem2dev_idmem2dev dma device id.
Returns
Zero on success.

◆ dao_dma_ctrl_dev2mem()

int16_t dao_dma_ctrl_dev2mem ( void  )

Get global DMA dev2mem device id.

Returns
dma device id.

◆ dao_dma_ctrl_mem2dev()

int16_t dao_dma_ctrl_mem2dev ( void  )

Get global DMA mem2dev device id.

Returns
dma device id.

◆ dao_dma_compl_wait()

void dao_dma_compl_wait ( uint16_t  vchan)

Check and wait for all DMA requests to complete

Parameters
vchanVchan ID

◆ dao_dma_has_stats_feature()

static __rte_always_inline int dao_dma_has_stats_feature ( void  )
static

Tests DMA stats support

Returns
1 if DMA stats is supported, 0 otherwise.

Definition at line 234 of file dao_dma.h.

◆ dao_dma_op_status()

static __rte_always_inline bool dao_dma_op_status ( struct dao_dma_vchan_state vchan,
uint16_t  op_idx 
)
static

Get DMA operation status

Parameters
vchanVchan associated with DMA operation.
op_idxDMA operation index
Returns
True - DMA op complete. False - DMA op not complete.

Definition at line 255 of file dao_dma.h.

◆ dao_dma_flush()

static __rte_always_inline bool dao_dma_flush ( struct dao_dma_vchan_state vchan,
const uint8_t  avail 
)
static

Flush DMA operation

Parameters
vchanVchan state pointer
availAvail needed post flush
Returns
True on success.

Definition at line 277 of file dao_dma.h.

◆ dao_dma_avail()

static __rte_always_inline uint16_t dao_dma_avail ( struct dao_dma_vchan_state vchan)
static

Get available space in DMA vchan state

Parameters
vchanVchan state pointer
Returns
Returns space in number of pointers.

Definition at line 316 of file dao_dma.h.

◆ dao_dma_sge_src()

static __rte_always_inline struct rte_dma_sge * dao_dma_sge_src ( struct dao_dma_vchan_state vchan)
static

Get DMA src pointer base

Parameters
vchanVchan state pointer
Returns
Returns pointer base

Definition at line 332 of file dao_dma.h.

◆ dao_dma_sge_dst()

static __rte_always_inline struct rte_dma_sge * dao_dma_sge_dst ( struct dao_dma_vchan_state vchan)
static

Get DMA dst pointer base

Parameters
vchanVchan state pointer
Returns
Returns pointer base

Definition at line 346 of file dao_dma.h.

◆ dao_dma_enq_x1()

static __rte_always_inline void dao_dma_enq_x1 ( struct dao_dma_vchan_state vchan,
rte_iova_t  src,
uint32_t  src_len,
rte_iova_t  dst,
uint32_t  dst_len 
)
static

Enqueue one DMA pointer pair.

Space is vchan state is checked by caller before calling this API

Parameters
vchanVchan state pointer
srcsource data IOVA
src_lensource data length
dstDestination data IOVA
dst_lenDestination data len

Definition at line 369 of file dao_dma.h.

◆ dao_dma_enq_dst_x1()

static __rte_always_inline void dao_dma_enq_dst_x1 ( struct dao_dma_vchan_state vchan,
rte_iova_t  dst,
uint32_t  dst_len 
)
static

Enqueue one DMA pointer for destination address.

Space in vchan state is checked by caller before calling this API

Parameters
vchanVchan state pointer
dstDestination data IOVA
dst_lenDestination data len

Definition at line 398 of file dao_dma.h.

◆ dao_dma_enq_src_x1()

static __rte_always_inline void dao_dma_enq_src_x1 ( struct dao_dma_vchan_state vchan,
rte_iova_t  src,
uint32_t  src_len 
)
static

Enqueue one DMA pointer for source address.

Space in vchan state is checked by caller before calling this API

Parameters
vchanVchan state pointer
srcsource data IOVA
src_lensource data length

Definition at line 422 of file dao_dma.h.

◆ dao_dma_enq_x4()

static __rte_always_inline uint16_t dao_dma_enq_x4 ( struct dao_dma_vchan_state vchan,
uint64x2_t *  vsrc,
uint64x2_t *  vdst 
)
static

Enqueue four DMA pointer pairs.

Parameters
vchanVchan state pointer
vsrcsource vector in format of struct rte_dma_sge.
vdstdestination vector in format of struct rte_dma_sge.
Returns
Number of pointers enqueued.

Definition at line 445 of file dao_dma.h.

◆ dao_dma_check_compl()

static __rte_always_inline void dao_dma_check_compl ( struct dao_dma_vchan_state vchan)
static

Check and update DMA completions.

Parameters
vchanVchan state pointer

Definition at line 512 of file dao_dma.h.

◆ dao_dma_check_meta_compl()

static __rte_always_inline void dao_dma_check_meta_compl ( struct dao_dma_vchan_state vchan,
const int  mem_order 
)
static

Check and update DMA completions with metadata.

Parameters
vchanVchan state pointer
mem_orderMemory order to update address

Definition at line 536 of file dao_dma.h.

◆ dao_dma_update_cmpl_meta()

static __rte_always_inline void dao_dma_update_cmpl_meta ( struct dao_dma_vchan_state vchan,
uint16_t *  ptr,
uint16_t  val,
uint16_t *  pend_ptr,
uint16_t  pend_val,
uint16_t  tail 
)
static

Update DMA op index metadata.

Parameters
vchanVchan state pointer
ptrdesc location to write
valValue to store in descriptor location
pend_ptrPending count location to write
pend_valPending Value to store
tailMeta data index to store

Definition at line 579 of file dao_dma.h.