xref: /dpdk/lib/node/ip4_rewrite_priv.h (revision 4a6672c2d301c105189ae74de73260af204c5ee8)
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 #include <rte_common.h>
8 
9 #define RTE_GRAPH_IP4_REWRITE_MAX_NH 64
10 #define RTE_GRAPH_IP4_REWRITE_MAX_LEN 56
11 
12 /**
13  * @internal
14  *
15  * Ipv4 rewrite next hop header data structure. Used to store port specific
16  * rewrite data.
17  */
18 struct ip4_rewrite_nh_header {
19 	uint16_t rewrite_len; /**< Header rewrite length. */
20 	uint16_t tx_node;     /**< Tx node next index identifier. */
21 	uint16_t enabled;     /**< NH enable flag */
22 	uint16_t rsvd;
23 	union {
24 		struct {
25 			struct rte_ether_addr dst;
26 			/**< Destination mac address. */
27 			struct rte_ether_addr src;
28 			/**< Source mac address. */
29 		};
30 		uint8_t rewrite_data[RTE_GRAPH_IP4_REWRITE_MAX_LEN];
31 		/**< Generic rewrite data */
32 	};
33 };
34 
35 /**
36  * @internal
37  *
38  * Ipv4 node main data structure.
39  */
40 struct ip4_rewrite_node_main {
41 	struct ip4_rewrite_nh_header nh[RTE_GRAPH_IP4_REWRITE_MAX_NH];
42 	/**< Array of next hop header data */
43 	uint16_t next_index[RTE_MAX_ETHPORTS];
44 	/**< Next index of each configured port. */
45 };
46 
47 /**
48  * @internal
49  *
50  * Get the ipv4 rewrite node.
51  *
52  * @return
53  *   Pointer to the ipv4 rewrite node.
54  */
55 struct rte_node_register *ip4_rewrite_node_get(void);
56 
57 /**
58  * @internal
59  *
60  * Set the Edge index of a given port_id.
61  *
62  * @param port_id
63  *   Ethernet port identifier.
64  * @param next_index
65  *   Edge index of the Given Tx node.
66  */
67 int ip4_rewrite_set_next(uint16_t port_id, uint16_t next_index);
68 
69 #endif /* __INCLUDE_IP4_REWRITE_PRIV_H__ */
70