NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_vxlan_shared_encap_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 <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 DOCA_LOG_REGISTER(FLOW_VXLAN_SHARED_ENCAP);
36 
37 #define ENCAP_RESOURCE_NUM 2
38 
39 /*
40  * Create DOCA Flow pipe with 5 tuple match and set pkt meta value
41  *
42  * @port [in]: port of the pipe
43  * @port_id [in]: port ID of the pipe
44  * @pipe [out]: created pipe pointer
45  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
46  */
47 static doca_error_t create_match_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
48 {
49  struct doca_flow_match match;
50  struct doca_flow_actions actions, *actions_arr[NB_ACTIONS_ARR];
51  struct doca_flow_fwd fwd;
52  struct doca_flow_pipe_cfg *pipe_cfg;
54 
55  memset(&match, 0, sizeof(match));
56  memset(&actions, 0, sizeof(actions));
57  memset(&fwd, 0, sizeof(fwd));
58 
59  /* 5 tuple match */
62  match.outer.ip4.src_ip = 0xffffffff;
63  match.outer.ip4.dst_ip = 0xffffffff;
65  match.outer.transport.src_port = 0xffff;
66  match.outer.transport.dst_port = 0xffff;
67 
68  /* set meta data to match on the egress domain */
69  actions.meta.pkt_meta = UINT32_MAX;
72  actions_arr[0] = &actions;
73 
74  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
75  if (result != DOCA_SUCCESS) {
76  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
77  return result;
78  }
79 
80  result = set_flow_pipe_cfg(pipe_cfg, "MATCH_PIPE", DOCA_FLOW_PIPE_BASIC, true);
81  if (result != DOCA_SUCCESS) {
82  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
83  goto destroy_pipe_cfg;
84  }
85  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, NULL);
86  if (result != DOCA_SUCCESS) {
87  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
88  goto destroy_pipe_cfg;
89  }
90  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, NULL, NB_ACTIONS_ARR);
91  if (result != DOCA_SUCCESS) {
92  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
93  goto destroy_pipe_cfg;
94  }
95 
96  /* forwarding traffic to other port */
98  fwd.port_id = port_id ^ 1;
99 
100  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
102  doca_flow_pipe_cfg_destroy(pipe_cfg);
103  return result;
104 }
105 
106 /*
107  * Create DOCA Flow pipe on EGRESS domain with match on the packet meta and encap action with changeable values
108  *
109  * @port [in]: port of the pipe
110  * @port_id [in]: pipe port ID
111  * @pipe [out]: created pipe pointer
112  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
113  */
114 static doca_error_t create_vxlan_shared_encap_pipe(struct doca_flow_port *port,
115  int port_id,
116  struct doca_flow_pipe **pipe)
117 {
118  struct doca_flow_match match;
120  struct doca_flow_actions actions, *actions_arr[NB_ACTIONS_ARR];
121  struct doca_flow_fwd fwd;
122  struct doca_flow_pipe_cfg *pipe_cfg;
124 
125  memset(&match, 0, sizeof(match));
126  memset(&match_mask, 0, sizeof(match_mask));
127  memset(&actions, 0, sizeof(actions));
128  memset(&fwd, 0, sizeof(fwd));
129 
130  /* match on pkt meta */
131  match_mask.meta.pkt_meta = UINT32_MAX;
132 
133  /* build basic outer VXLAN encap data*/
135  if (port_id == 0)
137  else
139  actions_arr[0] = &actions;
140 
141  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
142  if (result != DOCA_SUCCESS) {
143  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
144  return result;
145  }
146 
147  result = set_flow_pipe_cfg(pipe_cfg, "VXLAN_ENCAP_PIPE", DOCA_FLOW_PIPE_BASIC, true);
148  if (result != DOCA_SUCCESS) {
149  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
150  goto destroy_pipe_cfg;
151  }
153  if (result != DOCA_SUCCESS) {
154  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg domain: %s", doca_error_get_descr(result));
155  goto destroy_pipe_cfg;
156  }
157  result = doca_flow_pipe_cfg_set_match(pipe_cfg, &match, &match_mask);
158  if (result != DOCA_SUCCESS) {
159  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg match: %s", doca_error_get_descr(result));
160  goto destroy_pipe_cfg;
161  }
162  result = doca_flow_pipe_cfg_set_actions(pipe_cfg, actions_arr, NULL, NULL, NB_ACTIONS_ARR);
163  if (result != DOCA_SUCCESS) {
164  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
165  goto destroy_pipe_cfg;
166  }
167 
168  /* forwarding traffic to the wire */
170  fwd.port_id = port_id;
171 
172  result = doca_flow_pipe_create(pipe_cfg, &fwd, NULL, pipe);
174  doca_flow_pipe_cfg_destroy(pipe_cfg);
175  return result;
176 }
177 
178 /*
179  * Add DOCA Flow pipe entry with example 5 tuple match
180  *
181  * @pipe [in]: pipe of the entry
182  * @status [in]: user context for adding entry
183  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
184  */
185 static doca_error_t add_match_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
186 {
187  struct doca_flow_match match;
188  struct doca_flow_actions actions;
189  struct doca_flow_pipe_entry *entry;
191 
192  doca_be32_t dst_ip_addr = BE_IPV4_ADDR(8, 8, 8, 8);
193  doca_be32_t src_ip_addr = BE_IPV4_ADDR(1, 2, 3, 4);
194  doca_be16_t dst_port = rte_cpu_to_be_16(80);
195  doca_be16_t src_port = rte_cpu_to_be_16(1234);
196 
197  memset(&match, 0, sizeof(match));
198  memset(&actions, 0, sizeof(actions));
199 
200  match.outer.ip4.dst_ip = dst_ip_addr;
201  match.outer.ip4.src_ip = src_ip_addr;
204 
206  actions.outer.transport.src_port = rte_cpu_to_be_16(1235);
207  actions.action_idx = 0;
208 
209  result = doca_flow_pipe_add_entry(0, pipe, &match, &actions, NULL, NULL, 0, status, &entry);
210  if (result != DOCA_SUCCESS)
211  return result;
212 
213  return DOCA_SUCCESS;
214 }
215 
216 /*
217  * Add DOCA Flow pipe entry with example encap values
218  *
219  * @pipe [in]: pipe of the entry
220  * @port_id [in]: port id
221  * @status [in]: user context for adding entry
222  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise.
223  */
224 static doca_error_t add_vxlan_shared_encap_pipe_entry(struct doca_flow_pipe *pipe,
225  uint16_t port_id,
226  struct entries_status *status)
227 {
228  struct doca_flow_match match;
229  struct doca_flow_actions actions;
230  struct doca_flow_pipe_entry *entry;
232 
233  memset(&match, 0, sizeof(match));
234  memset(&actions, 0, sizeof(actions));
235 
236  match.meta.pkt_meta = DOCA_HTOBE32(1);
237 
239  if (port_id == 0)
241  else
243  actions.action_idx = 0;
244 
245  result = doca_flow_pipe_add_entry(0, pipe, &match, &actions, NULL, NULL, 0, status, &entry);
246  if (result != DOCA_SUCCESS)
247  return result;
248 
249  return DOCA_SUCCESS;
250 }
251 
252 /*
253  * Creat encap action
254  *
255  * @encap [in]: encap action
256  * @id [in]: encap resource id
257  */
258 static void create_encap_action(struct doca_flow_encap_action *encap, uint32_t id)
259 {
260  doca_be32_t encap_dst_ip_addr = BE_IPV4_ADDR(81, 81, 81, 81);
261  doca_be32_t encap_src_ip_addr = BE_IPV4_ADDR(11, 21, 31, 41);
262  uint8_t encap_ttl = 17;
263  doca_be32_t encap_vxlan_tun_id = DOCA_HTOBE32(0xadadad);
264  uint8_t src_mac[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
265  uint8_t dst_mac[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
266 
267  if (id == 1) {
268  encap_dst_ip_addr = BE_IPV4_ADDR(82, 82, 82, 82);
269  encap_src_ip_addr = BE_IPV4_ADDR(12, 22, 32, 42);
270  encap_ttl = 27;
271  encap_vxlan_tun_id = DOCA_HTOBE32(0xaeaeae);
272  }
273 
274  SET_MAC_ADDR(encap->outer.eth.src_mac, src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5]);
275  SET_MAC_ADDR(encap->outer.eth.dst_mac, dst_mac[0], dst_mac[1], dst_mac[2], dst_mac[3], dst_mac[4], dst_mac[5]);
277  encap->outer.ip4.src_ip = encap_src_ip_addr;
278  encap->outer.ip4.dst_ip = encap_dst_ip_addr;
279  encap->outer.ip4.ttl = encap_ttl;
282  encap->tun.type = DOCA_FLOW_TUN_VXLAN;
283  encap->tun.vxlan_tun_id = encap_vxlan_tun_id;
284 }
285 
286 /*
287  * Creat encap action
288  *
289  * @return: 0 on success and negative value otherwise
290  */
292 {
294  uint32_t i, id;
295  int ret;
296 
297  for (i = 0; i < ENCAP_RESOURCE_NUM; i++) {
298  create_encap_action(&res_cfg[i].encap_cfg.encap, i);
299  res_cfg[i].encap_cfg.is_l2 = true;
300 
301  id = i + 1;
303  if (ret)
304  return ret;
305  }
306 
307  return 0;
308 }
309 
310 /*
311  * Bind shared resource encap
312  *
313  * @port [in]: doca_flow port
314  * @port_id [in]: shared_encap to create flows if true
315  * @return: 0 on success and negative value otherwise
316  */
317 int bind_shared_resource_encap(struct doca_flow_port *port, uint16_t port_id)
318 {
319  uint32_t shared_res_arr[ENCAP_RESOURCE_NUM] = {0};
320  uint32_t i, id;
321  int ret;
322 
323  for (i = 0; i < ENCAP_RESOURCE_NUM; i++) {
324  id = i + 1;
325  shared_res_arr[i] = id;
326  }
327 
328  if (port_id == 0)
329  ret = doca_flow_shared_resources_bind(DOCA_FLOW_SHARED_RESOURCE_ENCAP, &shared_res_arr[0], 1, port);
330  else
331  ret = doca_flow_shared_resources_bind(DOCA_FLOW_SHARED_RESOURCE_ENCAP, &shared_res_arr[1], 1, port);
332  if (ret)
333  return ret;
334 
335  return 0;
336 }
337 
338 /*
339  * Creat flow vxlan with encap
340  *
341  * @nb_queues [in]: number of queues
342  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
343  */
345 {
346  int nb_ports = 2;
347  struct flow_resources resource = {0};
348  uint32_t nr_shared_resources[SHARED_RESOURCE_NUM_VALUES] = {0};
349  struct doca_flow_port *ports[nb_ports];
350  struct doca_dev *dev_arr[nb_ports];
351  uint32_t actions_mem_size[nb_ports];
352  struct doca_flow_pipe *pipe;
353  struct entries_status status_ingress;
354  int num_of_entries_ingress = 1;
355  struct entries_status status_egress;
356  int num_of_entries_egress = 1;
358  int port_id;
359 
360  nr_shared_resources[DOCA_FLOW_SHARED_RESOURCE_ENCAP] = ENCAP_RESOURCE_NUM + 1;
361  result = init_doca_flow(nb_queues, "vnf,hws", &resource, nr_shared_resources);
362  if (result != DOCA_SUCCESS) {
363  DOCA_LOG_ERR("Failed to init DOCA Flow: %s", doca_error_get_descr(result));
364  return result;
365  }
366 
367  memset(dev_arr, 0, sizeof(struct doca_dev *) * nb_ports);
368  ARRAY_INIT(actions_mem_size, ACTIONS_MEM_SIZE(nb_queues, num_of_entries_ingress + num_of_entries_egress));
370  if (result != DOCA_SUCCESS) {
371  DOCA_LOG_ERR("Failed to init DOCA ports: %s", doca_error_get_descr(result));
373  return result;
374  }
375 
377  if (result != DOCA_SUCCESS) {
378  DOCA_LOG_ERR("Create shared_encap resource failed: ret %d", result);
381  return result;
382  }
383 
384  for (int i = 0; i < nb_ports; i++) {
386  if (result != DOCA_SUCCESS) {
387  DOCA_LOG_ERR("Bind shared_encap resource failed: ret %d", result);
390  return result;
391  }
392  }
393  for (port_id = 0; port_id < nb_ports; port_id++) {
394  memset(&status_ingress, 0, sizeof(status_ingress));
395  memset(&status_egress, 0, sizeof(status_egress));
396 
397  result = create_match_pipe(ports[port_id], port_id, &pipe);
398  if (result != DOCA_SUCCESS) {
399  DOCA_LOG_ERR("Failed to create match pipe: %s", doca_error_get_descr(result));
402  return result;
403  }
404 
405  result = add_match_pipe_entry(pipe, &status_ingress);
406  if (result != DOCA_SUCCESS) {
407  DOCA_LOG_ERR("Failed to add entry to match pipe: %s", doca_error_get_descr(result));
410  return result;
411  }
412 
413  result = create_vxlan_shared_encap_pipe(ports[port_id ^ 1], port_id ^ 1, &pipe);
414  if (result != DOCA_SUCCESS) {
415  DOCA_LOG_ERR("Failed to create vxlan encap pipe: %s", doca_error_get_descr(result));
418  return result;
419  }
420 
421  result = add_vxlan_shared_encap_pipe_entry(pipe, port_id ^ 1, &status_egress);
422  if (result != DOCA_SUCCESS) {
423  DOCA_LOG_ERR("Failed to add entry to vxlan encap pipe: %s", doca_error_get_descr(result));
426  return result;
427  }
428 
429  result = doca_flow_entries_process(ports[port_id], 0, DEFAULT_TIMEOUT_US, num_of_entries_ingress);
430  if (result != DOCA_SUCCESS) {
431  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
434  return result;
435  }
436 
437  if (status_ingress.nb_processed != num_of_entries_ingress || status_ingress.failure) {
438  DOCA_LOG_ERR("Failed to process entries");
441  return DOCA_ERROR_BAD_STATE;
442  }
443 
444  result = doca_flow_entries_process(ports[port_id ^ 1], 0, DEFAULT_TIMEOUT_US, num_of_entries_egress);
445  if (result != DOCA_SUCCESS) {
446  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
449  return result;
450  }
451 
452  if (status_egress.nb_processed != num_of_entries_egress || status_egress.failure) {
453  DOCA_LOG_ERR("Failed to process entries");
456  return DOCA_ERROR_BAD_STATE;
457  }
458  }
459 
460  DOCA_LOG_INFO("Wait few seconds for packets to arrive");
461  sleep(10);
462 
465  return result;
466 }
#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 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 ENCAP_RESOURCE_NUM
static void create_encap_action(struct doca_flow_encap_action *encap, uint32_t id)
static doca_error_t add_match_pipe_entry(struct doca_flow_pipe *pipe, struct entries_status *status)
doca_error_t flow_vxlan_shared_encap(int nb_queues)
static int create_shared_resource_encap(void)
static doca_error_t add_vxlan_shared_encap_pipe_entry(struct doca_flow_pipe *pipe, uint16_t port_id, struct entries_status *status)
static doca_error_t create_vxlan_shared_encap_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(FLOW_VXLAN_SHARED_ENCAP)
int bind_shared_resource_encap(struct doca_flow_port *port, uint16_t port_id)
static doca_error_t create_match_pipe(struct doca_flow_port *port, int port_id, struct doca_flow_pipe **pipe)
#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
#define DOCA_FLOW_VXLAN_DEFAULT_PORT
Definition: doca_flow_net.h:49
@ DOCA_FLOW_L4_TYPE_EXT_UDP
@ DOCA_FLOW_L4_TYPE_EXT_TRANSPORT
@ DOCA_FLOW_L3_TYPE_IP4
@ DOCA_FLOW_TUN_VXLAN
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_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_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_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_SHARED_RESOURCE_ENCAP
Definition: doca_flow.h:103
@ 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_PIPE_DOMAIN_EGRESS
Definition: doca_flow.h:245
#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
doca flow actions information
Definition: doca_flow.h:684
struct doca_flow_header_format outer
Definition: doca_flow.h:703
enum doca_flow_resource_type encap_type
Definition: doca_flow.h:707
struct doca_flow_meta meta
Definition: doca_flow.h:699
uint32_t shared_encap_id
Definition: doca_flow.h:712
uint8_t action_idx
Definition: doca_flow.h:685
doca flow encap data information
Definition: doca_flow.h:566
struct doca_flow_tun tun
Definition: doca_flow.h:569
struct doca_flow_header_format outer
Definition: doca_flow.h:567
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]
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_eth eth
Definition: doca_flow.h:440
struct doca_flow_header_l4_port transport
Definition: doca_flow.h:463
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_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
struct doca_flow_meta meta
Definition: doca_flow.h:494
doca_be32_t pkt_meta
Definition: doca_flow.h:359
enum doca_flow_l3_meta outer_l3_type
Definition: doca_flow.h:382
struct doca_flow_encap_action encap
Definition: doca_flow.h:663
doca flow shared resource configuration
Definition: doca_flow.h:953
struct doca_flow_resource_encap_cfg encap_cfg
Definition: doca_flow.h:959
enum doca_flow_tun_type type
doca_be32_t vxlan_tun_id
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