CNDP  22.08.0
cne_dsa.h File Reference
#include <stdint.h>
#include <cne_common.h>

Go to the source code of this file.

Data Structures

struct  dsa_stats
 

Macros

#define DSA_OP_SUCCESS   0x0
 
#define DSA_OP_SKIPPED   0x1
 
#define DSA_OP_ADDRESS_ERR   0x03
 
#define DSA_OP_INVALID_LEN   0x13
 
#define DSA_OP_OVERLAPPING_BUFS   0x16
 

Functions

CNDP_API int16_t dsa_open (const char *name)
 
CNDP_API int dsa_close (uint16_t dev)
 
CNDP_API int dsa_get_stats (uint16_t dev, struct dsa_stats *stats)
 
CNDP_API uint16_t dsa_burst_capacity (uint16_t dev)
 
CNDP_API int dsa_enqueue_fill (uint16_t dev, uint64_t pattern, phys_addr_t dst, uint32_t length, uintptr_t dst_hdl)
 
CNDP_API int dsa_enqueue_copy (uint16_t dev, phys_addr_t src, phys_addr_t dst, uint32_t length, uintptr_t src_hdl, uintptr_t dst_hdl)
 
CNDP_API int dsa_fence (uint16_t dev)
 
CNDP_API int dsa_perform_ops (uint16_t dev)
 
CNDP_API int dsa_completed_ops (uint16_t dev, uint8_t max_copies, uint32_t *status, uint8_t *num_unsuccessful, uintptr_t *src_hdls, uintptr_t *dst_hdls)
 

Detailed Description

Interact with Intel(R) Data Streaming Accelerator (DSA).

Definition in file cne_dsa.h.

Macro Definition Documentation

◆ DSA_OP_SUCCESS

#define DSA_OP_SUCCESS   0x0

Operation completed successfully

Definition at line 26 of file cne_dsa.h.

◆ DSA_OP_SKIPPED

#define DSA_OP_SKIPPED   0x1

Operation not attempted (Earlier fence failed)

Definition at line 27 of file cne_dsa.h.

◆ DSA_OP_ADDRESS_ERR

#define DSA_OP_ADDRESS_ERR   0x03

Page fault or invalid address

Definition at line 28 of file cne_dsa.h.

◆ DSA_OP_INVALID_LEN

#define DSA_OP_INVALID_LEN   0x13

Invalid/too big length field passed

Definition at line 29 of file cne_dsa.h.

◆ DSA_OP_OVERLAPPING_BUFS

#define DSA_OP_OVERLAPPING_BUFS   0x16

Overlapping buffers error

Definition at line 30 of file cne_dsa.h.

Function Documentation

◆ dsa_open()

CNDP_API int16_t dsa_open ( const char *  name)

Open a device

Parameters
namethe device name in "/dev/dsa"
Returns
dsa device id to use in future api calls or -1 with errno set accordingly

◆ dsa_close()

CNDP_API int dsa_close ( uint16_t  dev)

Close a device previously opened with dsa_open()

Parameters
devThe dsa device id returned by dsa_open()
Returns
0 on success or -1 on error with errno set accordingly

◆ dsa_get_stats()

CNDP_API int dsa_get_stats ( uint16_t  dev,
struct dsa_stats stats 
)

Get device statistics

Parameters
devThe dsa device id returned by dsa_open()
statsA pointer to store statistics
Returns
0 on success or -1 on error with errno set accordingly

◆ dsa_burst_capacity()

CNDP_API uint16_t dsa_burst_capacity ( uint16_t  dev)

Return the number of available hardware descriptors

Parameters
devThe dsa device id returned by dsa_open()
Returns
Number of descriptors available to use.

◆ dsa_enqueue_fill()

CNDP_API int dsa_enqueue_fill ( uint16_t  dev,
uint64_t  pattern,
phys_addr_t  dst,
uint32_t  length,
uintptr_t  dst_hdl 
)

Enqueue a fill operation onto the device

This queues up a fill operation to be performed by hardware, but does not trigger hardware to begin that operation.

Parameters
devThe dsa device id returned by dsa_open()
patternThe pattern with which to populate the destination buffer
dstThe address of the destination buffer
lengthThe length of the destination buffer
dst_hdlAn opaque handle for the destination data, to be returned when this operation has been completed and the user polls for the completion details.
Returns
Number of operations enqueued, either 0 or 1

◆ dsa_enqueue_copy()

CNDP_API int dsa_enqueue_copy ( uint16_t  dev,
phys_addr_t  src,
phys_addr_t  dst,
uint32_t  length,
uintptr_t  src_hdl,
uintptr_t  dst_hdl 
)

Enqueue a copy operation onto the device

This queues up a copy operation to be performed by hardware, but does not trigger hardware to begin that operation.

Parameters
devThe dsa device id returned by dsa_open()
srcThe address of the source buffer
dstThe address of the destination buffer
lengthThe length of the data to copy
src_hdlAn opaque handle for the source data, to be returned when this operation has been completed and the user polls for the completion details.
dst_hdlAn opaque handle for the destination data, to be returned when this operation has been completed and the user polls for the completion details.
Returns
Number of operations enqueued, either 0 or 1

◆ dsa_fence()

CNDP_API int dsa_fence ( uint16_t  dev)

Add a fence to force ordering between operations

This adds a fence to a sequence of operations to enforce ordering, such that all operations enqueued before the fence must be completed before operations after the fence. NOTE: Since this fence may be added as a flag to the last operation enqueued, this API may not function correctly when called immediately after an dsa_perform_ops() call i.e. before any new operations are enqueued.

Parameters
devThe dsa device id returned by dsa_open()
Returns
Number of fences enqueued, either 0 or 1

◆ dsa_perform_ops()

CNDP_API int dsa_perform_ops ( uint16_t  dev)

Trigger hardware to begin performing enqueued operations

This API is used to write the "doorbell" to the hardware to trigger it to begin the operations previously enqueued by dsa_enqueue_*()

Parameters
devThe dsa device id returned by dsa_open()
Returns
0 on success or -1 on error with errno set accordingly

◆ dsa_completed_ops()

CNDP_API int dsa_completed_ops ( uint16_t  dev,
uint8_t  max_copies,
uint32_t *  status,
uint8_t *  num_unsuccessful,
uintptr_t *  src_hdls,
uintptr_t *  dst_hdls 
)

Returns details of operations that have been completed

The status of each operation is returned in the status array parameter. The function will return to the caller the user-provided "handles" for the copy operations completed by the hardware, and not already returned by a previous call to this API. If the src_hdls or dst_hdls parameters are NULL, they will be ignored, and the function returns the number of newly-completed operations. If status is also NULL, then max_copies parameter is also ignored and the function returns a count of the number of newly-completed operations.

Parameters
devThe dsa device id returned by dsa_open()
max_copiesThe number of entries which can fit in the status, src_hdls and dst_hdls arrays, i.e. max number of completed operations to report.
statusArray to hold the status of each completed operation. Array should be set to zeros on input, as the driver will only write error status values. A value of 1 implies an operation was not attempted, and any other non-zero value indicates operation failure. Parameter may be NULL if no status value checking is required.
num_unsuccessfulReturns the number of elements in status where the value is non-zero, i.e. the operation either failed or was not attempted due to an earlier failure. If this value is returned as zero (the expected case), the status array will not have been modified by the function and need not be checked by software
src_hdlsArray to hold the source handle parameters of the completed ops. Can be NULL.
dst_hdlsArray to hold the destination handle parameters of the completed ops. Can be NULL.
Returns
-1 on device error, with errno set appropriately and parameters unmodified. Otherwise number of returned operations i.e. number of valid entries in the status, src_hdls and dst_hdls array parameters. If status is NULL, this value may be greater than max_copies parameter.