NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_ordered_list_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 
29 #include <doca_log.h>
30 #include <doca_flow.h>
31 
32 #include "flow_common.h"
33 #include "doca_bitfield.h"
34 
35 DOCA_LOG_REGISTER(FLOW_ORDERED_LIST);
36 
37 /*
38  * Create DOCA Flow pipe with changeable 5 tuple match as root
39  *
40  * @port [in]: port of the pipe
41  * @next_pipe [in]: ordered list pipe
42  * @pipe [out]: created pipe pointer
43  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
44  */
45 doca_error_t create_root_pipe(struct doca_flow_port *port,
46  struct doca_flow_pipe *next_pipe,
47  struct doca_flow_pipe **pipe)
48 {
49  struct doca_flow_match match;
50  struct doca_flow_actions actions, *actions_arr[NB_ACTIONS_ARR];
51  struct doca_flow_fwd fwd;
52  struct doca_flow_pipe_cfg *pipe_cfg;
54 
55  memset(&match, 0, sizeof(match));
56  memset(&actions, 0, sizeof(actions));
57  memset(&fwd, 0, sizeof(fwd));
58 
59  /* 5 tuple match */
64  match.outer.ip4.src_ip = 0xffffffff;
65  match.outer.ip4.dst_ip = 0xffffffff;
66  match.outer.tcp.l4_port.src_port = 0xffff;
67  match.outer.tcp.l4_port.dst_port = 0xffff;
68 
69  actions_arr[0] = &actions;
70 
71  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
72  if (result != DOCA_SUCCESS) {
73  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
74  return result;
75  }
76 
77  result = set_flow_pipe_cfg(pipe_cfg, "ROOT_PIPE", DOCA_FLOW_PIPE_BASIC, true);
78  if (result != DOCA_SUCCESS) {
79  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
80  goto destroy_pipe_cfg;
81  }
82  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, NULL);
83  if (result != DOCA_SUCCESS) {
84  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
85  goto destroy_pipe_cfg;
86  }
87  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, NULL, NB_ACTIONS_ARR);
88  if (result != DOCA_SUCCESS) {
89  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
90  goto destroy_pipe_cfg;
91  }
92 
94  fwd.ordered_list_pipe.pipe = next_pipe;
95  fwd.ordered_list_pipe.idx = 0xffffffff;
96 
97  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
100  return result;
101 }
102 
103 /*
104  * Add DOCA Flow pipe entries to the root pipe that forwards the traffic to ordered list pipe entries
105  *
106  * @pipe [in]: pipe of the entries
107  * @next_pipe [in]: ordered list pipe to forward the matched traffic
108  * @status [in]: user context for adding entry
109  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
110  */
111 doca_error_t add_root_pipe_entries(struct doca_flow_pipe *pipe,
112  struct doca_flow_pipe *next_pipe,
113  struct entries_status *status)
114 {
115  struct doca_flow_match match;
116  struct doca_flow_fwd fwd;
117  struct doca_flow_pipe_entry *entry1;
118  struct doca_flow_pipe_entry *entry2;
120  doca_be32_t dst_ip_addr = BE_IPV4_ADDR(8, 8, 8, 8);
121  doca_be32_t src_ip_addr = BE_IPV4_ADDR(1, 1, 1, 1);
124 
125  memset(&match, 0, sizeof(match));
126  memset(&fwd, 0, sizeof(fwd));
127 
128  match.outer.ip4.dst_ip = dst_ip_addr;
129  match.outer.ip4.src_ip = src_ip_addr;
132 
134  fwd.ordered_list_pipe.pipe = next_pipe;
135  fwd.ordered_list_pipe.idx = 0; // fwd the first entry matches to entry idx 0 in ordered list pipe
136 
137  result = doca_flow_pipe_add_entry(0, pipe, &match, NULL, NULL, &fwd, 0, status, &entry1);
138  if (result != DOCA_SUCCESS)
139  return result;
140 
141  src_ip_addr = BE_IPV4_ADDR(2, 2, 2, 2);
142  match.outer.ip4.src_ip = src_ip_addr;
143  fwd.ordered_list_pipe.idx = 1; // fwd the second entry matches to entry idx 1 in ordered list pipe
144 
145  result = doca_flow_pipe_add_entry(0, pipe, &match, NULL, NULL, &fwd, 0, status, &entry2);
146  if (result != DOCA_SUCCESS)
147  return result;
148 
149  return DOCA_SUCCESS;
150 }
151 
152 /*
153  * Add DOCA Flow ordered list pipe with two lists
154  *
155  * @port [in]: port of the pipe
156  * @port_id [in]: port ID of the pipe
157  * @pipe [out]: created pipe pointer
158  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
159  */
160 doca_error_t create_ordered_list_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
161 {
162  struct doca_flow_fwd fwd;
163  const int nb_ordered_lists = 2;
164  struct doca_flow_monitor counter;
165  struct doca_flow_actions actions;
166  struct doca_flow_actions actions_2;
167  struct doca_flow_actions actions_mask;
168  struct doca_flow_pipe_cfg *pipe_cfg;
169  struct doca_flow_ordered_list ordered_list_0;
170  struct doca_flow_ordered_list ordered_list_1;
171  struct doca_flow_ordered_list_element element_0;
172  struct doca_flow_ordered_list_element element_1;
173  struct doca_flow_ordered_list_element element_2;
174  struct doca_flow_ordered_list *ordered_lists[nb_ordered_lists];
176 
177  memset(&fwd, 0, sizeof(fwd));
178  memset(&counter, 0, sizeof(counter));
179  memset(&actions, 0, sizeof(actions));
180  memset(&actions_mask, 0, sizeof(actions_mask));
181  memset(&ordered_list_0, 0, sizeof(ordered_list_0));
182  memset(&ordered_list_1, 0, sizeof(ordered_list_1));
183  memset(&element_0, 0, sizeof(element_0));
184  memset(&element_1, 0, sizeof(element_1));
185  memset(&element_2, 0, sizeof(element_2));
186 
187  ordered_lists[0] = &ordered_list_0;
188  ordered_lists[1] = &ordered_list_1;
189 
191  element_0.actions = &actions;
192  element_0.actions_mask = &actions_mask;
194  element_1.monitor = &counter;
196  element_2.actions = &actions_2;
197 
198  ordered_list_0.idx = 0;
199  ordered_list_0.size = 2;
200  ordered_list_0.elements = (struct doca_flow_ordered_list_element[]){element_0, element_1};
201 
202  ordered_list_1.idx = 1;
203  ordered_list_1.size = 3;
204  ordered_list_1.elements = (struct doca_flow_ordered_list_element[]){element_2, element_0, element_1};
205 
206  /* monitor with changeable shared counter ID */
208  counter.shared_counter.shared_counter_id = 0xffffffff;
209 
210  /* modify src ip */
212  actions.outer.ip4.src_ip = BE_IPV4_ADDR(192, 168, 0, 0);
213  actions_mask.outer.l3_type = DOCA_FLOW_L3_TYPE_IP4;
214  actions_mask.outer.ip4.src_ip = BE_IPV4_ADDR(255, 255, 0, 0);
215 
217  actions_2.outer.tcp.l4_port.src_port = DOCA_HTOBE16(555);
218  actions_2.outer.tcp.l4_port.dst_port = DOCA_HTOBE16(70);
219 
220  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
221  if (result != DOCA_SUCCESS) {
222  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
223  return result;
224  }
225 
226  result = set_flow_pipe_cfg(pipe_cfg, "ORDERED_LIST_PIPE", DOCA_FLOW_PIPE_ORDERED_LIST, false);
227  if (result != DOCA_SUCCESS) {
228  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
229  goto destroy_pipe_cfg;
230  }
231  result = doca_flow_pipe_cfg_set_ordered_lists(pipe_cfg, ordered_lists, nb_ordered_lists);
232  if (result != DOCA_SUCCESS) {
233  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
234  goto destroy_pipe_cfg;
235  }
236 
238  fwd.port_id = port_id ^ 1;
239 
240  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
242  doca_flow_pipe_cfg_destroy(pipe_cfg);
243  return result;
244 }
245 
246 /*
247  * Add DOCA Flow pipe entries to the ordered list pipe.
248  *
249  * @pipe [in]: pipe of the entries
250  * @port_id [in]: port ID of the entries
251  * @status [in]: user context for adding entry
252  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
253  */
254 doca_error_t add_ordered_list_pipe_entries(struct doca_flow_pipe *pipe, int port_id, struct entries_status *status)
255 {
256  struct doca_flow_pipe_entry *entry1;
257  struct doca_flow_pipe_entry *entry2;
258  struct doca_flow_ordered_list ordered_list_0;
259  struct doca_flow_ordered_list ordered_list_1;
260  struct doca_flow_ordered_list_element element_0;
261  struct doca_flow_ordered_list_element element_1;
262  struct doca_flow_ordered_list_element element_2;
263  struct doca_flow_monitor counter;
264  struct doca_flow_actions actions;
265  struct doca_flow_actions actions_mask;
267 
268  memset(&counter, 0, sizeof(counter));
269  memset(&actions, 0, sizeof(actions));
270  memset(&actions_mask, 0, sizeof(actions_mask));
271  memset(&element_0, 0, sizeof(element_0));
272  memset(&element_1, 0, sizeof(element_1));
273  memset(&element_2, 0, sizeof(element_2));
274  memset(&ordered_list_0, 0, sizeof(ordered_list_0));
275  memset(&ordered_list_1, 0, sizeof(ordered_list_1));
276 
278  element_0.actions = &actions;
279  element_0.actions_mask = &actions_mask;
281  element_1.monitor = &counter;
283  element_2.actions = &actions;
284 
285  ordered_list_0.idx = 0;
286  ordered_list_0.size = 2;
287  ordered_list_0.elements = (struct doca_flow_ordered_list_element[]){element_0, element_1};
288 
289  /* first list with counter ID = port ID */
290  counter.shared_counter.shared_counter_id = port_id;
291 
293  pipe,
294  0,
295  &ordered_list_0,
296  NULL,
298  status,
299  &entry1);
300  if (result != DOCA_SUCCESS)
301  return result;
302 
303  ordered_list_1.idx = 1;
304  ordered_list_1.size = 3;
305  ordered_list_1.elements = (struct doca_flow_ordered_list_element[]){element_2, element_0, element_1};
306 
307  /* second list with counter ID = port ID + 2*/
308  counter.shared_counter.shared_counter_id = port_id + 2;
310  pipe,
311  1,
312  &ordered_list_1,
313  NULL,
315  status,
316  &entry2);
317  if (result != DOCA_SUCCESS)
318  return result;
319 
320  return DOCA_SUCCESS;
321 }
322 
323 /*
324  * Run flow_ordered_list sample
325  *
326  * @nb_queues [in]: number of queues the sample will use
327  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
328  */
330 {
331  int nb_ports = 2;
332  struct flow_resources resource = {0};
333  uint32_t nr_shared_resources[SHARED_RESOURCE_NUM_VALUES] = {0};
334  struct doca_flow_port *ports[nb_ports];
335  struct doca_dev *dev_arr[nb_ports];
336  uint32_t actions_mem_size[nb_ports];
337  struct doca_flow_pipe *root_pipe;
338  struct doca_flow_pipe *ordered_list_pipe;
339  uint32_t shared_counter_ids[] = {0, 1, 2, 3};
340  struct doca_flow_resource_query query_results_array[4];
341  struct doca_flow_shared_resource_cfg cfg = {0};
342  int port_id;
343  struct entries_status status;
344  int num_of_entries = 4;
346 
347  nr_shared_resources[DOCA_FLOW_SHARED_RESOURCE_COUNTER] = 4;
348  resource.nr_counters = 2;
349 
350  result = init_doca_flow(nb_queues, "vnf,hws", &resource, nr_shared_resources);
351  if (result != DOCA_SUCCESS) {
352  DOCA_LOG_ERR("Failed to init DOCA Flow: %s", doca_error_get_descr(result));
353  return result;
354  }
355 
356  memset(dev_arr, 0, sizeof(struct doca_dev *) * nb_ports);
357  ARRAY_INIT(actions_mem_size, ACTIONS_MEM_SIZE(nb_queues, num_of_entries));
359  if (result != DOCA_SUCCESS) {
360  DOCA_LOG_ERR("Failed to init DOCA ports: %s", doca_error_get_descr(result));
362  return result;
363  }
364 
365  for (port_id = 0; port_id < nb_ports; port_id++) {
366  memset(&status, 0, sizeof(status));
367 
368  result = create_ordered_list_pipe(ports[port_id], port_id, &ordered_list_pipe);
369  if (result != DOCA_SUCCESS) {
370  DOCA_LOG_ERR("Failed to create ordered list pipe: %s", doca_error_get_descr(result));
373  return result;
374  }
375 
377  shared_counter_ids[port_id],
378  &cfg);
379  if (result != DOCA_SUCCESS) {
380  DOCA_LOG_ERR("Failed to configure shared counter to port %d", port_id);
383  return result;
384  }
385 
387  &shared_counter_ids[port_id],
388  1,
389  ports[port_id]);
390  if (result != DOCA_SUCCESS) {
391  DOCA_LOG_ERR("Failed to bind shared counter to pipe: %s", doca_error_get_descr(result));
394  return result;
395  }
396 
398  shared_counter_ids[port_id + 2],
399  &cfg);
400  if (result != DOCA_SUCCESS) {
401  DOCA_LOG_ERR("Failed to configure shared counter to port %d", port_id);
404  return result;
405  }
406 
408  &shared_counter_ids[port_id + 2],
409  1,
410  ports[port_id]);
411  if (result != DOCA_SUCCESS) {
412  DOCA_LOG_ERR("Failed to bind shared counter to pipe: %s", doca_error_get_descr(result));
415  return result;
416  }
417 
418  result = add_ordered_list_pipe_entries(ordered_list_pipe, port_id, &status);
419  if (result != DOCA_SUCCESS) {
420  DOCA_LOG_ERR("Failed to add ordered list pipe entries: %s", doca_error_get_descr(result));
423  return result;
424  }
425 
426  result = create_root_pipe(ports[port_id], ordered_list_pipe, &root_pipe);
427  if (result != DOCA_SUCCESS) {
428  DOCA_LOG_ERR("Failed to create root pipe: %s", doca_error_get_descr(result));
431  return result;
432  }
433  result = add_root_pipe_entries(root_pipe, ordered_list_pipe, &status);
434  if (result != DOCA_SUCCESS) {
435  DOCA_LOG_ERR("Failed to add root pipe entries: %s", doca_error_get_descr(result));
438  return result;
439  }
440 
442  if (result != DOCA_SUCCESS) {
443  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
446  return result;
447  }
448 
449  if (status.nb_processed != num_of_entries || status.failure) {
450  DOCA_LOG_ERR("Failed to process entries");
453  return DOCA_ERROR_BAD_STATE;
454  }
455  }
456 
457  DOCA_LOG_INFO("Wait few seconds for packets to arrive");
458  sleep(5);
459 
461  shared_counter_ids,
462  query_results_array,
463  nb_ports * 2);
464  if (result != DOCA_SUCCESS) {
465  DOCA_LOG_ERR("Failed to query shared counters: %s", doca_error_get_descr(result));
468  return result;
469  }
470 
471  for (port_id = 0; port_id < 4; port_id++) {
472  DOCA_LOG_INFO("Counter %d:", port_id);
473  DOCA_LOG_INFO("Total bytes: %ld", query_results_array[port_id].counter.total_bytes);
474  DOCA_LOG_INFO("Total packets: %ld", query_results_array[port_id].counter.total_pkts);
475  }
476 
479  return result;
480 }
#define NULL
Definition: __stddef_null.h:26
int32_t result
struct doca_flow_port * init_doca_flow(uint16_t port_id, uint8_t rxq_num)
Definition: flow.c:37
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
doca_error_t add_root_pipe_entries(struct doca_flow_pipe *pipe, struct doca_flow_pipe *next_pipe, struct entries_status *status)
doca_error_t create_root_pipe(struct doca_flow_port *port, struct doca_flow_pipe *next_pipe, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(FLOW_ORDERED_LIST)
doca_error_t add_ordered_list_pipe_entries(struct doca_flow_pipe *pipe, int port_id, struct entries_status *status)
doca_error_t create_ordered_list_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
doca_error_t flow_ordered_list(int nb_queues)
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_fwd fwd
Definition: flow_parser.c:109
#define DEFAULT_TIMEOUT_US
Definition: flow_skeleton.c:36
#define DOCA_HTOBE16(_x)
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_BAD_STATE
Definition: doca_error.h:56
@ DOCA_SUCCESS
Definition: doca_error.h:38
@ 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_EXPERIMENTAL doca_error_t doca_flow_pipe_ordered_list_add_entry(uint16_t pipe_queue, struct doca_flow_pipe *pipe, uint32_t idx, const struct doca_flow_ordered_list *ordered_list, const struct doca_flow_fwd *fwd, enum doca_flow_flags_type flags, void *user_ctx, struct doca_flow_pipe_entry **entry)
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_STABLE doca_error_t doca_flow_shared_resources_bind(enum doca_flow_shared_resource_type type, uint32_t *res_array, uint32_t res_array_len, void *bindable_obj)
Binds a bulk of shared resources to a bindable object.
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_shared_resource_set_cfg(enum doca_flow_shared_resource_type type, uint32_t id, struct doca_flow_shared_resource_cfg *cfg)
Configure a single shared resource.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_ordered_lists(struct doca_flow_pipe_cfg *cfg, struct doca_flow_ordered_list *const *ordered_lists, size_t nr_ordered_lists)
Set pipe's ordered lists.
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_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 void doca_flow_destroy(void)
Destroy the doca flow.
DOCA_EXPERIMENTAL doca_error_t doca_flow_shared_resources_query(enum doca_flow_shared_resource_type type, uint32_t *res_array, struct doca_flow_resource_query *query_results_array, uint32_t array_len)
Extract information about shared counter.
@ DOCA_FLOW_SHARED_RESOURCE_COUNTER
Definition: doca_flow.h:95
@ DOCA_FLOW_PIPE_BASIC
Definition: doca_flow.h:221
@ DOCA_FLOW_PIPE_ORDERED_LIST
Definition: doca_flow.h:231
@ DOCA_FLOW_L3_META_IPV4
Definition: doca_flow.h:296
@ DOCA_FLOW_NO_WAIT
Definition: doca_flow.h:115
@ DOCA_FLOW_ORDERED_LIST_ELEMENT_ACTIONS
Definition: doca_flow.h:1044
@ DOCA_FLOW_ORDERED_LIST_ELEMENT_MONITOR
Definition: doca_flow.h:1050
@ DOCA_FLOW_RESOURCE_TYPE_SHARED
Definition: doca_flow.h:614
@ DOCA_FLOW_FWD_ORDERED_LIST_PIPE
Definition: doca_flow.h:752
@ DOCA_FLOW_FWD_PORT
Definition: doca_flow.h:744
@ 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
const struct ip_frag_config * cfg
Definition: ip_frag_dp.c:0
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
#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
doca flow actions information
Definition: doca_flow.h:684
struct doca_flow_header_format outer
Definition: doca_flow.h:703
forwarding configuration
Definition: doca_flow.h:779
struct doca_flow_fwd::@80::@88 ordered_list_pipe
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
struct doca_flow_monitor::@103::@107 shared_counter
enum doca_flow_resource_type counter_type
Definition: doca_flow.h:988
Ordered list elements.
Definition: doca_flow.h:1057
struct doca_flow_monitor * monitor
Definition: doca_flow.h:1069
enum doca_flow_ordered_list_element_type type
Definition: doca_flow.h:1058
struct doca_flow_actions * actions_mask
Definition: doca_flow.h:1064
struct doca_flow_actions * actions
Definition: doca_flow.h:1062
Ordered list configuration.
Definition: doca_flow.h:1077
struct doca_flow_ordered_list_element * elements
Definition: doca_flow.h:1085
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
doca flow shared resource configuration
Definition: doca_flow.h:953
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