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: 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 ip4_* nodes 16 * like ip4_lookup, ip4_rewrite. 17 */ 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #include <rte_common.h> 23 #include <rte_compat.h> 24 25 #include <rte_graph.h> 26 27 /** 28 * IP4 lookup next nodes. 29 */ 30 enum rte_node_ip4_lookup_next { 31 RTE_NODE_IP4_LOOKUP_NEXT_REWRITE, 32 /**< Rewrite node. */ 33 RTE_NODE_IP4_LOOKUP_NEXT_IP4_LOCAL, 34 /** IP Local node. */ 35 RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP, 36 /**< Number of next nodes of lookup node. */ 37 }; 38 39 /** 40 * IP4 Local next nodes. 41 */ 42 enum rte_node_ip4_local_next { 43 RTE_NODE_IP4_LOCAL_NEXT_UDP4_INPUT, 44 /**< ip4 Local node. */ 45 RTE_NODE_IP4_LOCAL_NEXT_PKT_DROP, 46 /**< Packet drop node. */ 47 }; 48 49 /** 50 * IP4 reassembly next nodes. 51 */ 52 enum rte_node_ip4_reassembly_next { 53 RTE_NODE_IP4_REASSEMBLY_NEXT_PKT_DROP, 54 /**< Packet drop node. */ 55 }; 56 57 /** 58 * Reassembly configure structure. 59 * @see rte_node_ip4_reassembly_configure 60 */ 61 struct rte_node_ip4_reassembly_cfg { 62 struct rte_ip_frag_tbl *tbl; 63 /**< Reassembly fragmentation table. */ 64 struct rte_ip_frag_death_row *dr; 65 /**< Reassembly deathrow table. */ 66 rte_node_t node_id; 67 /**< Node identifier to configure. */ 68 }; 69 70 /** 71 * Add ipv4 route to lookup table. 72 * 73 * @param ip 74 * IP address of route to be added. 75 * @param depth 76 * Depth of the rule to be added. 77 * @param next_hop 78 * Next hop id of the rule result to be added. 79 * @param next_node 80 * Next node to redirect traffic to. 81 * 82 * @return 83 * 0 on success, negative otherwise. 84 */ 85 __rte_experimental 86 int rte_node_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop, 87 enum rte_node_ip4_lookup_next next_node); 88 89 /** 90 * Add a next hop's rewrite data. 91 * 92 * @param next_hop 93 * Next hop id to add rewrite data to. 94 * @param rewrite_data 95 * Rewrite data. 96 * @param rewrite_len 97 * Length of rewrite data. 98 * @param dst_port 99 * Destination port to redirect traffic to. 100 * 101 * @return 102 * 0 on success, negative otherwise. 103 */ 104 __rte_experimental 105 int rte_node_ip4_rewrite_add(uint16_t next_hop, uint8_t *rewrite_data, 106 uint8_t rewrite_len, uint16_t dst_port); 107 108 /** 109 * Add reassembly node configuration data. 110 * 111 * @param cfg 112 * Pointer to the configuration structure. 113 * @param cnt 114 * Number of configuration structures passed. 115 * 116 * @return 117 * 0 on success, negative otherwise. 118 */ 119 __rte_experimental 120 int rte_node_ip4_reassembly_configure(struct rte_node_ip4_reassembly_cfg *cfg, uint16_t cnt); 121 122 #ifdef __cplusplus 123 } 124 #endif 125 126 #endif /* __INCLUDE_RTE_NODE_IP4_API_H__ */ 127