199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(C) 2020 Marvell International Ltd. 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson #ifndef __INCLUDE_IP4_REWRITE_PRIV_H__ 599a2dd95SBruce Richardson #define __INCLUDE_IP4_REWRITE_PRIV_H__ 699a2dd95SBruce Richardson 799a2dd95SBruce Richardson #include <rte_common.h> 899a2dd95SBruce Richardson 999a2dd95SBruce Richardson #define RTE_GRAPH_IP4_REWRITE_MAX_NH 64 1099a2dd95SBruce Richardson #define RTE_GRAPH_IP4_REWRITE_MAX_LEN 56 1199a2dd95SBruce Richardson 1299a2dd95SBruce Richardson /** 1399a2dd95SBruce Richardson * @internal 1499a2dd95SBruce Richardson * 1599a2dd95SBruce Richardson * Ipv4 rewrite next hop header data structure. Used to store port specific 1699a2dd95SBruce Richardson * rewrite data. 1799a2dd95SBruce Richardson */ 1899a2dd95SBruce Richardson struct ip4_rewrite_nh_header { 1999a2dd95SBruce Richardson uint16_t rewrite_len; /**< Header rewrite length. */ 2099a2dd95SBruce Richardson uint16_t tx_node; /**< Tx node next index identifier. */ 2199a2dd95SBruce Richardson uint16_t enabled; /**< NH enable flag */ 2299a2dd95SBruce Richardson uint16_t rsvd; 2399a2dd95SBruce Richardson union { 2499a2dd95SBruce Richardson struct { 2599a2dd95SBruce Richardson struct rte_ether_addr dst; 2699a2dd95SBruce Richardson /**< Destination mac address. */ 2799a2dd95SBruce Richardson struct rte_ether_addr src; 2899a2dd95SBruce Richardson /**< Source mac address. */ 2999a2dd95SBruce Richardson }; 3099a2dd95SBruce Richardson uint8_t rewrite_data[RTE_GRAPH_IP4_REWRITE_MAX_LEN]; 3199a2dd95SBruce Richardson /**< Generic rewrite data */ 3299a2dd95SBruce Richardson }; 3399a2dd95SBruce Richardson }; 3499a2dd95SBruce Richardson 3599a2dd95SBruce Richardson /** 3699a2dd95SBruce Richardson * @internal 3799a2dd95SBruce Richardson * 3899a2dd95SBruce Richardson * Ipv4 node main data structure. 3999a2dd95SBruce Richardson */ 4099a2dd95SBruce Richardson struct ip4_rewrite_node_main { 4199a2dd95SBruce Richardson struct ip4_rewrite_nh_header nh[RTE_GRAPH_IP4_REWRITE_MAX_NH]; 4299a2dd95SBruce Richardson /**< Array of next hop header data */ 4399a2dd95SBruce Richardson uint16_t next_index[RTE_MAX_ETHPORTS]; 4499a2dd95SBruce Richardson /**< Next index of each configured port. */ 4599a2dd95SBruce Richardson }; 4699a2dd95SBruce Richardson 4799a2dd95SBruce Richardson /** 4899a2dd95SBruce Richardson * @internal 4999a2dd95SBruce Richardson * 5099a2dd95SBruce Richardson * Get the ipv4 rewrite node. 5199a2dd95SBruce Richardson * 52*4a6672c2SStephen Hemminger * @return 5399a2dd95SBruce Richardson * Pointer to the ipv4 rewrite node. 5499a2dd95SBruce Richardson */ 5599a2dd95SBruce Richardson struct rte_node_register *ip4_rewrite_node_get(void); 5699a2dd95SBruce Richardson 5799a2dd95SBruce Richardson /** 5899a2dd95SBruce Richardson * @internal 5999a2dd95SBruce Richardson * 6099a2dd95SBruce Richardson * Set the Edge index of a given port_id. 6199a2dd95SBruce Richardson * 6299a2dd95SBruce Richardson * @param port_id 6399a2dd95SBruce Richardson * Ethernet port identifier. 6499a2dd95SBruce Richardson * @param next_index 6599a2dd95SBruce Richardson * Edge index of the Given Tx node. 6699a2dd95SBruce Richardson */ 6799a2dd95SBruce Richardson int ip4_rewrite_set_next(uint16_t port_id, uint16_t next_index); 6899a2dd95SBruce Richardson 6999a2dd95SBruce Richardson #endif /* __INCLUDE_IP4_REWRITE_PRIV_H__ */ 70