112a9d9c8Sopenharmony_ci// bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq 212a9d9c8Sopenharmony_ci 312a9d9c8Sopenharmony_ci#define RTE_CACHE_LINE_MIN_SIZE 64 /**< Minimum Cache line size. */ 412a9d9c8Sopenharmony_ci 512a9d9c8Sopenharmony_ci#define RTE_CACHE_LINE_SIZE 64 612a9d9c8Sopenharmony_ci 712a9d9c8Sopenharmony_citypedef char int8_t; 812a9d9c8Sopenharmony_citypedef short int16_t; 912a9d9c8Sopenharmony_citypedef int int32_t; 1012a9d9c8Sopenharmony_citypedef long long int64_t; 1112a9d9c8Sopenharmony_ci 1212a9d9c8Sopenharmony_citypedef unsigned char uint8_t; 1312a9d9c8Sopenharmony_citypedef unsigned short uint16_t; 1412a9d9c8Sopenharmony_citypedef unsigned int uint32_t; 1512a9d9c8Sopenharmony_citypedef unsigned long long uint64_t; 1612a9d9c8Sopenharmony_ci 1712a9d9c8Sopenharmony_citypedef uint64_t phys_addr_t; 1812a9d9c8Sopenharmony_ci 1912a9d9c8Sopenharmony_ci/** 2012a9d9c8Sopenharmony_ci * Force alignment 2112a9d9c8Sopenharmony_ci */ 2212a9d9c8Sopenharmony_ci#define __rte_aligned(a) __attribute__((__aligned__(a))) 2312a9d9c8Sopenharmony_ci 2412a9d9c8Sopenharmony_ci/** 2512a9d9c8Sopenharmony_ci * Force alignment to cache line. 2612a9d9c8Sopenharmony_ci */ 2712a9d9c8Sopenharmony_ci#define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE) 2812a9d9c8Sopenharmony_ci 2912a9d9c8Sopenharmony_ci/** 3012a9d9c8Sopenharmony_ci * Force minimum cache line alignment. 3112a9d9c8Sopenharmony_ci */ 3212a9d9c8Sopenharmony_ci#define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE) 3312a9d9c8Sopenharmony_ci 3412a9d9c8Sopenharmony_ci/* define a set of marker types that can be used to refer to set points in the 3512a9d9c8Sopenharmony_ci * mbuf */ 3612a9d9c8Sopenharmony_ci__extension__ 3712a9d9c8Sopenharmony_citypedef void *MARKER[0]; /**< generic marker for a point in a structure */ 3812a9d9c8Sopenharmony_ci__extension__ 3912a9d9c8Sopenharmony_citypedef uint8_t MARKER8[0]; /**< generic marker with 1B alignment */ 4012a9d9c8Sopenharmony_ci__extension__ 4112a9d9c8Sopenharmony_citypedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes 4212a9d9c8Sopenharmony_ci * with a single assignment */ 4312a9d9c8Sopenharmony_ci 4412a9d9c8Sopenharmony_ci/** C extension macro for environments lacking C11 features. */ 4512a9d9c8Sopenharmony_ci#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L 4612a9d9c8Sopenharmony_ci#define RTE_STD_C11 __extension__ 4712a9d9c8Sopenharmony_ci#else 4812a9d9c8Sopenharmony_ci#define RTE_STD_C11 4912a9d9c8Sopenharmony_ci#endif 5012a9d9c8Sopenharmony_ci 5112a9d9c8Sopenharmony_ci/** 5212a9d9c8Sopenharmony_ci * The atomic counter structure. 5312a9d9c8Sopenharmony_ci */ 5412a9d9c8Sopenharmony_citypedef struct { 5512a9d9c8Sopenharmony_ci volatile int16_t cnt; /**< An internal counter value. */ 5612a9d9c8Sopenharmony_ci} rte_atomic16_t; 5712a9d9c8Sopenharmony_ci 5812a9d9c8Sopenharmony_ci/** 5912a9d9c8Sopenharmony_ci * The generic rte_mbuf, containing a packet mbuf. 6012a9d9c8Sopenharmony_ci */ 6112a9d9c8Sopenharmony_cistruct rte_mbuf { 6212a9d9c8Sopenharmony_ci MARKER cacheline0; 6312a9d9c8Sopenharmony_ci 6412a9d9c8Sopenharmony_ci void *buf_addr; /**< Virtual address of segment buffer. */ 6512a9d9c8Sopenharmony_ci phys_addr_t buf_physaddr; /**< Physical address of segment buffer. */ 6612a9d9c8Sopenharmony_ci 6712a9d9c8Sopenharmony_ci uint16_t buf_len; /**< Length of segment buffer. */ 6812a9d9c8Sopenharmony_ci 6912a9d9c8Sopenharmony_ci /* next 6 bytes are initialised on RX descriptor rearm */ 7012a9d9c8Sopenharmony_ci MARKER8 rearm_data; 7112a9d9c8Sopenharmony_ci uint16_t data_off; 7212a9d9c8Sopenharmony_ci 7312a9d9c8Sopenharmony_ci /** 7412a9d9c8Sopenharmony_ci * 16-bit Reference counter. 7512a9d9c8Sopenharmony_ci * It should only be accessed using the following functions: 7612a9d9c8Sopenharmony_ci * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and 7712a9d9c8Sopenharmony_ci * rte_mbuf_refcnt_set(). The functionality of these functions (atomic, 7812a9d9c8Sopenharmony_ci * or non-atomic) is controlled by the CONFIG_RTE_MBUF_REFCNT_ATOMIC 7912a9d9c8Sopenharmony_ci * config option. 8012a9d9c8Sopenharmony_ci */ 8112a9d9c8Sopenharmony_ci RTE_STD_C11 8212a9d9c8Sopenharmony_ci union { 8312a9d9c8Sopenharmony_ci rte_atomic16_t refcnt_atomic; /**< Atomically accessed refcnt */ 8412a9d9c8Sopenharmony_ci uint16_t refcnt; /**< Non-atomically accessed refcnt */ 8512a9d9c8Sopenharmony_ci }; 8612a9d9c8Sopenharmony_ci uint8_t nb_segs; /**< Number of segments. */ 8712a9d9c8Sopenharmony_ci uint8_t port; /**< Input port. */ 8812a9d9c8Sopenharmony_ci 8912a9d9c8Sopenharmony_ci uint64_t ol_flags; /**< Offload features. */ 9012a9d9c8Sopenharmony_ci 9112a9d9c8Sopenharmony_ci /* remaining bytes are set on RX when pulling packet from descriptor */ 9212a9d9c8Sopenharmony_ci MARKER rx_descriptor_fields1; 9312a9d9c8Sopenharmony_ci 9412a9d9c8Sopenharmony_ci /* 9512a9d9c8Sopenharmony_ci * The packet type, which is the combination of outer/inner L2, L3, L4 9612a9d9c8Sopenharmony_ci * and tunnel types. The packet_type is about data really present in the 9712a9d9c8Sopenharmony_ci * mbuf. Example: if vlan stripping is enabled, a received vlan packet 9812a9d9c8Sopenharmony_ci * would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the 9912a9d9c8Sopenharmony_ci * vlan is stripped from the data. 10012a9d9c8Sopenharmony_ci */ 10112a9d9c8Sopenharmony_ci RTE_STD_C11 10212a9d9c8Sopenharmony_ci union { 10312a9d9c8Sopenharmony_ci uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */ 10412a9d9c8Sopenharmony_ci struct { 10512a9d9c8Sopenharmony_ci uint32_t l2_type:4; /**< (Outer) L2 type. */ 10612a9d9c8Sopenharmony_ci uint32_t l3_type:4; /**< (Outer) L3 type. */ 10712a9d9c8Sopenharmony_ci uint32_t l4_type:4; /**< (Outer) L4 type. */ 10812a9d9c8Sopenharmony_ci uint32_t tun_type:4; /**< Tunnel type. */ 10912a9d9c8Sopenharmony_ci uint32_t inner_l2_type:4; /**< Inner L2 type. */ 11012a9d9c8Sopenharmony_ci uint32_t inner_l3_type:4; /**< Inner L3 type. */ 11112a9d9c8Sopenharmony_ci uint32_t inner_l4_type:4; /**< Inner L4 type. */ 11212a9d9c8Sopenharmony_ci }; 11312a9d9c8Sopenharmony_ci }; 11412a9d9c8Sopenharmony_ci 11512a9d9c8Sopenharmony_ci uint32_t pkt_len; /**< Total pkt len: sum of all segments. */ 11612a9d9c8Sopenharmony_ci uint16_t data_len; /**< Amount of data in segment buffer. */ 11712a9d9c8Sopenharmony_ci /** VLAN TCI (CPU order), valid if PKT_RX_VLAN_STRIPPED is set. */ 11812a9d9c8Sopenharmony_ci uint16_t vlan_tci; 11912a9d9c8Sopenharmony_ci 12012a9d9c8Sopenharmony_ci union { 12112a9d9c8Sopenharmony_ci uint32_t rss; /**< RSS hash result if RSS enabled */ 12212a9d9c8Sopenharmony_ci struct { 12312a9d9c8Sopenharmony_ci RTE_STD_C11 12412a9d9c8Sopenharmony_ci union { 12512a9d9c8Sopenharmony_ci struct { 12612a9d9c8Sopenharmony_ci uint16_t hash; 12712a9d9c8Sopenharmony_ci uint16_t id; 12812a9d9c8Sopenharmony_ci }; 12912a9d9c8Sopenharmony_ci uint32_t lo; 13012a9d9c8Sopenharmony_ci /**< Second 4 flexible bytes */ 13112a9d9c8Sopenharmony_ci }; 13212a9d9c8Sopenharmony_ci uint32_t hi; 13312a9d9c8Sopenharmony_ci /**< First 4 flexible bytes or FD ID, dependent on 13412a9d9c8Sopenharmony_ci PKT_RX_FDIR_* flag in ol_flags. */ 13512a9d9c8Sopenharmony_ci } fdir; /**< Filter identifier if FDIR enabled */ 13612a9d9c8Sopenharmony_ci struct { 13712a9d9c8Sopenharmony_ci uint32_t lo; 13812a9d9c8Sopenharmony_ci uint32_t hi; 13912a9d9c8Sopenharmony_ci } sched; /**< Hierarchical scheduler */ 14012a9d9c8Sopenharmony_ci uint32_t usr; /**< User defined tags. See rte_distributor_process() */ 14112a9d9c8Sopenharmony_ci } hash; /**< hash information */ 14212a9d9c8Sopenharmony_ci 14312a9d9c8Sopenharmony_ci uint32_t seqn; /**< Sequence number. See also rte_reorder_insert() */ 14412a9d9c8Sopenharmony_ci 14512a9d9c8Sopenharmony_ci /** Outer VLAN TCI (CPU order), valid if PKT_RX_QINQ_STRIPPED is set. */ 14612a9d9c8Sopenharmony_ci uint16_t vlan_tci_outer; 14712a9d9c8Sopenharmony_ci 14812a9d9c8Sopenharmony_ci /* second cache line - fields only used in slow path or on TX */ 14912a9d9c8Sopenharmony_ci MARKER cacheline1 __rte_cache_min_aligned; 15012a9d9c8Sopenharmony_ci 15112a9d9c8Sopenharmony_ci RTE_STD_C11 15212a9d9c8Sopenharmony_ci union { 15312a9d9c8Sopenharmony_ci void *userdata; /**< Can be used for external metadata */ 15412a9d9c8Sopenharmony_ci uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */ 15512a9d9c8Sopenharmony_ci }; 15612a9d9c8Sopenharmony_ci 15712a9d9c8Sopenharmony_ci struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ 15812a9d9c8Sopenharmony_ci struct rte_mbuf *next; /**< Next segment of scattered packet. */ 15912a9d9c8Sopenharmony_ci 16012a9d9c8Sopenharmony_ci /* fields to support TX offloads */ 16112a9d9c8Sopenharmony_ci RTE_STD_C11 16212a9d9c8Sopenharmony_ci union { 16312a9d9c8Sopenharmony_ci uint64_t tx_offload; /**< combined for easy fetch */ 16412a9d9c8Sopenharmony_ci __extension__ 16512a9d9c8Sopenharmony_ci struct { 16612a9d9c8Sopenharmony_ci uint64_t l2_len:7; 16712a9d9c8Sopenharmony_ci /**< L2 (MAC) Header Length for non-tunneling pkt. 16812a9d9c8Sopenharmony_ci * Outer_L4_len + ... + Inner_L2_len for tunneling pkt. 16912a9d9c8Sopenharmony_ci */ 17012a9d9c8Sopenharmony_ci uint64_t l3_len:9; /**< L3 (IP) Header Length. */ 17112a9d9c8Sopenharmony_ci uint64_t l4_len:8; /**< L4 (TCP/UDP) Header Length. */ 17212a9d9c8Sopenharmony_ci uint64_t tso_segsz:16; /**< TCP TSO segment size */ 17312a9d9c8Sopenharmony_ci 17412a9d9c8Sopenharmony_ci /* fields for TX offloading of tunnels */ 17512a9d9c8Sopenharmony_ci uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */ 17612a9d9c8Sopenharmony_ci uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */ 17712a9d9c8Sopenharmony_ci 17812a9d9c8Sopenharmony_ci /* uint64_t unused:8; */ 17912a9d9c8Sopenharmony_ci }; 18012a9d9c8Sopenharmony_ci }; 18112a9d9c8Sopenharmony_ci 18212a9d9c8Sopenharmony_ci /** Size of the application private data. In case of an indirect 18312a9d9c8Sopenharmony_ci * mbuf, it stores the direct mbuf private data size. */ 18412a9d9c8Sopenharmony_ci uint16_t priv_size; 18512a9d9c8Sopenharmony_ci 18612a9d9c8Sopenharmony_ci /** Timesync flags for use with IEEE1588. */ 18712a9d9c8Sopenharmony_ci uint16_t timesync; 18812a9d9c8Sopenharmony_ci} __rte_cache_aligned; 189