44 #define SLEEP_IN_NANOS (10 * 1000)
45 #define MAX_BURST_SIZE 256
46 #define MAX_PKT_SIZE 1600
49 #define RECV_TASK_USER_DATA 0x43210
77 uint32_t flow_tag, rx_hash;
78 const uint32_t *metadata_array;
81 state = ctx_user_data.
ptr;
101 DOCA_LOG_INFO(
"Received a packet with metadata %u", metadata_array[0]);
107 DOCA_LOG_INFO(
"Received a packet with flow_tag %u", flow_tag);
127 DOCA_LOG_INFO(
"Received a packet of size %lu successfully", packet_size);
147 struct timespec ts = {
218 struct timespec ts = {
252 goto destroy_eth_rxq;
258 goto destroy_eth_rxq;
264 goto destroy_eth_rxq;
270 goto destroy_eth_rxq;
276 goto destroy_eth_rxq;
282 goto destroy_eth_rxq;
287 DOCA_LOG_ERR(
"Failed to retrieve DOCA ETH RXQ context as DOCA context, err: %s",
289 goto destroy_eth_rxq;
295 goto destroy_eth_rxq;
298 user_data.
ptr = state;
302 goto destroy_eth_rxq;
308 goto destroy_eth_rxq;
449 uint32_t max_supported_burst_size;
450 uint32_t max_supported_packet_size;
494 .ibdev_name = ib_dev_name};
535 goto destroy_packet_buffers;
541 goto destroy_rxq_tasks;
550 destroy_packet_buffers:
doca_telemetry_exporter_timestamp_t timestamp
doca_error_t destroy_eth_core_resources(struct eth_core_resources *resources)
doca_error_t allocate_eth_core_resources(struct eth_core_config *cfg, struct eth_core_resources *resources)
doca_error_t allocate_eth_rxq_flow_resources(struct eth_rxq_flow_config *cfg, struct eth_rxq_flow_resources *resources)
doca_error_t rxq_common_init_doca_flow(struct doca_dev *dev, struct eth_rxq_flow_resources *resources)
static doca_error_t destroy_eth_rxq_packet_buffers(struct eth_rxq_sample_objects *state)
static doca_error_t create_eth_rxq_packet_buffer(struct eth_rxq_sample_objects *state)
DOCA_LOG_REGISTER(ETH_RXQ_REGULAR_RECEIVE)
static void destroy_eth_rxq_tasks(struct eth_rxq_sample_objects *state)
static doca_error_t submit_eth_rxq_tasks(struct eth_rxq_sample_objects *state)
#define RECV_TASK_USER_DATA
static void task_recv_common_cb(struct doca_eth_rxq_task_recv *task_recv, union doca_data task_user_data, union doca_data ctx_user_data)
static void eth_rxq_cleanup(struct eth_rxq_sample_objects *state)
static doca_error_t create_eth_rxq_ctx(struct eth_rxq_sample_objects *state)
static void retrieve_rxq_recv_tasks(struct eth_rxq_sample_objects *state)
static doca_error_t destroy_eth_rxq_ctx(struct eth_rxq_sample_objects *state)
doca_error_t eth_rxq_regular_receive(const char *ib_dev_name, bool timestamp_enable)
static doca_error_t create_eth_rxq_tasks(struct eth_rxq_sample_objects *state)
static doca_error_t check_device(struct doca_devinfo *devinfo)
static doca_error_t doca_buf_inventory_buf_get_by_addr(struct doca_buf_inventory *inventory, struct doca_mmap *mmap, void *addr, size_t len, struct doca_buf **buf)
Allocate single element from buffer inventory and point it to the buffer defined by addr & len argume...
DOCA_STABLE doca_error_t doca_buf_dec_refcount(struct doca_buf *buf, uint16_t *refcount)
Decrease the object reference count by 1, if 0 reached, return the element back to the inventory.
DOCA_STABLE doca_error_t doca_buf_get_data_len(const struct doca_buf *buf, size_t *data_len)
Get buffer's data length.
DOCA_STABLE doca_error_t doca_ctx_start(struct doca_ctx *ctx)
Finalizes all configurations, and starts the DOCA CTX.
DOCA_STABLE doca_error_t doca_ctx_get_state(const struct doca_ctx *ctx, enum doca_ctx_states *state)
Get context state.
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.
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_name(doca_error_t error)
Returns the string representation of an error code name.
@ DOCA_ERROR_NOT_SUPPORTED
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_task_recv_get_flow_tag(const struct doca_eth_rxq_task_recv *task_recv, uint32_t *flow_tag)
This method gets the flow tag of a finished receive task.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_task_recv_allocate_init(struct doca_eth_rxq *eth_rxq, struct doca_buf *pkt, union doca_data user_data, struct doca_eth_rxq_task_recv **task_recv)
This method allocates and initializes a doca_eth_rxq_task_recv task.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_task_recv_get_pkt(const struct doca_eth_rxq_task_recv *task_recv, struct doca_buf **pkt)
This method gets packet buffer from doca_eth_rxq_task_recv task.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_task_recv_set_conf(struct doca_eth_rxq *eth_rxq, doca_eth_rxq_task_recv_completion_cb_t task_completion_cb, doca_eth_rxq_task_recv_completion_cb_t task_error_cb, uint32_t task_recv_num)
This method sets the doca_eth_rxq_task_recv tasks configuration. can only be called before calling do...
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_task_recv_get_metadata_array(const struct doca_eth_rxq_task_recv *task_recv, const uint32_t **metadata_array)
This method gets metadata array for the packet received by receive task.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_task_recv_get_timestamp(const struct doca_eth_rxq_task_recv *task_recv, uint64_t *timestamp)
This method gets the timestamp of a finished receive task.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_task_recv_get_rx_hash(const struct doca_eth_rxq_task_recv *task_recv, uint32_t *rx_hash)
This method gets the RX hash of a finished receive task.
DOCA_EXPERIMENTAL struct doca_task * doca_eth_rxq_task_recv_as_doca_task(struct doca_eth_rxq_task_recv *task_recv)
This method converts a doca_eth_rxq_task_recv task to doca_task.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_set_flow_tag(struct doca_eth_rxq *eth_rxq, uint8_t enable_flow_tag)
Setter to enable flow tag support. User can retrieve flow tag per packet when this is enabled....
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_get_flow_queue_id(struct doca_eth_rxq *eth_rxq, uint16_t *flow_queue_id)
Get the DPDK queue ID of the doca_eth receive queue. can only be called after calling doca_ctx_start(...
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_set_type(struct doca_eth_rxq *eth_rxq, enum doca_eth_rxq_type type)
Set RX queue type property for doca_eth_rxq. can only be called before calling doca_ctx_start().
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_destroy(struct doca_eth_rxq *eth_rxq)
Destroy a DOCA ETH RXQ instance.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_set_timestamp(struct doca_eth_rxq *eth_rxq, uint8_t enable_timestamp)
Setter to enable timestamp support. User can retrieve timestamp in nanoseconds per packet when this i...
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_cap_is_type_supported(const struct doca_devinfo *devinfo, enum doca_eth_rxq_type type, enum doca_eth_rxq_data_path_type data_path_type)
Check if RX queue type is supported.
DOCA_EXPERIMENTAL struct doca_ctx * doca_eth_rxq_as_doca_ctx(struct doca_eth_rxq *eth_rxq)
Convert doca_eth_rxq instance into a generalized context for use with doca core objects.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_cap_get_max_packet_size(const struct doca_devinfo *devinfo, uint32_t *max_packet_size)
Get the maximum packet size supported by the device.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_create(struct doca_dev *dev, uint32_t max_burst_size, uint32_t max_packet_size, struct doca_eth_rxq **eth_rxq)
Create a DOCA ETH RXQ instance.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_cap_get_max_burst_size(const struct doca_devinfo *devinfo, uint32_t *max_burst_size)
Get the maximum burst size supported by the device.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_set_metadata_num(struct doca_eth_rxq *eth_rxq, uint8_t metadata_num)
Set metadata number for doca_eth_rxq. can only be called before calling doca_ctx_start().
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_set_rx_hash(struct doca_eth_rxq *eth_rxq, uint8_t enable_rx_hash)
Setter to enable RX hash support. User can retrieve RX hash per packet when this is enabled....
@ DOCA_ETH_RXQ_TYPE_REGULAR
@ DOCA_ETH_RXQ_DATA_PATH_TYPE_CPU
DOCA_STABLE void doca_flow_pipe_destroy(struct doca_flow_pipe *pipe)
Destroy one pipe.
DOCA_STABLE doca_error_t doca_flow_port_stop(struct doca_flow_port *port)
Stop a doca port.
DOCA_STABLE void doca_flow_destroy(void)
Destroy the doca flow.
#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_task_get_status(const struct doca_task *task)
Get task status.
DOCA_STABLE doca_error_t doca_pe_connect_ctx(struct doca_pe *pe, struct doca_ctx *ctx)
This method connects a context to a progress engine.
DOCA_STABLE doca_error_t doca_task_submit(struct doca_task *task)
Submit a task to a progress engine.
DOCA_STABLE uint8_t doca_pe_progress(struct doca_pe *pe)
Run the progress engine.
DOCA_STABLE void doca_task_free(struct doca_task *task)
Free a task back to where it was allocated from.
const struct ip_frag_config * cfg
struct program_core_objects core_objs
uint16_t * rxq_flow_queue_ids
struct doca_flow_pipe * root_pipe
struct doca_flow_port * df_port
struct doca_buf * packet_buf
struct eth_rxq_flow_resources flow_resources
struct doca_eth_rxq_task_recv * recv_task
uint16_t rxq_flow_queue_id
struct eth_core_resources core_resources
struct doca_eth_rxq * eth_rxq
struct doca_mmap * src_mmap
struct doca_buf_inventory * buf_inv
Convenience type for representing opaque data.