1 // bindgen-flags: --rust-target 1.0 --with-derive-hash --with-derive-partialeq --with-derive-eq
2 
3 
4 #define RTE_CACHE_LINE_MIN_SIZE 64	/**< Minimum Cache line size. */
5 
6 #define RTE_CACHE_LINE_SIZE 64
7 
8 typedef char int8_t;
9 typedef short int16_t;
10 typedef int int32_t;
11 typedef long long int64_t;
12 
13 typedef unsigned char uint8_t;
14 typedef unsigned short uint16_t;
15 typedef unsigned int uint32_t;
16 typedef unsigned long long uint64_t;
17 
18 typedef uint64_t phys_addr_t;
19 
20 /**
21  * Force alignment
22  */
23 #define __rte_aligned(a) __attribute__((__aligned__(a)))
24 
25 /**
26  * Force alignment to cache line.
27  */
28 #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
29 
30 /**
31  * Force minimum cache line alignment.
32  */
33 #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)
34 
35 /* define a set of marker types that can be used to refer to set points in the
36  * mbuf */
37 __extension__
38 typedef void    *MARKER[0];   /**< generic marker for a point in a structure */
39 __extension__
40 typedef uint8_t  MARKER8[0];  /**< generic marker with 1B alignment */
41 __extension__
42 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
43                                * with a single assignment */
44 
45 /** C extension macro for environments lacking C11 features. */
46 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
47 #define RTE_STD_C11 __extension__
48 #else
49 #define RTE_STD_C11
50 #endif
51 
52 /**
53  * The atomic counter structure.
54  */
55 typedef struct {
56 	volatile int16_t cnt; /**< An internal counter value. */
57 } rte_atomic16_t;
58 
59 /**
60  * The generic rte_mbuf, containing a packet mbuf.
61  */
62 struct rte_mbuf {
63 	MARKER cacheline0;
64 
65 	void *buf_addr;           /**< Virtual address of segment buffer. */
66 	phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */
67 
68 	uint16_t buf_len;         /**< Length of segment buffer. */
69 
70 	/* next 6 bytes are initialised on RX descriptor rearm */
71 	MARKER8 rearm_data;
72 	uint16_t data_off;
73 
74 	/**
75 	 * 16-bit Reference counter.
76 	 * It should only be accessed using the following functions:
77 	 * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
78 	 * rte_mbuf_refcnt_set(). The functionality of these functions (atomic,
79 	 * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC
80 	 * config option.
81 	 */
82 	RTE_STD_C11
83 	union {
84 		rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */
85 		uint16_t refcnt;              /**< Non-atomically accessed refcnt */
86 	};
87 	uint8_t nb_segs;          /**< Number of segments. */
88 	uint8_t port;             /**< Input port. */
89 
90 	uint64_t ol_flags;        /**< Offload features. */
91 
92 	/* remaining bytes are set on RX when pulling packet from descriptor */
93 	MARKER rx_descriptor_fields1;
94 
95 	/*
96 	 * The packet type, which is the combination of outer/inner L2, L3, L4
97 	 * and tunnel types. The packet_type is about data really present in the
98 	 * mbuf. Example: if vlan stripping is enabled, a received vlan packet
99 	 * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
100 	 * vlan is stripped from the data.
101 	 */
102 	RTE_STD_C11
103 	union {
104 		uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
105 		struct {
106 			uint32_t l2_type:4; /**< (Outer) L2 type. */
107 			uint32_t l3_type:4; /**< (Outer) L3 type. */
108 			uint32_t l4_type:4; /**< (Outer) L4 type. */
109 			uint32_t tun_type:4; /**< Tunnel type. */
110 			uint32_t inner_l2_type:4; /**< Inner L2 type. */
111 			uint32_t inner_l3_type:4; /**< Inner L3 type. */
112 			uint32_t inner_l4_type:4; /**< Inner L4 type. */
113 		};
114 	};
115 
116 	uint32_t pkt_len;         /**< Total pkt len: sum of all segments. */
117 	uint16_t data_len;        /**< Amount of data in segment buffer. */
118 	/** VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. */
119 	uint16_t vlan_tci;
120 
121 	union {
122 		uint32_t rss;     /**< RSS hash result if RSS enabled */
123 		struct {
124 			RTE_STD_C11
125 			union {
126 				struct {
127 					uint16_t hash;
128 					uint16_t id;
129 				};
130 				uint32_t lo;
131 				/**< Second 4 flexible bytes */
132 			};
133 			uint32_t hi;
134 			/**< First 4 flexible bytes or FD ID, dependent on
135 			     PKT_RX_FDIR_* flag in ol_flags. */
136 		} fdir;           /**< Filter identifier if FDIR enabled */
137 		struct {
138 			uint32_t lo;
139 			uint32_t hi;
140 		} sched;          /**< Hierarchical scheduler */
141 		uint32_t usr;	  /**< User defined tags. See rte_distributor_process() */
142 	} hash;                   /**< hash information */
143 
144 	uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */
145 
146 	/** Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set. */
147 	uint16_t vlan_tci_outer;
148 
149 	/* second cache line - fields only used in slow path or on TX */
150 	MARKER cacheline1 __rte_cache_min_aligned;
151 
152 	RTE_STD_C11
153 	union {
154 		void *userdata;   /**< Can be used for external metadata */
155 		uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */
156 	};
157 
158 	struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */
159 	struct rte_mbuf *next;    /**< Next segment of scattered packet. */
160 
161 	/* fields to support TX offloads */
162 	RTE_STD_C11
163 	union {
164 		uint64_t tx_offload;       /**< combined for easy fetch */
165 		__extension__
166 		struct {
167 			uint64_t l2_len:7;
168 			/**< L2 (MAC) Header Length for non-tunneling pkt.
169 			 * Outer_L4_len + ... + Inner_L2_len for tunneling pkt.
170 			 */
171 			uint64_t l3_len:9; /**< L3 (IP) Header Length. */
172 			uint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */
173 			uint64_t tso_segsz:16; /**< TCP TSO segment size */
174 
175 			/* fields for TX offloading of tunnels */
176 			uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */
177 			uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */
178 
179 			/* uint64_t unused:8; */
180 		};
181 	};
182 
183 	/** Size of the application private data. In case of an indirect
184 	 * mbuf, it stores the direct mbuf private data size. */
185 	uint16_t priv_size;
186 
187 	/** Timesync flags for use with IEEE1588. */
188 	uint16_t timesync;
189 } __rte_cache_aligned;
190