69 #pragma GCC poison RTE_MBUF_SCATTER_GATHER
70 #pragma GCC poison RTE_MBUF_REFCNT
86 #define PKT_RX_VLAN_PKT (1ULL << 0)
87 #define PKT_RX_RSS_HASH (1ULL << 1)
88 #define PKT_RX_FDIR (1ULL << 2)
89 #define PKT_RX_L4_CKSUM_BAD (1ULL << 3)
90 #define PKT_RX_IP_CKSUM_BAD (1ULL << 4)
91 #define PKT_RX_EIP_CKSUM_BAD (0ULL << 0)
92 #define PKT_RX_OVERSIZE (0ULL << 0)
93 #define PKT_RX_HBUF_OVERFLOW (0ULL << 0)
94 #define PKT_RX_RECIP_ERR (0ULL << 0)
95 #define PKT_RX_MAC_ERR (0ULL << 0)
97 #define PKT_RX_IPV4_HDR (1ULL << 5)
98 #define PKT_RX_IPV4_HDR_EXT (1ULL << 6)
99 #define PKT_RX_IPV6_HDR (1ULL << 7)
100 #define PKT_RX_IPV6_HDR_EXT (1ULL << 8)
102 #define PKT_RX_IEEE1588_PTP (1ULL << 9)
103 #define PKT_RX_IEEE1588_TMST (1ULL << 10)
105 #define PKT_RX_TUNNEL_IPV4_HDR (1ULL << 11)
106 #define PKT_RX_TUNNEL_IPV6_HDR (1ULL << 12)
108 #define PKT_RX_FDIR_ID (1ULL << 13)
109 #define PKT_RX_FDIR_FLX (1ULL << 14)
110 #define PKT_RX_QINQ_PKT (1ULL << 15)
118 #define PKT_TX_QINQ_PKT (1ULL << 49)
133 #define PKT_TX_TCP_SEG (1ULL << 50)
135 #define PKT_TX_IEEE1588_TMST (1ULL << 51)
148 #define PKT_TX_L4_NO_CKSUM (0ULL << 52)
149 #define PKT_TX_TCP_CKSUM (1ULL << 52)
150 #define PKT_TX_SCTP_CKSUM (2ULL << 52)
151 #define PKT_TX_UDP_CKSUM (3ULL << 52)
152 #define PKT_TX_L4_MASK (3ULL << 52)
161 #define PKT_TX_IP_CKSUM (1ULL << 54)
169 #define PKT_TX_IPV4 (1ULL << 55)
177 #define PKT_TX_IPV6 (1ULL << 56)
179 #define PKT_TX_VLAN_PKT (1ULL << 57)
189 #define PKT_TX_OUTER_IP_CKSUM (1ULL << 58)
196 #define PKT_TX_OUTER_IPV4 (1ULL << 59)
203 #define PKT_TX_OUTER_IPV6 (1ULL << 60)
205 #define __RESERVED (1ULL << 61)
207 #define IND_ATTACHED_MBUF (1ULL << 62)
210 #define CTRL_MBUF_FLAG (1ULL << 63)
261 #define RTE_PTYPE_UNKNOWN 0x00000000
269 #define RTE_PTYPE_L2_ETHER 0x00000001
276 #define RTE_PTYPE_L2_ETHER_TIMESYNC 0x00000002
283 #define RTE_PTYPE_L2_ETHER_ARP 0x00000003
290 #define RTE_PTYPE_L2_ETHER_LLDP 0x00000004
295 #define RTE_PTYPE_L2_MASK 0x0000000f
305 #define RTE_PTYPE_L3_IPV4 0x00000010
315 #define RTE_PTYPE_L3_IPV4_EXT 0x00000030
325 #define RTE_PTYPE_L3_IPV6 0x00000040
335 #define RTE_PTYPE_L3_IPV4_EXT_UNKNOWN 0x00000090
346 #define RTE_PTYPE_L3_IPV6_EXT 0x000000c0
357 #define RTE_PTYPE_L3_IPV6_EXT_UNKNOWN 0x000000e0
362 #define RTE_PTYPE_L3_MASK 0x000000f0
374 #define RTE_PTYPE_L4_TCP 0x00000100
386 #define RTE_PTYPE_L4_UDP 0x00000200
403 #define RTE_PTYPE_L4_FRAG 0x00000300
415 #define RTE_PTYPE_L4_SCTP 0x00000400
427 #define RTE_PTYPE_L4_ICMP 0x00000500
443 #define RTE_PTYPE_L4_NONFRAG 0x00000600
448 #define RTE_PTYPE_L4_MASK 0x00000f00
459 #define RTE_PTYPE_TUNNEL_IP 0x00001000
470 #define RTE_PTYPE_TUNNEL_GRE 0x00002000
483 #define RTE_PTYPE_TUNNEL_VXLAN 0x00003000
497 #define RTE_PTYPE_TUNNEL_NVGRE 0x00004000
510 #define RTE_PTYPE_TUNNEL_GENEVE 0x00005000
517 #define RTE_PTYPE_TUNNEL_GRENAT 0x00006000
521 #define RTE_PTYPE_TUNNEL_MASK 0x0000f000
529 #define RTE_PTYPE_INNER_L2_ETHER 0x00010000
536 #define RTE_PTYPE_INNER_L2_ETHER_VLAN 0x00020000
540 #define RTE_PTYPE_INNER_L2_MASK 0x000f0000
549 #define RTE_PTYPE_INNER_L3_IPV4 0x00100000
558 #define RTE_PTYPE_INNER_L3_IPV4_EXT 0x00200000
567 #define RTE_PTYPE_INNER_L3_IPV6 0x00300000
576 #define RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN 0x00400000
586 #define RTE_PTYPE_INNER_L3_IPV6_EXT 0x00500000
597 #define RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN 0x00600000
601 #define RTE_PTYPE_INNER_L3_MASK 0x00f00000
613 #define RTE_PTYPE_INNER_L4_TCP 0x01000000
625 #define RTE_PTYPE_INNER_L4_UDP 0x02000000
637 #define RTE_PTYPE_INNER_L4_FRAG 0x03000000
649 #define RTE_PTYPE_INNER_L4_SCTP 0x04000000
661 #define RTE_PTYPE_INNER_L4_ICMP 0x05000000
674 #define RTE_PTYPE_INNER_L4_NONFRAG 0x06000000
678 #define RTE_PTYPE_INNER_L4_MASK 0x0f000000
685 #define RTE_ETH_IS_IPV4_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV4)
692 #define RTE_ETH_IS_IPV6_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV6)
695 #define RTE_ETH_IS_TUNNEL_PKT(ptype) ((ptype) & (RTE_PTYPE_TUNNEL_MASK | \
696 RTE_PTYPE_INNER_L2_MASK | \
697 RTE_PTYPE_INNER_L3_MASK | \
698 RTE_PTYPE_INNER_L4_MASK))
702 #define RTE_MBUF_PRIV_ALIGN 8
732 #define RTE_MBUF_DEFAULT_DATAROOM 2048
733 #define RTE_MBUF_DEFAULT_BUF_SIZE \
734 (RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM)
776 MARKER rx_descriptor_fields1;
790 uint32_t inner_l2_type:4;
791 uint32_t inner_l3_type:4;
792 uint32_t inner_l4_type:4;
837 MARKER cacheline1 __rte_cache_aligned;
907 #define RTE_MBUF_INDIRECT(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF)
912 #define RTE_MBUF_DIRECT(mb) (!RTE_MBUF_INDIRECT(mb))
925 #ifdef RTE_LIBRTE_MBUF_DEBUG
928 #define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h)
931 #define __rte_mbuf_sanity_check_raw(m, is_h) do { \
933 rte_mbuf_sanity_check(m, is_h); \
937 #define RTE_MBUF_ASSERT(exp) \
939 rte_panic("line%d\tassert \"" #exp "\" failed\n", __LINE__); \
945 #define __rte_mbuf_sanity_check(m, is_h) do { } while (0)
948 #define __rte_mbuf_sanity_check_raw(m, is_h) do { } while (0)
951 #define RTE_MBUF_ASSERT(exp) do { } while (0)
955 #ifdef RTE_MBUF_REFCNT_ATOMIC
964 static inline uint16_t
992 static inline uint16_t
1015 static inline uint16_t
1025 static inline uint16_t
1043 #define RTE_MBUF_PREFETCH_TO_FREE(m) do { \
1095 static inline void __attribute__((always_inline))
1096 __rte_mbuf_raw_free(struct
rte_mbuf *m)
1124 void *m,
unsigned i);
1138 #define rte_ctrlmbuf_alloc(mp) rte_pktmbuf_alloc(mp)
1146 #define rte_ctrlmbuf_free(m) rte_pktmbuf_free(m)
1156 #define rte_ctrlmbuf_data(m) ((char *)((m)->buf_addr) + (m)->data_off)
1166 #define rte_ctrlmbuf_len(m) rte_pktmbuf_data_len(m)
1205 void *m,
unsigned i);
1263 unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
1277 static inline uint16_t
1298 static inline uint16_t
1327 m->data_off = (RTE_PKTMBUF_HEADROOM <= m->
buf_len) ?
1328 RTE_PKTMBUF_HEADROOM : m->
buf_len;
1350 if ((m = __rte_mbuf_raw_alloc(mp)) != NULL)
1390 mi->data_off = m->data_off;
1421 uint32_t mbuf_size, buf_len, priv_size;
1424 mbuf_size =
sizeof(
struct rte_mbuf) + priv_size;
1428 m->
buf_addr = (
char *)m + mbuf_size;
1430 m->
buf_len = (uint16_t)buf_len;
1431 m->data_off =
RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->
buf_len);
1436 static inline struct rte_mbuf* __attribute__((always_inline))
1437 __rte_pktmbuf_prefree_seg(struct
rte_mbuf *m)
1451 __rte_mbuf_raw_free(md);
1467 static inline void __attribute__((always_inline))
1470 if (
likely(NULL != (m = __rte_pktmbuf_prefree_seg(m)))) {
1472 __rte_mbuf_raw_free(m);
1535 }
while ((md = md->
next) != NULL &&
1569 }
while ((m = m->
next) != NULL);
1614 while (m2->
next != NULL)
1633 #define rte_pktmbuf_mtod_offset(m, t, o) \
1634 ((t)((char *)(m)->buf_addr + (m)->data_off + (o)))
1648 #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)
1658 #define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)
1668 #define rte_pktmbuf_data_len(m) ((m)->data_len)
1697 return (
char *)m->
buf_addr + m->data_off;
1729 return (
char*) tail;
1756 return (
char *)m->
buf_addr + m->data_off;