53 const char *
addr = (
char *)param;
58 DOCA_LOG_ERR(
"Entered device PCI address exceeding the maximum size of %d",
79 const char *txt = (
char *)param;
89 strncpy(conf->
cpy_txt, txt, txt_len + 1);
104 const char *
path = (
char *)param;
114 if (access(
path, F_OK | R_OK) != 0) {
115 DOCA_LOG_ERR(
"Failed to find file path pointed by export descriptor: %s",
path);
137 const int *num = (
int *)param;
140 DOCA_LOG_ERR(
"Entered number of source doca_buf: %d, valid value must be >= 1", *num);
159 const int *num = (
int *)param;
162 DOCA_LOG_ERR(
"Entered number of destination doca_buf: %d, valid value must be >= 1", *num);
182 const char *
path = (
char *)param;
192 if (access(
path, F_OK | R_OK) != 0) {
193 DOCA_LOG_ERR(
"Failed to find file path pointed by buffer information: %s",
path);
207 struct doca_argp_param *pci_address_param, *cpy_txt_param, *export_desc_path_param, *buf_info_path_param;
209 struct doca_argp_param *num_src_buf_param, *num_dst_buf_param;
238 "Text to DMA copy from the Host to the DPU (relevant only on the Host side)");
257 "Exported descriptor file path to save (Host) or to read from (DPU)");
275 "Buffer information file path to save (Host) or to read from (DPU)");
388 struct doca_ctx *
ctx,
397 switch (next_state) {
407 DOCA_LOG_ERR(
"DMA context entered into starting state. Unexpected transition");
420 DOCA_LOG_INFO(
"DMA context entered into stopping state. Any inflight tasks will be flushed");
433 uint32_t max_buf_list_len = 0;
443 DOCA_LOG_ERR(
"Failed to get memcpy task max_buf_list_len capability for DMA: %s",
447 if ((uint32_t)num_buf > max_buf_list_len) {
449 DOCA_LOG_ERR(
"Number of doca_buf [%d] exceed the limitation [%u]: %s",
static doca_error_t num_dst_buf_callback(void *param, void *config)
static doca_error_t num_src_buf_callback(void *param, void *config)
char path[MAX_PATH_LEN+1]
doca_error_t destroy_core_objects(struct program_core_objects *state)
doca_error_t create_core_objects(struct program_core_objects *state, uint32_t max_bufs)
static doca_error_t open_doca_device_with_pci(const char *pcie_value, struct doca_dev **retval)
doca_error_t dma_task_is_supported(struct doca_devinfo *devinfo)
static doca_error_t pci_callback(void *param, void *config)
doca_error_t register_dma_params(bool is_remote)
static doca_error_t text_callback(void *param, void *config)
doca_error_t destroy_dma_host_resources(struct program_core_objects *state)
doca_error_t allocate_dma_host_resources(const char *pcie_addr, struct program_core_objects *state)
DOCA_LOG_REGISTER(DMA_COMMON)
static void dma_memcpy_completed_callback(struct doca_dma_task_memcpy *dma_task, union doca_data task_user_data, union doca_data ctx_user_data)
static void dma_memcpy_error_callback(struct doca_dma_task_memcpy *dma_task, union doca_data task_user_data, union doca_data ctx_user_data)
doca_error_t destroy_dma_resources(struct dma_resources *resources)
doca_error_t allocate_dma_resources(const char *pcie_addr, int num_buf, struct dma_resources *resources)
static void dma_state_changed_callback(const union doca_data user_data, struct doca_ctx *ctx, enum doca_ctx_states prev_state, enum doca_ctx_states next_state)
static doca_error_t buf_info_path_callback(void *param, void *config)
static doca_error_t descriptor_path_callback(void *param, void *config)
#define MAX_USER_TXT_SIZE
struct rdma_resources resources
DOCA_EXPERIMENTAL void doca_argp_param_set_description(struct doca_argp_param *param, const char *description)
Set the description of the program param, used during program usage.
DOCA_EXPERIMENTAL void doca_argp_param_set_long_name(struct doca_argp_param *param, const char *name)
Set the long name of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_callback(struct doca_argp_param *param, doca_argp_param_cb_t callback)
Set the callback function of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_param_create(struct doca_argp_param **param)
Create new program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_type(struct doca_argp_param *param, enum doca_argp_type type)
Set the type of the param arguments.
DOCA_EXPERIMENTAL void doca_argp_param_set_short_name(struct doca_argp_param *param, const char *name)
Set the short name of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_register_param(struct doca_argp_param *input_param)
Register a program flag.
DOCA_STABLE doca_error_t doca_ctx_set_state_changed_cb(struct doca_ctx *ctx, doca_ctx_state_changed_callback_t cb)
Set state changed callback.
DOCA_STABLE doca_error_t doca_ctx_set_user_data(struct doca_ctx *ctx, union doca_data user_data)
set user data to context
DOCA_STABLE doca_error_t doca_ctx_stop(struct doca_ctx *ctx)
Stops the context allowing reconfiguration.
doca_ctx_states
This enum defines the states of a context.
@ DOCA_CTX_STATE_STARTING
@ DOCA_CTX_STATE_STOPPING
#define DOCA_DEVINFO_PCI_ADDR_SIZE
Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator.
DOCA_STABLE struct doca_devinfo * doca_dev_as_devinfo(const struct doca_dev *dev)
Get local device info from device. This should be useful when wanting to query information about devi...
DOCA_STABLE doca_error_t doca_dev_close(struct doca_dev *dev)
Destroy allocated local device instance.
DOCA_STABLE struct doca_task * doca_dma_task_memcpy_as_task(struct doca_dma_task_memcpy *task)
This method converts a memcpy task to doca_task.
DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_get_max_buf_list_len(const struct doca_devinfo *devinfo, uint32_t *max_buf_list_len)
DOCA_STABLE struct doca_ctx * doca_dma_as_ctx(struct doca_dma *dma)
DOCA_STABLE doca_error_t doca_dma_task_memcpy_set_conf(struct doca_dma *dma, doca_dma_task_memcpy_completion_cb_t task_completion_cb, doca_dma_task_memcpy_completion_cb_t task_error_cb, uint32_t num_memcpy_tasks)
This method sets the DMA memcpy tasks configuration.
DOCA_STABLE doca_error_t doca_dma_cap_task_memcpy_is_supported(const struct doca_devinfo *devinfo)
DOCA_STABLE doca_error_t doca_dma_create(struct doca_dev *dev, struct doca_dma **dma)
DOCA_STABLE doca_error_t doca_dma_destroy(struct doca_dma *dma)
#define DOCA_ERROR_PROPAGATE(r, t)
Save the first encountered doca_error_t.
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_INVALID_VALUE
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
DOCA_STABLE doca_error_t doca_mmap_destroy(struct doca_mmap *mmap)
Destroy DOCA Memory Map structure.
DOCA_STABLE doca_error_t doca_mmap_create(struct doca_mmap **mmap)
Allocates zero size memory map object with default/unset attributes.
DOCA_STABLE doca_error_t doca_mmap_add_dev(struct doca_mmap *mmap, struct doca_dev *dev)
Register DOCA memory map on a given device.
DOCA_STABLE doca_error_t doca_task_get_status(const struct doca_task *task)
Get task status.
DOCA_STABLE void doca_task_free(struct doca_task *task)
Free a task back to where it was allocated from.
#define MAX_USER_ARG_SIZE
char buf_info_path[MAX_ARG_SIZE]
char export_desc_path[MAX_ARG_SIZE]
char cpy_txt[MAX_TXT_SIZE]
char pci_address[DOCA_DEVINFO_PCI_ADDR_SIZE]
struct doca_mmap * src_mmap
size_t num_remaining_tasks
Convenience type for representing opaque data.
struct upf_accel_ctx * ctx