NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_ecmp_sample.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 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 <stdint.h>
27 #include <string.h>
28 #include <unistd.h>
29 
30 #include <rte_byteorder.h>
31 
32 #include <doca_log.h>
33 #include <doca_flow.h>
34 
35 #include "flow_common.h"
36 #include "flow_switch_common.h"
37 
38 DOCA_LOG_REGISTER(FLOW_ECMP);
39 
40 /* Get the percentage according to part and total */
41 #define GET_PERCENTAGE(part, total) (((double)part / (double)total) * 100)
42 
43 /* The number of seconds app waits for traffic to come */
44 #define WAITING_TIME 15
45 
46 #define MAX_ECMP_PORTS (8)
47 #define MAX_TOTAL_PORTS ((MAX_ECMP_PORTS) + 1)
48 
49 /*
50  * Create DOCA Flow root pipe on the switch port and add its entries.
51  *
52  * This pipe matches on outer L3 and L4 type,
53  * only IPv6 packet and either UDP or TCP packets are forwarded to hash pipe.
54  *
55  * @port [in]: port of the pipe.
56  * @shared_counter_id [in]: shared counter ID to use in monitor for all entries.
57  * @next_pipe [in]: pointer to the hash pipe for forwarding to.
58  * @status [in]: user context for adding entry.
59  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
60  */
61 static doca_error_t create_root_pipe(struct doca_flow_port *port,
62  uint32_t shared_counter_id,
63  struct doca_flow_pipe *next_pipe,
64  struct entries_status *status)
65 {
66  struct doca_flow_pipe *pipe;
67  struct doca_flow_pipe_entry *entry;
68  struct doca_flow_match match;
70  struct doca_flow_fwd fwd;
71  struct doca_flow_pipe_cfg *pipe_cfg;
73 
74  memset(&match, 0, sizeof(match));
75  memset(&monitor, 0, sizeof(monitor));
76  memset(&fwd, 0, sizeof(fwd));
77 
78  match.parser_meta.outer_l3_type = DOCA_FLOW_L3_META_IPV6; /* Specific */
79  match.parser_meta.outer_l4_type = UINT32_MAX; /* Changeable per entry */
80 
82  monitor.shared_counter.shared_counter_id = shared_counter_id; /* Specific */
83 
84  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
85  if (result != DOCA_SUCCESS) {
86  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
87  return result;
88  }
89 
90  result = set_flow_pipe_cfg(pipe_cfg, "ROOT_PIPE", DOCA_FLOW_PIPE_BASIC, true);
91  if (result != DOCA_SUCCESS) {
92  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
93  goto destroy_pipe_cfg;
94  }
96  if (result != DOCA_SUCCESS) {
97  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg nr_entries: %s", doca_error_get_descr(result));
98  goto destroy_pipe_cfg;
99  }
100  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, NULL);
101  if (result != DOCA_SUCCESS) {
102  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
103  goto destroy_pipe_cfg;
104  }
106  if (result != DOCA_SUCCESS) {
107  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg monitor: %s", doca_error_get_descr(result));
108  goto destroy_pipe_cfg;
109  }
110 
112  fwd.next_pipe = next_pipe;
113 
114  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, &pipe);
115  if (result != DOCA_SUCCESS) {
116  DOCA_LOG_ERR("Failed to create root pipe: %s", doca_error_get_descr(result));
117  goto destroy_pipe_cfg;
118  }
119  doca_flow_pipe_cfg_destroy(pipe_cfg);
120 
123  if (result != DOCA_SUCCESS) {
124  DOCA_LOG_ERR("Failed to add UDP entry into root pipe: %s", doca_error_get_descr(result));
125  return result;
126  }
127 
129  result = doca_flow_pipe_add_entry(0, pipe, &match, NULL, NULL, NULL, DOCA_FLOW_NO_WAIT, status, &entry);
130  if (result != DOCA_SUCCESS) {
131  DOCA_LOG_ERR("Failed to add TCP entry into root pipe: %s", doca_error_get_descr(result));
132  return result;
133  }
134 
135  return DOCA_SUCCESS;
136 
138  doca_flow_pipe_cfg_destroy(pipe_cfg);
139  return result;
140 }
141 
142 /*
143  * Check for given number whether it is power of 2.
144  *
145  * @x [in]: number to check.
146  * @return: true if given number is power of 2, false otherwise.
147  */
148 static inline bool is_power_of_two(uint8_t x)
149 {
150  return (x != 0) && ((x & (x - 1)) == 0);
151 }
152 
153 /*
154  * Create DOCA Flow hash pipe on the switch port.
155  *
156  * The hash pipe calculates the entry index based on IPv6 flow label.
157  *
158  * @port [in]: port of the pipe.
159  * @nb_flows [in]: number entries of the pipe.
160  * @pipe [out]: created pipe pointer.
161  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
162  */
163 static doca_error_t create_hash_pipe(struct doca_flow_port *port, uint8_t nb_flows, struct doca_flow_pipe **pipe)
164 {
166  struct doca_flow_monitor monitor;
167  struct doca_flow_fwd fwd;
168  struct doca_flow_pipe_cfg *pipe_cfg;
170 
171  memset(&match_mask, 0, sizeof(match_mask));
172  memset(&monitor, 0, sizeof(monitor));
173  memset(&fwd, 0, sizeof(fwd));
174 
175  if (!is_power_of_two(nb_flows))
176  DOCA_LOG_WARN("Hash pipe nb_flows %u is not power of 2, part of traffic will be lost", nb_flows);
177 
178  /* match mask defines which header fields to use in order to calculate the entry index */
180  match_mask.outer.ip6.flow_label = rte_cpu_to_be_32(0x000fffff);
181 
183 
184  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
185  if (result != DOCA_SUCCESS) {
186  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
187  return result;
188  }
189 
190  result = set_flow_pipe_cfg(pipe_cfg, "HASH_PIPE", DOCA_FLOW_PIPE_HASH, false);
191  if (result != DOCA_SUCCESS) {
192  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
193  goto destroy_pipe_cfg;
194  }
195  result = doca_flow_pipe_cfg_set_nr_entries(pipe_cfg, nb_flows);
196  if (result != DOCA_SUCCESS) {
197  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg nr_entries: %s", doca_error_get_descr(result));
198  goto destroy_pipe_cfg;
199  }
201  if (result != DOCA_SUCCESS) {
202  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
203  goto destroy_pipe_cfg;
204  }
206  if (result != DOCA_SUCCESS) {
207  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg monitor: %s", doca_error_get_descr(result));
208  goto destroy_pipe_cfg;
209  }
210 
211  /* FWD component is defined per entry */
213  fwd.port_id = 0xffff;
214 
215  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
217  doca_flow_pipe_cfg_destroy(pipe_cfg);
218  return result;
219 }
220 
221 /*
222  * Add DOCA Flow pipe entries to the hash pipe.
223  *
224  * Each entry forwards to different port.
225  *
226  * @pipe [in]: pipe of the entry.
227  * @nb_ecmp_ports [in]: number of ECMP target ports which it number of requested entries.
228  * @entries [in]: array of entry pointers to use for adding entry function.
229  * @status [in]: user context for adding entry.
230  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
231  */
232 static doca_error_t add_hash_pipe_entries(struct doca_flow_pipe *pipe,
233  uint8_t nb_ecmp_ports,
234  struct doca_flow_pipe_entry **entries,
235  struct entries_status *status)
236 {
240  uint16_t target_port;
241  uint8_t i;
242 
243  for (i = 0; i < nb_ecmp_ports; i++) {
244  target_port = i + 1;
245  fwd.port_id = target_port;
246 
247  /* Last entry should be inserted with DOCA_FLOW_NO_WAIT flag */
248  if (i == nb_ecmp_ports - 1)
249  flags = DOCA_FLOW_NO_WAIT;
250 
251  result = doca_flow_pipe_hash_add_entry(0, pipe, i, NULL, NULL, &fwd, flags, status, &entries[i]);
252  if (result != DOCA_SUCCESS) {
253  DOCA_LOG_ERR("Failed to add hash pipe entry index %u: %s", i, doca_error_get_descr(result));
254  return result;
255  }
256  }
257 
258  return DOCA_SUCCESS;
259 }
260 
261 /*
262  * Show ECMP results.
263  *
264  * @counter_id [in]: shared counter ID used in root pipe - used to query total traffic.
265  * @entries [in]: array of entry pointers from hash pipe - used to query their counters.
266  * @nb_ecmp_ports [in]: number of ECMP target ports - it is equal to entries array size.
267  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
268  */
269 static doca_error_t show_ecmp_results(uint32_t counter_id, struct doca_flow_pipe_entry **entries, uint8_t nb_ecmp_ports)
270 {
271  struct doca_flow_resource_query root_query_stats;
272  struct doca_flow_resource_query hash_query_stats;
273  uint32_t total_packets;
274  uint32_t nb_packets;
275  double percentage;
277  uint8_t i;
278 
279  result = doca_flow_shared_resources_query(DOCA_FLOW_SHARED_RESOURCE_COUNTER, &counter_id, &root_query_stats, 1);
280  if (result != DOCA_SUCCESS) {
281  DOCA_LOG_ERR("Failed to query root pipe shared counter: %s", doca_error_get_descr(result));
282  return result;
283  }
284 
285  total_packets = root_query_stats.counter.total_pkts;
286  if (total_packets == 0) {
287  DOCA_LOG_DBG("No traffic is arrived, no results");
288  return DOCA_SUCCESS;
289  }
290 
291  DOCA_LOG_INFO("Show ECMP results, %u packets are distributed into %u ports:", total_packets, nb_ecmp_ports);
292 
293  for (i = 0; i < nb_ecmp_ports; i++) {
294  result = doca_flow_resource_query_entry(entries[i], &hash_query_stats);
295  if (result != DOCA_SUCCESS) {
296  DOCA_LOG_ERR("Failed to query hash pipe entry %u: %s", i, doca_error_get_descr(result));
297  return result;
298  }
299 
300  nb_packets = hash_query_stats.counter.total_pkts;
301  percentage = GET_PERCENTAGE(nb_packets, total_packets);
302 
303  DOCA_LOG_INFO("Port %u received %u packets which is %g%% of the traffic (%u/%u)",
304  i + 1,
305  nb_packets,
306  percentage,
307  nb_packets,
308  total_packets);
309  }
310 
311  return DOCA_SUCCESS;
312 }
313 
314 /*
315  * Run flow_ecmp sample.
316  *
317  * @nb_queues [in]: number of queues the sample will use
318  * @nb_ports [in]: number of ports the sample will use
319  * @ctx [in]: flow switch context the sample will use
320  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
321  */
322 doca_error_t flow_ecmp(int nb_queues, int nb_ports, struct flow_switch_ctx *ctx)
323 {
324  struct doca_flow_shared_resource_cfg cfg = {0};
325  uint32_t nr_shared_resources[SHARED_RESOURCE_NUM_VALUES] = {0};
326  struct flow_resources resource = {0};
327  uint32_t shared_counter_id = 0;
328  struct doca_flow_port *switch_port;
329  struct doca_flow_port *ports[MAX_TOTAL_PORTS];
330  struct doca_flow_pipe *hash_pipe;
331  struct doca_dev *dev_arr[MAX_TOTAL_PORTS];
333  uint8_t nb_ecmp_ports = nb_ports - 1;
334  uint8_t nb_entries = nb_ecmp_ports + 2;
335  struct doca_flow_pipe_entry *entries[MAX_ECMP_PORTS];
336  struct entries_status status;
338 
339  nr_shared_resources[DOCA_FLOW_SHARED_RESOURCE_COUNTER] = 1;
340  resource.nr_counters = nb_entries;
341 
342  if (nb_ports > MAX_TOTAL_PORTS) {
343  DOCA_LOG_ERR("Number provided ports %d is too big (maximal supported is %d)",
344  nb_ports,
347  }
348 
349  result = init_doca_flow(nb_queues, "switch,hws", &resource, nr_shared_resources);
350  if (result != DOCA_SUCCESS) {
351  DOCA_LOG_ERR("Failed to init DOCA Flow: %s", doca_error_get_descr(result));
352  return result;
353  }
354 
355  memset(dev_arr, 0, sizeof(struct doca_dev *) * nb_ports);
356  dev_arr[0] = ctx->doca_dev[0];
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  switch_port = doca_flow_port_switch_get(NULL);
366 
368  if (result != DOCA_SUCCESS) {
369  DOCA_LOG_ERR("Failed to configure shared counter for root pipe: %s", doca_error_get_descr(result));
372  return result;
373  }
374 
375  result = doca_flow_shared_resources_bind(DOCA_FLOW_SHARED_RESOURCE_COUNTER, &shared_counter_id, 1, switch_port);
376  if (result != DOCA_SUCCESS) {
377  DOCA_LOG_ERR("Failed to bind shared counter to port: %s", doca_error_get_descr(result));
380  return result;
381  }
382 
383  result = create_hash_pipe(switch_port, nb_ecmp_ports, &hash_pipe);
384  if (result != DOCA_SUCCESS) {
385  DOCA_LOG_ERR("Failed to create hash pipe: %s", doca_error_get_descr(result));
388  return result;
389  }
390 
391  memset(&status, 0, sizeof(status));
392 
393  result = add_hash_pipe_entries(hash_pipe, nb_ecmp_ports, entries, &status);
394  if (result != DOCA_SUCCESS) {
395  DOCA_LOG_ERR("Failed to add entries to hash pipe: %s", doca_error_get_descr(result));
398  return result;
399  }
400 
401  result = create_root_pipe(switch_port, shared_counter_id, hash_pipe, &status);
402  if (result != DOCA_SUCCESS) {
403  DOCA_LOG_ERR("Failed to create root pipe with entries: %s", doca_error_get_descr(result));
406  return result;
407  }
408 
410  if (result != DOCA_SUCCESS) {
411  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
414  return result;
415  }
416 
417  if (status.nb_processed != nb_entries || status.failure) {
418  DOCA_LOG_ERR("Failed to process entries");
421  return DOCA_ERROR_BAD_STATE;
422  }
423 
424  DOCA_LOG_INFO("Wait %u seconds for packets to arrive", WAITING_TIME);
425  sleep(WAITING_TIME);
426 
427  result = show_ecmp_results(shared_counter_id, entries, nb_ecmp_ports);
428  if (result != DOCA_SUCCESS) {
429  DOCA_LOG_ERR("Failed to show results: %s", doca_error_get_descr(result));
432  return result;
433  }
434 
437  return result;
438 }
#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 int nb_entries
DOCA_LOG_REGISTER(FLOW_ECMP)
#define MAX_ECMP_PORTS
#define GET_PERCENTAGE(part, total)
static doca_error_t create_hash_pipe(struct doca_flow_port *port, uint8_t nb_flows, struct doca_flow_pipe **pipe)
#define MAX_TOTAL_PORTS
#define WAITING_TIME
static doca_error_t create_root_pipe(struct doca_flow_port *port, uint32_t shared_counter_id, struct doca_flow_pipe *next_pipe, struct entries_status *status)
doca_error_t flow_ecmp(int nb_queues, int nb_ports, struct flow_switch_ctx *ctx)
static bool is_power_of_two(uint8_t x)
static doca_error_t add_hash_pipe_entries(struct doca_flow_pipe *pipe, uint8_t nb_ecmp_ports, struct doca_flow_pipe_entry **entries, struct entries_status *status)
static doca_error_t show_ecmp_results(uint32_t counter_id, struct doca_flow_pipe_entry **entries, uint8_t nb_ecmp_ports)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static struct doca_flow_pipe_entry * entries[NB_ENTRIES]
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_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
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_INVALID_VALUE
Definition: doca_error.h:44
@ DOCA_ERROR_BAD_STATE
Definition: doca_error.h:56
@ DOCA_SUCCESS
Definition: doca_error.h:38
@ DOCA_FLOW_L3_TYPE_IP6
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_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_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_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_pipe_hash_add_entry(uint16_t pipe_queue, struct doca_flow_pipe *pipe, uint32_t entry_index, const struct doca_flow_actions *actions, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, const enum doca_flow_flags_type flags, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to an hash pipe.
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_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_STABLE struct doca_flow_port * doca_flow_port_switch_get(const struct doca_flow_port *port)
Get doca flow switch port.
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_BASIC
Definition: doca_flow.h:221
@ DOCA_FLOW_PIPE_HASH
Definition: doca_flow.h:233
@ DOCA_FLOW_L3_META_IPV6
Definition: doca_flow.h:298
@ DOCA_FLOW_NO_WAIT
Definition: doca_flow.h:115
@ DOCA_FLOW_WAIT_FOR_BATCH
Definition: doca_flow.h:117
@ DOCA_FLOW_RESOURCE_TYPE_SHARED
Definition: doca_flow.h:614
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
Definition: doca_flow.h:615
@ 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_WARN(format,...)
Generates a WARNING application log message.
Definition: doca_log.h:476
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
Definition: doca_log.h:486
#define DOCA_LOG_DBG(format,...)
Generates a DEBUG application log message.
Definition: doca_log.h:496
const struct ip_frag_config * cfg
Definition: ip_frag_dp.c:0
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 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
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
enum doca_flow_l3_type l3_type
Definition: doca_flow.h:446
struct doca_flow_header_ip6 ip6
Definition: doca_flow.h:451
doca_be32_t flow_label
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
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
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
struct upf_accel_ctx * ctx