xref: /dpdk/lib/node/rte_node_ip6_api.h (revision 2cfebc3f1046e4166e13b4f906e3ddc1c26c7eeb)
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 #include <rte_common.h>
19 #include <rte_compat.h>
20 #include <rte_ip6.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /**
27  * IP6 lookup next nodes.
28  */
29 enum rte_node_ip6_lookup_next {
30 	RTE_NODE_IP6_LOOKUP_NEXT_REWRITE,
31 	/**< Rewrite node. */
32 	RTE_NODE_IP6_LOOKUP_NEXT_PKT_DROP,
33 	/**< Packet drop node. */
34 };
35 
36 /**
37  * Add IPv6 route to lookup table.
38  *
39  * @param ip
40  *   IPv6 address of route to be added.
41  * @param depth
42  *   Depth of the rule to be added.
43  * @param next_hop
44  *   Next hop id of the rule result to be added.
45  * @param next_node
46  *   Next node to redirect traffic to.
47  *
48  * @return
49  *   0 on success, negative otherwise.
50  */
51 __rte_experimental
52 int rte_node_ip6_route_add(const struct rte_ipv6_addr *ip, uint8_t depth, uint16_t next_hop,
53 			   enum rte_node_ip6_lookup_next next_node);
54 
55 /**
56  * Add a next hop's rewrite data.
57  *
58  * @param next_hop
59  *   Next hop id to add rewrite data to.
60  * @param rewrite_data
61  *   Rewrite data.
62  * @param rewrite_len
63  *   Length of rewrite data.
64  * @param dst_port
65  *   Destination port to redirect traffic to.
66  *
67  * @return
68  *   0 on success, negative otherwise.
69  */
70 __rte_experimental
71 int rte_node_ip6_rewrite_add(uint16_t next_hop, uint8_t *rewrite_data,
72 			     uint8_t rewrite_len, uint16_t dst_port);
73 
74 #ifdef __cplusplus
75 }
76 #endif
77 
78 #endif /* __INCLUDE_RTE_NODE_IP6_API_H__ */
79