97 #define PKT_RX_VLAN_PKT (1ULL << 0)
99 #define PKT_RX_RSS_HASH (1ULL << 1)
100 #define PKT_RX_FDIR (1ULL << 2)
109 #define PKT_RX_L4_CKSUM_BAD (1ULL << 3)
118 #define PKT_RX_IP_CKSUM_BAD (1ULL << 4)
120 #define PKT_RX_EIP_CKSUM_BAD (1ULL << 5)
127 #define PKT_RX_VLAN_STRIPPED (1ULL << 6)
137 #define PKT_RX_IP_CKSUM_MASK ((1ULL << 4) | (1ULL << 7))
139 #define PKT_RX_IP_CKSUM_UNKNOWN 0
140 #define PKT_RX_IP_CKSUM_BAD (1ULL << 4)
141 #define PKT_RX_IP_CKSUM_GOOD (1ULL << 7)
142 #define PKT_RX_IP_CKSUM_NONE ((1ULL << 4) | (1ULL << 7))
152 #define PKT_RX_L4_CKSUM_MASK ((1ULL << 3) | (1ULL << 8))
154 #define PKT_RX_L4_CKSUM_UNKNOWN 0
155 #define PKT_RX_L4_CKSUM_BAD (1ULL << 3)
156 #define PKT_RX_L4_CKSUM_GOOD (1ULL << 8)
157 #define PKT_RX_L4_CKSUM_NONE ((1ULL << 3) | (1ULL << 8))
159 #define PKT_RX_IEEE1588_PTP (1ULL << 9)
160 #define PKT_RX_IEEE1588_TMST (1ULL << 10)
161 #define PKT_RX_FDIR_ID (1ULL << 13)
162 #define PKT_RX_FDIR_FLX (1ULL << 14)
171 #define PKT_RX_QINQ_STRIPPED (1ULL << 15)
178 #define PKT_RX_QINQ_PKT PKT_RX_QINQ_STRIPPED
185 #define PKT_RX_LRO (1ULL << 16)
190 #define PKT_RX_TIMESTAMP (1ULL << 17)
200 #define PKT_TX_MACSEC (1ULL << 44)
207 #define PKT_TX_TUNNEL_VXLAN (0x1ULL << 45)
208 #define PKT_TX_TUNNEL_GRE (0x2ULL << 45)
209 #define PKT_TX_TUNNEL_IPIP (0x3ULL << 45)
210 #define PKT_TX_TUNNEL_GENEVE (0x4ULL << 45)
212 #define PKT_TX_TUNNEL_MPLSINUDP (0x5ULL << 45)
214 #define PKT_TX_TUNNEL_MASK (0xFULL << 45)
219 #define PKT_TX_QINQ_PKT (1ULL << 49)
234 #define PKT_TX_TCP_SEG (1ULL << 50)
236 #define PKT_TX_IEEE1588_TMST (1ULL << 51)
249 #define PKT_TX_L4_NO_CKSUM (0ULL << 52)
250 #define PKT_TX_TCP_CKSUM (1ULL << 52)
251 #define PKT_TX_SCTP_CKSUM (2ULL << 52)
252 #define PKT_TX_UDP_CKSUM (3ULL << 52)
253 #define PKT_TX_L4_MASK (3ULL << 52)
262 #define PKT_TX_IP_CKSUM (1ULL << 54)
270 #define PKT_TX_IPV4 (1ULL << 55)
278 #define PKT_TX_IPV6 (1ULL << 56)
280 #define PKT_TX_VLAN_PKT (1ULL << 57)
290 #define PKT_TX_OUTER_IP_CKSUM (1ULL << 58)
297 #define PKT_TX_OUTER_IPV4 (1ULL << 59)
304 #define PKT_TX_OUTER_IPV6 (1ULL << 60)
310 #define PKT_TX_OFFLOAD_MASK ( \
313 PKT_TX_OUTER_IP_CKSUM | \
315 PKT_TX_IEEE1588_TMST | \
318 PKT_TX_TUNNEL_MASK | \
321 #define __RESERVED (1ULL << 61)
323 #define IND_ATTACHED_MBUF (1ULL << 62)
326 #define CTRL_MBUF_FLAG (1ULL << 63)
329 #define RTE_MBUF_PRIV_ALIGN 8
387 #define RTE_MBUF_DEFAULT_DATAROOM 2048
388 #define RTE_MBUF_DEFAULT_BUF_SIZE \
389 (RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM)
442 MARKER rx_descriptor_fields1;
504 MARKER cacheline1 __rte_cache_min_aligned;
579 #if RTE_CACHE_LINE_SIZE == 64
600 return mb->buf_physaddr + mb->data_off;
618 return mb->buf_physaddr + RTE_PKTMBUF_HEADROOM;
654 #define RTE_MBUF_INDIRECT(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF)
659 #define RTE_MBUF_DIRECT(mb) (!RTE_MBUF_INDIRECT(mb))
672 #ifdef RTE_LIBRTE_MBUF_DEBUG
675 #define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h)
680 #define __rte_mbuf_sanity_check(m, is_h) do { } while (0)
684 #ifdef RTE_MBUF_REFCNT_ATOMIC
693 static inline uint16_t
721 static inline uint16_t
744 static inline uint16_t
754 static inline uint16_t
772 #define RTE_MBUF_PREFETCH_TO_FREE(m) do { \
793 #define MBUF_RAW_ALLOC_CHECK(m) do { \
794 RTE_ASSERT(rte_mbuf_refcnt_read(m) == 1); \
795 RTE_ASSERT((m)->next == NULL); \
796 RTE_ASSERT((m)->nb_segs == 1); \
797 __rte_mbuf_sanity_check(m, 0); \
827 MBUF_RAW_ALLOC_CHECK(m);
850 RTE_ASSERT(m->
next == NULL);
859 __rte_mbuf_raw_free(
struct rte_mbuf *m)
886 void *m,
unsigned i);
900 #define rte_ctrlmbuf_alloc(mp) rte_pktmbuf_alloc(mp)
908 #define rte_ctrlmbuf_free(m) rte_pktmbuf_free(m)
918 #define rte_ctrlmbuf_data(m) ((char *)((m)->buf_addr) + (m)->data_off)
928 #define rte_ctrlmbuf_len(m) rte_pktmbuf_data_len(m)
967 void *m,
unsigned i);
1025 unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
1039 static inline uint16_t
1060 static inline uint16_t
1079 m->data_off =
RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->
buf_len);
1144 struct rte_mbuf **mbufs,
unsigned count)
1158 switch (count % 4) {
1160 while (idx != count) {
1161 MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
1166 MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
1171 MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
1176 MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
1217 mi->buf_physaddr = m->buf_physaddr;
1221 mi->data_off = m->data_off;
1257 uint32_t mbuf_size, buf_len, priv_size;
1260 mbuf_size =
sizeof(
struct rte_mbuf) + priv_size;
1264 m->
buf_addr = (
char *)m + mbuf_size;
1266 m->
buf_len = (uint16_t)buf_len;
1303 if (m->
next != NULL) {
1316 if (m->
next != NULL) {
1330 __rte_pktmbuf_prefree_seg(
struct rte_mbuf *m)
1411 }
while ((md = md->
next) != NULL &&
1445 }
while ((m = m->
next) != NULL);
1490 while (m2->
next != NULL)
1509 #define rte_pktmbuf_mtod_offset(m, t, o) \
1510 ((t)((char *)(m)->buf_addr + (m)->data_off + (o)))
1524 #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)
1535 #define rte_pktmbuf_mtophys_offset(m, o) \
1536 (phys_addr_t)((m)->buf_physaddr + (m)->data_off + (o))
1545 #define rte_pktmbuf_mtophys(m) rte_pktmbuf_mtophys_offset(m, 0)
1555 #define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)
1565 #define rte_pktmbuf_data_len(m) ((m)->data_len)
1594 return (
char *)m->
buf_addr + m->data_off;
1626 return (
char*) tail;
1653 return (
char *)m->
buf_addr + m->data_off;
1703 const void *__rte_pktmbuf_read(
const struct rte_mbuf *m, uint32_t off,
1704 uint32_t len,
void *buf);
1727 uint32_t off, uint32_t len,
void *buf)
1732 return __rte_pktmbuf_read(m, off, len, buf);
1761 cur_tail->
next = tail;
1787 uint64_t inner_l3_offset = m->
l2_len;
1813 !(ol_flags & PKT_TX_IP_CKSUM)))
1817 if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) &&
1839 int seg_len, copy_len;