NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
upf_accel_flow_processing.h
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 #ifndef UPF_ACCEL_FLOW_PROCESSING_H_
27 #define UPF_ACCEL_FLOW_PROCESSING_H_
28 
29 #include <assert.h>
30 
31 #include <rte_hash.h>
32 #include <rte_mbuf.h>
33 
34 #include "upf_accel.h"
35 
36 #define UPF_ACCEL_SW_AGING_LL_INVALID_NODE (-1)
37 
39  uint64_t pkts; /* Counter packets */
40  uint64_t bytes; /* Counter bytes */
41 };
42 
44  struct upf_accel_packet_byte_counter new_conn; /* New connections */
45  struct upf_accel_packet_byte_counter ex_conn; /* Existing connections */
46  struct upf_accel_packet_byte_counter err; /* Errors */
47 };
48 
50  uint64_t current; /* Number of currently accelerated flows */
51  uint64_t total; /* Total number of accelerated flows since app startup */
52  uint64_t errors; /* Acceleration errors */
53  uint64_t aging_errors; /* Number of failed aging cases */
54 };
55 
57  struct upf_accel_ctx *ctx; /* UPF Acceleration context */
58  uint16_t queue_id; /* Queue id */
59  struct rte_hash *dyn_tbl; /* Dynamic connection table */
60  struct upf_accel_entry_ctx *dyn_tbl_data; /* Dynamic connection table data */
61  struct upf_accel_fp_sw_counters sw_counters; /* SW DP counters */
62  struct app_shared_counter_ids quota_cntrs; /* Quota counters to handle */
63  struct upf_accel_fp_accel_counters accel_counters[PARSER_PKT_TYPE_NUM]; /* Port acceleration counters */
64  struct upf_accel_fp_accel_counters unaccel_counters[PARSER_PKT_TYPE_NUM]; /* Port not accelerated counters */
65  struct upf_accel_fp_accel_counters accel_failed_counters[PARSER_PKT_TYPE_NUM]; /* Port acceleration failed
66  counters */
67  struct upf_accel_sw_aging_ll sw_aging_ll[PARSER_PKT_TYPE_NUM]; /* SW Aging linked list */
68  uint64_t last_hw_aging_tsc[UPF_ACCEL_PORTS_MAX]; /* Last HW aging iteration timestamp */
69  bool hw_aging_in_progress[UPF_ACCEL_PORTS_MAX]; /* HW Aging in progress, more entries pending */
70 } __rte_aligned(RTE_CACHE_LINE_SIZE);
71 
72 /*
73  * Entry processing callback
74  *
75  * @entry [in]: DOCA Flow entry pointer
76  * @pipe_queue [in]: queue identifier
77  * @status [in]: DOCA Flow entry status
78  * @op [in]: DOCA Flow entry operation
79  * @user_ctx [out]: user context
80  */
81 void upf_accel_check_for_valid_entry_aging(struct doca_flow_pipe_entry *entry,
82  uint16_t pipe_queue,
83  enum doca_flow_entry_status status,
84  enum doca_flow_entry_op op,
85  void *user_ctx);
86 
87 /*
88  * UPF Acceleration flow processing main loop
89  *
90  * @fp_data [in]: flow processing data
91  */
92 void upf_accel_fp_loop(struct upf_accel_fp_data *fp_data);
93 
94 #endif /* UPF_ACCEL_FLOW_PROCESSING_H_ */
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
doca_flow_entry_op
doca flow entry operation
Definition: doca_flow.h:146
doca_flow_entry_status
doca flow entry status
Definition: doca_flow.h:160
@ PARSER_PKT_TYPE_NUM
Definition: packet_parser.h:39
Definition: upf_accel.h:329
struct upf_accel_fp_accel_counters accel_failed_counters[PARSER_PKT_TYPE_NUM]
bool hw_aging_in_progress[UPF_ACCEL_PORTS_MAX]
struct upf_accel_entry_ctx * dyn_tbl_data
struct upf_accel_ctx * ctx
struct app_shared_counter_ids quota_cntrs
struct upf_accel_fp_sw_counters sw_counters
uint64_t last_hw_aging_tsc[UPF_ACCEL_PORTS_MAX]
struct upf_accel_sw_aging_ll sw_aging_ll[PARSER_PKT_TYPE_NUM]
struct upf_accel_fp_accel_counters accel_counters[PARSER_PKT_TYPE_NUM]
struct upf_accel_fp_accel_counters unaccel_counters[PARSER_PKT_TYPE_NUM]
struct upf_accel_packet_byte_counter new_conn
struct upf_accel_packet_byte_counter err
struct upf_accel_packet_byte_counter ex_conn
@ UPF_ACCEL_PORTS_MAX
Definition: upf_accel.h:43
struct upf_accel_fp_data __rte_aligned(RTE_CACHE_LINE_SIZE)
void upf_accel_check_for_valid_entry_aging(struct doca_flow_pipe_entry *entry, uint16_t pipe_queue, enum doca_flow_entry_status status, enum doca_flow_entry_op op, void *user_ctx)
void upf_accel_fp_loop(struct upf_accel_fp_data *fp_data)