89 #define PKT_RX_VLAN_PKT (1ULL << 0)
91 #define PKT_RX_RSS_HASH (1ULL << 1)
92 #define PKT_RX_FDIR (1ULL << 2)
93 #define PKT_RX_L4_CKSUM_BAD (1ULL << 3)
94 #define PKT_RX_IP_CKSUM_BAD (1ULL << 4)
95 #define PKT_RX_EIP_CKSUM_BAD (1ULL << 5)
102 #define PKT_RX_VLAN_STRIPPED (1ULL << 6)
106 #define PKT_RX_IEEE1588_PTP (1ULL << 9)
107 #define PKT_RX_IEEE1588_TMST (1ULL << 10)
108 #define PKT_RX_FDIR_ID (1ULL << 13)
109 #define PKT_RX_FDIR_FLX (1ULL << 14)
118 #define PKT_RX_QINQ_STRIPPED (1ULL << 15)
125 #define PKT_RX_QINQ_PKT PKT_RX_QINQ_STRIPPED
134 #define PKT_TX_QINQ_PKT (1ULL << 49)
149 #define PKT_TX_TCP_SEG (1ULL << 50)
151 #define PKT_TX_IEEE1588_TMST (1ULL << 51)
164 #define PKT_TX_L4_NO_CKSUM (0ULL << 52)
165 #define PKT_TX_TCP_CKSUM (1ULL << 52)
166 #define PKT_TX_SCTP_CKSUM (2ULL << 52)
167 #define PKT_TX_UDP_CKSUM (3ULL << 52)
168 #define PKT_TX_L4_MASK (3ULL << 52)
177 #define PKT_TX_IP_CKSUM (1ULL << 54)
185 #define PKT_TX_IPV4 (1ULL << 55)
193 #define PKT_TX_IPV6 (1ULL << 56)
195 #define PKT_TX_VLAN_PKT (1ULL << 57)
205 #define PKT_TX_OUTER_IP_CKSUM (1ULL << 58)
212 #define PKT_TX_OUTER_IPV4 (1ULL << 59)
219 #define PKT_TX_OUTER_IPV6 (1ULL << 60)
221 #define __RESERVED (1ULL << 61)
223 #define IND_ATTACHED_MBUF (1ULL << 62)
226 #define CTRL_MBUF_FLAG (1ULL << 63)
276 #define RTE_PTYPE_UNKNOWN 0x00000000
284 #define RTE_PTYPE_L2_ETHER 0x00000001
291 #define RTE_PTYPE_L2_ETHER_TIMESYNC 0x00000002
298 #define RTE_PTYPE_L2_ETHER_ARP 0x00000003
305 #define RTE_PTYPE_L2_ETHER_LLDP 0x00000004
312 #define RTE_PTYPE_L2_ETHER_NSH 0x00000005
317 #define RTE_PTYPE_L2_MASK 0x0000000f
327 #define RTE_PTYPE_L3_IPV4 0x00000010
337 #define RTE_PTYPE_L3_IPV4_EXT 0x00000030
347 #define RTE_PTYPE_L3_IPV6 0x00000040
357 #define RTE_PTYPE_L3_IPV4_EXT_UNKNOWN 0x00000090
368 #define RTE_PTYPE_L3_IPV6_EXT 0x000000c0
379 #define RTE_PTYPE_L3_IPV6_EXT_UNKNOWN 0x000000e0
384 #define RTE_PTYPE_L3_MASK 0x000000f0
396 #define RTE_PTYPE_L4_TCP 0x00000100
408 #define RTE_PTYPE_L4_UDP 0x00000200
425 #define RTE_PTYPE_L4_FRAG 0x00000300
437 #define RTE_PTYPE_L4_SCTP 0x00000400
449 #define RTE_PTYPE_L4_ICMP 0x00000500
465 #define RTE_PTYPE_L4_NONFRAG 0x00000600
470 #define RTE_PTYPE_L4_MASK 0x00000f00
481 #define RTE_PTYPE_TUNNEL_IP 0x00001000
492 #define RTE_PTYPE_TUNNEL_GRE 0x00002000
505 #define RTE_PTYPE_TUNNEL_VXLAN 0x00003000
519 #define RTE_PTYPE_TUNNEL_NVGRE 0x00004000
532 #define RTE_PTYPE_TUNNEL_GENEVE 0x00005000
539 #define RTE_PTYPE_TUNNEL_GRENAT 0x00006000
543 #define RTE_PTYPE_TUNNEL_MASK 0x0000f000
551 #define RTE_PTYPE_INNER_L2_ETHER 0x00010000
558 #define RTE_PTYPE_INNER_L2_ETHER_VLAN 0x00020000
562 #define RTE_PTYPE_INNER_L2_MASK 0x000f0000
571 #define RTE_PTYPE_INNER_L3_IPV4 0x00100000
580 #define RTE_PTYPE_INNER_L3_IPV4_EXT 0x00200000
589 #define RTE_PTYPE_INNER_L3_IPV6 0x00300000
598 #define RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN 0x00400000
608 #define RTE_PTYPE_INNER_L3_IPV6_EXT 0x00500000
619 #define RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN 0x00600000
623 #define RTE_PTYPE_INNER_L3_MASK 0x00f00000
635 #define RTE_PTYPE_INNER_L4_TCP 0x01000000
647 #define RTE_PTYPE_INNER_L4_UDP 0x02000000
659 #define RTE_PTYPE_INNER_L4_FRAG 0x03000000
671 #define RTE_PTYPE_INNER_L4_SCTP 0x04000000
683 #define RTE_PTYPE_INNER_L4_ICMP 0x05000000
696 #define RTE_PTYPE_INNER_L4_NONFRAG 0x06000000
700 #define RTE_PTYPE_INNER_L4_MASK 0x0f000000
707 #define RTE_ETH_IS_IPV4_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV4)
714 #define RTE_ETH_IS_IPV6_HDR(ptype) ((ptype) & RTE_PTYPE_L3_IPV6)
717 #define RTE_ETH_IS_TUNNEL_PKT(ptype) ((ptype) & (RTE_PTYPE_TUNNEL_MASK | \
718 RTE_PTYPE_INNER_L2_MASK | \
719 RTE_PTYPE_INNER_L3_MASK | \
720 RTE_PTYPE_INNER_L4_MASK))
723 #define RTE_MBUF_PRIV_ALIGN 8
753 #define RTE_MBUF_DEFAULT_DATAROOM 2048
754 #define RTE_MBUF_DEFAULT_BUF_SIZE \
755 (RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM)
797 MARKER rx_descriptor_fields1;
852 MARKER cacheline1 __rte_cache_min_aligned;
917 #if RTE_CACHE_LINE_SIZE == 64
992 #define RTE_MBUF_INDIRECT(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF)
997 #define RTE_MBUF_DIRECT(mb) (!RTE_MBUF_INDIRECT(mb))
1010 #ifdef RTE_LIBRTE_MBUF_DEBUG
1013 #define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h)
1018 #define __rte_mbuf_sanity_check(m, is_h) do { } while (0)
1022 #ifdef RTE_MBUF_REFCNT_ATOMIC
1031 static inline uint16_t
1059 static inline uint16_t
1082 static inline uint16_t
1092 static inline uint16_t
1110 #define RTE_MBUF_PREFETCH_TO_FREE(m) do { \
1161 __rte_deprecated
static inline struct rte_mbuf *
1175 static inline void __attribute__((always_inline))
1176 __rte_mbuf_raw_free(struct
rte_mbuf *m)
1204 void *m,
unsigned i);
1218 #define rte_ctrlmbuf_alloc(mp) rte_pktmbuf_alloc(mp)
1226 #define rte_ctrlmbuf_free(m) rte_pktmbuf_free(m)
1236 #define rte_ctrlmbuf_data(m) ((char *)((m)->buf_addr) + (m)->data_off)
1246 #define rte_ctrlmbuf_len(m) rte_pktmbuf_data_len(m)
1285 void *m,
unsigned i);
1343 unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
1357 static inline uint16_t
1378 static inline uint16_t
1407 m->data_off = (RTE_PKTMBUF_HEADROOM <= m->
buf_len) ?
1408 RTE_PKTMBUF_HEADROOM : m->
buf_len;
1449 struct rte_mbuf **mbufs,
unsigned count)
1463 switch (count % 4) {
1465 while (idx != count) {
1527 mi->data_off = m->data_off;
1562 uint32_t mbuf_size, buf_len, priv_size;
1565 mbuf_size =
sizeof(
struct rte_mbuf) + priv_size;
1569 m->
buf_addr = (
char *)m + mbuf_size;
1571 m->
buf_len = (uint16_t)buf_len;
1572 m->data_off =
RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->
buf_len);
1577 __rte_mbuf_raw_free(md);
1580 static inline struct rte_mbuf* __attribute__((always_inline))
1581 __rte_pktmbuf_prefree_seg(struct
rte_mbuf *m)
1603 static inline void __attribute__((always_inline))
1606 if (
likely(NULL != (m = __rte_pktmbuf_prefree_seg(m)))) {
1608 __rte_mbuf_raw_free(m);
1671 }
while ((md = md->
next) != NULL &&
1705 }
while ((m = m->
next) != NULL);
1750 while (m2->
next != NULL)
1769 #define rte_pktmbuf_mtod_offset(m, t, o) \
1770 ((t)((char *)(m)->buf_addr + (m)->data_off + (o)))
1784 #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)
1795 #define rte_pktmbuf_mtophys_offset(m, o) \
1796 (phys_addr_t)((m)->buf_physaddr + (m)->data_off + (o))
1805 #define rte_pktmbuf_mtophys(m) rte_pktmbuf_mtophys_offset(m, 0)
1815 #define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)
1825 #define rte_pktmbuf_data_len(m) ((m)->data_len)
1854 return (
char *)m->
buf_addr + m->data_off;
1886 return (
char*) tail;
1913 return (
char *)m->
buf_addr + m->data_off;
1986 cur_tail->
next = tail;