NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_ct_common.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 <doca_log.h>
27 #include <doca_bitfield.h>
28 
29 #include <dpdk_utils.h>
30 
31 #include "flow_ct_common.h"
32 
33 #define DPDK_ADDITIONAL_ARG 2
34 
35 DOCA_LOG_REGISTER(FLOW_CT_COMMON);
36 
37 /*
38  * ARGP Callback - Handle DOCA Flow CT device PCI address parameter
39  *
40  * @param [in]: Input parameter
41  * @config [in/out]: Program configuration context
42  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
43  */
44 static doca_error_t pci_addr_callback(void *param, void *config)
45 {
46  struct ct_config *cfg = (struct ct_config *)config;
47  const char *dev_pci_addr = (char *)param;
48  int len;
49 
50  len = strnlen(dev_pci_addr, DOCA_DEVINFO_PCI_ADDR_SIZE);
51  /* Check using >= to make static code analysis satisfied */
53  DOCA_LOG_ERR("Entered device PCI address exceeding the maximum size of %d",
56  }
57 
58  /* The string will be '\0' terminated due to the strnlen check above */
59  strncpy(cfg->ct_dev_pci_addr[cfg->n_ports++], dev_pci_addr, len + 1);
60 
61  return DOCA_SUCCESS;
62 }
63 
64 #define FNV1A_32_OFFSET (uint32_t)2166136261
65 #define FNV1A_32_PRIME (uint32_t)16777619
66 /*
67  * FNV1A 32 bit hash calculation function
68  *
69  * @buf [in]: Input buffer to calculates hash on it's byte
70  * @len [in]: Bytes size of the input buffer
71  * @hash [in]: FNV1A_32_OFFSET or previous hash calculation
72  * @return: FNV1A hash calculation of the buffer
73  */
74 static uint32_t fnv1a_32bit_hash(const void *buf, size_t len, uint32_t hash)
75 {
76  const uint8_t *bytes = (const uint8_t *)buf;
77  size_t i;
78 
79  for (i = 0; i < len; i++) {
80  hash ^= (uint32_t)bytes[i];
81  hash *= FNV1A_32_PRIME;
82  }
83 
84  return hash;
85 }
86 
88 {
90 
91  struct doca_argp_param *dev_pci_addr_param;
92 
93  /* Create and register DOCA Flow CT device PCI address */
94  result = doca_argp_param_create(&dev_pci_addr_param);
95  if (result != DOCA_SUCCESS) {
96  DOCA_LOG_ERR("Failed to create ARGP param: %s", doca_error_get_descr(result));
97  return result;
98  }
99  doca_argp_param_set_short_name(dev_pci_addr_param, "p");
100  doca_argp_param_set_long_name(dev_pci_addr_param, "pci");
101  doca_argp_param_set_description(dev_pci_addr_param, "DOCA Flow CT device PCI address");
102  doca_argp_param_set_callback(dev_pci_addr_param, pci_addr_callback);
103  doca_argp_param_set_type(dev_pci_addr_param, DOCA_ARGP_TYPE_STRING);
104  doca_argp_param_set_mandatory(dev_pci_addr_param);
105  doca_argp_param_set_multiplicity(dev_pci_addr_param);
106  result = doca_argp_register_param(dev_pci_addr_param);
107  if (result != DOCA_SUCCESS) {
108  DOCA_LOG_ERR("Failed to register program param: %s", doca_error_get_descr(result));
109  return result;
110  }
111 
112  return DOCA_SUCCESS;
113 }
114 
116  uint32_t nb_arm_queues,
117  uint32_t nb_ctrl_queues,
118  uint32_t nb_user_actions,
120  uint32_t nb_ipv4_sessions,
121  uint32_t nb_ipv6_sessions,
122  uint32_t dup_filter_sz,
123  bool o_match_inner,
124  struct doca_flow_meta *o_zone_mask,
125  struct doca_flow_meta *o_modify_mask,
126  bool r_match_inner,
127  struct doca_flow_meta *r_zone_mask,
128  struct doca_flow_meta *r_modify_mask)
129 {
130  struct doca_flow_ct_cfg *ct_cfg;
132 
133  if (o_zone_mask == NULL || o_modify_mask == NULL) {
134  DOCA_LOG_ERR("Origin masks can't be null");
136  } else if (r_zone_mask == NULL || r_modify_mask == NULL) {
137  DOCA_LOG_ERR("Reply masks can't be null");
139  }
140 
141  result = doca_flow_ct_cfg_create(&ct_cfg);
142  if (result != DOCA_SUCCESS) {
143  DOCA_LOG_ERR("Failed to create DOCA Flow CT config: %s", doca_error_get_name(result));
144  return result;
145  }
146 
147  doca_flow_ct_cfg_set_flags(ct_cfg, flags);
148  doca_flow_ct_cfg_set_queues(ct_cfg, nb_arm_queues);
149  doca_flow_ct_cfg_set_ctrl_queues(ct_cfg, nb_ctrl_queues);
150  doca_flow_ct_cfg_set_user_actions(ct_cfg, nb_user_actions);
151  doca_flow_ct_cfg_set_aging_core(ct_cfg, nb_arm_queues + 1);
153  doca_flow_ct_cfg_set_connections(ct_cfg, nb_ipv4_sessions, nb_ipv6_sessions, 0);
154  doca_flow_ct_cfg_set_dup_filter_size(ct_cfg, dup_filter_sz);
155  doca_flow_ct_cfg_set_direction(ct_cfg, false, o_match_inner, o_zone_mask, o_modify_mask);
156  doca_flow_ct_cfg_set_direction(ct_cfg, true, r_match_inner, r_zone_mask, r_modify_mask);
157 
158  result = doca_flow_ct_init(ct_cfg);
159  if (result != DOCA_SUCCESS)
160  DOCA_LOG_ERR("Failed to initialize DOCA Flow CT: %s", doca_error_get_name(result));
161 
162  doca_flow_ct_cfg_destroy(ct_cfg);
163 
164  return result;
165 }
166 
167 doca_error_t flow_ct_dpdk_init(int argc, char **dpdk_argv)
168 {
169  char *argv[argc + DPDK_ADDITIONAL_ARG];
170 
171  memcpy(argv, dpdk_argv, sizeof(argv[0]) * argc);
172  argv[argc++] = "-a";
173  argv[argc++] = "pci:00:00.0";
174 
175  return dpdk_init(argc, argv);
176 }
177 
178 doca_error_t flow_ct_capable(struct doca_devinfo *dev_info)
179 {
181 }
182 
183 uint32_t flow_ct_hash_6tuple(const struct doca_flow_ct_match *match, doca_be32_t zone_field, bool is_ipv6)
184 {
185  uint32_t hash = FNV1A_32_OFFSET;
186  uint32_t zone;
187 
188  if (is_ipv6) {
189  zone = DOCA_BE32_GET(match->ipv6.metadata, zone_field);
190  hash = fnv1a_32bit_hash(match->ipv6.src_ip, 4, hash);
191  hash = fnv1a_32bit_hash(match->ipv6.dst_ip, 4, hash);
192  hash = fnv1a_32bit_hash(&match->ipv6.l4_port.dst_port, 1, hash);
193  hash = fnv1a_32bit_hash(&match->ipv6.l4_port.src_port, 1, hash);
194  hash = fnv1a_32bit_hash(&match->ipv6.next_proto, 1, hash);
195  hash = fnv1a_32bit_hash(&zone, 1, hash);
196  } else {
197  zone = DOCA_BE32_GET(match->ipv4.metadata, zone_field);
198  hash = fnv1a_32bit_hash(&match->ipv4.src_ip, 1, hash);
199  hash = fnv1a_32bit_hash(&match->ipv4.dst_ip, 1, hash);
200  hash = fnv1a_32bit_hash(&match->ipv4.l4_port.dst_port, 1, hash);
201  hash = fnv1a_32bit_hash(&match->ipv4.l4_port.src_port, 1, hash);
202  hash = fnv1a_32bit_hash(&match->ipv4.next_proto, 1, hash);
203  hash = fnv1a_32bit_hash(&zone, 1, hash);
204  }
205 
206  return hash;
207 }
208 
209 void cleanup_procedure(struct doca_flow_pipe *ct_pipe, int nb_ports, struct doca_flow_port *ports[])
210 {
212 
213  if (ct_pipe != NULL)
214  doca_flow_pipe_destroy(ct_pipe);
215 
217  if (result != DOCA_SUCCESS)
218  DOCA_LOG_ERR("Failed to stop doca flow ports: %s", doca_error_get_descr(result));
219 
222 }
223 
224 doca_error_t create_ct_root_pipe(struct doca_flow_port *port,
225  bool is_ipv4,
226  bool is_ipv6,
227  enum doca_flow_l4_meta l4_type,
228  struct doca_flow_pipe *fwd_pipe,
229  struct entries_status *status,
230  struct doca_flow_pipe **pipe)
231 {
232  struct doca_flow_match match;
233  struct doca_flow_fwd fwd;
234  struct doca_flow_pipe_cfg *pipe_cfg;
236 
237  memset(&fwd, 0, sizeof(fwd));
238 
239  result = doca_flow_pipe_cfg_create(&pipe_cfg, port);
240  if (result != DOCA_SUCCESS) {
241  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
242  return result;
243  }
244 
245  result = set_flow_pipe_cfg(pipe_cfg, "root", DOCA_FLOW_PIPE_CONTROL, true);
246  if (result != DOCA_SUCCESS) {
247  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
248  goto destroy_pipe_cfg;
249  }
250 
251  result = doca_flow_pipe_create(pipe_cfg, NULL, NULL, pipe);
252  if (result != DOCA_SUCCESS) {
253  DOCA_LOG_ERR("Failed to create root pipe: %s", doca_error_get_descr(result));
254  goto destroy_pipe_cfg;
255  }
256  doca_flow_pipe_cfg_destroy(pipe_cfg);
257 
259  fwd.next_pipe = fwd_pipe;
260 
261  /* Match IPv4 and IPv6 TCP packets */
262  if (is_ipv4) {
263  memset(&match, 0, sizeof(match));
265  match.parser_meta.outer_l4_type = l4_type;
267  match.outer.ip4.dst_ip = BE_IPV4_ADDR(1, 1, 1, 1);
269  1,
270  *pipe,
271  &match,
272  NULL,
273  NULL,
274  NULL,
275  NULL,
276  NULL,
277  NULL,
278  &fwd,
279  status,
280  NULL);
281  if (result != DOCA_SUCCESS) {
282  DOCA_LOG_ERR("Failed to add root pipe IPv4 entry: %s", doca_error_get_descr(result));
283  return result;
284  }
285 
286  match.outer.ip4.dst_ip = 0;
287  match.outer.ip4.src_ip = BE_IPV4_ADDR(1, 1, 1, 1);
289  1,
290  *pipe,
291  &match,
292  NULL,
293  NULL,
294  NULL,
295  NULL,
296  NULL,
297  NULL,
298  &fwd,
299  status,
300  NULL);
301  if (result != DOCA_SUCCESS) {
302  DOCA_LOG_ERR("Failed to add root pipe IPv4 entry: %s", doca_error_get_descr(result));
303  return result;
304  }
305  }
306 
307  if (is_ipv6) {
308  memset(&match, 0, sizeof(match));
310  match.parser_meta.outer_l4_type = l4_type;
312  match.outer.ip6.dst_ip[0] = 0x01010101;
313  match.outer.ip6.dst_ip[1] = 0x01010101;
314  match.outer.ip6.dst_ip[2] = 0x01010101;
315  match.outer.ip6.dst_ip[3] = 0x01010101;
317  1,
318  *pipe,
319  &match,
320  NULL,
321  NULL,
322  NULL,
323  NULL,
324  NULL,
325  NULL,
326  &fwd,
327  status,
328  NULL);
329  if (result != DOCA_SUCCESS) {
330  DOCA_LOG_ERR("Failed to add IPv6 root pipe entry: %s", doca_error_get_descr(result));
331  return result;
332  }
333 
334  memset(match.outer.ip6.dst_ip, 0, sizeof(match.outer.ip6.dst_ip));
335  match.outer.ip6.src_ip[0] = 0x01010101;
336  match.outer.ip6.src_ip[1] = 0x01010101;
337  match.outer.ip6.src_ip[2] = 0x01010101;
338  match.outer.ip6.src_ip[3] = 0x01010101;
340  1,
341  *pipe,
342  &match,
343  NULL,
344  NULL,
345  NULL,
346  NULL,
347  NULL,
348  NULL,
349  &fwd,
350  status,
351  NULL);
352  if (result != DOCA_SUCCESS) {
353  DOCA_LOG_ERR("Failed to add IPv6 root pipe entry: %s", doca_error_get_descr(result));
354  return result;
355  }
356  }
357 
358  /* Drop non TCP packets */
360  memset(&match, 0, sizeof(match));
362  2,
363  *pipe,
364  &match,
365  NULL,
366  NULL,
367  NULL,
368  NULL,
369  NULL,
370  NULL,
371  &fwd,
372  status,
373  NULL);
374  if (result != DOCA_SUCCESS) {
375  DOCA_LOG_ERR("Failed to add root pipe drop entry: %s", doca_error_get_descr(result));
376  return result;
377  }
378 
380  if (result != DOCA_SUCCESS)
381  DOCA_LOG_ERR("Failed to process root entry: %s", doca_error_get_descr(result));
382 
383  return result;
384 
386  doca_flow_pipe_cfg_destroy(pipe_cfg);
387  return result;
388 }
389 
390 doca_error_t flow_ct_queue_reserve(struct doca_flow_port *port,
391  uint16_t ct_queue,
392  struct entries_status *status,
393  uint32_t room)
394 {
396 
397  if (room == 0)
398  room = CT_DEFAULT_QUEUE_DEPTH;
399  else if (room > CT_DEFAULT_QUEUE_DEPTH) {
400  DOCA_LOG_ERR("Expecting room is bigger than default queue depth");
402  }
403 
404  result = doca_flow_ct_entries_process(port, ct_queue, room, room, NULL);
405  if (result != DOCA_SUCCESS)
406  DOCA_LOG_ERR("Failed to process entries: %s", doca_error_get_descr(result));
407  if (status->failure) {
408  DOCA_LOG_ERR("Failed to process entries, status is not success");
409  return DOCA_ERROR_BAD_STATE;
410  }
411  return DOCA_SUCCESS;
412 }
#define NULL
Definition: __stddef_null.h:26
int32_t result
struct rte_eth_dev_info dev_info
Definition: device.c:32
uint64_t len
doca_error_t dpdk_init(int argc, char **argv)
Definition: dpdk_utils.c:907
uint32_t flow_ct_hash_6tuple(const struct doca_flow_ct_match *match, doca_be32_t zone_field, bool is_ipv6)
doca_error_t flow_ct_dpdk_init(int argc, char **dpdk_argv)
static doca_error_t pci_addr_callback(void *param, void *config)
doca_error_t init_doca_flow_ct(uint32_t flags, uint32_t nb_arm_queues, uint32_t nb_ctrl_queues, uint32_t nb_user_actions, doca_flow_ct_entry_finalize_cb entry_finalize_cb, uint32_t nb_ipv4_sessions, uint32_t nb_ipv6_sessions, uint32_t dup_filter_sz, bool o_match_inner, struct doca_flow_meta *o_zone_mask, struct doca_flow_meta *o_modify_mask, bool r_match_inner, struct doca_flow_meta *r_zone_mask, struct doca_flow_meta *r_modify_mask)
DOCA_LOG_REGISTER(FLOW_CT_COMMON)
doca_error_t flow_ct_capable(struct doca_devinfo *dev_info)
#define FNV1A_32_OFFSET
doca_error_t flow_ct_register_params(void)
static uint32_t fnv1a_32bit_hash(const void *buf, size_t len, uint32_t hash)
doca_error_t create_ct_root_pipe(struct doca_flow_port *port, bool is_ipv4, bool is_ipv6, enum doca_flow_l4_meta l4_type, struct doca_flow_pipe *fwd_pipe, struct entries_status *status, struct doca_flow_pipe **pipe)
doca_error_t flow_ct_queue_reserve(struct doca_flow_port *port, uint16_t ct_queue, struct entries_status *status, uint32_t room)
#define DPDK_ADDITIONAL_ARG
void cleanup_procedure(struct doca_flow_pipe *ct_pipe, int nb_ports, struct doca_flow_port *ports[])
#define FNV1A_32_PRIME
#define CT_DEFAULT_QUEUE_DEPTH
static void entry_finalize_cb(struct doca_flow_pipe *pipe, void *entry, uint16_t ct_queue, void *usr_ctx)
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
#define BE_IPV4_ADDR(a, b, c, d)
Definition: flow_parser.c:64
static struct doca_flow_fwd fwd
Definition: flow_parser.c:109
#define DEFAULT_TIMEOUT_US
Definition: flow_skeleton.c:36
#define DOCA_BE32_GET(_m, _f)
DOCA_EXPERIMENTAL void doca_argp_param_set_description(struct doca_argp_param *param, const char *description)
Set the description of the program param, used during program usage.
DOCA_EXPERIMENTAL void doca_argp_param_set_long_name(struct doca_argp_param *param, const char *name)
Set the long name of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_callback(struct doca_argp_param *param, doca_argp_param_cb_t callback)
Set the callback function of the program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_mandatory(struct doca_argp_param *param)
Mark the program param as mandatory.
DOCA_EXPERIMENTAL doca_error_t doca_argp_param_create(struct doca_argp_param **param)
Create new program param.
DOCA_EXPERIMENTAL void doca_argp_param_set_type(struct doca_argp_param *param, enum doca_argp_type type)
Set the type of the param arguments.
DOCA_EXPERIMENTAL void doca_argp_param_set_short_name(struct doca_argp_param *param, const char *name)
Set the short name of the program param.
DOCA_EXPERIMENTAL doca_error_t doca_argp_register_param(struct doca_argp_param *input_param)
Register a program flag.
DOCA_EXPERIMENTAL void doca_argp_param_set_multiplicity(struct doca_argp_param *param)
Mark the program param as supporting multiple appearances.
@ DOCA_ARGP_TYPE_STRING
Definition: doca_argp.h:56
#define DOCA_DEVINFO_PCI_ADDR_SIZE
Buffer size to hold PCI BDF format: "XXXX:XX:XX.X". Including a null terminator.
Definition: doca_dev.h:313
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_name(doca_error_t error)
Returns the string representation of an error code name.
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_EXPERIMENTAL doca_error_t doca_flow_ct_entries_process(struct doca_flow_port *port, uint16_t pipe_queue, uint32_t min_room, uint32_t max_processed_entries, uint32_t *queue_room)
Process CT entries in queue.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_direction(struct doca_flow_ct_cfg *cfg, bool direction, bool match_inner, struct doca_flow_meta *zone_match_mask, struct doca_flow_meta *meta_modify_mask)
Set CT configuration origin and reply direction.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_create(struct doca_flow_ct_cfg **cfg)
Create CT configuration.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_flags(struct doca_flow_ct_cfg *cfg, uint32_t flags)
Set CT flags.
void(* doca_flow_ct_entry_finalize_cb)(struct doca_flow_pipe *pipe, void *entry, uint16_t queue, void *usr_ctx)
Definition: doca_flow_ct.h:72
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_user_actions(struct doca_flow_ct_cfg *cfg, uint32_t n_user_actions)
Set number of user actions.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_ctrl_queues(struct doca_flow_ct_cfg *cfg, uint32_t n_ctrl_queues)
Set number of control queues.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_queues(struct doca_flow_ct_cfg *cfg, uint32_t n_queues)
Set number of hardware queues.
DOCA_EXPERIMENTAL void doca_flow_ct_destroy(void)
Destroy the doca flow ct.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_dup_filter_size(struct doca_flow_ct_cfg *cfg, uint32_t dup_filter_sz)
Set Number of connections to cache in duplication filter.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cap_is_dev_supported(const struct doca_devinfo *devinfo)
Check if doca device supported by CT.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_aging_core(struct doca_flow_ct_cfg *cfg, uint32_t aging_core)
Set core ID to run aging thread on.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_init(const struct doca_flow_ct_cfg *cfg)
Initialize the doca flow ct.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_connections(struct doca_flow_ct_cfg *cfg, uint32_t n_ipv4, uint32_t n_ipv6, uint32_t n_total)
Set number of ARM sessions.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_set_entry_finalize_cb(struct doca_flow_ct_cfg *cfg, doca_flow_ct_entry_finalize_cb entry_finalize_cb)
Set entry finalize callback to query connection final stats.
DOCA_EXPERIMENTAL doca_error_t doca_flow_ct_cfg_destroy(struct doca_flow_ct_cfg *cfg)
Destroy CT configuration.
@ DOCA_FLOW_L3_TYPE_IP6
@ 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_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_STABLE void doca_flow_pipe_destroy(struct doca_flow_pipe *pipe)
Destroy one pipe.
DOCA_STABLE void doca_flow_destroy(void)
Destroy the doca flow.
doca_flow_l4_meta
doca flow l4 valid type for parser meta
Definition: doca_flow.h:305
@ DOCA_FLOW_PIPE_CONTROL
Definition: doca_flow.h:223
@ DOCA_FLOW_L3_META_IPV4
Definition: doca_flow.h:296
@ DOCA_FLOW_L3_META_IPV6
Definition: doca_flow.h:298
@ DOCA_FLOW_FWD_PIPE
Definition: doca_flow.h:746
@ DOCA_FLOW_FWD_DROP
Definition: doca_flow.h:748
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
Definition: doca_log.h:466
uint32_t doca_be32_t
Definition: doca_types.h:121
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 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
struct doca_flow_header_l4_port l4_port
Definition: doca_flow_ct.h:623
doca_be32_t src_ip
Definition: doca_flow_ct.h:625
doca_be32_t metadata
Definition: doca_flow_ct.h:629
doca_be32_t dst_ip
Definition: doca_flow_ct.h:627
doca_be32_t metadata
Definition: doca_flow_ct.h:645
struct doca_flow_header_l4_port l4_port
Definition: doca_flow_ct.h:639
doca_be32_t src_ip[4]
Definition: doca_flow_ct.h:641
doca_be32_t dst_ip[4]
Definition: doca_flow_ct.h:643
doca flow CT match pattern
Definition: doca_flow_ct.h:654
struct doca_flow_ct_match4 ipv4
Definition: doca_flow_ct.h:656
struct doca_flow_ct_match6 ipv6
Definition: doca_flow_ct.h:657
forwarding configuration
Definition: doca_flow.h:779
struct doca_flow_pipe * next_pipe
Definition: doca_flow.h:800
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_l3_type l3_type
Definition: doca_flow.h:446
struct doca_flow_header_ip6 ip6
Definition: doca_flow.h:451
doca_be32_t dst_ip[4]
doca_be32_t src_ip[4]
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 flow meta data
Definition: doca_flow.h:358
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
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 struct doca_flow_port * ports[FLOW_SWITCH_PORTS_MAX]
Definition: switch_core.c:42