对于新分配的MBUF,数据缓冲区中数据开始的区域是rte_pktmbuf_headroom bytes,在缓冲区开始后,缓存对齐。
据我所知, ,净空不包含任何数据。因此,我想知道为什么MBUF?还应有一个净空,此外,默认的尺寸为128B。我尝试将净空尺寸设置为更大的东西,例如5120B,并且不会影响性能。因此,我想知道净空存在的目的是什么?
For a newly allocated mbuf, the area at which the data begins in the message buffer is RTE_PKTMBUF_HEADROOM bytes after the beginning of the buffer, which is cache aligned.

As far as I know, the headroom does not contain any data. So I wonder why there should be a headroom in the mbuf?In addition, the default size of HEADROOM is 128B.I've tried setting the HEADROOM size to something bigger, like 5120B, and it doesn't affect performance. So I want to know what is the purpose of the existence of the Headroom, and is there any theoretical limit to the size of the Headroom?
发布评论
评论(1)
DPDK MBUF的净空适合于将额外的数据(通常为 metadata )准备到 packet 数据。它的用例特定于PMD。例如,在其中结构virtio_net_hdr 。其他驱动程序可以将其用于卸载结果:校验和有效性状态,数据包分类,哈希值,您将其命名。
至于上限,它取决于MBUF对象的最大大小和最小数据包数据室,这又可能是PMD特定的。在大多数用例中,只能依靠默认大小。
A DPDK mbuf's headroom is suited for prepending extra data (typically, metadata) to the packet data. Its use cases are PMD-specific. For example, virtio PMD stores
struct virtio_net_hdr
in it. Other drivers may use this for offload results: checksum validity status, packet classification, hash values, you name it.As for the upper limit, it depends on the mbuf object's maximum size and on the minimum packet data room, which, in turn, might be PMD-specific. For the majority of use cases, it's OK to just rely on default size.