dpdk-16.04 中 mbuf 结构的 rearm_data 标号标识一个连续 6 字节长度的起始位置,相关定义如下: /* next 6 bytes are initialised on RX descriptor rearm */ MARKER8 rearm_data; uint16_t data_off; /** * 16-bit Reference counter. * It should only be accessed using the following functions: * r...
headroom: 保留区域headroom:一般用来存放用户自己针对于mbuf的一些描素信息,一般保留给用户使用,可以通过修改mbuf头文件,来实现headroom的大小; data_off 的默认值就是 mbuf的headroom的大小;默认就是128。如果要定义超过这个范围的私有字段,请自行修改 RTE_PKTMBUF_HEADROOM 数据字段:data。 data区域一般指的是地址区间...
所以当我们从mbuf pool alloc一块mbuf过来的时候,都会reset一下mbuf的变量,里面就包含了重置data_off,具体如下: staticinlinevoidrte_pktmbuf_reset_headroom(structrte_mbuf *m) { m->data_off =(uint16_t)RTE_MIN((uint16_t)RTE_PKTMBUF_HEADROOM, (uint16_t)m->buf_len); }staticinlinevoidrte_pktm...
Data区域一般指的是地址区间在buf_addr + data_off到buf_addr + data_off + data_len,即data_len就是这段数据的长短。Tailroom一般指的是data_len还未包含的东西,默认其实data_len是0。 在rte_mbuf的设计中,考虑到内存的利用率和访问速度,采用了内存池(mempool)的方式来管理这些mbuf。使用环形缓冲区保存空闲...
uint16_tdata_off; // ... }; 其中,buf_addr是指向数据缓冲区起始地址的指针,data_off是数据在缓冲区中的偏移量。 假设有一个mbuf指向了一个rte_mbuf对象,则可以使用rte_pktmbuf_mtod_offset(mbuf, char *, offset)宏来获取指向缓冲区中某个位置的指针。其中,第一个参数是rte_mbuf对象的指针,第二个参数...
gdb打印mbuf的方法: vim~/.gdbinit handleSIGPIPEnostop noprint define pmbuf set$m=(struct rte_mbuf*)$arg0printf"dump mbuf at %p, buf_addr:%p, buf_len=%hu, data_off=%u\n",$m,$m->buf_addr,$m->buf_len,$m->data_offprintf"data_len=%hu, pkt_len=%d\n",$m->data_len,$m->pkt...
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_...
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_copy_hdr(mi, m);mi->data_off = m->data_off; mi->data_len = m->data_len; mi->buf_iova = m->buf_iova; mi->buf_addr = m->buf_addr; mi->buf_len = m->buf_len; mi->next =NULL; mi->pkt_len = mi->data_len; ...
return m->data_off; } /** * Get the tailroom of a packet mbuf.* * @param m * The packet mbuf.* @return * The length of the tailroom.*/ static inline uint16_t rte_pktmbuf_tailroom(const struct rte_mbuf *m) { __rte_mbuf_sanity_check(m, 0); ...