Data Structures

struct drv_mode_name

#include "libqdma_export.h"

Overview

Structure to hold the driver name and mode

Mode can be set for each PF or VF group using module parameters Refer enum qdma_drv_mode for different mode options

Fields

enum qdma_drv_mode drv_mode

Mode of the function

char name [20]

Driver Name

struct global_csr_conf

#include "libqdma_export.h"

Overview

global CSR configuration

Fields

unsigned int ring_sz [QDMA_GLOBAL_CSR_ARRAY_SZ]

Descriptor ring size ie. queue depth

unsigned int c2h_timer_cnt [QDMA_GLOBAL_CSR_ARRAY_SZ]

C2H timer count list

unsigned int c2h_cnt_th [QDMA_GLOBAL_CSR_ARRAY_SZ]

C2H counter threshold list

unsigned int c2h_buf_sz [QDMA_GLOBAL_CSR_ARRAY_SZ]

C2H buffer size list

unsigned int wb_intvl

Writeback interval

struct qdma_cmpl_ctrl

#include "libqdma_export.h"

Overview

Completion control

Fields

u8 cnt_th_idx :4

global_csr_conf.c2h_cnt_th [N]

u8 timer_idx :4

global_csr_conf.c2h_timer_cnt [N]

u8 trigger_mode :3

tigger_mode

u8 en_stat_desc :1

enable status desc. for CMPT

u8 cmpl_en_intr :1

enable interrupt for CMPT

struct qdma_dev_conf

#include "libqdma_export.h"

Overview

Defines the per-device qdma property.

Fields

struct pci_dev* pdev

pointer to pci_dev

u32 qsets_max

Maximum number of queue pairs per device

unsigned short rsvd2

Reserved

u8 zerolen_dma :1

Indicates whether zero length DMA is allowed or not

u8 master_pf :1

Indicates whether the current pf is master_pf or not

u8 intr_moderation :1

moderate interrupt generation

u8 rsvd1 :5

Reserved1

u8 vf_max

Maximum number of virtual functions for current physical function

u8 intr_rngsz

Interrupt ring size

u16 msix_qvec_max

interrupt:

  • MSI-X only max of QDMA_DEV_MSIX_VEC_MAX per function, 32 in Versal
  • 1 vector is reserved for user interrupt
  • 1 vector is reserved mailbox
  • 1 vector on pf0 is reserved for error interrupt
  • the remaining vectors will be used for queues max. of vectors used for queues. libqdma update w/ actual #
u16 user_msix_qvec_max

Max user msix vectors

u16 data_msix_qvec_max

Max data msix vectors

unsigned long uld

upper layer data, i.e. callback data

enum qdma_drv_mode qdma_drv_mode

qdma driver mode

char name [QDMA_DEV_NAME_MAXLEN]

an unique string to identify the dev. current format: qdma[pf|vf][idx] filled in by libqdma

char bar_num_config

dma config bar #, < 0 not present

char bar_num_user

AXI Master Lite(user bar)

char bar_num_bypass

AXI Bridge Master(bypass bar)

int qsets_base

queue base for this function

u32 bdf

device index

u32 idx

index of device in device list

void (* fp_user_isr_handler )(unsigned long dev_hndl, unsigned long uld)

user interrupt, if null, default libqdma handler is used

Parameters:

dev_hndl Device Handler
uld upper layer data, i.e. callback data
void (* fp_q_isr_top_dev )(unsigned long dev_hndl, unsigned long uld)

Q interrupt top, per-device addtional handling code.

Parameters:

dev_hndl Device Handler
uld upper layer data, i.e. callback data
void (* fp_flr_free_resource )(unsigned long dev_hndl)

for freeing any resources in FLR process

Parameters:

dev_hndl Device Handler
void* debugfs_dev_root

root path for debugfs

struct qdma_q_state

#include "libqdma_export.h"

Overview

display queue state in a string buffer

Fields

enum q_state_t qstate

current q state

u32 qidx :24

0xFFFF: libqdma choose the queue idx 0 ~ ( qdma_dev_conf.qsets_max - 1) the calling function choose the queue idx

u32 st :1

Indicates the streaming mode

enum queue_type_t q_type

queue type

struct qdma_q_type

#include "libqdma_export.h"

Overview

Queue type

Look up table for name of the queue type and enum

Fields

const char* name

Queue type name

enum queue_type_t q_type

Queue type

struct qdma_queue_conf

#include "libqdma_export.h"

Overview

qdma configuration parameters

qdma_queue_conf defines the per-dma Q property.

Fields

u32 qidx :24

Parameters:

qidx 0xFFFF: libqdma choose the queue idx 0 ~ ( qdma_dev_conf.qsets_max - 1) the calling function choose the queue idx
u32 st :1

config flags: byte #1 Indicates the streaming mode

u32 q_type :2

queue_type_t

u32 pipe :1

SDx only: inter-kernel communication pipe

u32 irq_en :1

poll or interrupt

u32 desc_rng_sz_idx :4

descriptor ring global_csr_conf.ringsz[N]

u8 wb_status_en :1

config flags: byte #2 writeback enable, disabled for ST C2H

u8 cmpl_status_acc_en :1

sw context.cmpl_status_acc_en

u8 cmpl_status_pend_chk :1

sw context.cmpl_stauts_pend_chk

u8 desc_bypass :1

send descriptor to bypass out

u8 pfetch_en :1

descriptor prefetch enable control

u8 fetch_credit :1

sw context.frcd_en[32]

u8 st_pkt_mode :1

Parameters:

st_pkt_mode SDx only: ST packet mode (i.e., with TLAST to identify the packet boundary)
u8 c2h_buf_sz_idx :4

config flags: byte #3 global_csr_conf.c2h_buf_sz [N]

u8 cmpl_rng_sz_idx :4

ST C2H Completion/Writeback ring global_csr_conf.ringsz[N]

u8 cmpl_desc_sz :2

config flags: byte #4 C2H ST cmpt + immediate data, desc_sz_t

u8 cmpl_stat_en :1

enable status desc. for CMPT

u8 cmpl_udd_en :1

C2H Completion entry user-defined data

u8 cmpl_timer_idx :4

global_csr_conf.c2h_timer_cnt [N]

u8 cmpl_cnt_th_idx :4

config flags byte #5 global_csr_conf.c2h_cnt_th [N]

u8 cmpl_trig_mode :3

tigger_mode_t

u8 cmpl_en_intr :1

enable interrupt for CMPT

u8 sw_desc_sz :2

config flags byte #6 SW Context desc size, desc_sz_t

u8 pfetch_bypass :1

prefetch bypass en

u8 cmpl_ovf_chk_dis :1

OVF_DIS C2H ST over flow disable

u8 port_id :3

Port ID

u8 at :1

Address Translation

u8 adaptive_rx :1

Adaptive rx counter threshold

u8 latency_optimize :1

optimize for latency

u8 init_pidx_dis :1

Disable pidx initialiaztion for ST C2H

u8 mm_channel :1

MM Channel

unsigned long quld

user provided per-Q irq handler

u32 pidx_acc :8

acummulate PIDX to batch packets

void (* fp_descq_isr_top )(unsigned long qhndl, unsigned long quld)

Q interrupt top, per-queue additional handling code for example, network rx napi_schedule(&Q->napi)

Parameters:

qhndl Queue handle
quld Queue ID
int (* fp_descq_c2h_packet )(unsigned long qhndl, unsigned long quld, unsigned int len, unsigned int sgcnt, struct qdma_sw_sg *sgl, void *udd)

optional rx packet handler: called from irq BH (i.e.qdma_queue_service_bh())

  1. do NOT modify any field of sgl b. if zero copy, do a get_page() to prevent page freeing c. do loop through the sgl with sg->next and stop at sgcnt. the last sg may not have sg->next = NULL

A single packet could contain: in the case of c2h_udd_en = 1:

udd only (udd valid, sgcnt = 0, sgl = NULL), or udd + packet data in the case of c2h_udd_en = 0: packet data (udd = NULL, sgcnt > 0 and sgl valid)

Parameters:

qhndl Queue handle
quld Queue ID
len Packet Length
sgcnt scatter gathher list count
sgl packet data in scatter-gather list
udd user defined data in the completion entry

Returns:

0 to allow libqdma free/re-task the sgl < 0, libqdma will keep the packet for processing again

int (* fp_bypass_desc_fill )(void *q_hndl, enum qdma_q_mode q_mode, enum qdma_q_dir, struct qdma_request *req)

fill the all the descriptors required for transfer

Parameters:

q_hndl handle with which bypass module can request back info from libqdma
q_mode mode in which q is initialized
q_dir direction in which q is initialized
sgcnt number of scatter gather entries for this request
sgl list of scatter gather entries

Returns:

On calling this API, bypass module can request for descriptor using qdma_q_desc_get and set up as many descriptors as required for each scatter gather entry. If descriptors required are not available, it can return the number of sgcnt addressed till now and return <0 in case of any failure

int (* fp_proc_ul_cmpt_entry )(void *cmpt_entry, struct qdma_ul_cmpt_info *cmpt_info)

parse cmpt entry in bypass mode

Parameters:

cmpt_entry cmpt entry descriptor
cmpt_info parsed bypass related info from cmpt_entry

Returns:

0 for success

char name [QDMA_QUEUE_NAME_MAXLEN]

Following fileds are filled by libqdma name of the qdma device

unsigned int rngsz

ring size of the queue

unsigned int rngsz_cmpt

completion ring size of the queue

unsigned int c2h_bufsz

C2H buffer size

u8 ping_pong_en :1

Ping Pong measurement

u32 aperture_size

Keyhole Aperture Size

struct qdma_queue_count

#include "libqdma_export.h"

Overview

QDMA queue count

Fields

u32 h2c_qcnt

H2C queue count

u32 c2h_qcnt

C2H queue count

u32 cmpt_qcnt

CMPT queue count

struct qdma_request

#include "libqdma_export.h"

Overview

qdma request for read or write

Fields

unsigned char opaque [QDMA_REQ_OPAQUE_SIZE]

private to the dma driver, do NOT touch

unsigned long uld_data

filled in by the calling function for the calling function

int (* fp_done )(struct qdma_request *req, unsigned int bytes_done, int err)

set fp_done for non-blocking mode

unsigned int timeout_ms

timeout in mili-seconds, 0 - no timeout

unsigned int count

total data size

u64 ep_addr

MM only, DDR/BRAM memory addr

u8 no_memcpy :1

flag to indicate if memcpy is required

u8 write :1

if write to the device

u8 dma_mapped :1

if sgt is already dma mapped

u8 h2c_eot :1

indicates end of transfer towards user kernel

u8 check_qstate_disabled :1

state check disbaled in queue pkt API

u8 udd_len

user defined data present

unsigned int sgcnt

number of scatter-gather entries < 64K

struct qdma_sw_sg* sgl

scatter-gather list of data bufs

u8 udd [QDMA_UDD_MAXLEN]

udd data

struct qdma_sw_sg

#include "libqdma_export.h"

Overview

qdma scatter gather request

Fields

struct qdma_sw_sg* next

pointer to next page

struct page* pg

pointer to current page

unsigned int offset

offset in current page

unsigned int len

length of the page

dma_addr_t dma_addr

dma address of the allocated page

struct qdma_ul_cmpt_info

#include "libqdma_export.h"

Overview

Completion entry format

Completion Entry is user logic dependent Current SW supported the following completion entry format

Fields

u8 fbits

Flag bits

u8 format :1

Format of the entry

u8 color :1

Indicates the validity of the entry

u8 err :1

Indicates the error status

u8 desc_used :1

Indicates the descriptor used status

u8 eot :1

Indicates the end of transfer

u8 filler :3

Filler bits

u8 rsvd

Reserved filed added for structure alignment

u16 len

Length of the completion entry

unsigned int pidx

Producer Index

__be64* entry

Completion entry

struct qdma_version_info

#include "libqdma_export.h"

Overview

defines the per-device version information

Fields

char rtl_version_str [DEVICE_VERSION_INFO_STR_LENGTH]

Version string

char vivado_release_str [DEVICE_VERSION_INFO_STR_LENGTH]

Release string

char ip_str [DEVICE_VERSION_INFO_STR_LENGTH]

IP version string

char device_type_str [DEVICE_VERSION_INFO_STR_LENGTH]

Qdma device type string

Overview

Global Variables

struct drv_mode_name mode_name_list []

Externel structure definition mode_name_list

struct qdma_q_type q_type_list []

Externel structure definition q_type_list