NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_aging_sample.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 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 <string.h>
27 #include <unistd.h>
28 #include <stdlib.h>
29 
30 #include <rte_byteorder.h>
31 #include <rte_random.h>
32 
33 #include <doca_flow.h>
34 #include <doca_flow_definitions.h>
35 #include <doca_log.h>
36 
37 #include "flow_common.h"
38 
39 DOCA_LOG_REGISTER(FLOW_AGING);
40 
41 /* user context struct for aging entry */
43  struct entries_status *status; /* status pointer */
44  int entry_num; /* entry number */
45  int port_id; /* port ID of the entry */
46 };
47 
48 /*
49  * Entry processing callback
50  *
51  * @entry [in]: DOCA Flow entry pointer
52  * @pipe_queue [in]: queue identifier
53  * @status [in]: DOCA Flow entry status
54  * @op [in]: DOCA Flow entry operation
55  * @user_ctx [out]: user context
56  */
57 static void check_for_valid_entry_aging(struct doca_flow_pipe_entry *entry,
58  uint16_t pipe_queue,
59  enum doca_flow_entry_status status,
60  enum doca_flow_entry_op op,
61  void *user_ctx)
62 {
63  struct aging_user_data *entry_status = (struct aging_user_data *)user_ctx;
65 
66  if (entry_status == NULL)
67  return;
68 
70  entry_status->status->failure = true; /* set failure to true if processing failed */
71  if (op == DOCA_FLOW_ENTRY_OP_AGED) {
73  if (result != DOCA_SUCCESS) {
74  DOCA_LOG_ERR("Failed to remove entry number %d from port %d: %s",
75  entry_status->entry_num,
76  entry_status->port_id,
78  } else {
79  DOCA_LOG_INFO("Entry number %d from port %d aged out and removed",
80  entry_status->entry_num,
81  entry_status->port_id);
82  }
83  } else
84  entry_status->status->nb_processed++;
85 }
86 
87 /*
88  * Create DOCA Flow pipe with five tuple match and monitor with aging flag
89  *
90  * @port [in]: port of the pipe
91  * @port_id [in]: port ID of the pipe
92  * @n_entries [in]: pipe size
93  * @pipe [out]: created pipe pointer
94  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
95  */
96 static doca_error_t create_aging_pipe(struct doca_flow_port *port,
97  int port_id,
98  uint32_t n_entries,
99  struct doca_flow_pipe **pipe)
100 {
101  struct doca_flow_match match;
102  struct doca_flow_monitor monitor;
103  struct doca_flow_actions actions;
104  struct doca_flow_actions *actions_arr[NB_ACTIONS_ARR];
105  struct doca_flow_fwd fwd, fwd_miss;
106  struct doca_flow_pipe_cfg *pipe_cfg;
108 
109  memset(&match, 0, sizeof(match));
110  memset(&monitor, 0, sizeof(monitor));
111  memset(&actions, 0, sizeof(actions));
112  memset(&fwd, 0, sizeof(fwd));
113  memset(&fwd_miss, 0, sizeof(fwd_miss));
114  memset(&pipe_cfg, 0, sizeof(pipe_cfg));
115 
116  /* set monitor with aging */
117  monitor.aging_sec = 0xffffffff;
118 
119  /* 5 tuple match */
124  match.outer.ip4.src_ip = 0xffffffff;
125  match.outer.ip4.dst_ip = 0xffffffff;
126  match.outer.tcp.l4_port.src_port = 0xffff;
127  match.outer.tcp.l4_port.dst_port = 0xffff;
128 
129  actions_arr[0] = &actions;
130 
131  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
132  if (result != DOCA_SUCCESS) {
133  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
134  return result;
135  }
136 
137  result = set_flow_pipe_cfg(pipe_cfg, "AGING_PIPE", DOCA_FLOW_PIPE_BASIC, true);
138  if (result != DOCA_SUCCESS) {
139  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
140  goto destroy_pipe_cfg;
141  }
142  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, NULL);
143  if (result != DOCA_SUCCESS) {
144  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
145  goto destroy_pipe_cfg;
146  }
147  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, NULL, NB_ACTIONS_ARR);
148  if (result != DOCA_SUCCESS) {
149  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
150  goto destroy_pipe_cfg;
151  }
153  if (result != DOCA_SUCCESS) {
154  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
155  goto destroy_pipe_cfg;
156  }
157 
159  if (result != DOCA_SUCCESS) {
160  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg miss counter: %s", doca_error_get_descr(result));
161  doca_flow_pipe_cfg_destroy(pipe_cfg);
162  return result;
163  }
164 
165  result = doca_flow_pipe_cfg_set_nr_entries(pipe_cfg, n_entries);
166  if (result != DOCA_SUCCESS) {
167  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg nr entries: %s", doca_error_get_descr(result));
168  goto destroy_pipe_cfg;
169  }
170 
172  fwd.port_id = port_id ^ 1;
173 
175 
176  result = doca_flow_pipe_create(pipe_cfg, &fwd, &fwd_miss, pipe);
178  doca_flow_pipe_cfg_destroy(pipe_cfg);
179  return result;
180 }
181 
182 /*
183  * Add DOCA Flow entries to the aging pipe, each entry with different aging time
184  *
185  * @pipe [in]: pipe of the entries
186  * @user_data [in]: user data array
187  * @port [in]: port of the entries
188  * @port_id [in]: port ID of the entries
189  * @num_of_aging_entries [in]: number of entries to add
190  * @status [in]: user context for adding entry
191  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
192  */
193 static doca_error_t add_aging_pipe_entries(struct doca_flow_pipe *pipe,
194  struct aging_user_data *user_data,
195  struct doca_flow_port *port,
196  int port_id,
197  int num_of_aging_entries,
198  struct entries_status *status)
199 {
200  struct doca_flow_match match;
201  struct doca_flow_actions actions;
202  struct doca_flow_monitor monitor;
203  int i;
205  doca_be32_t dst_ip_addr = BE_IPV4_ADDR(8, 8, 8, 8);
206  doca_be16_t dst_port = rte_cpu_to_be_16(80);
207  doca_be16_t src_port = rte_cpu_to_be_16(1234);
208  doca_be32_t src_ip_addr; /* set different src ip per entry */
210 
211  for (i = 0; i < num_of_aging_entries; i++) {
212  src_ip_addr = BE_IPV4_ADDR((i + 1), 2, 3, 4);
213 
214  memset(&match, 0, sizeof(match));
215  memset(&actions, 0, sizeof(actions));
216  memset(&monitor, 0, sizeof(monitor));
217 
218  /* flows will be aged out in 5s */
219  monitor.aging_sec = 5;
220 
221  match.outer.ip4.dst_ip = dst_ip_addr;
222  match.outer.ip4.src_ip = src_ip_addr;
225  /* fill user data with entry number and entry pointer */
226  user_data[i].entry_num = i;
227  user_data[i].port_id = port_id;
228  user_data[i].status = status;
229 
230  if (i == num_of_aging_entries - 1)
231  flags = DOCA_FLOW_NO_WAIT; /* send the last entry with DOCA_FLOW_NO_WAIT flag for pushing all
232  the entries */
233 
234  result =
235  doca_flow_pipe_add_entry(0, pipe, &match, &actions, &monitor, NULL, flags, &user_data[i], NULL);
236  if (result != DOCA_SUCCESS) {
237  DOCA_LOG_ERR("Failed to add entry: %s", doca_error_get_descr(result));
238  return result;
239  }
240  }
241  do {
243  0,
245  num_of_aging_entries - status->nb_processed);
246  if (result != DOCA_SUCCESS) {
247  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
248  return result;
249  }
250  if (status->failure) {
251  DOCA_LOG_ERR("Failed to process entries, status is not success");
252  return DOCA_ERROR_BAD_STATE;
253  }
254  } while (status->nb_processed < num_of_aging_entries);
255  DOCA_LOG_INFO("Added %d entries to port %d", status->nb_processed, port_id);
256  status->nb_processed = 0;
257 
258  return DOCA_SUCCESS;
259 }
260 
261 /*
262  * Query the miss counters and show the results.
263  *
264  * @root_pipe [in]: root pipe containing miss counter for drop action.
265  * @ip_selector_pipe [in]: IP selector pipe containing miss counter for group action.
266  * @miss_is_updated [in]: indicator whether miss updating is done.
267  * @port_id [in]: port ID of the pipes.
268  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
269  */
270 static doca_error_t miss_counter_query(struct doca_flow_pipe *pipe, int port_id)
271 {
272  struct doca_flow_resource_query query_stats;
274 
275  result = doca_flow_resource_query_pipe_miss(pipe, &query_stats);
276  if (result != DOCA_SUCCESS) {
277  DOCA_LOG_ERR("Port %u failed to query pipe miss: %s", port_id, doca_error_get_descr(result));
278  return result;
279  }
280 
281  DOCA_LOG_INFO("Port %d pipe miss %ld packets", port_id, query_stats.counter.total_pkts);
282 
283  return DOCA_SUCCESS;
284 }
285 
286 /*
287  * Handle all aged flow in a port
288  *
289  * @port [in]: port to remove the aged flow from
290  * @total_counter [in/out]: counter for all aged flows in both ports
291  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
292  */
293 static doca_error_t handle_aged_flow(struct doca_flow_port *port, int *total_counter)
294 {
295  uint64_t quota_time = 20; /* max handling aging time in ms */
296  int num_of_aged_entries = 0;
297 
298  num_of_aged_entries = doca_flow_aging_handle(port, 0, quota_time, 0);
299  /* call handle aging until full cycle complete */
300  while (num_of_aged_entries != -1) {
301  if (num_of_aged_entries > 0) {
302  *total_counter += num_of_aged_entries;
303  DOCA_LOG_INFO("Num of aged entries: %d, total: %d", num_of_aged_entries, *total_counter);
304  }
305 
306  num_of_aged_entries = doca_flow_aging_handle(port, 0, quota_time, 0);
307  }
308  return DOCA_SUCCESS;
309 }
310 
311 /*
312  * Run flow_aging sample
313  *
314  * @nb_queues [in]: number of queues the sample will use
315  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
316  */
317 doca_error_t flow_aging(int nb_queues)
318 {
319  const int nb_ports = 2;
320  /* the counters will divide by all queues per port */
321  struct flow_resources resource = {0};
322  uint32_t nr_shared_resources[SHARED_RESOURCE_NUM_VALUES] = {0};
323  struct doca_flow_port *ports[nb_ports];
324  struct doca_dev *dev_arr[nb_ports];
325  uint32_t actions_mem_size[nb_ports];
326  struct doca_flow_pipe *pipe;
327  struct entries_status status[nb_ports];
328  struct aging_user_data *user_data[nb_ports];
329  int num_of_aging_entries = 10;
330  int aged_entry_counter = 0;
332  int port_id;
333 
334  resource.nr_counters = 80 + num_of_aging_entries * nb_ports;
335 
336  result = init_doca_flow_cb(nb_queues,
337  "vnf,hws",
338  &resource,
339  nr_shared_resources,
341  NULL,
342  NULL);
343  if (result != DOCA_SUCCESS) {
344  DOCA_LOG_ERR("Failed to init DOCA Flow: %s", doca_error_get_descr(result));
345  return result;
346  }
347 
348  memset(dev_arr, 0, sizeof(struct doca_dev *) * nb_ports);
349  ARRAY_INIT(actions_mem_size, ACTIONS_MEM_SIZE(nb_queues, num_of_aging_entries));
351  if (result != DOCA_SUCCESS) {
352  DOCA_LOG_ERR("Failed to init DOCA ports: %s", doca_error_get_descr(result));
354  return result;
355  }
356 
357  memset(user_data, 0, sizeof(struct aging_user_data *) * nb_ports);
358 
359  for (port_id = 0; port_id < nb_ports; port_id++) {
360  memset(&status[port_id], 0, sizeof(status[port_id]));
361 
362  result = create_aging_pipe(ports[port_id], port_id, num_of_aging_entries, &pipe);
363  if (result != DOCA_SUCCESS) {
364  DOCA_LOG_ERR("Failed to create pipe: %s", doca_error_get_descr(result));
365  goto entries_cleanup;
366  }
367 
368  user_data[port_id] =
369  (struct aging_user_data *)malloc(num_of_aging_entries * sizeof(struct aging_user_data));
370  if (user_data[port_id] == NULL) {
371  DOCA_LOG_ERR("Failed to allocate user data");
373  goto entries_cleanup;
374  }
375 
377  user_data[port_id],
378  ports[port_id],
379  port_id,
380  num_of_aging_entries,
381  &status[port_id]);
382  if (result != DOCA_SUCCESS) {
384  goto entries_cleanup;
385  }
386  }
387 
388  /* wait few seconds for packets to arrive so query will not return zero */
389  DOCA_LOG_INFO("Wait %d seconds for first batch of packets to arrive", 5);
390  sleep(5);
391 
392  DOCA_LOG_INFO("Show miss counter results after first iteration of sending packets");
393  for (port_id = 0; port_id < nb_ports; port_id++) {
395  if (result != DOCA_SUCCESS) {
396  DOCA_LOG_ERR("Port %u failed to query miss counter: %s", port_id, doca_error_get_descr(result));
397  goto entries_cleanup;
398  }
399  }
400 
401  DOCA_LOG_INFO("Wait few seconds for all entries to age out");
402  memset(status, 0, sizeof(status));
403  /* handle aging in loop until all entries aged out */
404  while (aged_entry_counter < num_of_aging_entries * nb_ports) {
405  sleep(1);
406  for (port_id = 0; port_id < nb_ports; port_id++) {
407  result = handle_aged_flow(ports[port_id], &aged_entry_counter);
408  if (result != DOCA_SUCCESS) {
409  DOCA_LOG_ERR("Failed to handle aged flow: %s", doca_error_get_descr(result));
410  goto entries_cleanup;
411  }
412  }
413  }
414 
415  /* most of entries are processed automatically before removing new entries, poll results of remaining entries */
416  for (port_id = 0; port_id < nb_ports; port_id++) {
417  while (status[port_id].nb_processed < num_of_aging_entries) {
419  0,
421  num_of_aging_entries - status[port_id].nb_processed);
422  if (result != DOCA_SUCCESS) {
423  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
424  goto entries_cleanup;
425  }
426  if (status[port_id].failure) {
427  DOCA_LOG_ERR("Failed to process entries, status is not success");
428  goto entries_cleanup;
429  }
430  }
431  DOCA_LOG_INFO("Completed processing port %d", port_id);
432  }
433 
434  DOCA_LOG_INFO("Wait %d seconds for second batch of packets to arrive", 5);
435  sleep(5);
436 
437  DOCA_LOG_INFO("Show miss counter results after second batch of packets");
438  for (port_id = 0; port_id < nb_ports; port_id++) {
440  if (result != DOCA_SUCCESS) {
441  DOCA_LOG_ERR("Port %u failed to query miss counter: %s", port_id, doca_error_get_descr(result));
442  goto entries_cleanup;
443  }
444  }
445 
446 entries_cleanup:
447  for (port_id = 0; port_id < nb_ports; port_id++) {
448  if (user_data[port_id])
449  free(user_data[port_id]);
450  }
451  doca_error = result;
454  doca_error = result;
456  return doca_error;
457 }
#define NULL
Definition: __stddef_null.h:26
int32_t result
static doca_error_t handle_aged_flow(struct doca_flow_port *port, int *total_counter)
static doca_error_t add_aging_pipe_entries(struct doca_flow_pipe *pipe, struct aging_user_data *user_data, struct doca_flow_port *port, int port_id, int num_of_aging_entries, struct entries_status *status)
static void check_for_valid_entry_aging(struct doca_flow_pipe_entry *entry, uint16_t pipe_queue, enum doca_flow_entry_status status, enum doca_flow_entry_op op, void *user_ctx)
static doca_error_t miss_counter_query(struct doca_flow_pipe *pipe, int port_id)
static doca_error_t create_aging_pipe(struct doca_flow_port *port, int port_id, uint32_t n_entries, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(FLOW_AGING)
doca_error_t flow_aging(int nb_queues)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static struct doca_flow_fwd fwd_miss
Definition: flow_parser.c:110
static struct doca_flow_actions actions
Definition: flow_parser.c:107
#define BE_IPV4_ADDR(a, b, c, d)
Definition: flow_parser.c:64
static struct doca_flow_monitor monitor
Definition: flow_parser.c:108
static struct doca_flow_fwd fwd
Definition: flow_parser.c:109
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
#define DEFAULT_TIMEOUT_US
Definition: flow_skeleton.c:36
enum doca_error doca_error_t
DOCA API return codes.
doca_error
DOCA API return codes.
Definition: doca_error.h:37
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_BAD_STATE
Definition: doca_error.h:56
@ DOCA_SUCCESS
Definition: doca_error.h:38
@ DOCA_ERROR_NO_MEMORY
Definition: doca_error.h:45
@ DOCA_FLOW_L4_TYPE_EXT_TCP
@ DOCA_FLOW_L3_TYPE_IP4
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_destroy(struct doca_flow_pipe_cfg *cfg)
Destroy DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_create(struct doca_flow_pipe_cfg **cfg, struct doca_flow_port *port)
Create DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_entries_process(struct doca_flow_port *port, uint16_t pipe_queue, uint64_t timeout, uint32_t max_processed_entries)
Process entries in queue.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_match(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_match *match, const struct doca_flow_match *match_mask)
Set pipe's match and match mask.
doca_flow_entry_op
doca flow entry operation
Definition: doca_flow.h:146
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_create(const struct doca_flow_pipe_cfg *cfg, const struct doca_flow_fwd *fwd, const struct doca_flow_fwd *fwd_miss, struct doca_flow_pipe **pipe)
Create one new pipe.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_miss_counter(struct doca_flow_pipe_cfg *cfg, bool miss_counter)
Set to enable pipe's miss counter.
doca_flow_flags_type
doca flow flags type
Definition: doca_flow.h:114
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_actions(struct doca_flow_pipe_cfg *cfg, struct doca_flow_actions *const *actions, struct doca_flow_actions *const *actions_masks, struct doca_flow_action_descs *const *action_descs, size_t nr_actions)
Set pipe's actions, actions mask and actions descriptor.
DOCA_STABLE int doca_flow_aging_handle(struct doca_flow_port *port, uint16_t queue, uint64_t quota, uint64_t max_entries)
Handle aging of entries.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_monitor(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_monitor *monitor)
Set pipe's monitor.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_add_entry(uint16_t pipe_queue, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_actions *actions, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, uint32_t flags, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a pipe.
DOCA_STABLE doca_error_t doca_flow_pipe_remove_entry(uint16_t pipe_queue, uint32_t flags, struct doca_flow_pipe_entry *entry)
Free one pipe entry.
doca_flow_entry_status
doca flow entry status
Definition: doca_flow.h:160
DOCA_STABLE void doca_flow_destroy(void)
Destroy the doca flow.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_nr_entries(struct doca_flow_pipe_cfg *cfg, uint32_t nr_entries)
Set pipe's maximum number of flow rules.
DOCA_EXPERIMENTAL doca_error_t doca_flow_resource_query_pipe_miss(struct doca_flow_pipe *pipe, struct doca_flow_resource_query *query_stats)
Extract information about pipe miss entry.
@ DOCA_FLOW_ENTRY_OP_AGED
Definition: doca_flow.h:153
@ DOCA_FLOW_PIPE_BASIC
Definition: doca_flow.h:221
@ DOCA_FLOW_L3_META_IPV4
Definition: doca_flow.h:296
@ DOCA_FLOW_NO_WAIT
Definition: doca_flow.h:115
@ DOCA_FLOW_WAIT_FOR_BATCH
Definition: doca_flow.h:117
@ DOCA_FLOW_FWD_PORT
Definition: doca_flow.h:744
@ DOCA_FLOW_FWD_DROP
Definition: doca_flow.h:748
@ DOCA_FLOW_ENTRY_STATUS_SUCCESS
Definition: doca_flow.h:163
@ DOCA_FLOW_L4_META_TCP
Definition: doca_flow.h:308
#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
uint32_t doca_be32_t
Definition: doca_types.h:121
uint16_t doca_be16_t
Declare DOCA endianity types.
Definition: doca_types.h:120
uint16_t src_port
Definition: packets.h:0
uint16_t dst_port
Definition: packets.h:1
doca_error_t stop_doca_flow_ports(int nb_ports, struct doca_flow_port *ports[])
Definition: flow_common.c:240
doca_error_t init_doca_flow_ports(int nb_ports, struct doca_flow_port *ports[], bool is_hairpin, struct doca_dev *dev_arr[], uint32_t actions_mem_size[])
Definition: flow_common.c:296
doca_error_t set_flow_pipe_cfg(struct doca_flow_pipe_cfg *cfg, const char *name, enum doca_flow_pipe_type type, bool is_root)
Definition: flow_common.c:305
doca_error_t init_doca_flow_cb(int nb_queues, const char *mode, struct flow_resources *resource, uint32_t nr_shared_resources[], doca_flow_entry_process_cb cb, doca_flow_pipe_process_cb pipe_process_cb, struct doca_flow_definitions *defs)
Definition: flow_common.c:79
#define NB_ACTIONS_ARR
Definition: flow_common.h:58
#define SHARED_RESOURCE_NUM_VALUES
Definition: flow_common.h:59
#define ACTIONS_MEM_SIZE(nr_queues, entries)
Definition: flow_common.h:66
#define ARRAY_INIT(array, val)
Definition: flow_common.h:71
struct entries_status * status
doca flow actions information
Definition: doca_flow.h:684
forwarding configuration
Definition: doca_flow.h:779
uint16_t port_id
Definition: doca_flow.h:795
enum doca_flow_fwd_type type
Definition: doca_flow.h:780
struct doca_flow_header_ip4 ip4
Definition: doca_flow.h:449
enum doca_flow_l4_type_ext l4_type_ext
Definition: doca_flow.h:454
enum doca_flow_l3_type l3_type
Definition: doca_flow.h:446
struct doca_flow_header_tcp tcp
Definition: doca_flow.h:461
struct doca_flow_header_l4_port l4_port
doca flow matcher information
Definition: doca_flow.h:491
struct doca_flow_parser_meta parser_meta
Definition: doca_flow.h:496
struct doca_flow_header_format outer
Definition: doca_flow.h:498
doca monitor action configuration
Definition: doca_flow.h:968
uint32_t aging_sec
Definition: doca_flow.h:1000
enum doca_flow_l3_meta outer_l3_type
Definition: doca_flow.h:382
enum doca_flow_l4_meta outer_l4_type
Definition: doca_flow.h:383
flow resource query
Definition: doca_flow.h:1101
struct doca_flow_resource_query::@115::@117 counter
user context struct that will be used in entries process callback
Definition: flow_common.h:78
uint32_t nr_counters
Definition: flow_common.h:96
static int nb_ports
Definition: switch_core.c:44
static uint32_t actions_mem_size[FLOW_SWITCH_PORTS_MAX]
Definition: switch_core.c:43
static struct doca_flow_port * ports[FLOW_SWITCH_PORTS_MAX]
Definition: switch_core.c:42