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_MASK (0xFULL << 45)
217 #define PKT_TX_QINQ_PKT (1ULL << 49)
232 #define PKT_TX_TCP_SEG (1ULL << 50)
234 #define PKT_TX_IEEE1588_TMST (1ULL << 51)
247 #define PKT_TX_L4_NO_CKSUM (0ULL << 52)
248 #define PKT_TX_TCP_CKSUM (1ULL << 52)
249 #define PKT_TX_SCTP_CKSUM (2ULL << 52)
250 #define PKT_TX_UDP_CKSUM (3ULL << 52)
251 #define PKT_TX_L4_MASK (3ULL << 52)
260 #define PKT_TX_IP_CKSUM (1ULL << 54)
268 #define PKT_TX_IPV4 (1ULL << 55)
276 #define PKT_TX_IPV6 (1ULL << 56)
278 #define PKT_TX_VLAN_PKT (1ULL << 57)
288 #define PKT_TX_OUTER_IP_CKSUM (1ULL << 58)
295 #define PKT_TX_OUTER_IPV4 (1ULL << 59)
302 #define PKT_TX_OUTER_IPV6 (1ULL << 60)
308 #define PKT_TX_OFFLOAD_MASK ( \
311 PKT_TX_OUTER_IP_CKSUM | \
313 PKT_TX_IEEE1588_TMST | \
316 PKT_TX_TUNNEL_MASK | \
319 #define __RESERVED (1ULL << 61)
321 #define IND_ATTACHED_MBUF (1ULL << 62)
324 #define CTRL_MBUF_FLAG (1ULL << 63)
327 #define RTE_MBUF_PRIV_ALIGN 8
385 #define RTE_MBUF_DEFAULT_DATAROOM 2048
386 #define RTE_MBUF_DEFAULT_BUF_SIZE \
387 (RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM)
440 MARKER rx_descriptor_fields1;
502 MARKER cacheline1 __rte_cache_min_aligned;
577 #if RTE_CACHE_LINE_SIZE == 64
598 return mb->buf_physaddr + mb->data_off;
616 return mb->buf_physaddr + RTE_PKTMBUF_HEADROOM;
652 #define RTE_MBUF_INDIRECT(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF)
657 #define RTE_MBUF_DIRECT(mb) (!RTE_MBUF_INDIRECT(mb))
670 #ifdef RTE_LIBRTE_MBUF_DEBUG
673 #define __rte_mbuf_sanity_check(m, is_h) rte_mbuf_sanity_check(m, is_h)
678 #define __rte_mbuf_sanity_check(m, is_h) do { } while (0)
682 #ifdef RTE_MBUF_REFCNT_ATOMIC
691 static inline uint16_t
719 static inline uint16_t
742 static inline uint16_t
752 static inline uint16_t
770 #define RTE_MBUF_PREFETCH_TO_FREE(m) do { \
791 #define MBUF_RAW_ALLOC_CHECK(m) do { \
792 RTE_ASSERT(rte_mbuf_refcnt_read(m) == 1); \
793 RTE_ASSERT((m)->next == NULL); \
794 RTE_ASSERT((m)->nb_segs == 1); \
795 __rte_mbuf_sanity_check(m, 0); \
825 MBUF_RAW_ALLOC_CHECK(m);
843 static inline void __attribute__((always_inline))
848 RTE_ASSERT(m->next == NULL);
849 RTE_ASSERT(m->nb_segs == 1);
857 __rte_mbuf_raw_free(
struct rte_mbuf *m)
884 void *m,
unsigned i);
898 #define rte_ctrlmbuf_alloc(mp) rte_pktmbuf_alloc(mp)
906 #define rte_ctrlmbuf_free(m) rte_pktmbuf_free(m)
916 #define rte_ctrlmbuf_data(m) ((char *)((m)->buf_addr) + (m)->data_off)
926 #define rte_ctrlmbuf_len(m) rte_pktmbuf_data_len(m)
965 void *m,
unsigned i);
1023 unsigned cache_size, uint16_t priv_size, uint16_t data_room_size,
1037 static inline uint16_t
1058 static inline uint16_t
1077 m->data_off =
RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->
buf_len);
1142 struct rte_mbuf **mbufs,
unsigned count)
1156 switch (count % 4) {
1158 while (idx != count) {
1159 MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
1164 MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
1169 MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
1174 MBUF_RAW_ALLOC_CHECK(mbufs[idx]);
1215 mi->buf_physaddr = m->buf_physaddr;
1219 mi->data_off = m->data_off;
1255 uint32_t mbuf_size, buf_len, priv_size;
1258 mbuf_size =
sizeof(
struct rte_mbuf) + priv_size;
1262 m->
buf_addr = (
char *)m + mbuf_size;
1264 m->
buf_len = (uint16_t)buf_len;
1291 __attribute__((always_inline))
1302 if (m->next != NULL) {
1315 if (m->next != NULL) {
1329 __rte_pktmbuf_prefree_seg(
struct rte_mbuf *m)
1343 static inline void __attribute__((always_inline))
1410 }
while ((md = md->
next) != NULL &&
1444 }
while ((m = m->
next) != NULL);
1489 while (m2->
next != NULL)
1508 #define rte_pktmbuf_mtod_offset(m, t, o) \
1509 ((t)((char *)(m)->buf_addr + (m)->data_off + (o)))
1523 #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0)
1534 #define rte_pktmbuf_mtophys_offset(m, o) \
1535 (phys_addr_t)((m)->buf_physaddr + (m)->data_off + (o))
1544 #define rte_pktmbuf_mtophys(m) rte_pktmbuf_mtophys_offset(m, 0)
1554 #define rte_pktmbuf_pkt_len(m) ((m)->pkt_len)
1564 #define rte_pktmbuf_data_len(m) ((m)->data_len)
1593 return (
char *)m->
buf_addr + m->data_off;
1625 return (
char*) tail;
1652 return (
char *)m->
buf_addr + m->data_off;
1702 const void *__rte_pktmbuf_read(
const struct rte_mbuf *m, uint32_t off,
1703 uint32_t len,
void *buf);
1726 uint32_t off, uint32_t len,
void *buf)
1731 return __rte_pktmbuf_read(m, off, len, buf);
1760 cur_tail->
next = tail;
1786 uint64_t inner_l3_offset = m->
l2_len;
1812 !(ol_flags & PKT_TX_IP_CKSUM)))
1816 if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) &&
1838 int seg_len, copy_len;