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 #include <rte_common.h> 19 #include <rte_compat.h> 20 21 #include <rte_graph.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 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 int rte_node_ip4_route_add(uint32_t ip, uint8_t depth, uint16_t next_hop, 86 enum rte_node_ip4_lookup_next next_node); 87 88 /** 89 * Add a next hop's rewrite data. 90 * 91 * @param next_hop 92 * Next hop id to add rewrite data to. 93 * @param rewrite_data 94 * Rewrite data. 95 * @param rewrite_len 96 * Length of rewrite data. 97 * @param dst_port 98 * Destination port to redirect traffic to. 99 * 100 * @return 101 * 0 on success, negative otherwise. 102 */ 103 int rte_node_ip4_rewrite_add(uint16_t next_hop, uint8_t *rewrite_data, 104 uint8_t rewrite_len, uint16_t dst_port); 105 106 /** 107 * Add reassembly node configuration data. 108 * 109 * @param cfg 110 * Pointer to the configuration structure. 111 * @param cnt 112 * Number of configuration structures passed. 113 * 114 * @return 115 * 0 on success, negative otherwise. 116 */ 117 __rte_experimental 118 int rte_node_ip4_reassembly_configure(struct rte_node_ip4_reassembly_cfg *cfg, uint16_t cnt); 119 120 #ifdef __cplusplus 121 } 122 #endif 123 124 #endif /* __INCLUDE_RTE_NODE_IP4_API_H__ */ 125