头文件 lib/librte_mbuf/rte_mbuf_core.h
20.11.3 版本下定义:
struct rte_mbuf {
RTE_MARKER cacheline0;
void *buf_addr; /**< 段缓冲区的虚拟地址,即报文缓存区,注意默认前128个字节是预留的 */
/**
* 段缓冲区的物理地址。
* 强制对齐到8字节,以确保32位和64位的mbuf cacheline0布局完全相同。
* 这使得向量驱动程序的工作更容易。
*/
rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t));
/* next 8 bytes are initialised on RX descriptor rearm */
RTE_MARKER64 rearm_data;
uint16_t data_off; /**< 报文缓存偏移量,默认是128 */
/**
* 引用计数. 为了支持零拷贝广播,大小应当设置为16比特。
* 它只能通过以下函数访问:
* rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and
* rte_mbuf_refcnt_set().
* 这些函数(原子或非原子)的功能由RTE_MBUF_REFCNT_ATOMIC 控制
*/
uint16_t refcnt;
uint16_t nb_segs; /**< 分段数. */
/** Input port (16 bits to support more than 256 virtual ports).
* The event eth Tx adapter uses this field to specify the output port.
*/
uint16_t port;
uint64_t ol_flags; /**< Offload features. */
/* remaining bytes are set on RX when pulling packet from descriptor */
RTE_MARKER rx_descriptor_fields1;
/*
* The packet type, which is the combination of outer/inner L2, L3, L4
* and tunnel types. The packet_type is about data really present in the
* mbuf. Example: if vlan stripping is enabled, a received vlan packet
* would have RTE_PTYPE_L2_ETHER and not RTE_PTYPE_L2_VLAN because the
* vlan is stripped from the data.
*/
RTE_STD_C11
union {
uint32_t packet_type; /**< L2/L3/L4 and tunnel information. */
__extension__
struct {
uint8_t l2_type:4; /**< (Outer) L2 type. */
uint8_t l3_type:4; /**< (Outer) L3 type. */
uint8_t l4_type:4; /**< (Outer) L4 type. */
uint8_t tun_type:4; /**< Tunnel type. */
RTE_STD_C11
union {
uint8_t inner_esp_next_proto;
/**< ESP next protocol type, valid if
* RTE_PTYPE_TUNNEL_ESP tunnel type is set
* on both Tx an