xref: /dpdk/lib/node/rte_node_ip6_api.h (revision 3c4898ef762eeb2578b9ae3d7f6e3a0e5cbca8c8)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2023 Marvell.
3  */
4 
5 #ifndef __INCLUDE_RTE_NODE_IP6_API_H__
6 #define __INCLUDE_RTE_NODE_IP6_API_H__
7 
8 /**
9  * @file rte_node_ip6_api.h
10  *
11  * @warning
12  * @b EXPERIMENTAL:
13  * All functions in this file may be changed or removed without prior notice.
14  *
15  * This API allows to do control path functions of ip6_* nodes
16  * like ip6_lookup, ip6_rewrite.
17  */
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #include <rte_common.h>
23 #include <rte_compat.h>
24 
25 /**
26  * IP6 lookup next nodes.
27  */
28 enum rte_node_ip6_lookup_next {
29 	RTE_NODE_IP6_LOOKUP_NEXT_REWRITE,
30 	/**< Rewrite node. */
31 	RTE_NODE_IP6_LOOKUP_NEXT_PKT_DROP,
32 	/**< Packet drop node. */
33 };
34 
35 /**
36  * Add IPv6 route to lookup table.
37  *
38  * @param ip
39  *   IPv6 address of route to be added.
40  * @param depth
41  *   Depth of the rule to be added.
42  * @param next_hop
43  *   Next hop id of the rule result to be added.
44  * @param next_node
45  *   Next node to redirect traffic to.
46  *
47  * @return
48  *   0 on success, negative otherwise.
49  */
50 __rte_experimental
51 int rte_node_ip6_route_add(const uint8_t *ip, uint8_t depth, uint16_t next_hop,
52 			   enum rte_node_ip6_lookup_next next_node);
53 
54 /**
55  * Add a next hop's rewrite data.
56  *
57  * @param next_hop
58  *   Next hop id to add rewrite data to.
59  * @param rewrite_data
60  *   Rewrite data.
61  * @param rewrite_len
62  *   Length of rewrite data.
63  * @param dst_port
64  *   Destination port to redirect traffic to.
65  *
66  * @return
67  *   0 on success, negative otherwise.
68  */
69 __rte_experimental
70 int rte_node_ip6_rewrite_add(uint16_t next_hop, uint8_t *rewrite_data,
71 			     uint8_t rewrite_len, uint16_t dst_port);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* __INCLUDE_RTE_NODE_IP6_API_H__ */
78