rte_mbuf整个用来存数据的buf包括headroom、data和tailroom三个区域。Headroom区域默认128字节,可以通过宏RTE_PKTMBUF_HEADROOM调整。Data区域一般指的是地址区间在buf_addr + data_off到buf_addr + data_off + data_len,即data_len就是这段数据的长短。Tailroom一般指的是data_len还未包含的东西,默认其实data_len...
#define RTE_MBUF_DEFAULT_BUF_SIZE (RTE_MBUF_DEFAULT_DATAROOM + RTE_PKTMBUF_HEADROOM) 所以当我们从mbuf pool alloc一块mbuf过来的时候,都会reset一下mbuf的变量,里面就包含了重置data_off,具体如下: staticinlinevoidrte_pktmbuf_reset_headroom(structrte_mbuf *m) { m->data_off =(uint16_t)RTE_MIN...
uint16_tdata_off; // ... }; 其中,buf_addr是指向数据缓冲区起始地址的指针,data_off是数据在缓冲区中的偏移量。 假设有一个mbuf指向了一个rte_mbuf对象,则可以使用rte_pktmbuf_mtod_offset(mbuf, char *, offset)宏来获取指向缓冲区中某个位置的指针。其中,第一个参数是rte_mbuf对象的指针,第二个参数...
mbuf->data_off = RTE_PKTMBUF_HEADROOM; mbuf->nb_segs = 1; mbuf->port = rxq->port_id; dma_addr = rte_cpu_to_le_64(rte_mbuf_data_dma_addr_default(mbuf)); rxd = &rxq->rx_ring[i]; rxd->read.hdr_addr = 0; rxd->read.pkt_addr = dma_addr; rxe[i].mbuf = mbuf; } retur...
MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); // 配置以太网设备 struct rte_eth_conf port_conf = {0}; rte_eth_dev_configure(port_id, 1, 1, &port_conf); ...
descriptor rearm */ MARKER64 rearm_data; uint16_t data_off; /** * Reference counter. Its size should at least equal to the size * of port field (16 bits), to support zero-copy broadcast. * It should only be accessed using the following functions: * rte_mbuf_refcnt_update(), rte_...
1. 理解 rte_pktmbuf_mtod 函数的用途和上下文 rte_pktmbuf_mtod 的主要目的是将 rte_mbuf 结构体中的 buf_addr(指向数据包缓冲区的起始地址)与 data_off(数据偏移量)相加,然后将其结果转换为特定类型的指针。这样,用户就可以直接通过这个指针来访问和操作数据包中的数据。 2. 查找 rte_pktmbuf_mtod 函数的...
uint16_t data_off; /** * Reference counter. Its size should at least equal to the size * of port field (16 bits), to support zero-copy broadcast. * It should only be accessed using the following functions: * rte_mbuf_refcnt_update(), rte_mbuf_refcnt_read(), and ...
rte_pktmbuf_mtod_offset() 将struct rte_mbuf类型的数据包缓冲区对象转换为指向偏移量处的缓冲区数据的指针。 #define rte_pktmbuf_mtod_offset (m,t,o) ((t)(void *)((char *)(m)->buf_addr + (m)->data_off + (o))) 其中各参数的含义如下: ...
We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Cancel Create saved search Sign in Sign up Reseting focus {...