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_META_POINTER   48
 
#define DAO_DMA_MAX_POINTER_THR_DFLT   8u
 
#define DAO_DMA_MAX_VCHAN_PER_LCORE   64
 
#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_src_avail (struct dao_dma_vchan_state *vchan)
 
static __rte_always_inline uint16_t dao_dma_dst_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)
 
static __rte_always_inline void dao_dma_check_meta_compl_v2 (struct dao_dma_vchan_state *vchan, const int mem_order)
 
static __rte_always_inline void dao_dma_update_cmpl_meta_v2 (struct dao_dma_vchan_state *vchan, uint16_t *ptr, uint16_t 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_META_POINTER

#define DAO_DMA_MAX_META_POINTER   48

DMA MAX META pointer MAX DMA POINTER

Definition at line 28 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 31 of file dao_dma.h.

◆ DAO_DMA_MAX_VCHAN_PER_LCORE

#define DAO_DMA_MAX_VCHAN_PER_LCORE   64

DMA Max VCHAN per lcore

Definition at line 34 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 37 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 237 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 258 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 280 of file dao_dma.h.

◆ dao_dma_src_avail()

static __rte_always_inline uint16_t dao_dma_src_avail ( struct dao_dma_vchan_state vchan)
static

Get available space in DMA src vchan state

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

Definition at line 319 of file dao_dma.h.

◆ dao_dma_dst_avail()

static __rte_always_inline uint16_t dao_dma_dst_avail ( struct dao_dma_vchan_state vchan)
static

Get available space in DMA dst vchan state

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

Definition at line 335 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 351 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 365 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 388 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 417 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 441 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 464 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 531 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 555 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 598 of file dao_dma.h.

◆ dao_dma_check_meta_compl_v2()

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

Check and update DMA completions with metadata version2.

Parameters
vchanVchan state pointer
mem_orderMemory order to update address

Definition at line 621 of file dao_dma.h.

◆ dao_dma_update_cmpl_meta_v2()

static __rte_always_inline void dao_dma_update_cmpl_meta_v2 ( struct dao_dma_vchan_state vchan,
uint16_t *  ptr,
uint16_t  val,
uint16_t  tail 
)
static

Update DMA op index metadata version2.

Parameters
vchanVchan state pointer
ptrdesc location to write
valValue to store in descriptor location
tailMeta data index to store

Definition at line 659 of file dao_dma.h.