File: rte_node_ip4_api.h

package info (click to toggle)
dpdk 25.11-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 127,892 kB
  • sloc: ansic: 2,358,479; python: 16,426; sh: 4,474; makefile: 1,713; awk: 70
file content (162 lines) | stat: -rw-r--r-- 3,707 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(C) 2020 Marvell International Ltd.
 */

#ifndef __INCLUDE_RTE_NODE_IP4_API_H__
#define __INCLUDE_RTE_NODE_IP4_API_H__

/**
 * @file rte_node_ip4_api.h
 *
 * @warning
 * @b EXPERIMENTAL:
 * All functions in this file may be changed or removed without prior notice.
 *
 * This API allows to do control path functions of ip4_* nodes
 * like ip4_lookup, ip4_rewrite.
 */
#include <rte_common.h>
#include <rte_compat.h>

#include <rte_fib.h>
#include <rte_graph.h>

#ifdef __cplusplus
extern "C" {
#endif

/** IP4 output arc */
#define RTE_IP4_OUTPUT_FEATURE_ARC_NAME "rte_ip4_output_arc"
#define RTE_IP4_OUTPUT_END_FEATURE_NAME "rte_if_tx_feature"

/**
 * IP4 lookup next nodes.
 */
enum rte_node_ip4_lookup_next {
	RTE_NODE_IP4_LOOKUP_NEXT_REWRITE,
	/**< Rewrite node. */
	RTE_NODE_IP4_LOOKUP_NEXT_IP4_LOCAL,
	/** IP Local node. */
	RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP,
	/**< Number of next nodes of lookup node. */
};

/**
 * IP4 Local next nodes.
 */
enum rte_node_ip4_local_next {
	RTE_NODE_IP4_LOCAL_NEXT_UDP4_INPUT,
	/**< ip4 Local node. */
	RTE_NODE_IP4_LOCAL_NEXT_PKT_DROP,
	/**< Packet drop node. */
};

/**
 * IP4 reassembly next nodes.
 */
enum rte_node_ip4_reassembly_next {
	RTE_NODE_IP4_REASSEMBLY_NEXT_PKT_DROP,
       /**< Packet drop node. */
};

/**
 * Reassembly configure structure.
 * @see rte_node_ip4_reassembly_configure
 */
struct rte_node_ip4_reassembly_cfg {
	struct rte_ip_frag_tbl *tbl;
	/**< Reassembly fragmentation table. */
	struct rte_ip_frag_death_row *dr;
	/**< Reassembly deathrow table. */
	rte_node_t node_id;
	/**< Node identifier to configure. */
};

/**
 * Add ipv4 route to lookup table.
 *
 * @param ip
 *   IP address of route to be added.
 * @param depth
 *   Depth of the rule to be added.
 * @param next_hop
 *   Next hop id of the rule result to be added.
 * @param next_node
 *   Next node to redirect traffic to.
 *
 * @return
 *   0 on success, negative otherwise.
 */
int rte_node_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop,
			   enum rte_node_ip4_lookup_next next_node);

/**
 * Add a next hop's rewrite data.
 *
 * @param next_hop
 *   Next hop id to add rewrite data to.
 * @param rewrite_data
 *   Rewrite data.
 * @param rewrite_len
 *   Length of rewrite data.
 * @param dst_port
 *   Destination port to redirect traffic to.
 *
 * @return
 *   0 on success, negative otherwise.
 */
int rte_node_ip4_rewrite_add(uint16_t next_hop, uint8_t *rewrite_data,
			     uint8_t rewrite_len, uint16_t dst_port);

/**
 * Add reassembly node configuration data.
 *
 * @param cfg
 *   Pointer to the configuration structure.
 * @param cnt
 *   Number of configuration structures passed.
 *
 * @return
 *   0 on success, negative otherwise.
 */
__rte_experimental
int rte_node_ip4_reassembly_configure(struct rte_node_ip4_reassembly_cfg *cfg, uint16_t cnt);

/**
 * Create ipv4 FIB.
 *
 * @param socket
 *   NUMA socket for FIB memory allocation.
 * @param conf
 *   Structure containing FIB configuration.
 *
 * @return
 *   0 on success, negative otherwise.
 */
__rte_experimental
int rte_node_ip4_fib_create(int socket, struct rte_fib_conf *conf);

/**
 * Add ipv4 route to FIB.
 *
 * @param ip
 *   IP address of route to be added.
 * @param depth
 *   Depth of the rule to be added.
 * @param next_hop
 *   Next hop id of the rule result to be added.
 * @param next_node
 *   Next node to redirect traffic to.
 *
 * @return
 *   0 on success, negative otherwise.
 */
__rte_experimental
int rte_node_ip4_fib_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop,
			       enum rte_node_ip4_lookup_next next_node);

#ifdef __cplusplus
}
#endif

#endif /* __INCLUDE_RTE_NODE_IP4_API_H__ */