NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_acl_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 <string.h>
27 #include <unistd.h>
28 
29 #include <doca_log.h>
30 #include <doca_flow.h>
31 
32 #include "flow_common.h"
33 
35 
36 #define ACL_MEM_REQ_PER_ENTRY (32)
37 
38 #define ACL_ACTIONS_MEM_SIZE(nr_queues, entries) \
39  rte_align32pow2(MAX((uint32_t)(entries * ACL_MEM_REQ_PER_ENTRY * DOCA_FLOW_MAX_ENTRY_ACTIONS_MEM_SIZE), \
40  (uint32_t)(nr_queues * MIN_ACTIONS_MEM_SIZE_PER_QUEUE))) /* Total actions memory size */
41 
42 /* for egress use domain = DOCA_FLOW_PIPE_DOMAIN_EGRESS*/
44 
45 /*
46  * Create DOCA Flow control pipe
47  *
48  * @port [in]: port of the pipe
49  * @port_id [in]: port ID of the pipe
50  * @pipe [out]: created pipe pointer
51  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
52  */
53 doca_error_t create_rx_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
54 {
56 
57  struct doca_flow_pipe_cfg *pipe_cfg;
58  struct doca_flow_match match;
59  struct doca_flow_fwd fwd;
60 
61  memset(&match, 0, sizeof(match));
62  memset(&fwd, 0, sizeof(fwd));
63 
64  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
65  if (result != DOCA_SUCCESS) {
66  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
67  return result;
68  }
69 
70  result = set_flow_pipe_cfg(pipe_cfg, "CONTROL_PIPE", DOCA_FLOW_PIPE_CONTROL, true);
71  if (result != DOCA_SUCCESS) {
72  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
73  goto destroy_pipe_cfg;
74  }
75 
76  result = doca_flow_pipe_create(pipe_cfg, NULL, NULL, pipe);
77  if (result != DOCA_SUCCESS)
78  goto destroy_pipe_cfg;
80 
82 
83  /* forwarding traffic to other port */
85  fwd.port_id = port_id ^ 1;
86 
88  0,
89  *pipe,
90  &match,
91  NULL,
92  NULL,
93  NULL,
94  NULL,
95  NULL,
96  NULL,
97  &fwd,
98  NULL,
99  NULL);
101  doca_flow_pipe_cfg_destroy(pipe_cfg);
102  return result;
103 }
104 
105 /*
106  * Add DOCA Flow ACL pipe that matched IPV4 addresses
107  *
108  * @port [in]: port of the pipe
109  * @is_root [in]: pipeline is root or not.
110  * @pipe [out]: created pipe pointer
111  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
112  */
113 doca_error_t create_acl_pipe(struct doca_flow_port *port, bool is_root, struct doca_flow_pipe **pipe)
114 {
115  struct doca_flow_match match;
116  struct doca_flow_actions actions, *actions_arr[NB_ACTIONS_ARR];
117  struct doca_flow_pipe_cfg *pipe_cfg;
118  struct doca_flow_fwd fwd_miss;
121 
122  memset(&match, 0, sizeof(match));
123  memset(&actions, 0, sizeof(actions));
124  memset(&fwd_miss, 0, sizeof(fwd_miss));
125 
128  match.outer.ip4.src_ip = 0xffffffff;
129  match.outer.ip4.dst_ip = 0xffffffff;
130 
131  match.outer.tcp.l4_port.src_port = 0xffff;
132  match.outer.tcp.l4_port.dst_port = 0xffff;
133 
134  actions_arr[0] = &actions;
135 
137 
138  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
139  if (result != DOCA_SUCCESS) {
140  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
141  return result;
142  }
143 
144  result = set_flow_pipe_cfg(pipe_cfg, "ACL_PIPE", DOCA_FLOW_PIPE_ACL, is_root);
145  if (result != DOCA_SUCCESS) {
146  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
147  goto destroy_pipe_cfg;
148  }
150  if (result != DOCA_SUCCESS) {
151  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg nr_entries: %s", doca_error_get_descr(result));
152  goto destroy_pipe_cfg;
153  }
155  if (result != DOCA_SUCCESS) {
156  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg domain: %s", doca_error_get_descr(result));
157  goto destroy_pipe_cfg;
158  }
159  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, NULL);
160  if (result != DOCA_SUCCESS) {
161  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
162  goto destroy_pipe_cfg;
163  }
164  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, NULL, NB_ACTIONS_ARR);
165  if (result != DOCA_SUCCESS) {
166  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
167  goto destroy_pipe_cfg;
168  }
169 
170  result = doca_flow_pipe_create(pipe_cfg, &fwd, &fwd_miss, pipe);
172  doca_flow_pipe_cfg_destroy(pipe_cfg);
173  return result;
174 }
175 
176 /*
177  * Add DOCA Flow pipe entry to the ACL pipe.
178  *
179  * @pipe [in]: pipe of the entry
180  * @port_id [in]: port ID of the entry
181  * @status [in]: the entries status struct that monitors the entries in this specific port
182  * @src_ip_addr [in]: src ip address
183  * @dst_ip_addr [in]: dst ip address
184  * @src_port [in]: src port
185  * @dst_port [in]: dst port
186  * @l4_type [in]: l4 protocol
187  * @src_ip_addr_mask [in]: src ip mask
188  * @dst_ip_addr_mask [in]: dst ip mask
189  * @src_port_mask [in]: src port mask.
190  * if src_port_mask is equal to src_port, ACL adds rule with exact src port : src_port with mask 0xffff
191  * if src_port_mask is 0, ACL adds rule with any src port : src_port with mask 0x0
192  * if src_port_mask > src_port, ACL adds rule with port range : src_port_from = src_port, src_port_to =
193  *src_port_mask with mask 0xffff if src_port_mask < src_port, ACL will return with the error
194  * @dst_port_mask [in]: dst port mask
195  * if dst_port_mask is equal to dst_port, ACL adds rule with exact dst port : dst_port with mask 0xffff
196  * if dst_port_mask is 0, ACL adds rule with any dst port : dst_port with mask 0x0
197  * if dst_port_mask > dst_port, ACL adds rule with port range : dst_port_from = dst_port, dst_port_to =
198  *dst_port_mask with mask 0xffff if dst_port_mask < dst_port, ACL will return with the error
199  * @priority [in]: priority of the entry. 0 <= priority <= 1024. the lowest parameter value is used as the highest
200  *priority
201  * @is_allow [in]: allow or deny the entry
202  * @flag [in]: Flow entry will be pushed to hw immediately or not. enum doca_flow_flags_type.
203  * flag DOCA_FLOW_WAIT_FOR_BATCH is using for collecting entries by ACL module
204  * flag DOCA_FLOW_NO_WAIT is using for adding the entry and starting building and offloading
205  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
206  */
207 doca_error_t add_acl_specific_entry(struct doca_flow_pipe *pipe,
208  int port_id,
209  struct entries_status *status,
210  doca_be32_t src_ip_addr,
211  doca_be32_t dst_ip_addr,
214  uint8_t l4_type,
215  doca_be32_t src_ip_addr_mask,
216  doca_be32_t dst_ip_addr_mask,
217  doca_be16_t src_port_mask,
218  doca_be16_t dst_port_mask,
219  uint16_t priority,
220  bool is_allow,
221  enum doca_flow_flags_type flag)
222 {
223  struct doca_flow_match match;
225  struct doca_flow_fwd fwd;
227 
228  memset(&match, 0, sizeof(match));
229  memset(&match_mask, 0, sizeof(match_mask));
230  memset(&fwd, 0, sizeof(fwd));
231 
232  match_mask.outer.ip4.src_ip = src_ip_addr_mask;
233  match_mask.outer.ip4.dst_ip = dst_ip_addr_mask;
234 
236  match.outer.ip4.src_ip = src_ip_addr;
237  match.outer.ip4.dst_ip = dst_ip_addr;
238 
239  if (l4_type == DOCA_FLOW_L4_TYPE_EXT_TCP) {
241  match_mask.parser_meta.outer_l4_type = UINT32_MAX;
244  match_mask.outer.tcp.l4_port.src_port = src_port_mask;
245  match_mask.outer.tcp.l4_port.dst_port = dst_port_mask;
246  } else {
248  match_mask.parser_meta.outer_l4_type = UINT32_MAX;
251  match_mask.outer.udp.l4_port.src_port = src_port_mask;
252  match_mask.outer.udp.l4_port.dst_port = dst_port_mask;
253  }
254  match.outer.l4_type_ext = l4_type;
255 
256  if (is_allow) {
259  fwd.port_id = port_id ^ 1;
260  } else { // domain == DOCA_FLOW_PIPE_DOMAIN_EGRESS
262  fwd.port_id = port_id;
263  }
264  } else
266 
267  result = doca_flow_pipe_acl_add_entry(0, pipe, &match, &match_mask, priority, &fwd, flag, status, NULL);
268 
269  if (result != DOCA_SUCCESS) {
270  DOCA_LOG_ERR("Failed to add acl pipe entry: %s", doca_error_get_descr(result));
271  return result;
272  }
273 
274  return DOCA_SUCCESS;
275 }
276 
277 /*
278  * Add DOCA Flow pipe entries to the ACL pipe.
279  *
280  * @pipe [in]: pipe of the entry
281  * @port_id [in]: port ID of the entry
282  * @status [in]: user context for adding entry
283  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
284  */
285 doca_error_t add_acl_pipe_entries(struct doca_flow_pipe *pipe, int port_id, struct entries_status *status)
286 {
288 
290  port_id,
291  status,
292  BE_IPV4_ADDR(1, 2, 3, 4),
293  BE_IPV4_ADDR(8, 8, 8, 8),
294  RTE_BE16(1234),
295  RTE_BE16(80),
297  RTE_BE32(0xffffffff),
298  RTE_BE32(0xffffffff),
299  RTE_BE16(0x00),
300  RTE_BE16(0x0),
301  10,
302  false,
304  if (result != DOCA_SUCCESS)
305  return result;
306 
308  port_id,
309  status,
310  BE_IPV4_ADDR(172, 20, 1, 4),
311  BE_IPV4_ADDR(192, 168, 3, 4),
312  RTE_BE16(1234),
313  RTE_BE16(80),
315  RTE_BE32(0xffffffff),
316  RTE_BE32(0xffffffff),
317  RTE_BE16(0x0),
318  RTE_BE16(3000),
319  50,
320  true,
322 
323  if (result != DOCA_SUCCESS)
324  return result;
325 
327  port_id,
328  status,
329  BE_IPV4_ADDR(172, 20, 1, 4),
330  BE_IPV4_ADDR(192, 168, 3, 4),
331  RTE_BE16(1234),
332  RTE_BE16(80),
334  RTE_BE32(0xffffffff),
335  RTE_BE32(0xffffffff),
336  RTE_BE16(1234),
337  RTE_BE16(0x0),
338  40,
339  true,
341 
342  if (result != DOCA_SUCCESS)
343  return result;
344 
346  port_id,
347  status,
348  BE_IPV4_ADDR(1, 2, 3, 5),
349  BE_IPV4_ADDR(8, 8, 8, 6),
350  RTE_BE16(1234),
351  RTE_BE16(80),
353  RTE_BE32(0xffffff00),
354  RTE_BE32(0xffffff00),
355  RTE_BE16(0xffff),
356  RTE_BE16(80),
357  20,
358  true,
360 
361  if (result != DOCA_SUCCESS)
362  return result;
363 
364  return DOCA_SUCCESS;
365 }
366 
367 /*
368  * Run flow_acl sample
369  *
370  * @nb_queues [in]: number of queues the sample will use
371  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
372  */
373 doca_error_t flow_acl(int nb_queues)
374 {
375  const int nb_ports = 2;
376  struct flow_resources resource = {0};
377  uint32_t nr_shared_resources[SHARED_RESOURCE_NUM_VALUES] = {0};
378  struct doca_flow_port *ports[nb_ports];
379  struct doca_dev *dev_arr[nb_ports];
380  uint32_t actions_mem_size[nb_ports];
381  struct doca_flow_pipe *acl_pipe;
382  struct doca_flow_pipe *rx_pipe;
383  struct entries_status status;
384  int num_of_entries = 4;
386  int port_id, port_acl;
387 
388  result = init_doca_flow(nb_queues, "vnf,hws", &resource, nr_shared_resources);
389  if (result != DOCA_SUCCESS) {
390  DOCA_LOG_ERR("Failed to init DOCA Flow: %s", doca_error_get_descr(result));
391  return result;
392  }
393 
394  memset(dev_arr, 0, sizeof(struct doca_dev *) * nb_ports);
395  ARRAY_INIT(actions_mem_size, ACL_ACTIONS_MEM_SIZE(nb_queues, num_of_entries));
397  if (result != DOCA_SUCCESS) {
398  DOCA_LOG_ERR("Failed to init DOCA ports: %s", doca_error_get_descr(result));
400  return result;
401  }
402 
403  for (port_id = 0; port_id < nb_ports; port_id++) {
404  memset(&status, 0, sizeof(status));
405 
407  port_acl = port_id;
408  else // domain == DOCA_FLOW_PIPE_DOMAIN_EGRESS
409  port_acl = port_id ^ 1;
410 
411  result = create_acl_pipe(ports[port_acl], true, &acl_pipe);
412  if (result != DOCA_SUCCESS) {
413  DOCA_LOG_ERR("Failed to create acl pipe: %s", doca_error_get_descr(result));
416  return result;
417  }
418 
419  result = add_acl_pipe_entries(acl_pipe, port_acl, &status);
420  if (result != DOCA_SUCCESS) {
423  return result;
424  }
425 
427  result = create_rx_pipe(ports[port_id], port_id, &rx_pipe);
428  if (result != DOCA_SUCCESS) {
429  DOCA_LOG_ERR("Failed to create main pipe: %s", doca_error_get_descr(result));
432  return result;
433  }
434  }
435 
436  result = doca_flow_entries_process(ports[port_acl], 0, DEFAULT_TIMEOUT_US, num_of_entries);
437  if (result != DOCA_SUCCESS) {
438  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
441  return result;
442  }
443 
444  if (status.nb_processed != num_of_entries || status.failure) {
445  DOCA_LOG_ERR("Failed to process entries");
448  return DOCA_ERROR_BAD_STATE;
449  }
450  }
451 
452  DOCA_LOG_INFO("Wait few seconds for packets to arrive");
453  sleep(50);
454 
457  return result;
458 }
#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
doca_error_t flow_acl(int nb_queues)
doca_error_t create_acl_pipe(struct doca_flow_port *port, bool is_root, struct doca_flow_pipe **pipe)
static enum doca_flow_pipe_domain domain
doca_error_t add_acl_pipe_entries(struct doca_flow_pipe *pipe, int port_id, struct entries_status *status)
doca_error_t add_acl_specific_entry(struct doca_flow_pipe *pipe, int port_id, struct entries_status *status, doca_be32_t src_ip_addr, doca_be32_t dst_ip_addr, doca_be16_t src_port, doca_be16_t dst_port, uint8_t l4_type, doca_be32_t src_ip_addr_mask, doca_be32_t dst_ip_addr_mask, doca_be16_t src_port_mask, doca_be16_t dst_port_mask, uint16_t priority, bool is_allow, enum doca_flow_flags_type flag)
#define ACL_ACTIONS_MEM_SIZE(nr_queues, entries)
doca_error_t create_rx_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(FLOW_ACL)
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_fwd fwd
Definition: flow_parser.c:109
static struct doca_flow_match match_mask
Definition: flow_parser.c:106
#define DEFAULT_TIMEOUT_US
Definition: flow_skeleton.c:36
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_L4_TYPE_EXT_UDP
@ 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_EXPERIMENTAL doca_error_t doca_flow_pipe_control_add_entry(uint16_t pipe_queue, uint32_t priority, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_match *match_mask, const struct doca_flow_match_condition *condition, const struct doca_flow_actions *actions, const struct doca_flow_actions *actions_mask, const struct doca_flow_action_descs *action_descs, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a control pipe.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_acl_add_entry(uint16_t pipe_queue, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_match *match_mask, const uint32_t priority, const struct doca_flow_fwd *fwd, const enum doca_flow_flags_type flag, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a acl pipe.
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_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 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_flow_pipe_domain
doca flow pipe domain
Definition: doca_flow.h:240
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_domain(struct doca_flow_pipe_cfg *cfg, enum doca_flow_pipe_domain domain)
Set pipe's domain.
@ DOCA_FLOW_PIPE_CONTROL
Definition: doca_flow.h:223
@ DOCA_FLOW_PIPE_ACL
Definition: doca_flow.h:229
@ 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_CHANGEABLE
Definition: doca_flow.h:756
@ DOCA_FLOW_FWD_DROP
Definition: doca_flow.h:748
@ DOCA_FLOW_L4_META_UDP
Definition: doca_flow.h:310
@ DOCA_FLOW_L4_META_TCP
Definition: doca_flow.h:308
@ DOCA_FLOW_PIPE_DOMAIN_EGRESS
Definition: doca_flow.h:245
@ DOCA_FLOW_PIPE_DOMAIN_DEFAULT
Definition: doca_flow.h:241
#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
#define NB_ACTIONS_ARR
Definition: flow_common.h:58
#define SHARED_RESOURCE_NUM_VALUES
Definition: flow_common.h:59
#define ARRAY_INIT(array, val)
Definition: flow_common.h:71
doca flow actions information
Definition: doca_flow.h:684
forwarding configuration
Definition: doca_flow.h:779
struct doca_flow_pipe * pipe
Definition: doca_flow.h:806
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
struct doca_flow_header_udp udp
Definition: doca_flow.h:459
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
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
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
user context struct that will be used in entries process callback
Definition: flow_common.h:78
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