1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(C) 2020 Marvell International Ltd. 3 */ 4 #ifndef __INCLUDE_IP4_REWRITE_PRIV_H__ 5 #define __INCLUDE_IP4_REWRITE_PRIV_H__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 #include <rte_common.h> 12 13 #define RTE_GRAPH_IP4_REWRITE_MAX_NH 64 14 #define RTE_GRAPH_IP4_REWRITE_MAX_LEN 56 15 16 /** 17 * @internal 18 * 19 * Ipv4 rewrite next hop header data structure. Used to store port specific 20 * rewrite data. 21 */ 22 struct ip4_rewrite_nh_header { 23 uint16_t rewrite_len; /**< Header rewrite length. */ 24 uint16_t tx_node; /**< Tx node next index identifier. */ 25 uint16_t enabled; /**< NH enable flag */ 26 uint16_t rsvd; 27 union { 28 struct { 29 struct rte_ether_addr dst; 30 /**< Destination mac address. */ 31 struct rte_ether_addr src; 32 /**< Source mac address. */ 33 }; 34 uint8_t rewrite_data[RTE_GRAPH_IP4_REWRITE_MAX_LEN]; 35 /**< Generic rewrite data */ 36 }; 37 }; 38 39 /** 40 * @internal 41 * 42 * Ipv4 node main data structure. 43 */ 44 struct ip4_rewrite_node_main { 45 struct ip4_rewrite_nh_header nh[RTE_GRAPH_IP4_REWRITE_MAX_NH]; 46 /**< Array of next hop header data */ 47 uint16_t next_index[RTE_MAX_ETHPORTS]; 48 /**< Next index of each configured port. */ 49 }; 50 51 /** 52 * @internal 53 * 54 * Get the ipv4 rewrite node. 55 * 56 * @retrun 57 * Pointer to the ipv4 rewrite node. 58 */ 59 struct rte_node_register *ip4_rewrite_node_get(void); 60 61 /** 62 * @internal 63 * 64 * Set the Edge index of a given port_id. 65 * 66 * @param port_id 67 * Ethernet port identifier. 68 * @param next_index 69 * Edge index of the Given Tx node. 70 */ 71 int ip4_rewrite_set_next(uint16_t port_id, uint16_t next_index); 72 73 #ifdef __cplusplus 74 } 75 #endif 76 77 #endif /* __INCLUDE_IP4_REWRITE_PRIV_H__ */ 78