NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
simple_fwd.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 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_H_
27 #define SIMPLE_FWD_H_
28 
29 #include <stdint.h>
30 #include <stdbool.h>
31 
32 #include <doca_flow.h>
33 
34 #include "simple_fwd_pkt.h"
35 #include "simple_fwd_port.h"
36 
37 #define SIMPLE_FWD_PORTS (2) /* Number of ports used by the application */
38 #define SIMPLE_FWD_MAX_FLOWS (8096) /* Maximum number of flows used/added by the application at a given time */
39 
40 /* Application resources, such as flow table, pipes and hairpin peers */
42  struct simple_fwd_ft *ft; /* Flow table, used for stprng flows */
43  uint16_t hairpin_peer[SIMPLE_FWD_PORTS]; /* Binded pair ports array*/
44  struct doca_flow_port *ports[SIMPLE_FWD_PORTS]; /* DOCA Flow ports array used by the application */
45  struct doca_flow_pipe *pipe_vxlan[SIMPLE_FWD_PORTS]; /* VXLAN pipe of each port */
46  struct doca_flow_pipe *pipe_gre[SIMPLE_FWD_PORTS]; /* GRE pipe of each port */
47  struct doca_flow_pipe *pipe_gtp[SIMPLE_FWD_PORTS]; /* GTP pipe of each port */
48  struct doca_flow_pipe *pipe_control[SIMPLE_FWD_PORTS]; /* control pipe of each port */
49  struct doca_flow_pipe *pipe_hairpin[SIMPLE_FWD_PORTS]; /* hairpin pipe for non-VxLAN/GRE/GTP traffic */
50  struct doca_flow_pipe *pipe_rss[SIMPLE_FWD_PORTS]; /* RSS pipe, matches every packet and forwards to SW */
51  struct doca_flow_pipe *vxlan_encap_pipe[SIMPLE_FWD_PORTS]; /* vxlan encap pipe on the egress domain */
52  uint16_t nb_queues; /* flow age query item buffer */
53  struct doca_flow_aged_query *query_array[0]; /* buffer for flow aged query items */
54 };
55 
56 /* Simple FWD flow entry representation */
58  bool is_hw; /* Wether the entry in HW or not */
59  uint64_t total_pkts; /* Total number of packets matched the flow */
60  uint64_t total_bytes; /* Total number of bytes matched the flow */
61  uint16_t pipe_queue; /* Pipe queue of the flow entry */
62  struct doca_flow_pipe_entry *hw_entry; /* a pointer for the flow entry in hw */
63 };
64 
65 /*
66  * fills struct app_vnf with init/destroy, process and other needed pointer functions.
67  *
68  * @return: a pointer to struct app_vnf which contains all needed pointer functions
69  */
70 struct app_vnf *simple_fwd_get_vnf(void);
71 
72 #endif /* SIMPLE_FWD_H_ */
struct app_vnf * simple_fwd_get_vnf(void)
Definition: simple_fwd.c:1536
#define SIMPLE_FWD_PORTS
Definition: simple_fwd.h:37
struct doca_flow_aged_query * query_array[0]
Definition: simple_fwd.h:53
struct doca_flow_pipe * pipe_rss[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:50
struct doca_flow_pipe * pipe_vxlan[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:45
struct simple_fwd_ft * ft
Definition: simple_fwd.h:42
struct doca_flow_pipe * pipe_hairpin[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:49
struct doca_flow_port * ports[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:44
uint16_t nb_queues
Definition: simple_fwd.h:52
struct doca_flow_pipe * pipe_gre[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:46
struct doca_flow_pipe * vxlan_encap_pipe[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:51
struct doca_flow_pipe * pipe_control[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:48
struct doca_flow_pipe * pipe_gtp[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:47
uint16_t hairpin_peer[SIMPLE_FWD_PORTS]
Definition: simple_fwd.h:43
Definition: simple_fwd.h:57
struct doca_flow_pipe_entry * hw_entry
Definition: simple_fwd.h:62
uint64_t total_pkts
Definition: simple_fwd.h:59
uint16_t pipe_queue
Definition: simple_fwd.h:61
bool is_hw
Definition: simple_fwd.h:58
uint64_t total_bytes
Definition: simple_fwd.h:60