NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_shared_counter_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 <rte_byteorder.h>
30 
31 #include <doca_log.h>
32 #include <doca_flow.h>
33 
34 #include "flow_common.h"
35 
36 DOCA_LOG_REGISTER(FLOW_SHARED_COUNTER);
37 
38 /* Set match l4 port */
39 #define SET_L4_PORT(layer, port, value) \
40  do { \
41  if (match.layer.l4_type_ext == DOCA_FLOW_L4_TYPE_EXT_TCP) \
42  match.layer.tcp.l4_port.port = (value); \
43  else if (match.layer.l4_type_ext == DOCA_FLOW_L4_TYPE_EXT_UDP) \
44  match.layer.udp.l4_port.port = (value); \
45  } while (0)
46 
47 enum {
48  TCP_ENTRY = 0,
50 };
51 
52 /*
53  * Create DOCA Flow pipe with 5 tuple match and monitor with shared counter ID
54  *
55  * @port [in]: port of the pipe
56  * @port_id [in]: port ID of the pipe
57  * @out_l4_type [in]: l4 type to match: UDP/TCP
58  * @pipe [out]: created pipe pointer
59  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
60  */
61 static doca_error_t create_shared_counter_pipe(struct doca_flow_port *port,
62  int port_id,
63  enum doca_flow_l4_type_ext out_l4_type,
64  struct doca_flow_pipe **pipe)
65 {
66  struct doca_flow_match match;
68  struct doca_flow_actions actions, *actions_arr[NB_ACTIONS_ARR];
69  struct doca_flow_fwd fwd;
70  struct doca_flow_pipe_cfg *pipe_cfg;
72 
73  memset(&match, 0, sizeof(match));
74  memset(&monitor, 0, sizeof(monitor));
75  memset(&actions, 0, sizeof(actions));
76  memset(&fwd, 0, sizeof(fwd));
77 
78  /* 5 tuple match */
79  match.outer.l4_type_ext = out_l4_type;
81  match.outer.ip4.src_ip = 0xffffffff;
82  match.outer.ip4.dst_ip = 0xffffffff;
83  SET_L4_PORT(outer, src_port, 0xffff);
84  SET_L4_PORT(outer, dst_port, 0xffff);
85 
86  actions_arr[0] = &actions;
87 
88  /* monitor with changeable shared counter ID */
90  monitor.shared_counter.shared_counter_id = 0xffffffff;
91 
92  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
93  if (result != DOCA_SUCCESS) {
94  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
95  return result;
96  }
97 
98  result = set_flow_pipe_cfg(pipe_cfg, "SHARED_COUNTER_PIPE", DOCA_FLOW_PIPE_BASIC, false);
99  if (result != DOCA_SUCCESS) {
100  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
101  goto destroy_pipe_cfg;
102  }
103  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, NULL);
104  if (result != DOCA_SUCCESS) {
105  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
106  goto destroy_pipe_cfg;
107  }
108  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, NULL, NB_ACTIONS_ARR);
109  if (result != DOCA_SUCCESS) {
110  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
111  goto destroy_pipe_cfg;
112  }
114  if (result != DOCA_SUCCESS) {
115  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg monitor: %s", doca_error_get_descr(result));
116  goto destroy_pipe_cfg;
117  }
118 
119  /* forwarding traffic to other port */
121  fwd.port_id = port_id ^ 1;
122 
123  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
125  doca_flow_pipe_cfg_destroy(pipe_cfg);
126  return result;
127 }
128 
129 /*
130  * Add DOCA Flow pipe entry to the shared counter pipe
131  *
132  * @pipe [in]: pipe of the entry
133  * @out_l4_type [in]: l4 type to match: UDP/TCP
134  * @shared_counter_id [in]: ID of the shared counter
135  * @status [in]: user context for adding entry
136  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
137  */
138 static doca_error_t add_shared_counter_pipe_entry(struct doca_flow_pipe *pipe,
139  enum doca_flow_l4_type_ext out_l4_type,
140  uint32_t shared_counter_id,
141  struct entries_status *status,
142  struct doca_flow_pipe_entry **entry)
143 {
144  struct doca_flow_match match;
145  struct doca_flow_actions actions;
146  struct doca_flow_monitor monitor;
148 
149  /* example 5-tuple to match */
150  doca_be32_t dst_ip_addr = BE_IPV4_ADDR(8, 8, 8, 8);
151  doca_be32_t src_ip_addr = BE_IPV4_ADDR(1, 2, 3, 4);
152  doca_be16_t dst_port = rte_cpu_to_be_16(80);
153  doca_be16_t src_port = rte_cpu_to_be_16(1234);
154 
155  memset(&match, 0, sizeof(match));
156  memset(&actions, 0, sizeof(actions));
157  memset(&monitor, 0, sizeof(monitor));
158 
159  /* set shared counter ID */
160  monitor.shared_counter.shared_counter_id = shared_counter_id;
161 
162  match.outer.ip4.dst_ip = dst_ip_addr;
163  match.outer.ip4.src_ip = src_ip_addr;
164  match.outer.l4_type_ext = out_l4_type;
165  SET_L4_PORT(outer, dst_port, dst_port);
166  SET_L4_PORT(outer, src_port, src_port);
167 
168  result = doca_flow_pipe_add_entry(0, pipe, &match, &actions, &monitor, NULL, 0, status, entry);
169  if (result != DOCA_SUCCESS) {
170  DOCA_LOG_ERR("Failed to add entry: %s", doca_error_get_descr(result));
171  return result;
172  }
173 
174  return DOCA_SUCCESS;
175 }
176 
177 /*
178  * Add DOCA Flow control pipe
179  *
180  * @port [in]: port of the pipe
181  * @pipe [out]: created pipe pointer
182  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
183  */
184 static doca_error_t create_control_pipe(struct doca_flow_port *port, struct doca_flow_pipe **pipe)
185 {
186  struct doca_flow_pipe_cfg *pipe_cfg;
188 
189  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
190  if (result != DOCA_SUCCESS) {
191  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
192  return result;
193  }
194 
195  result = set_flow_pipe_cfg(pipe_cfg, "CONTROL_PIPE", DOCA_FLOW_PIPE_CONTROL, true);
196  if (result != DOCA_SUCCESS) {
197  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
198  goto destroy_pipe_cfg;
199  }
200 
201  result = doca_flow_pipe_create(pipe_cfg, NULL, NULL, pipe);
203  doca_flow_pipe_cfg_destroy(pipe_cfg);
204  return result;
205 }
206 
207 /*
208  * Add DOCA Flow pipe entries to the control pipe. First entry forwards UDP packets to udp_pipe and the second
209  * forwards TCP packets to tcp_pipe
210  *
211  * @control_pipe [in]: pipe of the entries
212  * @tcp_pipe [in]: pointer to the TCP pipe to forward packets to
213  * @udp_pipe [in]: pointer to the UDP pipe to forward packets to
214  * @status [in]: user context for adding entry
215  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
216  */
217 static doca_error_t add_control_pipe_entries(struct doca_flow_pipe *control_pipe,
218  struct doca_flow_pipe *tcp_pipe,
219  struct doca_flow_pipe *udp_pipe,
220  struct entries_status *status)
221 {
222  struct doca_flow_match match;
223  struct doca_flow_fwd fwd;
224  uint8_t priority = 0;
226 
227  memset(&match, 0, sizeof(match));
228  memset(&fwd, 0, sizeof(fwd));
229 
232 
234  fwd.next_pipe = udp_pipe;
235 
237  priority,
238  control_pipe,
239  &match,
240  NULL,
241  NULL,
242  NULL,
243  NULL,
244  NULL,
245  NULL,
246  &fwd,
247  status,
248  NULL);
249  if (result != DOCA_SUCCESS) {
250  DOCA_LOG_ERR("Failed to add control pipe entry: %s", doca_error_get_descr(result));
251  return result;
252  }
253 
254  memset(&match, 0, sizeof(match));
255  memset(&fwd, 0, sizeof(fwd));
256 
259 
261  fwd.next_pipe = tcp_pipe;
262 
264  priority,
265  control_pipe,
266  &match,
267  NULL,
268  NULL,
269  NULL,
270  NULL,
271  NULL,
272  NULL,
273  &fwd,
274  status,
275  NULL);
276  if (result != DOCA_SUCCESS) {
277  DOCA_LOG_ERR("Failed to add control pipe entry: %s", doca_error_get_descr(result));
278  return result;
279  }
280  return DOCA_SUCCESS;
281 }
282 
283 /*
284  * Run flow_shared_counter sample
285  *
286  * @nb_queues [in]: number of queues the sample will use
287  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
288  */
290 {
291  int nb_ports = 2;
292  struct flow_resources resource = {0};
293  uint32_t nr_shared_resources[SHARED_RESOURCE_NUM_VALUES] = {0};
294  struct doca_flow_port *ports[nb_ports];
295  struct doca_dev *dev_arr[nb_ports];
296  uint32_t actions_mem_size[nb_ports];
297  struct doca_flow_pipe *tcp_pipe, *udp_pipe, *pipe;
298  int port_id;
299  uint32_t shared_counter_ids[] = {0, 1};
300  struct doca_flow_resource_query query_results_array[nb_ports];
301  struct doca_flow_shared_resource_cfg cfg = {0};
302  struct entries_status status;
303  int num_of_entries = 4;
305  struct doca_flow_pipe_entry *entry[nb_ports][2];
306 
307  nr_shared_resources[DOCA_FLOW_SHARED_RESOURCE_COUNTER] = 2;
308 
309  result = init_doca_flow(nb_queues, "vnf,hws", &resource, nr_shared_resources);
310  if (result != DOCA_SUCCESS) {
311  DOCA_LOG_ERR("Failed to init DOCA Flow: %s", doca_error_get_descr(result));
312  return result;
313  }
314 
315  memset(dev_arr, 0, sizeof(struct doca_dev *) * nb_ports);
316  ARRAY_INIT(actions_mem_size, ACTIONS_MEM_SIZE(nb_queues, num_of_entries));
318  if (result != DOCA_SUCCESS) {
319  DOCA_LOG_ERR("Failed to init DOCA ports: %s", doca_error_get_descr(result));
321  return result;
322  }
323 
324  for (port_id = 0; port_id < nb_ports; port_id++) {
325  memset(&status, 0, sizeof(status));
326  /* config and bind shared counter to port */
328  if (result != DOCA_SUCCESS) {
329  DOCA_LOG_ERR("Failed to configure shared counter to port %d", port_id);
332  return result;
333  }
334 
336  &shared_counter_ids[port_id],
337  1,
338  ports[port_id]);
339  if (result != DOCA_SUCCESS) {
340  DOCA_LOG_ERR("Failed to bind shared counter to pipe");
343  return result;
344  }
345 
346  result = create_shared_counter_pipe(ports[port_id], port_id, DOCA_FLOW_L4_TYPE_EXT_TCP, &tcp_pipe);
347  if (result != DOCA_SUCCESS) {
348  DOCA_LOG_ERR("Failed to create pipe: %s", doca_error_get_descr(result));
351  return result;
352  }
353 
356  shared_counter_ids[port_id],
357  &status,
358  &entry[port_id][TCP_ENTRY]);
359  if (result != DOCA_SUCCESS) {
360  DOCA_LOG_ERR("Failed to add entry: %s", doca_error_get_descr(result));
363  return result;
364  }
365 
366  result = create_shared_counter_pipe(ports[port_id], port_id, DOCA_FLOW_L4_TYPE_EXT_UDP, &udp_pipe);
367  if (result != DOCA_SUCCESS) {
368  DOCA_LOG_ERR("Failed to create pipe: %s", doca_error_get_descr(result));
371  return result;
372  }
373 
376  shared_counter_ids[port_id],
377  &status,
378  &entry[port_id][UDP_ENTRY]);
379  if (result != DOCA_SUCCESS) {
380  DOCA_LOG_ERR("Failed to add entry: %s", doca_error_get_descr(result));
383  return result;
384  }
385  result = create_control_pipe(ports[port_id], &pipe);
386  if (result != DOCA_SUCCESS) {
387  DOCA_LOG_ERR("Failed to create control pipe: %s", doca_error_get_descr(result));
390  return result;
391  }
392 
393  result = add_control_pipe_entries(pipe, tcp_pipe, udp_pipe, &status);
394  if (result != DOCA_SUCCESS) {
397  return result;
398  }
399 
400  result = doca_flow_entries_process(ports[port_id], 0, DEFAULT_TIMEOUT_US, num_of_entries);
401  if (result != DOCA_SUCCESS) {
402  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
405  return result;
406  }
407 
408  if (status.nb_processed != num_of_entries || status.failure) {
409  DOCA_LOG_ERR("Failed to process entries");
412  return DOCA_ERROR_BAD_STATE;
413  }
414  }
415 
416  DOCA_LOG_INFO("Wait few seconds for packets to arrive");
417  sleep(5);
418 
420  shared_counter_ids,
421  query_results_array,
422  nb_ports);
423  if (result != DOCA_SUCCESS) {
424  DOCA_LOG_ERR("Failed to query shared counter resource: %s", doca_error_get_descr(result));
427  return result;
428  }
429 
430  DOCA_LOG_INFO("Query shared counter data:");
431  for (port_id = 0; port_id < nb_ports; port_id++) {
432  DOCA_LOG_INFO("Port %d:", port_id);
433  DOCA_LOG_INFO(" Total bytes: %ld", query_results_array[port_id].counter.total_bytes);
434  DOCA_LOG_INFO(" Total packets: %ld", query_results_array[port_id].counter.total_pkts);
435  }
436 
437  DOCA_LOG_INFO("Query per entry shared counter data:");
438  for (port_id = 0; port_id < nb_ports; port_id++) {
439  DOCA_LOG_INFO("Port %d:", port_id);
440  for (int i = 0; i < 2; i++) {
441  result = doca_flow_resource_query_entry(entry[port_id][i], &query_results_array[0]);
442  if (result != DOCA_SUCCESS) {
443  DOCA_LOG_ERR("Failed to query %s entry (Port %d): %s",
444  i == TCP_ENTRY ? "TCP" : "UDP",
445  port_id,
449  return result;
450  }
451  DOCA_LOG_INFO(" %s entry:", i == TCP_ENTRY ? "TCP" : "UDP");
452  DOCA_LOG_INFO(" Total bytes: %ld", query_results_array[port_id].counter.total_bytes);
453  DOCA_LOG_INFO(" Total packets: %ld", query_results_array[port_id].counter.total_pkts);
454  }
455  }
456 
459  return result;
460 }
#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)
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]
static doca_error_t create_control_pipe(struct doca_flow_port *port, struct doca_flow_pipe **pipe)
doca_error_t flow_shared_counter(int nb_queues)
static doca_error_t add_control_pipe_entries(struct doca_flow_pipe *control_pipe, struct doca_flow_pipe *tcp_pipe, struct doca_flow_pipe *udp_pipe, struct entries_status *status)
#define SET_L4_PORT(layer, port, value)
static doca_error_t create_shared_counter_pipe(struct doca_flow_port *port, int port_id, enum doca_flow_l4_type_ext out_l4_type, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(FLOW_SHARED_COUNTER)
static doca_error_t add_shared_counter_pipe_entry(struct doca_flow_pipe *pipe, enum doca_flow_l4_type_ext out_l4_type, uint32_t shared_counter_id, struct entries_status *status, struct doca_flow_pipe_entry **entry)
#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
doca flow layer 4 packet extend type
@ 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_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_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_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_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_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 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_EXPERIMENTAL doca_error_t doca_flow_resource_query_entry(struct doca_flow_pipe_entry *entry, struct doca_flow_resource_query *query_stats)
Extract information about specific entry.
@ DOCA_FLOW_SHARED_RESOURCE_COUNTER
Definition: doca_flow.h:95
@ DOCA_FLOW_PIPE_CONTROL
Definition: doca_flow.h:223
@ DOCA_FLOW_PIPE_BASIC
Definition: doca_flow.h:221
@ DOCA_FLOW_L3_META_IPV4
Definition: doca_flow.h:296
@ DOCA_FLOW_RESOURCE_TYPE_SHARED
Definition: doca_flow.h:614
@ DOCA_FLOW_FWD_PORT
Definition: doca_flow.h:744
@ DOCA_FLOW_FWD_PIPE
Definition: doca_flow.h:746
@ DOCA_FLOW_L4_META_UDP
Definition: doca_flow.h:310
@ 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
forwarding configuration
Definition: doca_flow.h:779
struct doca_flow_pipe * next_pipe
Definition: doca_flow.h:800
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
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
uint32_t shared_counter_id
Definition: doca_flow.h:992
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
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