44 #define SLEEP_IN_NANOS (10 * 1000)
45 #define MAX_BURST_SIZE 256
46 #define MAX_PKT_SIZE 1600
48 #define LOG_MAX_LRO_PKT_SIZE 15
49 #define PKT_MAX_TIME 10
50 #define COUNTERS_NUM (1 << 19)
51 #define SAMPLE_RUNS_TIME 30
79 const uint32_t *metadata_array;
80 uint32_t flow_tag, rx_hash;
85 state = event_user_data.
ptr;
97 DOCA_LOG_INFO(
"Received a packet with metadata %u", metadata_array[0]);
103 DOCA_LOG_INFO(
"Received a packet with flow_tag %u", flow_tag);
121 DOCA_LOG_ERR(
"Failed to get received packet data size");
123 DOCA_LOG_INFO(
"Received a packet with data size %lu successfully", packet_size);
130 DOCA_LOG_INFO(
"Received a packet with headroom size %d, requested %d",
139 DOCA_LOG_INFO(
"Received a packet with tailroom size %d, requested %d",
157 struct doca_buf *pkt,
166 state = event_user_data.
ptr;
205 struct timespec ts = {
209 time_t start_time, end_time;
210 double elapsed_time = 0;
212 start_time = time(
NULL);
214 end_time = time(
NULL);
215 elapsed_time = difftime(end_time, start_time);
221 DOCA_LOG_INFO(
"Total call-backs invoked: %lu, %lu out of them were successful",
249 goto destroy_eth_rxq;
258 goto destroy_eth_rxq;
261 user_data.
ptr = state;
268 goto destroy_eth_rxq;
274 goto destroy_eth_rxq;
280 goto destroy_eth_rxq;
286 goto destroy_eth_rxq;
292 goto destroy_eth_rxq;
298 goto destroy_eth_rxq;
304 goto destroy_eth_rxq;
309 DOCA_LOG_ERR(
"Failed to retrieve DOCA ETH RXQ context as DOCA context, err: %s",
311 goto destroy_eth_rxq;
317 goto destroy_eth_rxq;
323 goto destroy_eth_rxq;
398 uint32_t max_supported_burst_size;
399 uint32_t max_supported_packet_size;
438 bool timestamp_enable,
439 uint16_t headroom_size,
440 uint16_t tailroom_size)
444 .success_cb_counter = 0,
449 .inventory_num_elements = 0,
451 .ibdev_name = ib_dev_name};
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 get_pkt_tailroom(struct doca_buf *pkt, uint16_t *tailroom_size)
doca_error_t get_pkt_headroom(struct doca_buf *pkt, uint16_t *headroom_size)
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 void eth_rxq_cleanup(struct eth_rxq_sample_objects *state)
DOCA_LOG_REGISTER(ETH_RXQ_MANAGED_MEMPOOL_RECEIVE)
static void event_managed_rcv_error_cb(struct doca_eth_rxq_event_managed_recv *event_managed_recv, struct doca_buf *pkt, union doca_data event_user_data)
static doca_error_t create_eth_rxq_ctx(struct eth_rxq_sample_objects *state)
#define LOG_MAX_LRO_PKT_SIZE
doca_error_t eth_rxq_managed_mempool_receive(const char *ib_dev_name, bool timestamp_enable, uint16_t headroom_size, uint16_t tailroom_size)
static void retrieve_rxq_managed_recv_event(struct eth_rxq_sample_objects *state)
static doca_error_t destroy_eth_rxq_ctx(struct eth_rxq_sample_objects *state)
static doca_error_t check_device(struct doca_devinfo *devinfo)
static void event_managed_rcv_success_cb(struct doca_eth_rxq_event_managed_recv *event_managed_recv, struct doca_buf *pkt, union doca_data event_user_data)
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_stop(struct doca_ctx *ctx)
Stops the context allowing reconfiguration.
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_event_managed_recv_get_timestamp(const struct doca_eth_rxq_event_managed_recv *event_managed_recv, uint64_t *timestamp)
This method gets the timestamp of a managed receive event.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_event_managed_recv_get_status(const struct doca_eth_rxq_event_managed_recv *event_managed_recv)
This method gets status of finished doca_eth_rxq_event_managed_recv event.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_event_managed_recv_register(struct doca_eth_rxq *eth_rxq, union doca_data user_data, doca_eth_rxq_event_managed_recv_handler_cb_t success_event_handler, doca_eth_rxq_event_managed_recv_handler_cb_t error_event_handler)
This method registers a doca_eth_rxq_event_managed_recv event. can only be called before calling doca...
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_event_managed_recv_get_metadata_array(const struct doca_eth_rxq_event_managed_recv *event_managed_recv, const uint32_t **metadata_array)
This method gets metadata array for the packet received by managed receive event.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_event_managed_recv_get_rx_hash(const struct doca_eth_rxq_event_managed_recv *event_managed_recv, uint32_t *rx_hash)
This method gets the RX hash of a managed receive event.
DOCA_EXPERIMENTAL doca_error_t doca_eth_rxq_event_managed_recv_get_flow_tag(const struct doca_eth_rxq_event_managed_recv *event_managed_recv, uint32_t *flow_tag)
This method gets the flow tag of a managed receive event.
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_packet_tailroom(struct doca_eth_rxq *eth_rxq, uint16_t tail_size)
Setter to enable packet tailroom support. User can use doca_buf's tailroom of size tail_size when thi...
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_packet_headroom(struct doca_eth_rxq *eth_rxq, uint16_t head_size)
Setter to enable packet headroom support. User can use doca_buf's headroom of size head_size when thi...
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_set_pkt_buf(struct doca_eth_rxq *eth_rxq, struct doca_mmap *mmap, uint32_t mmap_offset, uint32_t mmap_len)
Set Eth packet buffer for a doca_eth_rxq. can only be called before calling doca_ctx_start().
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_estimate_packet_buf_size(enum doca_eth_rxq_type type, uint32_t rate, uint16_t pkt_max_time, uint32_t max_packet_size, uint32_t max_burst_size, uint8_t log_max_lro_pkt_sz, uint16_t head_size, uint16_t tail_size, uint32_t *buf_size)
Get the recommended size for the mmap buffer of a doca_eth_rxq.
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_MANAGED_MEMPOOL
@ 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_pe_connect_ctx(struct doca_pe *pe, struct doca_ctx *ctx)
This method connects a context to a progress engine.
DOCA_STABLE uint8_t doca_pe_progress(struct doca_pe *pe)
Run the progress engine.
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 eth_rxq_flow_resources flow_resources
uint16_t rxq_flow_queue_id
struct eth_core_resources core_resources
uint64_t success_cb_counter
struct doca_eth_rxq * eth_rxq
uint64_t total_cb_counter
struct doca_mmap * src_mmap
Convenience type for representing opaque data.