]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/lib/librte_node/rte_node_ip4_api.h
31a752b00bcc245944af36045897135a34bd5851
[ceph.git] / ceph / src / spdk / dpdk / lib / librte_node / rte_node_ip4_api.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(C) 2020 Marvell International Ltd.
3 */
4
5 #ifndef __INCLUDE_RTE_NODE_IP4_API_H__
6 #define __INCLUDE_RTE_NODE_IP4_API_H__
7
8 /**
9 * @file rte_node_ip4_api.h
10 *
11 * @warning
12 * @b EXPERIMENTAL: this API may change without prior notice
13 *
14 * This API allows to do control path functions of ip4_* nodes
15 * like ip4_lookup, ip4_rewrite.
16 *
17 */
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 #include <rte_common.h>
23
24 /**
25 * IP4 lookup next nodes.
26 */
27 enum rte_node_ip4_lookup_next {
28 RTE_NODE_IP4_LOOKUP_NEXT_REWRITE,
29 /**< Rewrite node. */
30 RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP,
31 /**< Packet drop node. */
32 RTE_NODE_IP4_LOOKUP_NEXT_MAX,
33 /**< Number of next nodes of lookup node. */
34 };
35
36 /**
37 * Add ipv4 route to lookup table.
38 *
39 * @param ip
40 * IP 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_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop,
53 enum rte_node_ip4_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_ip4_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_IP4_API_H__ */