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