NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_geneve_opt_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 <stdint.h>
27 #include <string.h>
28 #include <unistd.h>
29 
30 #include <rte_byteorder.h>
31 
32 #include <doca_flow.h>
33 #include <doca_log.h>
34 
35 #include "flow_common.h"
36 
37 DOCA_LOG_REGISTER(FLOW_GENEVE_OPT);
38 
39 #define SAMPLE_CLASS_ID 0x107
40 
41 #define CHANGEABLE_32 (UINT32_MAX)
42 #define CHANGEABLE_16 (UINT16_MAX)
43 #define FULL_MASK_32 (UINT32_MAX)
44 
45 /*
46  * Fill list of GENEVE options parser user configuration
47  *
48  * @list [out]: list of option configurations
49  */
51 {
52  /*
53  * Prepare the configuration for first option.
54  *
55  * 0 1 2 3
56  * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
57  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
58  * | class (0x107) | type (1) | | len (5) |
59  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60  * | DW0 (not part of the parser) |
61  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
62  * | DW1 (part of the parser) |
63  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
64  * | DW2 (not part of the parser) |
65  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
66  * | DW3 (part of the parser) |
67  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
68  * | DW4 (not part of the parser) |
69  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
70  */
72  list[0].option_class = rte_cpu_to_be_16(SAMPLE_CLASS_ID);
73  list[0].option_type = 1;
74  list[0].option_len = 5; /* Data length - excluding the option header */
75  list[0].data_mask[0] = 0x0;
76  list[0].data_mask[1] = FULL_MASK_32;
77  list[0].data_mask[2] = 0x0;
78  list[0].data_mask[3] = FULL_MASK_32;
79  list[0].data_mask[4] = 0x0;
80 
81  /*
82  * Prepare the configuration for second option.
83  *
84  * 0 1 2 3
85  * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
86  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
87  * | class (0x107) | type (2) | | len (2) |
88  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
89  * | DW0 (part of the parser) |
90  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
91  * | DW1 (part of the parser) |
92  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
93  */
95  list[1].option_class = rte_cpu_to_be_16(SAMPLE_CLASS_ID);
96  list[1].option_type = 2;
97  list[1].option_len = 2; /* Data length - excluding the option header */
98  list[1].data_mask[0] = FULL_MASK_32;
99  list[1].data_mask[1] = FULL_MASK_32;
100 
101  /*
102  * Prepare the configuration for third option.
103  *
104  * 0 1 2 3
105  * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
106  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
107  * | class (0x107) | type (3) | | len (4) |
108  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
109  * | DW0 (not part of the parser) |
110  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
111  * | DW1 (not part of the parser) |
112  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
113  * | DW2 (not part of the parser) |
114  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
115  * | DW3 (part of the parser) |
116  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
117  */
119  list[2].option_class = rte_cpu_to_be_16(SAMPLE_CLASS_ID);
120  list[2].option_type = 3;
121  list[2].option_len = 4; /* Data length - excluding the option header */
122  list[2].data_mask[0] = 0x0;
123  list[2].data_mask[1] = 0x0;
124  list[2].data_mask[2] = 0x0;
125  list[2].data_mask[3] = FULL_MASK_32;
126 }
127 
128 /*
129  * Create DOCA Flow pipe that match GENEVE traffic with changeable GENEVE VNI and options and decap it.
130  *
131  * @port [in]: port of the pipe
132  * @port_id [in]: port ID of the pipe
133  * @pipe [out]: created pipe pointer
134  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
135  */
136 static doca_error_t create_geneve_opt_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
137 {
138  struct doca_flow_match match;
140  struct doca_flow_actions actions1, actions2, *actions_arr[2];
141  struct doca_flow_fwd fwd;
142  struct doca_flow_pipe_cfg *pipe_cfg;
143  uint8_t mac_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
145 
146  memset(&match, 0, sizeof(match));
147  memset(&match_mask, 0, sizeof(match_mask));
148  memset(&actions1, 0, sizeof(actions1));
149  memset(&actions2, 0, sizeof(actions2));
150  memset(&fwd, 0, sizeof(fwd));
151 
152  actions_arr[0] = &actions1;
153  actions_arr[1] = &actions2;
154 
159  match.tun.type = DOCA_FLOW_TUN_GENEVE;
160  match.tun.geneve.vni = CHANGEABLE_32;
161  match_mask.tun.geneve.vni = BUILD_VNI(0xffffff);
162 
163  /* First option - index 0 describes the option header */
164  match.tun.geneve_options[0].class_id = rte_cpu_to_be_16(SAMPLE_CLASS_ID);
165  match.tun.geneve_options[0].type = 1;
166  match.tun.geneve_options[0].length = 5;
168  match_mask.tun.geneve_options[0].type = 0xff;
169  /*
170  * Indexes 1-5 describe the option data, index 4 describes the 4th DW in data.
171  * Make data as changeable by cover all data (5 DWs).
172  */
178  /* Mask the only DW we want to match */
180 
181  /*
182  * Second option - index 6 describes the option header.
183  * The order of options in match structure is regardless to options order in parser creation.
184  * This pipe will match if the options will be present in any kind of order.
185  */
186  match.tun.geneve_options[6].class_id = rte_cpu_to_be_16(SAMPLE_CLASS_ID);
187  match.tun.geneve_options[6].type = 2;
188  match.tun.geneve_options[6].length = 2;
190  match_mask.tun.geneve_options[6].type = 0xff;
191  /*
192  * Indexes 7-8 describe the option data, index 7 describes the 1st DW in data and index 8
193  * describes the 2nd DW in data.
194  * Make data as changeable by cover all data (2 DWs).
195  */
198  /* We want to match the all DWs in data */
201 
202  /* Third option - index 9 describes the option header */
203  match.tun.geneve_options[9].class_id = rte_cpu_to_be_16(SAMPLE_CLASS_ID);
204  match.tun.geneve_options[9].type = 3;
205  match.tun.geneve_options[9].length = 4;
207  match_mask.tun.geneve_options[9].type = 0xff;
208  /*
209  * Indexes 10-13 describe the option data, index 13 describes the last DW in data (the 4th).
210  * Make data as changeable by cover all data (4 DWs).
211  */
212  match.tun.geneve_options[10].data = CHANGEABLE_32;
213  match.tun.geneve_options[11].data = CHANGEABLE_32;
214  match.tun.geneve_options[12].data = CHANGEABLE_32;
215  match.tun.geneve_options[13].data = CHANGEABLE_32;
216  /* Mask the only DW we want to match */
218 
220  actions1.decap_cfg.is_l2 = true;
221 
223  actions2.decap_cfg.is_l2 = false;
224  /* Append eth header after decap GENEVE L3 tunnel */
226  mac_addr[0],
227  mac_addr[1],
228  mac_addr[2],
229  mac_addr[3],
230  mac_addr[4],
231  mac_addr[5]);
233  mac_addr[0],
234  mac_addr[1],
235  mac_addr[2],
236  mac_addr[3],
237  mac_addr[4],
238  mac_addr[5]);
239  actions2.decap_cfg.eth.type = RTE_BE16(CHANGEABLE_16);
240 
241  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
242  if (result != DOCA_SUCCESS) {
243  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
244  return result;
245  }
246 
247  result = set_flow_pipe_cfg(pipe_cfg, "GENEVE_OPT_PIPE", DOCA_FLOW_PIPE_BASIC, true);
248  if (result != DOCA_SUCCESS) {
249  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
250  goto destroy_pipe_cfg;
251  }
252  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, &match_mask);
253  if (result != DOCA_SUCCESS) {
254  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
255  goto destroy_pipe_cfg;
256  }
257  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, NULL, 2);
258  if (result != DOCA_SUCCESS) {
259  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
260  goto destroy_pipe_cfg;
261  }
262 
264  fwd.port_id = port_id ^ 1;
265 
266  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
268  doca_flow_pipe_cfg_destroy(pipe_cfg);
269  return result;
270 }
271 
272 /*
273  * Add DOCA Flow pipe entries with example GENEVE VNI to match
274  *
275  * @pipe [in]: pipe of the entry
276  * @status [in]: user context for adding entry
277  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
278  */
279 static doca_error_t add_geneve_opt_pipe_entries(struct doca_flow_pipe *pipe, struct entries_status *status)
280 {
281  struct doca_flow_match match;
282  struct doca_flow_actions actions;
283  struct doca_flow_pipe_entry *entry;
284  uint8_t mac1[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
285  uint8_t mac2[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
287 
288  memset(&match, 0, sizeof(match));
289  memset(&actions, 0, sizeof(actions));
290 
291  match.tun.geneve.vni = BUILD_VNI(0xabcdef);
292  /* First option - data example */
293  match.tun.geneve_options[4].data = rte_cpu_to_be_32(0x00abcdef);
294  /* Second option - data example */
295  match.tun.geneve_options[7].data = rte_cpu_to_be_32(0x00abcdef);
296  match.tun.geneve_options[8].data = rte_cpu_to_be_32(0x00abcdef);
297  /* Third option - data example */
298  match.tun.geneve_options[13].data = rte_cpu_to_be_32(0x00abcdef);
299  actions.action_idx = 0;
300 
301  result = doca_flow_pipe_add_entry(0, pipe, &match, &actions, NULL, NULL, 0, status, &entry);
302  if (result != DOCA_SUCCESS)
303  return result;
304 
305  match.tun.geneve.vni = BUILD_VNI(0x123456);
306  /* First option - data example */
307  match.tun.geneve_options[4].data = rte_cpu_to_be_32(0x00123456);
308  /* Second option - data example */
309  match.tun.geneve_options[7].data = rte_cpu_to_be_32(0x00123456);
310  match.tun.geneve_options[8].data = rte_cpu_to_be_32(0x00123456);
311  /* Third option - data example */
312  match.tun.geneve_options[13].data = rte_cpu_to_be_32(0x00123456);
313  actions.action_idx = 1;
314  SET_MAC_ADDR(actions.decap_cfg.eth.src_mac, mac1[0], mac1[1], mac1[2], mac1[3], mac1[4], mac1[5]);
315  SET_MAC_ADDR(actions.decap_cfg.eth.dst_mac, mac2[0], mac2[1], mac2[2], mac2[3], mac2[4], mac2[5]);
317 
318  result = doca_flow_pipe_add_entry(0, pipe, &match, &actions, NULL, NULL, 0, status, &entry);
319  if (result != DOCA_SUCCESS)
320  return result;
321 
322  match.tun.geneve.vni = BUILD_VNI(0x778899);
323  /* First option - data example */
324  match.tun.geneve_options[4].data = rte_cpu_to_be_32(0x00778899);
325  /* Second option - data example */
326  match.tun.geneve_options[7].data = rte_cpu_to_be_32(0x00778899);
327  match.tun.geneve_options[8].data = rte_cpu_to_be_32(0x00778899);
328  /* Third option - data example */
329  match.tun.geneve_options[13].data = rte_cpu_to_be_32(0x00778899);
330  actions.action_idx = 1;
331  SET_MAC_ADDR(actions.decap_cfg.eth.src_mac, mac1[5], mac1[4], mac1[3], mac1[2], mac1[1], mac1[0]);
332  SET_MAC_ADDR(actions.decap_cfg.eth.dst_mac, mac2[5], mac2[4], mac2[3], mac2[2], mac2[1], mac2[0]);
334 
335  result = doca_flow_pipe_add_entry(0, pipe, &match, &actions, NULL, NULL, 0, status, &entry);
336  if (result != DOCA_SUCCESS)
337  return result;
338 
339  return DOCA_SUCCESS;
340 }
341 
342 /*
343  * Run flow_geneve_opt sample
344  *
345  * @nb_queues [in]: number of queues the sample will use
346  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
347  */
349 {
350  int nb_ports = 2;
351  uint8_t nb_options = 3;
352  struct flow_resources resource = {0};
353  uint32_t nr_shared_resources[SHARED_RESOURCE_NUM_VALUES] = {0};
354  struct doca_flow_parser_geneve_opt_cfg tlv_list[nb_options];
355  struct doca_flow_parser *parsers[nb_ports];
356  struct doca_flow_port *ports[nb_ports];
357  struct doca_dev *dev_arr[nb_ports];
358  uint32_t actions_mem_size[nb_ports];
359  struct doca_flow_pipe *pipes[nb_ports];
360  struct entries_status status;
361  uint32_t num_of_entries = 3;
363  int port_id;
364 
365  result = init_doca_flow(nb_queues, "vnf,hws", &resource, nr_shared_resources);
366  if (result != DOCA_SUCCESS) {
367  DOCA_LOG_ERR("Failed to init DOCA Flow: %s", doca_error_get_descr(result));
368  return result;
369  }
370 
371  memset(dev_arr, 0, sizeof(struct doca_dev *) * nb_ports);
372  ARRAY_INIT(actions_mem_size, ACTIONS_MEM_SIZE(nb_queues, num_of_entries));
374  if (result != DOCA_SUCCESS) {
375  DOCA_LOG_ERR("Failed to init DOCA ports: %s", doca_error_get_descr(result));
377  return result;
378  }
379 
380  memset(tlv_list, 0, sizeof(tlv_list[0]) * nb_options);
382 
383  for (port_id = 0; port_id < nb_ports; port_id++) {
384  memset(&status, 0, sizeof(status));
385 
386  result = doca_flow_parser_geneve_opt_create(ports[port_id], tlv_list, nb_options, &parsers[port_id]);
387  if (result != DOCA_SUCCESS) {
388  DOCA_LOG_ERR("Failed to create geneve parser: %s", doca_error_get_descr(result));
391  return result;
392  }
393 
394  result = create_geneve_opt_pipe(ports[port_id], port_id, &pipes[port_id]);
395  if (result != DOCA_SUCCESS) {
396  DOCA_LOG_ERR("Failed to add geneve opt pipe: %s", doca_error_get_descr(result));
399  return result;
400  }
401 
402  result = add_geneve_opt_pipe_entries(pipes[port_id], &status);
403  if (result != DOCA_SUCCESS) {
404  DOCA_LOG_ERR("Failed to add geneve pipe match entries: %s", doca_error_get_descr(result));
407  return result;
408  }
409 
410  result = flow_process_entries(ports[port_id], &status, num_of_entries);
411  if (result != DOCA_SUCCESS) {
412  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
415  return result;
416  }
417  }
418 
419  DOCA_LOG_INFO("Wait few seconds for packets to arrive");
420  sleep(10);
421 
424  return result;
425 }
#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
#define SET_MAC_ADDR(addr, a, b, c, d, e, f)
Definition: flow_common.h:60
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static doca_error_t create_geneve_opt_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
#define CHANGEABLE_16
static void fill_parser_geneve_opt_cfg_list(struct doca_flow_parser_geneve_opt_cfg *list)
doca_error_t flow_geneve_opt(int nb_queues)
#define SAMPLE_CLASS_ID
#define CHANGEABLE_32
#define FULL_MASK_32
DOCA_LOG_REGISTER(FLOW_GENEVE_OPT)
static doca_error_t add_geneve_opt_pipe_entries(struct doca_flow_pipe *pipe, struct entries_status *status)
static struct doca_flow_actions actions
Definition: flow_parser.c:107
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]
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_SUCCESS
Definition: doca_error.h:38
#define DOCA_FLOW_ETHER_TYPE_IPV6
Definition: doca_flow_net.h:58
#define DOCA_FLOW_ETHER_TYPE_IPV4
Definition: doca_flow_net.h:57
@ DOCA_FLOW_TUN_GENEVE
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_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_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_parser_geneve_opt_create(const struct doca_flow_port *port, const struct doca_flow_parser_geneve_opt_cfg tlv_list[], uint8_t nb_options, struct doca_flow_parser **parser)
Creates GENEVE TLV parser for the selected port.
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_BASIC
Definition: doca_flow.h:221
@ DOCA_FLOW_PARSER_GENEVE_OPT_MODE_FIXED
Definition: doca_flow.h:1122
@ DOCA_FLOW_L3_META_IPV4
Definition: doca_flow.h:296
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
Definition: doca_flow.h:615
@ DOCA_FLOW_FWD_PORT
Definition: doca_flow.h:744
@ DOCA_FLOW_L4_META_UDP
Definition: doca_flow.h:310
#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
doca_error_t flow_process_entries(struct doca_flow_port *port, struct entries_status *status, uint32_t nr_entries)
Definition: flow_common.c:338
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 BUILD_VNI(uint24_vni)
Definition: flow_common.h:56
#define ARRAY_INIT(array, val)
Definition: flow_common.h:71
doca flow actions information
Definition: doca_flow.h:684
enum doca_flow_resource_type decap_type
Definition: doca_flow.h:689
struct doca_flow_resource_decap_cfg decap_cfg
Definition: doca_flow.h:692
uint8_t action_idx
Definition: doca_flow.h:685
forwarding configuration
Definition: doca_flow.h:779
uint16_t port_id
Definition: doca_flow.h:795
enum doca_flow_fwd_type type
Definition: doca_flow.h:780
uint8_t dst_mac[DOCA_FLOW_ETHER_ADDR_LEN]
uint8_t src_mac[DOCA_FLOW_ETHER_ADDR_LEN]
doca flow matcher information
Definition: doca_flow.h:491
struct doca_flow_parser_meta parser_meta
Definition: doca_flow.h:496
struct doca_flow_tun tun
Definition: doca_flow.h:500
User configuration structure using to create parser for single GENEVE TLV option.
Definition: doca_flow.h:1131
enum doca_flow_parser_geneve_opt_mode match_on_class_mode
Definition: doca_flow.h:1132
doca_be32_t data_mask[DOCA_FLOW_GENEVE_DATA_OPTION_LEN_MAX]
Definition: doca_flow.h:1140
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
struct doca_flow_header_eth eth
Definition: doca_flow.h:673
enum doca_flow_tun_type type
union doca_flow_geneve_option geneve_options[DOCA_FLOW_GENEVE_OPT_LEN_MAX]
struct doca_flow_header_geneve geneve
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