NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
simple_fwd_vnf_core.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-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 #ifndef SIMPLE_FWD_VNF_CORE_H_
27 #define SIMPLE_FWD_VNF_CORE_H_
28 
29 #include <dpdk_utils.h>
30 
31 #include "app_vnf.h"
32 
33 /* Simple FWD VNF application configuration */
35  struct application_dpdk_config *dpdk_cfg; /* DPDK configurations */
36  uint16_t rx_only; /* Whether or not to work in "receive mode" only, where the application does not send received
37  packets */
38  uint16_t hw_offload; /* Whether or not HW steering is used */
39  uint64_t stats_timer; /* The time between periodic stats prints */
40  bool is_hairpin; /* Number of hairpin queues */
41  bool age_thread; /* Whther or not to use a dedicated thread to handle aged flows */
42 };
43 
44 /* Simple FWD VNF parameters to be passed when starting processing packets */
46  struct simple_fwd_config *cfg; /* Application configuration */
47  struct app_vnf *vnf; /* Holder for all functions pointers used by the application */
48 };
49 
50 /*
51  * Registers all flags used bu the users when running the application, such as "aging-thread" flag.
52  * This is needed so that the parsing by DOCA argument parser work as expected.
53  *
54  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
55  */
57 
58 /*
59  * Process received packets, mainly retrieving packet's key, then checking if there is an entry found
60  * matching the generated key, in the entries table.
61  * If no entry found, the function will create and add new one.
62  * In addition, this function handles aging as well
63  *
64  * @process_pkts_params [in]: an argument containing the mapping between queues and cores/lcores
65  * @return: 0 on success and non-zero value on failure
66  *
67  * @NOTE: This function is a thread safe
68  */
69 int simple_fwd_process_pkts(void *process_pkts_params);
70 
71 /*
72  * Stops the application from processing further packets
73  */
75 
76 /*
77  * Maps queues to cores/lcores and vice versa
78  *
79  * @nb_queues [in]: number of queues to map
80  */
81 void simple_fwd_map_queue(uint16_t nb_queues);
82 
83 /*
84  * Destroys all allocated resources used by the application
85  *
86  * @vnf [in]: application allocated resources such as ports, pipes and entries.
87  */
88 void simple_fwd_destroy(struct app_vnf *vnf);
89 
90 #endif /* SIMPLE_FWD_VNF_CORE_H_ */
enum doca_error doca_error_t
DOCA API return codes.
void simple_fwd_destroy(struct app_vnf *vnf)
int simple_fwd_process_pkts(void *process_pkts_params)
void simple_fwd_process_pkts_stop(void)
void simple_fwd_map_queue(uint16_t nb_queues)
doca_error_t register_simple_fwd_params(void)
struct application_dpdk_config * dpdk_cfg
struct simple_fwd_config * cfg