NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
upf_accel_pipeline.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025 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 <unistd.h>
27 
28 #include <rte_ethdev.h>
29 
30 #include <doca_flow.h>
31 #include <doca_bitfield.h>
32 #include <doca_log.h>
33 
34 #include "upf_accel.h"
35 #include "upf_accel_pipeline.h"
36 
37 DOCA_LOG_REGISTER(UPF_ACCEL::PIPELINE);
38 
39 #define UPF_ACCEL_PSC_EXTENSION_CODE 0x85
40 
41 #define UPF_ACCEL_BUILD_VNI(uint24_vni) (DOCA_HTOBE32((uint32_t)uint24_vni << 8)) /* Create VNI match field */
42 
44  enum upf_accel_port port_id,
45  uint16_t pipe_queue,
46  struct doca_flow_pipe *pipe,
47  const struct doca_flow_match *match,
48  const struct doca_flow_actions *actions,
49  const struct doca_flow_monitor *mon,
50  const struct doca_flow_fwd *fwd,
51  uint32_t flags,
52  void *usr_ctx,
53  struct doca_flow_pipe_entry **entry)
54 {
55  const doca_error_t result =
56  doca_flow_pipe_add_entry(pipe_queue, pipe, match, actions, mon, fwd, flags, usr_ctx, entry);
57  if (result != DOCA_SUCCESS) {
58  DOCA_LOG_ERR("Failed to add static entry: %s", doca_error_get_descr(result));
59  return result;
60  }
62 
63  return result;
64 }
65 
66 /*
67  * Create a flow pipe
68  *
69  * @pipe_cfg [in]: UPF Acceleration pipe configuration
70  * @pipe [out]: pointer to store the created pipe at
71  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
72  */
73 static doca_error_t upf_accel_pipe_create(struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
74 {
75  struct doca_flow_pipe_cfg *cfg;
77 
79  if (result != DOCA_SUCCESS) {
80  DOCA_LOG_ERR("Failed to create doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
81  return result;
82  }
83 
84  result = set_flow_pipe_cfg(cfg, pipe_cfg->name, DOCA_FLOW_PIPE_BASIC, pipe_cfg->is_root);
85  if (result != DOCA_SUCCESS) {
86  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg: %s", doca_error_get_descr(result));
87  goto destroy_pipe_cfg;
88  }
89 
91  if (result != DOCA_SUCCESS) {
92  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg domain: %s", doca_error_get_descr(result));
93  goto destroy_pipe_cfg;
94  }
95 
97  if (result != DOCA_SUCCESS) {
98  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg num_entries: %s", doca_error_get_descr(result));
99  goto destroy_pipe_cfg;
100  }
101 
102  if (pipe_cfg->match != NULL) {
103  result = doca_flow_pipe_cfg_set_match(cfg, pipe_cfg->match, pipe_cfg->match_mask);
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  }
109 
110  if (pipe_cfg->mon != NULL) {
112  if (result != DOCA_SUCCESS) {
113  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg monitor: %s", doca_error_get_descr(result));
114  goto destroy_pipe_cfg;
115  }
116  }
117 
118  if (pipe_cfg->actions.num_actions) {
120  pipe_cfg->actions.action_list,
121  NULL,
122  pipe_cfg->actions.action_desc_list,
123  pipe_cfg->actions.num_actions);
124  if (result != DOCA_SUCCESS) {
125  DOCA_LOG_ERR("Failed to set doca_flow_pipe_cfg actions: %s", doca_error_get_descr(result));
126  goto destroy_pipe_cfg;
127  }
128  }
129 
130  result = doca_flow_pipe_create(cfg, pipe_cfg->fwd, pipe_cfg->fwd_miss, pipe);
131  if (result != DOCA_SUCCESS) {
132  DOCA_LOG_ERR("Failed to create UPF accel pipe: %s", doca_error_get_descr(result));
133  goto destroy_pipe_cfg;
134  }
135 
138  return result;
139 }
140 
141 /*
142  * Create a flow pipe that drops the packets
143  *
144  * @upf_accel_ctx [in]: UPF Acceleration context
145  * @pipe_cfg [in]: UPF Acceleration pipe configuration
146  * @drop_type [in]: Drop pipe type
147  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
148  */
150  struct upf_accel_pipe_cfg *pipe_cfg,
151  enum upf_accel_pipe_drop_type drop_type)
152 {
153  enum upf_accel_pipe_type drop_pipe_idx = upf_accel_drop_idx_get(pipe_cfg, drop_type);
154  struct doca_flow_pipe **pipe = &upf_accel_ctx->pipes[pipe_cfg->port_id][drop_pipe_idx];
156  uint8_t entry_idx = upf_accel_domain_idx_get(pipe_cfg->port_id, pipe_cfg->domain);
158  struct doca_flow_match match = {0};
159  char *pipe_name = "DROP_PIPE";
161 
162  pipe_cfg->name = pipe_name;
163  pipe_cfg->is_root = false;
164  pipe_cfg->num_entries = 1;
165  pipe_cfg->match = &match;
166  pipe_cfg->match_mask = NULL;
167  pipe_cfg->mon = &mon;
168  pipe_cfg->fwd = &fwd;
169  pipe_cfg->fwd_miss = NULL;
170  pipe_cfg->actions.num_actions = 0;
171 
172  result = upf_accel_pipe_create(pipe_cfg, pipe);
173  if (result != DOCA_SUCCESS) {
174  DOCA_LOG_ERR("Failed to create drop pipe: %s", doca_error_get_descr(result));
175  return result;
176  }
177 
179  pipe_cfg->port_id,
180  0,
181  *pipe,
182  NULL,
183  NULL,
184  NULL,
185  NULL,
186  0,
188  &upf_accel_ctx->drop_entries[drop_type][entry_idx]);
189  if (result != DOCA_SUCCESS) {
190  DOCA_LOG_ERR("Failed to add drop pipe entry: %s", doca_error_get_descr(result));
191  return result;
192  }
193 
194  return result;
195 }
196 
197 /*
198  * Create the drop flow pipes
199  *
200  * @upf_accel_ctx [in]: UPF Acceleration context
201  * @pipe_cfg [in]: UPF Acceleration pipe configuration
202  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
203  */
205  struct upf_accel_pipe_cfg *pipe_cfg)
206 {
208  int i;
209 
210  for (i = 0; i < UPF_ACCEL_DROP_NUM; i++) {
212  if (result != DOCA_SUCCESS) {
213  DOCA_LOG_ERR("Failed to create drop pipe %d: %s", i, doca_error_get_descr(result));
214  return result;
215  }
216  }
217 
218  return DOCA_SUCCESS;
219 }
220 
221 /*
222  * Create a flow pipe that sends the packets to SW
223  *
224  * @upf_accel_ctx [in]: UPF Acceleration context
225  * @pipe_cfg [in]: UPF Acceleration pipe configuration
226  * @is_ul [in]: boolean to indicate whether this pipe is for UL (GTP) pkts
227  * @pipe [out]: pointer to store the created pipe at
228  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
229  */
231  struct upf_accel_pipe_cfg *pipe_cfg,
232  bool is_ul,
233  struct doca_flow_pipe **pipe)
234 {
235  const uint32_t outer_flags = is_ul ? 0 : DOCA_FLOW_RSS_IPV4 | DOCA_FLOW_RSS_UDP;
236  const uint32_t inner_flags = is_ul ? DOCA_FLOW_RSS_IPV4 | DOCA_FLOW_RSS_UDP : 0;
237  uint16_t rss_queues[RTE_MAX_LCORE];
240  .rss.outer_flags = outer_flags,
241  .rss.inner_flags = inner_flags,
242  .rss.queues_array = rss_queues,
243  .rss.nr_queues = upf_accel_ctx->num_queues - 1,
245  struct doca_flow_actions act_set_dir = {.meta.pkt_meta = UINT32_MAX};
246  struct doca_flow_actions *action_list[] = {&act_set_dir};
247  uint16_t queue_id = 1; /* Queue 0 is reserved */
248  struct doca_flow_match match = {0};
249  char *pipe_name = "TO_SW_PIPE";
251  int i;
252 
253  pipe_cfg->name = pipe_name;
254  pipe_cfg->is_root = false;
255  pipe_cfg->num_entries = 1;
256  pipe_cfg->match = &match;
257  pipe_cfg->match_mask = NULL;
258  pipe_cfg->mon = NULL;
259  pipe_cfg->fwd = &fwd;
260  pipe_cfg->fwd_miss = NULL;
261  pipe_cfg->actions.num_actions = 1;
262  pipe_cfg->actions.action_list = action_list;
263  pipe_cfg->actions.action_desc_list = NULL;
264 
265  for (i = 0; i < upf_accel_ctx->num_queues; ++i)
266  rss_queues[i] = queue_id++;
267 
268  result = upf_accel_pipe_create(pipe_cfg, pipe);
269  if (result != DOCA_SUCCESS) {
270  DOCA_LOG_ERR("Failed to create to sw pipe: %s", doca_error_get_descr(result));
271  return result;
272  }
273 
274  act_set_dir.meta.pkt_meta = is_ul ? rte_cpu_to_be_32(UPF_ACCEL_META_PKT_DIR_UL) :
275  rte_cpu_to_be_32(UPF_ACCEL_META_PKT_DIR_DL);
276  act_set_dir.action_idx = 0;
277 
279  pipe_cfg->port_id,
280  0,
281  *pipe,
282  NULL,
283  &act_set_dir,
284  NULL,
285  NULL,
286  0,
288  NULL);
289  if (result != DOCA_SUCCESS) {
290  DOCA_LOG_ERR("Failed to add to sw pipe entry: %s", doca_error_get_descr(result));
291  return result;
292  }
293 
294  return result;
295 }
296 
297 /*
298  * Create a TX root flow pipe.
299  *
300  * @upf_accel_ctx [in]: UPF Acceleration context
301  * @pipe_cfg [in]: UPF Acceleration pipe configuration
302  * @pipe [out]: pointer to store the created pipe at
303  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
304  */
306  struct upf_accel_pipe_cfg *pipe_cfg,
307  struct doca_flow_pipe **pipe)
308 {
309  struct doca_flow_fwd fwd = {
312  struct doca_flow_fwd fwd_miss = {
314  .next_pipe =
316  struct doca_flow_match match = {0};
317  char *pipe_name = "TX_ROOT_PIPE";
319 
320  pipe_cfg->name = pipe_name;
321  pipe_cfg->is_root = true;
322  pipe_cfg->num_entries = 1;
323  pipe_cfg->match = &match;
324  pipe_cfg->match_mask = NULL;
325  pipe_cfg->mon = NULL;
326  pipe_cfg->fwd = &fwd;
327  pipe_cfg->fwd_miss = &fwd_miss;
328  pipe_cfg->actions.num_actions = 0;
329 
330  result = upf_accel_pipe_create(pipe_cfg, pipe);
331  if (result != DOCA_SUCCESS) {
332  DOCA_LOG_ERR("Failed to create tx root pipe: %s", doca_error_get_descr(result));
333  return result;
334  }
335 
337  pipe_cfg->port_id,
338  0,
339  *pipe,
340  NULL,
341  NULL,
342  NULL,
343  NULL,
344  0,
346  NULL);
347  if (result != DOCA_SUCCESS) {
348  DOCA_LOG_ERR("Failed to add tx root pipe entry: %s", doca_error_get_descr(result));
349  return result;
350  }
351 
352  return result;
353 }
354 
355 /*
356  * Create a flow pipe that does encap and counter
357  *
358  * @upf_accel_ctx [in]: UPF Acceleration context
359  * @pipe_cfg [in]: UPF Acceleration pipe configuration
360  * @fwd [in]: fwd upon hit
361  * @pipe [out]: pointer to store the created pipe at
362  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
363  */
365  struct upf_accel_pipe_cfg *pipe_cfg,
366  struct doca_flow_fwd *fwd,
367  struct doca_flow_pipe **pipe)
368 {
369  struct doca_flow_monitor mon = {
371  .shared_counter.shared_counter_id = 0xffffffff,
372  };
373  struct doca_flow_match match_mask = {.meta.pkt_meta = rte_cpu_to_be_32(UPF_ACCEL_MAX_NUM_PDR - 1)};
374  struct doca_flow_fwd fwd_miss = {
376  .next_pipe =
378  struct doca_flow_actions act_encap_4g = {
380  .encap_cfg.encap = {.outer = {.eth.type = RTE_BE16(DOCA_FLOW_ETHER_TYPE_IPV4),
381  .l3_type = DOCA_FLOW_L3_TYPE_IP4,
382  .ip4 = {.src_ip = RTE_BE32(UPF_ACCEL_SRC_IP),
383  .dst_ip = UINT32_MAX,
384  .version_ihl = RTE_BE16(UPF_ACCEL_VERSION_IHL_IPV4),
385  .ttl = UPF_ACCEL_ENCAP_TTL,
386  .next_proto = DOCA_FLOW_PROTO_UDP},
387  .l4_type_ext = DOCA_FLOW_L4_TYPE_EXT_UDP,
388  .udp.l4_port = {.src_port = RTE_BE16(RTE_GTPU_UDP_PORT - 2),
389  .dst_port = RTE_BE16(RTE_GTPU_UDP_PORT)}},
390  .tun = {.type = DOCA_FLOW_TUN_GTPU, .gtp_teid = UINT32_MAX}}};
391  struct doca_flow_actions *action_list[UPF_ACCEL_ENCAP_ACTION_NUM];
392  struct doca_flow_actions act_none = {0};
393  struct doca_flow_actions act_encap_5g;
394  const uint8_t src_mac[] = UPF_ACCEL_SRC_MAC;
395  const uint8_t dst_mac[] = UPF_ACCEL_DST_MAC;
396  struct doca_flow_match match = {0};
397  char *pipe_name = "ENCAP_PIPE";
399 
400  pipe_cfg->name = pipe_name;
401  pipe_cfg->is_root = false;
403  pipe_cfg->match = &match;
404  pipe_cfg->match_mask = &match_mask;
405  pipe_cfg->mon = &mon;
406  pipe_cfg->fwd = fwd;
407  pipe_cfg->fwd_miss = &fwd_miss;
409  pipe_cfg->actions.action_list = action_list;
410  pipe_cfg->actions.action_desc_list = NULL;
411 
413  src_mac[0],
414  src_mac[1],
415  src_mac[2],
416  src_mac[3],
417  src_mac[4],
418  src_mac[5]);
420  dst_mac[0],
421  dst_mac[1],
422  dst_mac[2],
423  dst_mac[3],
424  dst_mac[4],
425  dst_mac[5]);
426 
427  memcpy(&act_encap_5g, &act_encap_4g, sizeof(act_encap_4g));
429  act_encap_5g.encap_cfg.encap.tun.gtp_ext_psc_qfi = UINT8_MAX;
430 
431  action_list[UPF_ACCEL_ENCAP_ACTION_4G] = &act_encap_4g;
432  action_list[UPF_ACCEL_ENCAP_ACTION_5G] = &act_encap_5g;
433  action_list[UPF_ACCEL_ENCAP_ACTION_NONE] = &act_none;
434 
435  result = upf_accel_pipe_create(pipe_cfg, pipe);
436  if (result != DOCA_SUCCESS) {
437  DOCA_LOG_ERR("Failed to create encap pipe: %s", doca_error_get_descr(result));
438  return result;
439  }
440 
441  return result;
442 }
443 
444 /*
445  * Create a flow pipe that does vxlan encap
446  *
447  * @upf_accel_ctx [in]: UPF Acceleration context
448  * @pipe_cfg [in]: UPF Acceleration pipe configuration
449  * @pipe [out]: pointer to store the created pipe at
450  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
451  */
453  struct upf_accel_pipe_cfg *pipe_cfg,
454  struct doca_flow_pipe **pipe)
455 {
456  struct doca_flow_fwd fwd_miss = {
458  .next_pipe =
460  struct doca_flow_fwd fwd = {.type = DOCA_FLOW_FWD_PORT, .port_id = pipe_cfg->port_id};
461  struct doca_flow_actions act_encap = {
463  .encap_cfg.is_l2 = true,
464  .encap_cfg.encap = {.outer = {.eth.type = RTE_BE16(DOCA_FLOW_ETHER_TYPE_IPV4),
465  .l3_type = DOCA_FLOW_L3_TYPE_IP4,
466  .ip4 = {.src_ip = RTE_BE32(UPF_ACCEL_SRC_IP),
467  .dst_ip = RTE_BE32(UPF_ACCEL_DST_IP),
468  .version_ihl = RTE_BE16(UPF_ACCEL_VERSION_IHL_IPV4),
469  .ttl = UPF_ACCEL_ENCAP_TTL,
470  .next_proto = DOCA_FLOW_PROTO_UDP},
471  .l4_type_ext = DOCA_FLOW_L4_TYPE_EXT_UDP,
472  .udp.l4_port.dst_port = RTE_BE16(RTE_VXLAN_DEFAULT_PORT)},
473  .tun = {.type = DOCA_FLOW_TUN_VXLAN, .vxlan_tun_id = UINT32_MAX}}};
474  struct doca_flow_actions *action_list[] = {&act_encap};
475  const uint8_t src_mac[] = UPF_ACCEL_SRC_MAC;
476  const uint8_t dst_mac[] = UPF_ACCEL_DST_MAC;
477  char *pipe_name = "VXLAN_ENCAP_PIPE";
478  struct doca_flow_match match = {0};
480 
481  pipe_cfg->name = pipe_name;
482  pipe_cfg->is_root = false;
484  pipe_cfg->match = &match;
485  pipe_cfg->match_mask = NULL;
486  pipe_cfg->mon = NULL;
487  pipe_cfg->fwd = &fwd;
488  pipe_cfg->fwd_miss = &fwd_miss;
489  pipe_cfg->actions.num_actions = 1;
490  pipe_cfg->actions.action_list = action_list;
491  pipe_cfg->actions.action_desc_list = NULL;
492 
493  SET_MAC_ADDR(match.outer.eth.dst_mac, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
494 
496  src_mac[0],
497  src_mac[1],
498  src_mac[2],
499  src_mac[3],
500  src_mac[4],
501  src_mac[5]);
503  dst_mac[0],
504  dst_mac[1],
505  dst_mac[2],
506  dst_mac[3],
507  dst_mac[4],
508  dst_mac[5]);
509 
510  result = upf_accel_pipe_create(pipe_cfg, pipe);
511  if (result != DOCA_SUCCESS) {
512  DOCA_LOG_ERR("Failed to create vxlan encap pipe: %s", doca_error_get_descr(result));
513  return result;
514  }
515 
516  return result;
517 }
518 
519 /*
520  * Create a flow pipe that implements FAR
521  *
522  * @upf_accel_ctx [in]: UPF Acceleration context
523  * @pipe_cfg [in]: UPF Acceleration pipe configuration
524  * @pipe [out]: pointer to store the created pipe at
525  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
526  */
528  struct upf_accel_pipe_cfg *pipe_cfg,
529  struct doca_flow_pipe **pipe)
530 {
531  struct doca_flow_fwd fwd_miss = {
533  .next_pipe =
536  .port_id = upf_accel_ctx->get_fwd_port(pipe_cfg->port_id)};
537  struct doca_flow_action_desc ad_dec_ttl = {.type = DOCA_FLOW_ACTION_ADD,
538  .field_op.dst.field_string = "outer.ipv4.ttl"};
539  struct doca_flow_action_descs ads = {.nb_action_desc = 1, .desc_array = &ad_dec_ttl};
540  struct doca_flow_actions act_dec_ttl = {.outer.ip4.ttl = -1};
541  struct doca_flow_action_descs *action_desc_list[] = {&ads};
542  struct doca_flow_actions *action_list[] = {&act_dec_ttl};
543  struct doca_flow_match match = {0};
544  char *pipe_name = "FAR_PIPE";
546 
547  pipe_cfg->name = pipe_name;
548  pipe_cfg->is_root = false;
549  pipe_cfg->num_entries = 1;
550  pipe_cfg->match = &match;
551  pipe_cfg->match_mask = NULL;
552  pipe_cfg->mon = NULL;
553  pipe_cfg->fwd = &fwd;
554  pipe_cfg->fwd_miss = &fwd_miss;
555  pipe_cfg->actions.num_actions = 1;
556  pipe_cfg->actions.action_list = action_list;
557  pipe_cfg->actions.action_desc_list = action_desc_list;
558 
559  result = upf_accel_pipe_create(pipe_cfg, pipe);
560  if (result != DOCA_SUCCESS) {
561  DOCA_LOG_ERR("Failed to create far pipe: %s", doca_error_get_descr(result));
562  return result;
563  }
564 
566  pipe_cfg->port_id,
567  0,
568  *pipe,
569  NULL,
570  NULL,
571  NULL,
572  NULL,
573  0,
575  NULL);
576  if (result != DOCA_SUCCESS) {
577  DOCA_LOG_ERR("Failed to add far pipe entry: %s", doca_error_get_descr(result));
578  return result;
579  }
580 
581  return result;
582 }
583 
584 /*
585  * Create a flow pipe that does decap
586  *
587  * @upf_accel_ctx [in]: UPF Acceleration context
588  * @pipe_cfg [in]: UPF Acceleration pipe configuration
589  * @pipe [out]: pointer to store the created pipe at
590  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
591  */
593  struct upf_accel_pipe_cfg *pipe_cfg,
594  struct doca_flow_pipe **pipe)
595 {
596  struct doca_flow_fwd fwd_miss = {
598  .next_pipe =
601  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_FAR]};
603  .decap_cfg.eth.type = RTE_BE16(DOCA_FLOW_ETHER_TYPE_IPV4)};
604  struct doca_flow_actions *action_list[] = {&act_decap};
605  const uint8_t src_mac[] = UPF_ACCEL_SRC_MAC;
606  const uint8_t dst_mac[] = UPF_ACCEL_DST_MAC;
607  struct doca_flow_match match = {0};
608  char *pipe_name = "DECAP_PIPE";
610 
611  pipe_cfg->name = pipe_name;
612  pipe_cfg->is_root = false;
613  pipe_cfg->num_entries = 1;
614  pipe_cfg->match = &match;
615  pipe_cfg->match_mask = NULL;
616  pipe_cfg->mon = NULL;
617  pipe_cfg->fwd = &fwd;
618  pipe_cfg->fwd_miss = &fwd_miss;
619  pipe_cfg->actions.num_actions = 1;
620  pipe_cfg->actions.action_list = action_list;
621  pipe_cfg->actions.action_desc_list = NULL;
622 
623  SET_MAC_ADDR(act_decap.decap_cfg.eth.src_mac,
624  src_mac[0],
625  src_mac[1],
626  src_mac[2],
627  src_mac[3],
628  src_mac[4],
629  src_mac[5]);
630  SET_MAC_ADDR(act_decap.decap_cfg.eth.dst_mac,
631  dst_mac[0],
632  dst_mac[1],
633  dst_mac[2],
634  dst_mac[3],
635  dst_mac[4],
636  dst_mac[5]);
637 
638  result = upf_accel_pipe_create(pipe_cfg, pipe);
639  if (result != DOCA_SUCCESS) {
640  DOCA_LOG_ERR("Failed to create decap pipe: %s", doca_error_get_descr(result));
641  return result;
642  }
643 
645  pipe_cfg->port_id,
646  0,
647  *pipe,
648  NULL,
649  NULL,
650  NULL,
651  NULL,
652  0,
654  NULL);
655  if (result != DOCA_SUCCESS) {
656  DOCA_LOG_ERR("Failed to add decap pipe entry: %s", doca_error_get_descr(result));
657  return result;
658  }
659 
660  return result;
661 }
662 
663 /*
664  * Create a flow pipe that does vxlan decap
665  *
666  * @upf_accel_ctx [in]: UPF Acceleration context
667  * @pipe_cfg [in]: UPF Acceleration pipe configuration
668  * @fwd_pipe [in]: next pipe
669  * @pipe [out]: pointer to store the created pipe at
670  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
671  */
673  struct upf_accel_pipe_cfg *pipe_cfg,
674  struct doca_flow_pipe *fwd_pipe,
675  struct doca_flow_pipe **pipe)
676 {
677  struct doca_flow_fwd fwd_miss = {
679  .next_pipe =
681  struct doca_flow_fwd fwd = {.type = DOCA_FLOW_FWD_PIPE, .next_pipe = fwd_pipe};
683  .decap_cfg.is_l2 = true,
684  .decap_cfg.eth.type = RTE_BE16(DOCA_FLOW_ETHER_TYPE_IPV4)};
686  .udp.l4_port.dst_port = RTE_BE16(DOCA_FLOW_VXLAN_DEFAULT_PORT)},
687  .tun = {.type = DOCA_FLOW_TUN_VXLAN, .vxlan_tun_id = UINT32_MAX}};
688  struct doca_flow_actions *action_list[] = {&act_decap};
689  const uint8_t src_mac[] = UPF_ACCEL_SRC_MAC;
690  const uint8_t dst_mac[] = UPF_ACCEL_DST_MAC;
691  char *pipe_name = "VXLAN_DECAP_PIPE";
693 
694  pipe_cfg->name = pipe_name;
695  pipe_cfg->is_root = false;
697  pipe_cfg->match = &match;
698  pipe_cfg->match_mask = NULL;
699  pipe_cfg->mon = NULL;
700  pipe_cfg->fwd = &fwd;
701  pipe_cfg->fwd_miss = &fwd_miss;
702  pipe_cfg->actions.num_actions = 1;
703  pipe_cfg->actions.action_list = action_list;
704  pipe_cfg->actions.action_desc_list = NULL;
705 
706  SET_MAC_ADDR(match.inner.eth.dst_mac, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
707 
708  SET_MAC_ADDR(act_decap.decap_cfg.eth.src_mac,
709  src_mac[0],
710  src_mac[1],
711  src_mac[2],
712  src_mac[3],
713  src_mac[4],
714  src_mac[5]);
715  SET_MAC_ADDR(act_decap.decap_cfg.eth.dst_mac,
716  dst_mac[0],
717  dst_mac[1],
718  dst_mac[2],
719  dst_mac[3],
720  dst_mac[4],
721  dst_mac[5]);
722 
723  result = upf_accel_pipe_create(pipe_cfg, pipe);
724  if (result != DOCA_SUCCESS) {
725  DOCA_LOG_ERR("Failed to create vxlan decap pipe: %s", doca_error_get_descr(result));
726  return result;
727  }
728 
730  pipe_cfg->port_id,
731  0,
732  *pipe,
733  NULL,
734  NULL,
735  NULL,
736  NULL,
737  0,
739  NULL);
740  if (result != DOCA_SUCCESS) {
741  DOCA_LOG_ERR("Failed to add vxlan decap pipe entry: %s", doca_error_get_descr(result));
742  return result;
743  }
744 
745  return result;
746 }
747 
748 /*
749  * Create a flow pipe that does meter color matching
750  *
751  * @upf_accel_ctx [in]: UPF Acceleration context
752  * @pipe_cfg [in]: UPF Acceleration pipe configuration
753  * @green_fwd_pipe [in]: the pipe to forward as a green action
754  * @pipe [out]: pointer to store the created pipe at
755  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
756  */
758  struct upf_accel_pipe_cfg *pipe_cfg,
759  struct doca_flow_pipe *green_fwd_pipe,
760  struct doca_flow_pipe **pipe)
761 {
762  enum upf_accel_pipe_type drop_pipe_idx = upf_accel_drop_idx_get(pipe_cfg, UPF_ACCEL_DROP_RATE);
764  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][drop_pipe_idx]};
765  struct doca_flow_match match = {.parser_meta.meter_color = UINT8_MAX};
767  char *pipe_name = "COLOR_MATCH_PIPE";
769 
770  pipe_cfg->name = pipe_name;
771  pipe_cfg->is_root = false;
772  pipe_cfg->num_entries = 2;
773  pipe_cfg->match = &match;
774  pipe_cfg->match_mask = NULL;
775  pipe_cfg->mon = NULL;
776  pipe_cfg->fwd = &fwd;
777  pipe_cfg->fwd_miss = &fwd_miss;
778  pipe_cfg->actions.num_actions = 0;
779 
780  result = upf_accel_pipe_create(pipe_cfg, pipe);
781  if (result != DOCA_SUCCESS) {
782  DOCA_LOG_ERR("Failed to create color match pipe %s", doca_error_get_descr(result));
783  return result;
784  }
785 
786  fwd.next_pipe = green_fwd_pipe;
787  match.parser_meta.meter_color = DOCA_FLOW_METER_COLOR_GREEN;
788 
790  pipe_cfg->port_id,
791  0,
792  *pipe,
793  &match,
794  NULL,
795  NULL,
796  &fwd,
797  0,
799  NULL);
800  if (result != DOCA_SUCCESS) {
801  DOCA_LOG_ERR("Failed to add green match pipe entry: %s", doca_error_get_descr(result));
802  return result;
803  }
804 
805  fwd.next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][drop_pipe_idx];
806  match.parser_meta.meter_color = DOCA_FLOW_METER_COLOR_RED;
808  pipe_cfg->port_id,
809  0,
810  *pipe,
811  &match,
812  NULL,
813  NULL,
814  &fwd,
815  0,
817  NULL);
818  if (result != DOCA_SUCCESS) {
819  DOCA_LOG_ERR("Failed to add red match pipe entry: %s", doca_error_get_descr(result));
820  return result;
821  }
822 
823  return result;
824 }
825 
826 /*
827  * Create a flow pipe that has shared meter
828  *
829  * @upf_accel_ctx [in]: UPF Acceleration context
830  * @pipe_cfg [in]: UPF Acceleration pipe configuration
831  * @pipe [out]: pointer to store the created pipe at
832  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
833  */
835  struct upf_accel_pipe_cfg *pipe_cfg,
836  struct doca_flow_pipe **pipe)
837 {
839  .shared_meter.shared_meter_id = UINT32_MAX};
840  struct doca_flow_fwd fwd_miss = {
842  .next_pipe =
844  struct doca_flow_match match_mask = {.meta.pkt_meta = rte_cpu_to_be_32(UPF_ACCEL_MAX_NUM_PDR - 1)};
846  char *pipe_name = "SHARED_METER_PIPE";
847  struct doca_flow_match match = {0};
849 
850  pipe_cfg->name = pipe_name;
851  pipe_cfg->is_root = false;
853  pipe_cfg->match = &match;
854  pipe_cfg->match_mask = &match_mask;
855  pipe_cfg->mon = &mon;
856  pipe_cfg->fwd = &fwd;
857  pipe_cfg->fwd_miss = &fwd_miss;
858  pipe_cfg->actions.num_actions = 0;
859 
860  result = upf_accel_pipe_create(pipe_cfg, pipe);
861  if (result != DOCA_SUCCESS) {
862  DOCA_LOG_ERR("Failed to create shared meter pipe: %s", doca_error_get_descr(result));
863  return result;
864  }
865 
866  return result;
867 }
868 
869 /*
870  * Create a shared meter chain, example:
871  *
872  * [Meter A] --(Hit) HasAnotherMeter--> [Color A] --Green--> [Meter B] --...
873  * | |
874  * | --Red--> [RateDrop]
875  * | |
876  * --(Hit) NoMoreMeters--> [Color NoMoreMeters] --Green--> Out
877  * |
878  * --(Miss) [DebugDrop]
879  *
880  * @upf_accel_ctx [in]: UPF Acceleration context
881  * @pipe_cfg [in]: UPF Acceleration pipe configuration
882  * @color_pipe_next_pipe [in]: the pipe to jump to after chain ends
883  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
884  */
886  struct upf_accel_pipe_cfg *pipe_cfg,
887  struct doca_flow_pipe *color_pipe_next_pipe)
888 {
890  int i;
891 
892  if (pipe_cfg->domain == DOCA_FLOW_PIPE_DOMAIN_DEFAULT) {
893  DOCA_LOG_ERR("Meter chain cannot be created in ingress");
895  }
896 
897  /* Create single NoMoreMeters pipe, jump to it if no more meters after each meters pipe. */
900  pipe_cfg,
901  color_pipe_next_pipe,
903  if (result != DOCA_SUCCESS) {
904  DOCA_LOG_ERR("Failed to create color pipe NoMoreMeters: %s", doca_error_get_descr(result));
905  return result;
906  }
907 
908  for (i = upf_accel_ctx->upf_accel_cfg->qers->num_qers - 1; i >= 0; --i) {
911  pipe_cfg,
913  if (result != DOCA_SUCCESS) {
914  DOCA_LOG_ERR("Failed to create meter pipe num %d: %s", i, doca_error_get_descr(result));
915  return result;
916  }
917 
918  /*
919  * The following color match pipe is to continue to the next meters pipe, since
920  * the last meters pipe always points to NoMoreMeters for color match, we skip it.
921  */
922  if (i == (int)(upf_accel_ctx->upf_accel_cfg->qers->num_qers - 1))
923  continue;
924 
927  pipe_cfg,
930  if (result != DOCA_SUCCESS) {
931  DOCA_LOG_ERR("Failed to create color pipe num %d: %s", i, doca_error_get_descr(result));
932  return result;
933  }
934  }
935 
936  return result;
937 }
938 
939 /*
940  * Create 8 tuple pipe
941  *
942  * @upf_accel_ctx [in]: UPF Acceleration context
943  * @pipe_cfg [in]: UPF Acceleration pipe configuration
944  * @pipe [out]: pointer to store the created pipe at
945  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
946  */
948  struct upf_accel_pipe_cfg *pipe_cfg,
949  struct doca_flow_pipe **pipe)
950 {
951  struct doca_flow_match match = {
952  .outer = {.l3_type = DOCA_FLOW_L3_TYPE_IP4, .ip4.src_ip = UINT32_MAX},
953  .tun = {.type = DOCA_FLOW_TUN_GTPU, .gtp_teid = UINT32_MAX, .gtp_ext_psc_qfi = UINT8_MAX},
954  .inner = {.l3_type = DOCA_FLOW_L3_TYPE_IP4,
955  .ip4 = {.dst_ip = UINT32_MAX, .src_ip = UINT32_MAX, .next_proto = UINT8_MAX},
956  .l4_type_ext = DOCA_FLOW_L4_TYPE_EXT_UDP,
957  .udp.l4_port = {.dst_port = UINT16_MAX, .src_port = UINT16_MAX}}};
959  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_DECAP]};
961  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_UL_TO_SW]};
963  struct doca_flow_actions act_pdr2md = {.meta.pkt_meta = UINT32_MAX};
964  struct doca_flow_actions *action_list[] = {&act_pdr2md};
965  char *pipe_name = "8T_PIPE";
967 
968  pipe_cfg->name = pipe_name;
969  pipe_cfg->is_root = false;
971  pipe_cfg->match = &match;
972  pipe_cfg->match_mask = NULL;
973  pipe_cfg->mon = &mon;
974  pipe_cfg->fwd = &fwd;
975  pipe_cfg->fwd_miss = &fwd_miss;
976  pipe_cfg->actions.num_actions = 1;
977  pipe_cfg->actions.action_list = action_list;
978  pipe_cfg->actions.action_desc_list = NULL;
979 
980  result = upf_accel_pipe_create(pipe_cfg, pipe);
981  if (result != DOCA_SUCCESS) {
982  DOCA_LOG_ERR("Failed to create 8t pipe: %s", doca_error_get_descr(result));
983  return result;
984  }
985 
986  return result;
987 }
988 
989 /*
990  * Create 7 tuple pipe
991  *
992  * @upf_accel_ctx [in]: UPF Acceleration context
993  * @pipe_cfg [in]: UPF Acceleration pipe configuration
994  * @pipe [out]: pointer to store the created pipe at
995  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
996  */
998  struct upf_accel_pipe_cfg *pipe_cfg,
999  struct doca_flow_pipe **pipe)
1000 {
1001  struct doca_flow_match match = {
1002  .outer = {.l3_type = DOCA_FLOW_L3_TYPE_IP4, .ip4.src_ip = UINT32_MAX},
1003  .tun = {.type = DOCA_FLOW_TUN_GTPU, .gtp_teid = UINT32_MAX},
1004  .inner = {.l3_type = DOCA_FLOW_L3_TYPE_IP4,
1005  .ip4 = {.dst_ip = UINT32_MAX, .src_ip = UINT32_MAX, .next_proto = UINT8_MAX},
1006  .l4_type_ext = DOCA_FLOW_L4_TYPE_EXT_UDP,
1007  .udp.l4_port = {.dst_port = UINT16_MAX, .src_port = UINT16_MAX}}};
1009  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_DECAP]};
1011  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_UL_TO_SW]};
1013  struct doca_flow_actions act_pdr2md = {.meta.pkt_meta = UINT32_MAX};
1014  struct doca_flow_actions *action_list[] = {&act_pdr2md};
1015  char *pipe_name = "7T_PIPE";
1017 
1018  pipe_cfg->name = pipe_name;
1019  pipe_cfg->is_root = false;
1021  pipe_cfg->match = &match;
1022  pipe_cfg->match_mask = NULL;
1023  pipe_cfg->mon = &mon;
1024  pipe_cfg->fwd = &fwd;
1025  pipe_cfg->fwd_miss = &fwd_miss;
1026  pipe_cfg->actions.num_actions = 1;
1027  pipe_cfg->actions.action_list = action_list;
1028  pipe_cfg->actions.action_desc_list = NULL;
1029 
1030  result = upf_accel_pipe_create(pipe_cfg, pipe);
1031  if (result != DOCA_SUCCESS) {
1032  DOCA_LOG_ERR("Failed to create 7t pipe: %s", doca_error_get_descr(result));
1033  return result;
1034  }
1035 
1036  return result;
1037 }
1038 
1039 /*
1040  * Create 5 tuple pipe
1041  *
1042  * @upf_accel_ctx [in]: UPF Acceleration context
1043  * @pipe_cfg [in]: UPF Acceleration pipe configuration
1044  * @pipe [out]: pointer to store the created pipe at
1045  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
1046  */
1048  struct upf_accel_pipe_cfg *pipe_cfg,
1049  struct doca_flow_pipe **pipe)
1050 {
1051  struct doca_flow_match match = {
1053  .ip4 = {.dst_ip = UINT32_MAX, .src_ip = UINT32_MAX, .next_proto = UINT8_MAX},
1054  .l4_type_ext = DOCA_FLOW_L4_TYPE_EXT_UDP,
1055  .udp.l4_port = {.dst_port = UINT16_MAX, .src_port = UINT16_MAX}}};
1057  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_FAR]};
1059  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_DL_TO_SW]};
1061  struct doca_flow_actions act_pdr2md = {.meta.pkt_meta = UINT32_MAX};
1062  struct doca_flow_actions *action_list[] = {&act_pdr2md};
1063  char *pipe_name = "5T_PIPE";
1065 
1066  pipe_cfg->name = pipe_name;
1067  pipe_cfg->is_root = false;
1069  pipe_cfg->match = &match;
1070  pipe_cfg->match_mask = NULL;
1071  pipe_cfg->mon = &mon;
1072  pipe_cfg->fwd = &fwd;
1073  pipe_cfg->fwd_miss = &fwd_miss;
1074  pipe_cfg->actions.num_actions = 1;
1075  pipe_cfg->actions.action_list = action_list;
1076  pipe_cfg->actions.action_desc_list = NULL;
1077 
1078  result = upf_accel_pipe_create(pipe_cfg, pipe);
1079  if (result != DOCA_SUCCESS) {
1080  DOCA_LOG_ERR("Failed to create 5t pipe: %s", doca_error_get_descr(result));
1081  return result;
1082  }
1083 
1084  return result;
1085 }
1086 
1087 /*
1088  * Create GTP extension match pipe
1089  *
1090  * @upf_accel_ctx [in]: UPF Acceleration context
1091  * @pipe_cfg [in]: UPF Acceleration pipe configuration
1092  * @pipe [out]: pointer to store the created pipe at
1093  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
1094  */
1096  struct upf_accel_pipe_cfg *pipe_cfg,
1097  struct doca_flow_pipe **pipe)
1098 {
1100  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_8T]};
1102  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_7T]};
1103  struct doca_flow_match match = {
1104  .tun = {.type = DOCA_FLOW_TUN_GTPU, .gtp_next_ext_hdr_type = UPF_ACCEL_PSC_EXTENSION_CODE}};
1105 
1106  char *pipe_name = "EXTENDED_GTP_PIPE";
1108 
1109  pipe_cfg->name = pipe_name;
1110  pipe_cfg->is_root = false;
1111  pipe_cfg->num_entries = 1;
1112  pipe_cfg->match = &match;
1113  pipe_cfg->match_mask = NULL;
1114  pipe_cfg->mon = NULL;
1115  pipe_cfg->fwd = &fwd;
1116  pipe_cfg->fwd_miss = &fwd_miss;
1117  pipe_cfg->actions.num_actions = 0;
1118 
1119  result = upf_accel_pipe_create(pipe_cfg, pipe);
1120  if (result != DOCA_SUCCESS) {
1121  DOCA_LOG_ERR("Failed to create extended gtp pipe: %s", doca_error_get_descr(result));
1122  return result;
1123  }
1124 
1126  pipe_cfg->port_id,
1127  0,
1128  *pipe,
1129  &match,
1130  NULL,
1131  NULL,
1132  NULL,
1133  0,
1134  &upf_accel_ctx->static_entry_ctx[pipe_cfg->port_id],
1135  NULL);
1136  if (result != DOCA_SUCCESS) {
1137  DOCA_LOG_ERR("Failed to add extended gtp pipe entry: %s", doca_error_get_descr(result));
1138  return result;
1139  }
1140 
1141  return result;
1142 }
1143 
1144 /*
1145  * Create UL/DL demux pipe
1146  *
1147  * @upf_accel_ctx [in]: UPF Acceleration context
1148  * @pipe_cfg [in]: UPF Acceleration pipe configuration
1149  * @pipe [out]: pointer to store the created pipe at
1150  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
1151  */
1153  struct upf_accel_pipe_cfg *pipe_cfg,
1154  struct doca_flow_pipe **pipe)
1155 {
1157  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][UPF_ACCEL_PIPE_5T]};
1158  struct doca_flow_fwd fwd = {.type = DOCA_FLOW_FWD_PIPE};
1159  uint32_t fixed_port = upf_accel_ctx->upf_accel_cfg->fixed_port;
1160  struct doca_flow_fwd *fwd_miss_ptr;
1161  struct doca_flow_match match = {0};
1162  char *pipe_name = "ULDL_PIPE";
1163  uint32_t fwd_pipe_idx;
1165 
1166  if (fixed_port == (uint32_t)UPF_ACCEL_FIXED_PORT_NONE) {
1168  match.outer.udp.l4_port.dst_port = RTE_BE16(RTE_GTPU_UDP_PORT);
1169  fwd_pipe_idx = UPF_ACCEL_PIPE_EXT_GTP;
1170  fwd_miss_ptr = &fwd_miss;
1171  } else {
1172  fwd_pipe_idx = (pipe_cfg->port_id == fixed_port) ? UPF_ACCEL_PIPE_EXT_GTP : UPF_ACCEL_PIPE_5T;
1173  fwd_miss_ptr = NULL;
1174  }
1175 
1176  fwd.next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id][fwd_pipe_idx];
1177 
1178  pipe_cfg->name = pipe_name;
1179  pipe_cfg->is_root = false;
1180  pipe_cfg->num_entries = 1;
1181  pipe_cfg->match = &match;
1182  pipe_cfg->match_mask = NULL;
1183  pipe_cfg->mon = NULL;
1184  pipe_cfg->fwd = &fwd;
1185  pipe_cfg->fwd_miss = fwd_miss_ptr;
1186  pipe_cfg->actions.num_actions = 0;
1187 
1188  result = upf_accel_pipe_create(pipe_cfg, pipe);
1189  if (result != DOCA_SUCCESS) {
1190  DOCA_LOG_ERR("Failed to create uldl pipe: %s", doca_error_get_descr(result));
1191  return result;
1192  }
1193 
1195  pipe_cfg->port_id,
1196  0,
1197  *pipe,
1198  NULL,
1199  NULL,
1200  NULL,
1201  NULL,
1202  0,
1203  &upf_accel_ctx->static_entry_ctx[pipe_cfg->port_id],
1204  NULL);
1205  if (result != DOCA_SUCCESS) {
1206  DOCA_LOG_ERR("Failed to add uldl pipe entry: %s", doca_error_get_descr(result));
1207  return result;
1208  }
1209 
1210  return result;
1211 }
1212 
1213 /*
1214  * Create root pipe
1215  *
1216  * @upf_accel_ctx [in]: UPF Acceleration context
1217  * @pipe_cfg [in]: UPF Acceleration pipe configuration
1218  * @fwd_pipe [in]: next pipe
1219  * @pipe [out]: pointer to store the created pipe at
1220  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
1221  */
1223  struct upf_accel_pipe_cfg *pipe_cfg,
1224  struct doca_flow_pipe *fwd_pipe,
1225  struct doca_flow_pipe **pipe)
1226 {
1227  struct doca_flow_match match = {.outer = {.l3_type = DOCA_FLOW_L3_TYPE_IP4, .ip4.ttl = UINT8_MAX}};
1228  struct doca_flow_fwd fwd = {
1230  .next_pipe = upf_accel_ctx->pipes[pipe_cfg->port_id]
1232  struct doca_flow_fwd fwd_miss = {.type = DOCA_FLOW_FWD_PIPE, .next_pipe = fwd_pipe};
1233  char *pipe_name = "ROOT_PIPE";
1235 
1236  pipe_cfg->name = pipe_name;
1237  pipe_cfg->is_root = true;
1238  pipe_cfg->num_entries = 2;
1239  pipe_cfg->match = &match;
1240  pipe_cfg->match_mask = NULL;
1241  pipe_cfg->mon = NULL;
1242  pipe_cfg->fwd = &fwd;
1243  pipe_cfg->fwd_miss = &fwd_miss;
1244  pipe_cfg->actions.num_actions = 0;
1245 
1246  result = upf_accel_pipe_create(pipe_cfg, pipe);
1247  if (result != DOCA_SUCCESS) {
1248  DOCA_LOG_ERR("Failed to create root pipe: %s", doca_error_get_descr(result));
1249  return result;
1250  }
1251 
1252  match.outer.ip4.ttl = 0;
1254  pipe_cfg->port_id,
1255  0,
1256  *pipe,
1257  &match,
1258  NULL,
1259  NULL,
1260  NULL,
1261  0,
1262  &upf_accel_ctx->static_entry_ctx[pipe_cfg->port_id],
1263  NULL);
1264  if (result != DOCA_SUCCESS) {
1265  DOCA_LOG_ERR("Failed to add root pipe entry: %s", doca_error_get_descr(result));
1266  return result;
1267  }
1268 
1269  match.outer.ip4.ttl = 1;
1271  pipe_cfg->port_id,
1272  0,
1273  *pipe,
1274  &match,
1275  NULL,
1276  NULL,
1277  NULL,
1278  0,
1279  &upf_accel_ctx->static_entry_ctx[pipe_cfg->port_id],
1280  NULL);
1281  if (result != DOCA_SUCCESS) {
1282  DOCA_LOG_ERR("Failed to add root pipe entry: %s", doca_error_get_descr(result));
1283  return result;
1284  }
1285 
1286  return result;
1287 }
1288 
1289 /*
1290  * Create RX pipeline
1291  *
1292  * @upf_accel_ctx [in]: UPF Acceleration context
1293  * @port_id [in]: Port ID
1294  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
1295  */
1297 {
1298  struct upf_accel_pipe_cfg pipe_cfg = {
1299  .port_id = port_id,
1300  .port = upf_accel_ctx->ports[pipe_cfg.port_id],
1302  };
1303  struct doca_flow_pipe *root_fwd_pipe;
1305 
1307  if (result != DOCA_SUCCESS) {
1308  DOCA_LOG_ERR("Failed to create rx drop pipes: %s", doca_error_get_descr(result));
1309  return result;
1310  }
1311 
1313  &pipe_cfg,
1314  false,
1316  if (result != DOCA_SUCCESS) {
1317  DOCA_LOG_ERR("Failed to create rx DL-to-sw pipe: %s", doca_error_get_descr(result));
1318  return result;
1319  }
1320 
1322  &pipe_cfg,
1323  true,
1325  if (result != DOCA_SUCCESS) {
1326  DOCA_LOG_ERR("Failed to create rx UL-to-sw pipe: %s", doca_error_get_descr(result));
1327  return result;
1328  }
1329 
1331  &pipe_cfg,
1333  if (result != DOCA_SUCCESS) {
1334  DOCA_LOG_ERR("Failed to create rx far pipe: %s", doca_error_get_descr(result));
1335  return result;
1336  }
1337 
1339  &pipe_cfg,
1341  if (result != DOCA_SUCCESS) {
1342  DOCA_LOG_ERR("Failed to create rx decap pipe: %s", doca_error_get_descr(result));
1343  return result;
1344  }
1345 
1347  &pipe_cfg,
1349  if (result != DOCA_SUCCESS) {
1350  DOCA_LOG_ERR("Failed to create rx 5t pipe: %s", doca_error_get_descr(result));
1351  return result;
1352  }
1353 
1355  &pipe_cfg,
1357  if (result != DOCA_SUCCESS) {
1358  DOCA_LOG_ERR("Failed to create rx 7t pipe: %s", doca_error_get_descr(result));
1359  return result;
1360  }
1361 
1363  &pipe_cfg,
1365  if (result != DOCA_SUCCESS) {
1366  DOCA_LOG_ERR("Failed to create rx 8t pipe: %s", doca_error_get_descr(result));
1367  return result;
1368  }
1369 
1371  &pipe_cfg,
1373  if (result != DOCA_SUCCESS) {
1374  DOCA_LOG_ERR("Failed to create rx ext-gtp pipe: %s", doca_error_get_descr(result));
1375  return result;
1376  }
1377 
1379  &pipe_cfg,
1381  if (result != DOCA_SUCCESS) {
1382  DOCA_LOG_ERR("Failed to create rx uldl pipe: %s", doca_error_get_descr(result));
1383  return result;
1384  }
1385 
1388  upf_accel_ctx,
1389  &pipe_cfg,
1392  if (result != DOCA_SUCCESS) {
1393  DOCA_LOG_ERR("Failed to create rx vxlan decap pipe: %s", doca_error_get_descr(result));
1394  return result;
1395  }
1396  root_fwd_pipe = upf_accel_ctx->pipes[pipe_cfg.port_id][UPF_ACCEL_PIPE_RX_VXLAN_DECAP];
1397  } else
1398  root_fwd_pipe = upf_accel_ctx->pipes[pipe_cfg.port_id][UPF_ACCEL_PIPE_ULDL];
1399 
1401  &pipe_cfg,
1402  root_fwd_pipe,
1404  if (result != DOCA_SUCCESS) {
1405  DOCA_LOG_ERR("Failed to create rx root pipe: %s", doca_error_get_descr(result));
1406  return result;
1407  }
1408 
1409  return result;
1410 }
1411 
1412 /*
1413  * Create TX pipeline
1414  *
1415  * @upf_accel_ctx [in]: UPF Acceleration context
1416  * @port_id [in]: Port ID
1417  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
1418  */
1420 {
1421  struct upf_accel_pipe_cfg pipe_cfg = {
1422  .port_id = port_id,
1423  .port = upf_accel_ctx->ports[pipe_cfg.port_id],
1424  .domain = DOCA_FLOW_PIPE_DOMAIN_EGRESS,
1425  };
1426  struct doca_flow_fwd counter_fwd;
1428 
1430  if (result != DOCA_SUCCESS) {
1431  DOCA_LOG_ERR("Failed to create tx drop pipes: %s", doca_error_get_descr(result));
1432  return result;
1433  }
1434 
1437  upf_accel_ctx,
1438  &pipe_cfg,
1440  if (result != DOCA_SUCCESS) {
1441  DOCA_LOG_ERR("Failed to create tx vxlan encap pipe: %s", doca_error_get_descr(result));
1442  return result;
1443  }
1444  counter_fwd.type = DOCA_FLOW_FWD_PIPE;
1446  } else {
1447  counter_fwd.type = DOCA_FLOW_FWD_PORT;
1448  counter_fwd.port_id = pipe_cfg.port_id;
1449  }
1450 
1451  result =
1453  &pipe_cfg,
1454  &counter_fwd,
1456  if (result != DOCA_SUCCESS) {
1457  DOCA_LOG_ERR("Failed to create tx encap pipe: %s", doca_error_get_descr(result));
1458  return result;
1459  }
1460 
1462  &pipe_cfg,
1464  if (result != DOCA_SUCCESS) {
1465  DOCA_LOG_ERR("Failed to create tx meter_chain: %s", doca_error_get_descr(result));
1466  return result;
1467  }
1468 
1470  &pipe_cfg,
1472  if (result != DOCA_SUCCESS) {
1473  DOCA_LOG_ERR("Failed to create tx root pipe: %s", doca_error_get_descr(result));
1474  return result;
1475  }
1476 
1477  return result;
1478 }
1479 
1480 /*
1481  * Insert entry to a vxlan encap and a vxlan decap pipes
1482  *
1483  * @upf_accel_ctx [in]: UPF Acceleration context
1484  * @vxlan [in]: VXLAN decoded struct
1485  * @port_id [in]: port ID
1486  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
1487  */
1489  const struct upf_accel_vxlan *vxlan,
1490  enum upf_accel_port port_id)
1491 {
1492  struct doca_flow_actions act_encap = {.encap_cfg.encap.tun.vxlan_tun_id = UPF_ACCEL_BUILD_VNI(vxlan->vni)};
1493  struct doca_flow_match match = {0};
1495 
1496  SET_MAC_ADDR(match.outer.eth.dst_mac,
1497  vxlan->mac[0],
1498  vxlan->mac[1],
1499  vxlan->mac[2],
1500  vxlan->mac[3],
1501  vxlan->mac[4],
1502  vxlan->mac[5]);
1503 
1505  port_id,
1506  0,
1508  &match,
1509  &act_encap,
1510  NULL,
1511  NULL,
1512  0,
1513  &upf_accel_ctx->static_entry_ctx[port_id],
1514  NULL);
1515  if (result != DOCA_SUCCESS) {
1516  DOCA_LOG_ERR("Failed to add vxlan encap entry: %s", doca_error_get_descr(result));
1517  return result;
1518  }
1519 
1520  /* Nullify outer dst mac before using match again for vxlan decap pipe entry */
1521  SET_MAC_ADDR(match.outer.eth.dst_mac, 0, 0, 0, 0, 0, 0);
1522  match.tun.vxlan_tun_id = UPF_ACCEL_BUILD_VNI(vxlan->vni);
1523  SET_MAC_ADDR(match.inner.eth.dst_mac,
1524  vxlan->mac[0],
1525  vxlan->mac[1],
1526  vxlan->mac[2],
1527  vxlan->mac[3],
1528  vxlan->mac[4],
1529  vxlan->mac[5]);
1530 
1532  port_id,
1533  0,
1535  &match,
1536  NULL,
1537  NULL,
1538  NULL,
1539  0,
1540  &upf_accel_ctx->static_entry_ctx[port_id],
1541  NULL);
1542  if (result != DOCA_SUCCESS) {
1543  DOCA_LOG_ERR("Failed to add vxlan decap entry: %s", doca_error_get_descr(result));
1544  return result;
1545  }
1546 
1547  return DOCA_SUCCESS;
1548 }
1549 
1550 /*
1551  * Add all VXLAN related rules
1552  *
1553  * @upf_accel_ctx [in]: UPF Acceleration context
1554  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
1555  */
1557 {
1558  const struct upf_accel_vxlans *vxlans = upf_accel_ctx->upf_accel_cfg->vxlans;
1559  const size_t num_vxlans = vxlans->num_vxlans;
1560  const struct upf_accel_vxlan *vxlan;
1561  enum upf_accel_port port_id;
1563  uint32_t vxlan_idx;
1564 
1565  for (vxlan_idx = 0; vxlan_idx < num_vxlans; vxlan_idx++) {
1566  vxlan = &vxlans->arr_vxlans[vxlan_idx];
1567 
1568  for (port_id = 0; port_id < upf_accel_ctx->num_ports; port_id++) {
1570  if (result != DOCA_SUCCESS) {
1571  DOCA_LOG_ERR("Failed to add on port %u vxlan rules for vxlan idx %u: %s",
1572  port_id,
1573  vxlan_idx,
1575  return result;
1576  }
1577  }
1578  }
1579 
1580  return DOCA_SUCCESS;
1581 }
1582 
1584 {
1585  enum upf_accel_port port_id;
1587 
1588  for (port_id = 0; port_id < upf_accel_ctx->num_ports; port_id++) {
1590  if (result != DOCA_SUCCESS) {
1591  DOCA_LOG_ERR("Failed to create rx pipeline in port %d: %s",
1592  port_id,
1594  return result;
1595  }
1596 
1598  if (result != DOCA_SUCCESS) {
1599  DOCA_LOG_ERR("Failed to create tx pipeline in port %d: %s",
1600  port_id,
1602  return result;
1603  }
1604  }
1605 
1608  DOCA_LOG_ERR("Failed to add vxlan rules");
1609  return result;
1610  }
1611  }
1612 
1613  return result;
1614 }
#define NULL
Definition: __stddef_null.h:26
int32_t result
#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_fwd fwd_miss
Definition: flow_parser.c:110
static uint16_t * rss_queues
Definition: flow_parser.c:114
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]
static uint8_t entry_idx
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_NOT_SUPPORTED
Definition: doca_error.h:42
@ DOCA_SUCCESS
Definition: doca_error.h:38
#define DOCA_FLOW_VXLAN_DEFAULT_PORT
Definition: doca_flow_net.h:49
#define DOCA_FLOW_PROTO_UDP
Definition: doca_flow_net.h:42
#define DOCA_FLOW_ETHER_TYPE_IPV4
Definition: doca_flow_net.h:57
@ DOCA_FLOW_L4_TYPE_EXT_UDP
@ DOCA_FLOW_L3_TYPE_IP4
@ DOCA_FLOW_TUN_GTPU
@ 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_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_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 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 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_RSS_IPV4
Definition: doca_flow.h:764
@ DOCA_FLOW_RSS_UDP
Definition: doca_flow.h:768
@ DOCA_FLOW_PIPE_BASIC
Definition: doca_flow.h:221
@ DOCA_FLOW_ACTION_ADD
Definition: doca_flow.h:1010
@ DOCA_FLOW_RSS_HASH_FUNCTION_SYMMETRIC_TOEPLITZ
Definition: doca_flow.h:174
@ 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_FWD_DROP
Definition: doca_flow.h:748
@ DOCA_FLOW_FWD_RSS
Definition: doca_flow.h:742
@ DOCA_FLOW_PIPE_DOMAIN_EGRESS
Definition: doca_flow.h:245
@ DOCA_FLOW_PIPE_DOMAIN_DEFAULT
Definition: doca_flow.h:241
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
Definition: doca_log.h:466
const struct ip_frag_config * cfg
Definition: ip_frag_dp.c:0
uint16_t queue_id
Definition: ip_frag_dp.c:1
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
action description
Definition: doca_flow.h:1019
enum doca_flow_action_type type
Definition: doca_flow.h:1020
action descriptor array
Definition: doca_flow.h:1033
doca flow actions information
Definition: doca_flow.h:684
struct doca_flow_resource_encap_cfg encap_cfg
Definition: doca_flow.h:710
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
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
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
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
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_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_header_format inner
Definition: doca_flow.h:502
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_tun tun
Definition: doca_flow.h:500
struct doca_flow_meta meta
Definition: doca_flow.h:494
doca_be32_t pkt_meta
Definition: doca_flow.h:359
doca monitor action configuration
Definition: doca_flow.h:968
enum doca_flow_resource_type counter_type
Definition: doca_flow.h:988
enum doca_flow_resource_type meter_type
Definition: doca_flow.h:969
uint32_t aging_sec
Definition: doca_flow.h:1000
enum doca_flow_meter_color meter_color
Definition: doca_flow.h:380
struct doca_flow_header_eth eth
Definition: doca_flow.h:673
struct doca_flow_encap_action encap
Definition: doca_flow.h:663
enum doca_flow_tun_type type
doca_be32_t vxlan_tun_id
uint8_t gtp_ext_psc_qfi
uint8_t gtp_next_ext_hdr_type
struct doca_flow_action_descs ** action_desc_list
Definition: upf_accel.h:356
struct doca_flow_actions ** action_list
Definition: upf_accel.h:355
const char * vxlan_config_file_path
Definition: upf_accel.h:264
struct upf_accel_qers * qers
Definition: upf_accel.h:263
uint32_t hw_aging_time_sec
Definition: upf_accel.h:266
struct upf_accel_vxlans * vxlans
Definition: upf_accel.h:265
uint32_t fixed_port
Definition: upf_accel.h:269
upf_accel_get_forwarding_port get_fwd_port
Definition: upf_accel.h:351
uint16_t num_queues
Definition: upf_accel.h:339
struct doca_flow_pipe * pipes[UPF_ACCEL_PORTS_MAX][UPF_ACCEL_PIPE_NUM]
Definition: upf_accel.h:343
uint32_t num_static_entries[UPF_ACCEL_PORTS_MAX]
Definition: upf_accel.h:350
struct doca_flow_port * ports[UPF_ACCEL_PORTS_MAX]
Definition: upf_accel.h:344
uint16_t num_ports
Definition: upf_accel.h:338
struct doca_flow_pipe_entry * drop_entries[UPF_ACCEL_DROP_NUM][UPF_ACCEL_NUM_DOMAINS]
Definition: upf_accel.h:347
struct upf_accel_entry_ctx static_entry_ctx[UPF_ACCEL_PORTS_MAX]
Definition: upf_accel.h:349
const struct upf_accel_config * upf_accel_cfg
Definition: upf_accel.h:342
uint32_t num_entries
Definition: upf_accel.h:366
struct doca_flow_fwd * fwd
Definition: upf_accel.h:369
enum doca_flow_pipe_domain domain
Definition: upf_accel.h:363
struct doca_flow_match * match
Definition: upf_accel.h:367
struct doca_flow_port * port
Definition: upf_accel.h:362
struct doca_flow_match * match_mask
Definition: upf_accel.h:368
struct doca_flow_monitor * mon
Definition: upf_accel.h:371
struct upf_accel_action_cfg actions
Definition: upf_accel.h:372
struct doca_flow_fwd * fwd_miss
Definition: upf_accel.h:370
enum upf_accel_port port_id
Definition: upf_accel.h:361
size_t num_qers
Definition: upf_accel.h:243
uint32_t vni
Definition: upf_accel.h:249
uint8_t mac[DOCA_FLOW_ETHER_ADDR_LEN]
Definition: upf_accel.h:250
size_t num_vxlans
Definition: upf_accel.h:254
struct upf_accel_vxlan arr_vxlans[]
Definition: upf_accel.h:255
#define UPF_ACCEL_SRC_MAC
Definition: upf_accel.h:58
#define UPF_ACCEL_META_PKT_DIR_UL
Definition: upf_accel.h:74
upf_accel_port
Definition: upf_accel.h:40
#define UPF_ACCEL_DST_MAC
Definition: upf_accel.h:62
#define UPF_ACCEL_DST_IP
Definition: upf_accel.h:68
upf_accel_pipe_drop_type
Definition: upf_accel.h:112
@ UPF_ACCEL_DROP_DBG
Definition: upf_accel.h:113
@ UPF_ACCEL_DROP_RATE
Definition: upf_accel.h:114
@ UPF_ACCEL_DROP_NUM
Definition: upf_accel.h:116
@ UPF_ACCEL_DROP_FILTER
Definition: upf_accel.h:115
static uint8_t upf_accel_drop_idx_get(struct upf_accel_pipe_cfg *pipe_cfg, enum upf_accel_pipe_drop_type drop_type)
Definition: upf_accel.h:393
#define UPF_ACCEL_MAX_NUM_PDR
Definition: upf_accel.h:54
static uint8_t upf_accel_domain_idx_get(enum upf_accel_port port_id, uint8_t domain)
Definition: upf_accel.h:406
#define UPF_ACCEL_META_PKT_DIR_DL
Definition: upf_accel.h:75
upf_accel_pipe_type
Definition: upf_accel.h:119
@ UPF_ACCEL_PIPE_FAR
Definition: upf_accel.h:121
@ UPF_ACCEL_PIPE_TX_COLOR_MATCH_START
Definition: upf_accel.h:136
@ UPF_ACCEL_PIPE_8T
Definition: upf_accel.h:142
@ UPF_ACCEL_PIPE_ULDL
Definition: upf_accel.h:140
@ UPF_ACCEL_PIPE_DL_TO_SW
Definition: upf_accel.h:122
@ UPF_ACCEL_PIPE_DECAP
Definition: upf_accel.h:145
@ UPF_ACCEL_PIPE_TX_ROOT
Definition: upf_accel.h:128
@ UPF_ACCEL_PIPE_TX_VXLAN_ENCAP
Definition: upf_accel.h:130
@ UPF_ACCEL_PIPE_TX_COUNTER
Definition: upf_accel.h:129
@ UPF_ACCEL_PIPE_RX_VXLAN_DECAP
Definition: upf_accel.h:124
@ UPF_ACCEL_PIPE_5T
Definition: upf_accel.h:144
@ UPF_ACCEL_PIPE_7T
Definition: upf_accel.h:143
@ UPF_ACCEL_PIPE_RX_ROOT
Definition: upf_accel.h:120
@ UPF_ACCEL_PIPE_UL_TO_SW
Definition: upf_accel.h:123
@ UPF_ACCEL_PIPE_EXT_GTP
Definition: upf_accel.h:141
@ UPF_ACCEL_PIPE_TX_SHARED_METERS_START
Definition: upf_accel.h:134
@ UPF_ACCEL_PIPE_TX_COLOR_MATCH_NO_MORE_METERS
Definition: upf_accel.h:138
#define UPF_ACCEL_SRC_IP
Definition: upf_accel.h:67
#define UPF_ACCEL_FIXED_PORT_NONE
Definition: upf_accel.h:91
@ UPF_ACCEL_ENCAP_ACTION_NONE
Definition: upf_accel.h:153
@ UPF_ACCEL_ENCAP_ACTION_NUM
Definition: upf_accel.h:154
@ UPF_ACCEL_ENCAP_ACTION_5G
Definition: upf_accel.h:152
@ UPF_ACCEL_ENCAP_ACTION_4G
Definition: upf_accel.h:151
static doca_error_t upf_accel_pipe_shared_meter_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_far_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_root_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe *fwd_pipe, struct doca_flow_pipe **pipe)
DOCA_LOG_REGISTER(UPF_ACCEL::PIPELINE)
doca_error_t upf_accel_pipeline_create(struct upf_accel_ctx *upf_accel_ctx)
#define UPF_ACCEL_PSC_EXTENSION_CODE
static doca_error_t upf_accel_pipe_ext_gtp_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_vxlan_insert(struct upf_accel_ctx *upf_accel_ctx, const struct upf_accel_vxlan *vxlan, enum upf_accel_port port_id)
#define UPF_ACCEL_BUILD_VNI(uint24_vni)
static doca_error_t upf_accel_pipe_drop_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, enum upf_accel_pipe_drop_type drop_type)
static doca_error_t upf_accel_pipe_7t_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
doca_error_t upf_accel_pipe_static_entry_add(struct upf_accel_ctx *upf_accel_ctx, enum upf_accel_port port_id, 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 *mon, const struct doca_flow_fwd *fwd, uint32_t flags, void *usr_ctx, struct doca_flow_pipe_entry **entry)
static doca_error_t upf_accel_pipe_uldl_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_drops_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg)
static doca_error_t upf_accel_pipe_5t_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_create(struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_8t_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_decap_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_vxlan_decap_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe *fwd_pipe, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipeline_tx_create(struct upf_accel_ctx *upf_accel_ctx, enum upf_accel_port port_id)
static doca_error_t upf_accel_pipe_vxlan_encap_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_vxlan_rules_add(struct upf_accel_ctx *upf_accel_ctx)
static doca_error_t upf_accel_pipe_meter_chain_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe *color_pipe_next_pipe)
static doca_error_t upf_accel_pipe_encap_counter_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_fwd *fwd, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_color_match_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe *green_fwd_pipe, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipeline_rx_create(struct upf_accel_ctx *upf_accel_ctx, enum upf_accel_port port_id)
static doca_error_t upf_accel_pipe_tx_root_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, struct doca_flow_pipe **pipe)
static doca_error_t upf_accel_pipe_to_sw_create(struct upf_accel_ctx *upf_accel_ctx, struct upf_accel_pipe_cfg *pipe_cfg, bool is_ul, struct doca_flow_pipe **pipe)
#define UPF_ACCEL_MAX_NUM_CONNECTIONS
#define UPF_ACCEL_ENCAP_TTL
#define UPF_ACCEL_VERSION_IHL_IPV4
#define UPF_ACCEL_MAX_NUM_VNIS