NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_match_comparison_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 #include <doca_bitfield.h>
32 
33 #include "flow_common.h"
34 
35 #define META_U32_BIT_OFFSET(idx) (offsetof(struct doca_flow_meta, u32[(idx)]) << 3)
36 #define NB_ACTION_DESC (3)
37 #define IP_TCP_DEFAULT_HDR_LEN 40
38 
39 DOCA_LOG_REGISTER(FLOW_MATCH_COMPARISON);
40 
41 /*
42  * Create DOCA Flow pipe with changeable match on meta data
43  *
44  * @port [in]: port of the pipe
45  * @port_id [in]: port ID of the pipe
46  * @pipe [out]: created pipe pointer
47  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
48  */
49 static doca_error_t create_match_meta_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
50 {
51  struct doca_flow_match match;
53  struct doca_flow_actions actions, *actions_arr[NB_ACTIONS_ARR];
54  struct doca_flow_fwd fwd;
55  struct doca_flow_pipe_cfg *pipe_cfg;
57 
58  memset(&match_mask, 0, sizeof(match_mask));
59  memset(&match, 0, sizeof(match));
60  memset(&actions, 0, sizeof(actions));
61  memset(&fwd, 0, sizeof(fwd));
62 
63  /* set match_mask on meta */
64  match_mask.meta.u32[0] = UINT32_MAX;
65 
66  actions_arr[0] = &actions;
67 
68  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
69  if (result != DOCA_SUCCESS) {
70  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
71  return result;
72  }
73 
74  result = set_flow_pipe_cfg(pipe_cfg, "MATCH_PIPE", DOCA_FLOW_PIPE_BASIC, false);
75  if (result != DOCA_SUCCESS) {
76  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
77  goto destroy_pipe_cfg;
78  }
79  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, &match_mask);
80  if (result != DOCA_SUCCESS) {
81  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
82  goto destroy_pipe_cfg;
83  }
84  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, NULL, NB_ACTIONS_ARR);
85  if (result != DOCA_SUCCESS) {
86  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
87  goto destroy_pipe_cfg;
88  }
89 
90  /* forwarding traffic to other port */
92  fwd.port_id = port_id ^ 1;
93 
94  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
97  return result;
98 }
99 
100 /*
101  * Add DOCA Flow pipe entry with example meta data value to match
102  *
103  * @pipe [in]: pipe of the entry
104  * @status [in]: user context for adding entry
105  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
106  */
107 static doca_error_t add_match_meta_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
108 {
109  struct doca_flow_match match;
110  struct doca_flow_actions actions;
111  struct doca_flow_pipe_entry *entry;
113 
114  memset(&match, 0, sizeof(match));
115  memset(&actions, 0, sizeof(actions));
116 
117  /* setting match on meta */
119 
120  result = doca_flow_pipe_add_entry(0, pipe, &match, &actions, NULL, NULL, 0, status, &entry);
121  if (result != DOCA_SUCCESS)
122  return result;
123 
124  return DOCA_SUCCESS;
125 }
126 
127 /*
128  * Create DOCA Flow control pipe for comparison
129  *
130  * @port [in]: port of the pipe
131  * @pipe [out]: created pipe pointer
132  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
133  */
134 static doca_error_t create_match_comparison_pipe(struct doca_flow_port *port, struct doca_flow_pipe **pipe)
135 {
136  struct doca_flow_pipe_cfg *pipe_cfg;
138 
139  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
140  if (result != DOCA_SUCCESS) {
141  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
142  return result;
143  }
144 
145  result = set_flow_pipe_cfg(pipe_cfg, "CONTROL_MATCH_COMPARISON_PIPE", DOCA_FLOW_PIPE_CONTROL, false);
146  if (result != DOCA_SUCCESS) {
147  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
148  goto destroy_pipe_cfg;
149  }
150 
151  result = doca_flow_pipe_create(pipe_cfg, NULL, NULL, pipe);
153  doca_flow_pipe_cfg_destroy(pipe_cfg);
154  return result;
155 }
156 
157 /*
158  * Add DOCA Flow pipe entry with comparison to match
159  *
160  * @pipe [in]: pipe of the entry
161  * @next_pipe [in]: next_pipe of the comparison
162  * @status [in]: user context for adding entry
163  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
164  */
165 static doca_error_t add_match_comparison_pipe_entry(struct doca_flow_pipe *pipe,
166  struct doca_flow_pipe *next_pipe,
167  struct entries_status *status)
168 {
169  struct doca_flow_match_condition condition;
170  struct doca_flow_fwd fwd;
172 
173  memset(&condition, 0, sizeof(condition));
174 
175  condition.operation = DOCA_FLOW_COMPARE_GT;
176  condition.field_op.a.field_string = "meta.data";
177  condition.field_op.a.bit_offset = META_U32_BIT_OFFSET(1);
178  condition.field_op.b.field_string = "meta.data";
179  condition.field_op.b.bit_offset = META_U32_BIT_OFFSET(0);
180  condition.field_op.width = 32;
181 
184 
186  0,
187  pipe,
188  NULL,
189  NULL,
190  &condition,
191  NULL,
192  NULL,
193  NULL,
194  NULL,
195  &fwd,
196  status,
197  NULL);
198  if (result != DOCA_SUCCESS)
199  return result;
200 
201  return DOCA_SUCCESS;
202 }
203 
204 /*
205  * Create DOCA Flow pipe with 5 tuple match, and copy & add ipv4.version_ihl tcp.data_offset
206  *
207  * @port [in]: port of the pipe
208  * @next_pipe [in]: pipe to forward the matched packets
209  * @pipe [out]: created pipe pointer
210  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
211  */
212 static doca_error_t create_sum_to_meta_pipe(struct doca_flow_port *port,
213  struct doca_flow_pipe *next_pipe,
214  struct doca_flow_pipe **pipe)
215 {
216  struct doca_flow_match match;
217  struct doca_flow_actions actions;
218  struct doca_flow_actions *actions_arr[NB_ACTIONS_ARR];
219  struct doca_flow_fwd fwd;
220  struct doca_flow_pipe_cfg *pipe_cfg;
221  struct doca_flow_action_descs descs;
222  struct doca_flow_action_descs *descs_arr[NB_ACTIONS_ARR];
223  struct doca_flow_action_desc desc_array[NB_ACTION_DESC] = {0};
225 
226  memset(&match, 0, sizeof(match));
227  memset(&actions, 0, sizeof(actions));
228  memset(&fwd, 0, sizeof(fwd));
229  memset(&descs, 0, sizeof(descs));
230 
231  actions_arr[0] = &actions;
232  descs_arr[0] = &descs;
234  descs.desc_array = desc_array;
235 
236  /* copy ipv4.version_ihl to u32[0] */
237  desc_array[0].type = DOCA_FLOW_ACTION_COPY;
238  desc_array[0].field_op.src.field_string = "outer.ipv4.version_ihl";
239  desc_array[0].field_op.src.bit_offset = 0;
240  desc_array[0].field_op.dst.field_string = "meta.data";
241  /* Set bit_offset to 2 as ihl * 4 = IPv4 hdr len */
242  desc_array[0].field_op.dst.bit_offset = META_U32_BIT_OFFSET(0) + 2;
243  desc_array[0].field_op.width = 4;
244 
245  /* accumulate tcp.data_offset to u32[0] */
246  desc_array[1].type = DOCA_FLOW_ACTION_ADD;
247  desc_array[1].field_op.src.field_string = "outer.tcp.data_offset";
248  desc_array[1].field_op.src.bit_offset = 0;
249  desc_array[1].field_op.dst.field_string = "meta.data";
250  /* Set bit_offset to 2 as tcp.df * 4 = TCP hdr len */
251  desc_array[1].field_op.dst.bit_offset = META_U32_BIT_OFFSET(0) + 2;
252  desc_array[1].field_op.width = 4;
253 
254  /* add IPv4.total_len to u32[1] */
255  desc_array[2].type = DOCA_FLOW_ACTION_ADD;
256  desc_array[2].field_op.src.field_string = "outer.ipv4.total_len";
257  desc_array[2].field_op.src.bit_offset = 0;
258  desc_array[2].field_op.dst.field_string = "meta.data";
259  desc_array[2].field_op.dst.bit_offset = META_U32_BIT_OFFSET(1);
260  desc_array[2].field_op.width = 16;
261 
262  /* 5 tuple match */
265  match.outer.ip4.src_ip = 0xffffffff;
266  match.outer.ip4.dst_ip = 0xffffffff;
267  match.outer.tcp.l4_port.src_port = 0xffff;
268  match.outer.tcp.l4_port.dst_port = 0xffff;
269 
270  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
271  if (result != DOCA_SUCCESS) {
272  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
273  return result;
274  }
275 
276  result = set_flow_pipe_cfg(pipe_cfg, "SUM_TO_META_PIPE", DOCA_FLOW_PIPE_BASIC, true);
277  if (result != DOCA_SUCCESS) {
278  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
279  goto destroy_pipe_cfg;
280  }
281  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, NULL);
282  if (result != DOCA_SUCCESS) {
283  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
284  goto destroy_pipe_cfg;
285  }
286  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, descs_arr, NB_ACTIONS_ARR);
287  if (result != DOCA_SUCCESS) {
288  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
289  goto destroy_pipe_cfg;
290  }
291 
293  fwd.next_pipe = next_pipe;
294 
295  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
297  doca_flow_pipe_cfg_destroy(pipe_cfg);
298  return result;
299 }
300 
301 /*
302  * Add DOCA Flow pipe entry with sum of ipv4.ihl and tcp.data_offset to meta.
303  *
304  * @pipe [in]: pipe of the entry
305  * @status [in]: user context for adding entry
306  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
307  */
308 static doca_error_t add_sum_to_meta_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
309 {
310  struct doca_flow_match match;
311  struct doca_flow_actions actions;
312  struct doca_flow_pipe_entry *entry;
314 
315  doca_be32_t dst_ip_addr = BE_IPV4_ADDR(8, 8, 8, 8);
316  doca_be32_t src_ip_addr = BE_IPV4_ADDR(1, 2, 3, 4);
317  doca_be16_t dst_port = rte_cpu_to_be_16(80);
318  doca_be16_t src_port = rte_cpu_to_be_16(1234);
319 
320  memset(&match, 0, sizeof(match));
321  memset(&actions, 0, sizeof(actions));
322 
323  match.outer.ip4.dst_ip = dst_ip_addr;
324  match.outer.ip4.src_ip = src_ip_addr;
327 
328  result = doca_flow_pipe_add_entry(0, pipe, &match, &actions, NULL, NULL, 0, status, &entry);
329  if (result != DOCA_SUCCESS)
330  return result;
331 
332  return DOCA_SUCCESS;
333 }
334 
335 /*
336  * Run flow_match_comparison sample
337  *
338  * @nb_queues [in]: number of queues the sample will use
339  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
340  */
342 {
343  const int nb_ports = 2;
344  struct flow_resources resource = {0};
345  uint32_t nr_shared_resources[SHARED_RESOURCE_NUM_VALUES] = {0};
346  struct doca_flow_port *ports[nb_ports];
347  struct doca_flow_pipe *comparison_pipe;
348  struct doca_flow_pipe *match_meta_pipe;
349  struct doca_flow_pipe *sum_pipe;
350  struct doca_dev *dev_arr[nb_ports];
351  uint32_t actions_mem_size[nb_ports];
352  struct entries_status status;
353  int num_of_entries = 3;
355  int port_id;
356 
357  result = init_doca_flow(nb_queues, "vnf,hws", &resource, nr_shared_resources);
358  if (result != DOCA_SUCCESS) {
359  DOCA_LOG_ERR("Failed to init DOCA Flow: %s", doca_error_get_descr(result));
360  return result;
361  }
362 
363  memset(dev_arr, 0, sizeof(struct doca_dev *) * nb_ports);
364  ARRAY_INIT(actions_mem_size, ACTIONS_MEM_SIZE(nb_queues, num_of_entries));
366  if (result != DOCA_SUCCESS) {
367  DOCA_LOG_ERR("Failed to init DOCA ports: %s", doca_error_get_descr(result));
369  return result;
370  }
371 
372  for (port_id = 0; port_id < nb_ports; port_id++) {
373  memset(&status, 0, sizeof(status));
374 
375  result = create_match_meta_pipe(ports[port_id], port_id, &match_meta_pipe);
376  if (result != DOCA_SUCCESS) {
377  DOCA_LOG_ERR("Failed to create match meta pipe: %s", doca_error_get_descr(result));
380  return result;
381  }
382 
383  result = add_match_meta_pipe_entry(match_meta_pipe, &status);
384  if (result != DOCA_SUCCESS) {
385  DOCA_LOG_ERR("Failed to add match meta entry: %s", doca_error_get_descr(result));
388  return result;
389  }
390 
391  result = create_match_comparison_pipe(ports[port_id], &comparison_pipe);
392  if (result != DOCA_SUCCESS) {
393  DOCA_LOG_ERR("Failed to create comparison pipe: %s", doca_error_get_descr(result));
396  return result;
397  }
398 
399  result = add_match_comparison_pipe_entry(comparison_pipe, match_meta_pipe, &status);
400  if (result != DOCA_SUCCESS) {
401  DOCA_LOG_ERR("Failed to add comparison entry: %s", doca_error_get_descr(result));
404  return result;
405  }
406 
407  result = create_sum_to_meta_pipe(ports[port_id], comparison_pipe, &sum_pipe);
408  if (result != DOCA_SUCCESS) {
409  DOCA_LOG_ERR("Failed to create sum to meta pipe: %s", doca_error_get_descr(result));
412  return result;
413  }
414 
415  result = add_sum_to_meta_pipe_entry(sum_pipe, &status);
416  if (result != DOCA_SUCCESS) {
417  DOCA_LOG_ERR("Failed to add sum to meta entry: %s", doca_error_get_descr(result));
420  return result;
421  }
422 
423  result = doca_flow_entries_process(ports[port_id], 0, DEFAULT_TIMEOUT_US, num_of_entries);
424  if (result != DOCA_SUCCESS) {
425  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
428  return result;
429  }
430 
431  if (status.nb_processed != num_of_entries || status.failure) {
432  DOCA_LOG_ERR("Failed to process entries");
435  return DOCA_ERROR_BAD_STATE;
436  }
437  }
438 
439  DOCA_LOG_INFO("Wait few seconds for packets to arrive");
440  sleep(5);
441 
444  return result;
445 }
#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_LOG_REGISTER(FLOW_MATCH_COMPARISON)
static doca_error_t add_match_comparison_pipe_entry(struct doca_flow_pipe *pipe, struct doca_flow_pipe *next_pipe, struct entries_status *status)
static doca_error_t create_match_meta_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
static doca_error_t add_sum_to_meta_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
doca_error_t flow_match_comparison(int nb_queues)
static doca_error_t create_match_comparison_pipe(struct doca_flow_port *port, struct doca_flow_pipe **pipe)
static doca_error_t create_sum_to_meta_pipe(struct doca_flow_port *port, struct doca_flow_pipe *next_pipe, struct doca_flow_pipe **pipe)
static doca_error_t add_match_meta_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
#define META_U32_BIT_OFFSET(idx)
#define NB_ACTION_DESC
#define IP_TCP_DEFAULT_HDR_LEN
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
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
#define DEFAULT_TIMEOUT_US
Definition: flow_skeleton.c:36
#define DOCA_HTOBE32(_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_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_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_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_FLOW_PIPE_CONTROL
Definition: doca_flow.h:223
@ DOCA_FLOW_PIPE_BASIC
Definition: doca_flow.h:221
@ DOCA_FLOW_ACTION_COPY
Definition: doca_flow.h:1012
@ DOCA_FLOW_ACTION_ADD
Definition: doca_flow.h:1010
@ DOCA_FLOW_COMPARE_GT
Definition: doca_flow.h:518
@ DOCA_FLOW_FWD_PORT
Definition: doca_flow.h:744
@ DOCA_FLOW_FWD_PIPE
Definition: doca_flow.h:746
#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 ACTIONS_MEM_SIZE(nr_queues, entries)
Definition: flow_common.h:66
#define ARRAY_INIT(array, val)
Definition: flow_common.h:71
action description
Definition: doca_flow.h:1019
enum doca_flow_action_type type
Definition: doca_flow.h:1020
struct doca_flow_action_desc::@108::@110 field_op
action descriptor array
Definition: doca_flow.h:1033
struct doca_flow_action_desc * desc_array
Definition: doca_flow.h:1036
doca flow actions information
Definition: doca_flow.h:684
forwarding configuration
Definition: doca_flow.h:779
struct doca_flow_pipe * next_pipe
Definition: doca_flow.h:800
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
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 match condition information
Definition: doca_flow.h:548
enum doca_flow_compare_op operation
Definition: doca_flow.h:549
struct doca_flow_match_condition::@68::@70 field_op
doca flow matcher information
Definition: doca_flow.h:491
struct doca_flow_header_format outer
Definition: doca_flow.h:498
struct doca_flow_meta meta
Definition: doca_flow.h:494
doca_be32_t u32[DOCA_FLOW_META_SCRATCH_PAD_MAX]
Definition: doca_flow.h:360
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