NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
eth_rxq_managed_mempool_receive_sample.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  */
25 
26 #include <time.h>
27 #include <unistd.h>
28 
29 #include <doca_flow.h>
30 #include <doca_buf.h>
31 #include <doca_buf_inventory.h>
32 #include <doca_ctx.h>
33 #include <doca_eth_rxq.h>
35 #include <doca_error.h>
36 #include <doca_log.h>
37 
38 #include "common.h"
39 #include "eth_common.h"
40 #include "eth_rxq_common.h"
41 
42 DOCA_LOG_REGISTER(ETH_RXQ_MANAGED_MEMPOOL_RECEIVE);
43 
44 #define SLEEP_IN_NANOS (10 * 1000) /* sample the task every 10 microseconds */
45 #define MAX_BURST_SIZE 256 /* Max burst size to set for eth_rxq */
46 #define MAX_PKT_SIZE 1600 /* Max packet size to set for eth_rxq */
47 #define RATE 10000 /* Traffic max rate in [MB/s] */
48 #define LOG_MAX_LRO_PKT_SIZE 15 /* Log of max LRO packet size */
49 #define PKT_MAX_TIME 10 /* Max time in [μs] to process a packet */
50 #define COUNTERS_NUM (1 << 19) /* Number of counters to configure for DOCA flow*/
51 #define SAMPLE_RUNS_TIME 30 /* Sample total run-time in [s] */
52 
54  struct eth_core_resources core_resources; /* A struct to hold ETH core resources */
55  struct eth_rxq_flow_resources flow_resources; /* A struct to hold DOCA flow resources */
56  struct doca_eth_rxq *eth_rxq; /* DOCA ETH RXQ context */
57  uint64_t total_cb_counter; /* Counter for all call-back calls */
58  uint64_t success_cb_counter; /* Counter for successful call-back calls */
59  uint16_t rxq_flow_queue_id; /* DOCA ETH RXQ's flow queue ID */
60  bool timestamp_enable; /* timestamp enable */
61  uint16_t headroom_size; /* headroom size */
62  uint16_t tailroom_size; /* tailroom size */
63 };
64 
65 /*
66  * ETH RXQ managed receive event completed callback
67  *
68  * @event_managed_recv [in]: Completed event
69  * @pkt [in]: received packet
70  * @event_user_data [in]: User provided data, used to associate with a specific type of events
71  */
72 static void event_managed_rcv_success_cb(struct doca_eth_rxq_event_managed_recv *event_managed_recv,
73  struct doca_buf *pkt,
74  union doca_data event_user_data)
75 {
76  doca_error_t status, event_status;
77  struct eth_rxq_sample_objects *state;
78  size_t packet_size;
79  const uint32_t *metadata_array;
80  uint32_t flow_tag, rx_hash;
81  uint64_t timestamp;
82  uint16_t headroom_size;
83  uint16_t tailroom_size;
84 
85  state = event_user_data.ptr;
86  state->total_cb_counter++;
87  state->success_cb_counter++;
88 
89  event_status = doca_eth_rxq_event_managed_recv_get_status(event_managed_recv);
90  if (event_status != DOCA_SUCCESS)
91  DOCA_LOG_ERR("Event status is %s", doca_error_get_name(event_status));
92 
93  status = doca_eth_rxq_event_managed_recv_get_metadata_array(event_managed_recv, &metadata_array);
94  if (status != DOCA_SUCCESS)
95  DOCA_LOG_ERR("Failed to get metadata_array, err: %s", doca_error_get_name(status));
96  else
97  DOCA_LOG_INFO("Received a packet with metadata %u", metadata_array[0]);
98 
99  status = doca_eth_rxq_event_managed_recv_get_flow_tag(event_managed_recv, &flow_tag);
100  if (status != DOCA_SUCCESS)
101  DOCA_LOG_ERR("Failed to get flow_tag, err: %s", doca_error_get_name(status));
102  else
103  DOCA_LOG_INFO("Received a packet with flow_tag %u", flow_tag);
104 
105  status = doca_eth_rxq_event_managed_recv_get_rx_hash(event_managed_recv, &rx_hash);
106  if (status != DOCA_SUCCESS)
107  DOCA_LOG_ERR("Failed to get rx_hash, err: %s", doca_error_get_name(status));
108  else
109  DOCA_LOG_INFO("Received a packet with rx_hash %u", rx_hash);
110 
111  if (state->timestamp_enable) {
112  status = doca_eth_rxq_event_managed_recv_get_timestamp(event_managed_recv, &timestamp);
113  if (status != DOCA_SUCCESS)
114  DOCA_LOG_ERR("Failed to get timestamp, err: %s", doca_error_get_name(status));
115  else
116  DOCA_LOG_INFO("Received a packet with timestamp %lu", timestamp);
117  }
118 
119  status = doca_buf_get_data_len(pkt, &packet_size);
120  if (status != DOCA_SUCCESS)
121  DOCA_LOG_ERR("Failed to get received packet data size");
122  else
123  DOCA_LOG_INFO("Received a packet with data size %lu successfully", packet_size);
124 
125  if (state->headroom_size > 0) {
126  status = get_pkt_headroom(pkt, &headroom_size);
127  if (status != DOCA_SUCCESS)
128  DOCA_LOG_ERR("Failed to get packet headroom size, err: %s", doca_error_get_name(status));
129  else
130  DOCA_LOG_INFO("Received a packet with headroom size %d, requested %d",
132  state->headroom_size);
133  }
134  if (state->tailroom_size > 0) {
135  status = get_pkt_tailroom(pkt, &tailroom_size);
136  if (status != DOCA_SUCCESS)
137  DOCA_LOG_ERR("Failed to get packet tailroom size, err: %s", doca_error_get_name(status));
138  else
139  DOCA_LOG_INFO("Received a packet with tailroom size %d, requested %d",
141  state->tailroom_size);
142  }
143 
144  status = doca_buf_dec_refcount(pkt, NULL);
145  if (status != DOCA_SUCCESS)
146  DOCA_LOG_ERR("Failed to free packet buffer, err: %s", doca_error_get_name(status));
147 }
148 
149 /*
150  * ETH RXQ managed receive event completed callback
151  *
152  * @event_managed_recv [in]: Failed event
153  * @pkt [in]: received packet (NULL in this case)
154  * @event_user_data [in]: User provided data, used to associate with a specific type of events
155  */
156 static void event_managed_rcv_error_cb(struct doca_eth_rxq_event_managed_recv *event_managed_recv,
157  struct doca_buf *pkt,
158  union doca_data event_user_data)
159 {
160  doca_error_t status;
161  struct eth_rxq_sample_objects *state;
162 
163  if (pkt != NULL)
164  DOCA_LOG_ERR("Received a non NULL packet");
165 
166  state = event_user_data.ptr;
167  state->total_cb_counter++;
168  status = doca_eth_rxq_event_managed_recv_get_status(event_managed_recv);
169 
170  DOCA_LOG_ERR("Failed to receive a packet, err: %s", doca_error_get_name(status));
171 }
172 
173 /*
174  * Destroy ETH RXQ context related resources
175  *
176  * @state [in]: eth_rxq_sample_objects struct to destroy its ETH RXQ context
177  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
178  */
180 {
181  doca_error_t status;
182 
183  status = doca_ctx_stop(state->core_resources.core_objs.ctx);
184  if (status != DOCA_SUCCESS) {
185  DOCA_LOG_ERR("Failed to stop DOCA context, err: %s", doca_error_get_name(status));
186  return status;
187  }
188 
189  status = doca_eth_rxq_destroy(state->eth_rxq);
190  if (status != DOCA_SUCCESS) {
191  DOCA_LOG_ERR("Failed to destroy DOCA ETH RXQ context, err: %s", doca_error_get_name(status));
192  return status;
193  }
194 
195  return DOCA_SUCCESS;
196 }
197 
198 /*
199  * Retrieve ETH RXQ tasks
200  *
201  * @state [in]: eth_rxq_sample_objects struct to retrieve events from
202  */
204 {
205  struct timespec ts = {
206  .tv_sec = 0,
207  .tv_nsec = SLEEP_IN_NANOS,
208  };
209  time_t start_time, end_time;
210  double elapsed_time = 0;
211 
212  start_time = time(NULL);
213  while (elapsed_time <= SAMPLE_RUNS_TIME) {
214  end_time = time(NULL);
215  elapsed_time = difftime(end_time, start_time);
216 
218  nanosleep(&ts, &ts);
219  }
220 
221  DOCA_LOG_INFO("Total call-backs invoked: %lu, %lu out of them were successful",
222  state->total_cb_counter,
223  state->success_cb_counter);
224 }
225 
226 /*
227  * Create ETH RXQ context related resources
228  *
229  * @state [in/out]: eth_rxq_sample_objects struct to create its ETH RXQ context
230  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
231  */
233 {
234  doca_error_t status, clean_status;
235  union doca_data user_data;
236 
239  MAX_PKT_SIZE,
240  &(state->eth_rxq));
241  if (status != DOCA_SUCCESS) {
242  DOCA_LOG_ERR("Failed to create ETH RXQ context, err: %s", doca_error_get_name(status));
243  return status;
244  }
245 
247  if (status != DOCA_SUCCESS) {
248  DOCA_LOG_ERR("Failed to set type, err: %s", doca_error_get_name(status));
249  goto destroy_eth_rxq;
250  }
251 
252  status = doca_eth_rxq_set_pkt_buf(state->eth_rxq,
254  0,
255  state->core_resources.mmap_size);
256  if (status != DOCA_SUCCESS) {
257  DOCA_LOG_ERR("Failed to set packet buffer, err: %s", doca_error_get_name(status));
258  goto destroy_eth_rxq;
259  }
260 
261  user_data.ptr = state;
263  user_data,
266  if (status != DOCA_SUCCESS) {
267  DOCA_LOG_ERR("Failed to register managed receive event, err: %s", doca_error_get_name(status));
268  goto destroy_eth_rxq;
269  }
270 
271  status = doca_eth_rxq_set_metadata_num(state->eth_rxq, 1);
272  if (status != DOCA_SUCCESS) {
273  DOCA_LOG_ERR("Failed to enable metadata, err: %s", doca_error_get_name(status));
274  goto destroy_eth_rxq;
275  }
276 
277  status = doca_eth_rxq_set_flow_tag(state->eth_rxq, 1);
278  if (status != DOCA_SUCCESS) {
279  DOCA_LOG_ERR("Failed to enable flow_tag, err: %s", doca_error_get_name(status));
280  goto destroy_eth_rxq;
281  }
282 
283  status = doca_eth_rxq_set_rx_hash(state->eth_rxq, 1);
284  if (status != DOCA_SUCCESS) {
285  DOCA_LOG_ERR("Failed to enable rx_hash, err: %s", doca_error_get_name(status));
286  goto destroy_eth_rxq;
287  }
288 
289  status = doca_eth_rxq_set_timestamp(state->eth_rxq, state->timestamp_enable);
290  if (status != DOCA_SUCCESS) {
291  DOCA_LOG_ERR("Failed to set enable timestamp, err: %s", doca_error_get_name(status));
292  goto destroy_eth_rxq;
293  }
294 
295  status = doca_eth_rxq_set_packet_headroom(state->eth_rxq, state->headroom_size);
296  if (status != DOCA_SUCCESS) {
297  DOCA_LOG_ERR("Failed to set packet headroom size, err: %s", doca_error_get_name(status));
298  goto destroy_eth_rxq;
299  }
300 
301  status = doca_eth_rxq_set_packet_tailroom(state->eth_rxq, state->tailroom_size);
302  if (status != DOCA_SUCCESS) {
303  DOCA_LOG_ERR("Failed to set packet tailroom size, err: %s", doca_error_get_name(status));
304  goto destroy_eth_rxq;
305  }
306 
308  if (state->core_resources.core_objs.ctx == NULL) {
309  DOCA_LOG_ERR("Failed to retrieve DOCA ETH RXQ context as DOCA context, err: %s",
310  doca_error_get_name(status));
311  goto destroy_eth_rxq;
312  }
313 
315  if (status != DOCA_SUCCESS) {
316  DOCA_LOG_ERR("Failed to connect PE, err: %s", doca_error_get_name(status));
317  goto destroy_eth_rxq;
318  }
319 
320  status = doca_ctx_start(state->core_resources.core_objs.ctx);
321  if (status != DOCA_SUCCESS) {
322  DOCA_LOG_ERR("Failed to start DOCA context, err: %s", doca_error_get_name(status));
323  goto destroy_eth_rxq;
324  }
325 
326  status = doca_eth_rxq_get_flow_queue_id(state->eth_rxq, &(state->rxq_flow_queue_id));
327  if (status != DOCA_SUCCESS) {
328  DOCA_LOG_ERR("Failed to get flow queue ID of RXQ, err: %s", doca_error_get_name(status));
329  goto stop_ctx;
330  }
331 
332  return DOCA_SUCCESS;
333 stop_ctx:
334  clean_status = doca_ctx_stop(state->core_resources.core_objs.ctx);
335  state->core_resources.core_objs.ctx = NULL;
336 
337  if (clean_status != DOCA_SUCCESS)
338  return status;
339 destroy_eth_rxq:
340  clean_status = doca_eth_rxq_destroy(state->eth_rxq);
341  state->eth_rxq = NULL;
342 
343  if (clean_status != DOCA_SUCCESS)
344  return status;
345 
346  return status;
347 }
348 
349 /*
350  * Clean sample resources
351  *
352  * @state [in]: eth_rxq_sample_objects struct to clean
353  */
354 static void eth_rxq_cleanup(struct eth_rxq_sample_objects *state)
355 {
356  doca_error_t status;
357 
358  if (state->flow_resources.root_pipe != NULL)
360 
361  if (state->flow_resources.df_port != NULL) {
362  status = doca_flow_port_stop(state->flow_resources.df_port);
363  if (status != DOCA_SUCCESS) {
364  DOCA_LOG_ERR("Failed to destroy eth_rxq_ctx, err: %s", doca_error_get_name(status));
365  return;
366  }
367  }
368 
369  if (state->eth_rxq != NULL) {
370  status = destroy_eth_rxq_ctx(state);
371  if (status != DOCA_SUCCESS) {
372  DOCA_LOG_ERR("Failed to destroy eth_rxq_ctx, err: %s", doca_error_get_name(status));
373  return;
374  }
375  }
376 
377  if (state->core_resources.core_objs.dev != NULL) {
378  status = destroy_eth_core_resources(&(state->core_resources));
379  if (status != DOCA_SUCCESS) {
380  DOCA_LOG_ERR("Failed to destroy core_resources, err: %s", doca_error_get_name(status));
381  return;
382  }
383  }
384 
385  if (state->flow_resources.df_port != NULL)
387 }
388 
389 /*
390  * Check if device supports needed capabilities
391  *
392  * @devinfo [in]: Device info for device to check
393  * @return: DOCA_SUCCESS in case the device supports needed capabilities and DOCA_ERROR otherwise
394  */
395 static doca_error_t check_device(struct doca_devinfo *devinfo)
396 {
397  doca_error_t status;
398  uint32_t max_supported_burst_size;
399  uint32_t max_supported_packet_size;
400 
401  status = doca_eth_rxq_cap_get_max_burst_size(devinfo, &max_supported_burst_size);
402  if (status != DOCA_SUCCESS) {
403  DOCA_LOG_ERR("Failed to get supported max burst size, err: %s", doca_error_get_name(status));
404  return status;
405  }
406 
407  if (max_supported_burst_size < MAX_BURST_SIZE)
409 
410  status = doca_eth_rxq_cap_get_max_packet_size(devinfo, &max_supported_packet_size);
411  if (status != DOCA_SUCCESS) {
412  DOCA_LOG_ERR("Failed to get supported max packet size, err: %s", doca_error_get_name(status));
413  return status;
414  }
415 
416  if (max_supported_packet_size < MAX_PKT_SIZE)
418 
419  status = doca_eth_rxq_cap_is_type_supported(devinfo,
422  if (status != DOCA_SUCCESS && status != DOCA_ERROR_NOT_SUPPORTED) {
423  DOCA_LOG_ERR("Failed to check supported type, err: %s", doca_error_get_name(status));
424  return status;
425  }
426 
427  return status;
428 }
429 
430 /*
431  * Run ETH RXQ managed mempool mode receive
432  *
433  * @ib_dev_name [in]: IB device name of a doca device
434  * @timestamp_enable [in]: timestamp enable
435  * @return: DOCA_SUCCESS on success, DOCA_ERROR otherwise
436  */
438  bool timestamp_enable,
439  uint16_t headroom_size,
440  uint16_t tailroom_size)
441 {
442  doca_error_t status;
443  struct eth_rxq_sample_objects state = {.total_cb_counter = 0,
444  .success_cb_counter = 0,
445  .timestamp_enable = timestamp_enable,
446  .headroom_size = headroom_size,
447  .tailroom_size = tailroom_size};
448  struct eth_core_config cfg = {.mmap_size = 0,
449  .inventory_num_elements = 0,
450  .check_device = check_device,
451  .ibdev_name = ib_dev_name};
452  struct eth_rxq_flow_config flow_cfg = {};
453 
455  RATE,
456  PKT_MAX_TIME,
457  MAX_PKT_SIZE,
460  headroom_size,
461  tailroom_size,
462  &(cfg.mmap_size));
463  if (status != DOCA_SUCCESS) {
464  DOCA_LOG_ERR("Failed to estimate mmap size for ETH RXQ, err: %s", doca_error_get_name(status));
465  return status;
466  }
467 
468  status = allocate_eth_core_resources(&cfg, &(state.core_resources));
469  if (status != DOCA_SUCCESS) {
470  DOCA_LOG_ERR("Failed allocate core resources, err: %s", doca_error_get_name(status));
471  goto rxq_cleanup;
472  }
473 
474  flow_cfg.dev = state.core_resources.core_objs.dev;
475 
476  status = rxq_common_init_doca_flow(flow_cfg.dev, &(state.flow_resources));
477  if (status != DOCA_SUCCESS) {
478  DOCA_LOG_ERR("Failed to init doca flow, err: %s", doca_error_get_name(status));
479  goto rxq_cleanup;
480  }
481 
482  status = create_eth_rxq_ctx(&state);
483  if (status != DOCA_SUCCESS) {
484  DOCA_LOG_ERR("Failed to create/start ETH RXQ context, err: %s", doca_error_get_name(status));
485  goto rxq_cleanup;
486  }
487 
488  flow_cfg.rxq_flow_queue_ids = &(state.rxq_flow_queue_id);
489  flow_cfg.nb_queues = 1;
490 
491  status = allocate_eth_rxq_flow_resources(&flow_cfg, &(state.flow_resources));
492  if (status != DOCA_SUCCESS) {
493  DOCA_LOG_ERR("Failed to allocate flow resources, err: %s", doca_error_get_name(status));
494  goto rxq_cleanup;
495  }
496 
498 rxq_cleanup:
499  eth_rxq_cleanup(&state);
500 
501  return status;
502 }
#define NULL
Definition: __stddef_null.h:26
doca_telemetry_exporter_timestamp_t timestamp
doca_error_t destroy_eth_core_resources(struct eth_core_resources *resources)
Definition: eth_common.c:98
doca_error_t allocate_eth_core_resources(struct eth_core_config *cfg, struct eth_core_resources *resources)
Definition: eth_common.c:38
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)
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
Definition: doca_error.h:42
@ DOCA_SUCCESS
Definition: doca_error.h:38
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
Definition: doca_eth_rxq.h:75
@ DOCA_ETH_RXQ_DATA_PATH_TYPE_CPU
Definition: doca_eth_rxq.h:95
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.
Definition: doca_log.h:466
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
Definition: doca_log.h:486
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
Definition: ip_frag_dp.c:0
struct program_core_objects core_objs
Definition: eth_common.h:40
uint32_t mmap_size
Definition: eth_common.h:43
uint16_t * rxq_flow_queue_ids
struct doca_dev * dev
struct doca_flow_pipe * root_pipe
struct doca_flow_port * df_port
struct doca_pe * pe
Definition: common.h:51
struct doca_mmap * src_mmap
Definition: common.h:47
struct doca_dev * dev
Definition: common.h:46
struct doca_ctx * ctx
Definition: common.h:50
Convenience type for representing opaque data.
Definition: doca_types.h:56
void * ptr
Definition: doca_types.h:57