rte_mbuf 在 dpdk 18.08 中没有结构 rte_pktmbuf pkt

rte_mbuf in dpdk 18.08 doesnt have struct rte_pktmbuf pkt

升级到 dpdk 18.08 版本后出现以下编译错误。

error: ‘struct rte_mbuf’ has no member named ‘pkt’
  m->pkt.data = ((char*)m->pkt.data - (BTG_IP_VHL_HL(ip->version_ihl) << 2));
   ^

根据文档 rte_mbuf 结构不再具有数据包消息缓冲区结构 rte_pktmbuf pkt 反过来保存包含段缓冲区中数据起始地址的 void* 数据。

struct rte_mbuf {
.
.
.
union {
        struct rte_ctrlmbuf ctrl;
        struct rte_pktmbuf pkt;
    };
}
struct rte_pktmbuf {
    /* valid for any segment */
    struct rte_mbuf *next; 
    void* data;  /**< Start address of data in segment buffer. */

请让我知道rte_mbuf结构体的其他哪些字段可以与dpdk 18.08版本一起使用,这意味着数据包消息缓冲区中数据的起始地址,以便提前解决此编译error.Thanks .

它是 rte_pktmbuf_mtod(m, t) 宏。

A macro that points to the start of the data in the mbuf.

The returned pointer is cast to type t. Before using this function, the user must ensure that the first segment is large enough to accommodate its data.

来源:DPDK API

更新:

要在数据包缓冲区前添加一些数据,有一个专用函数:rte_pktmbuf_prepend()(这里是 DPDK documentation

如果没有旧代码的上下文,很难 100% 确定,但看起来必须将此片段重写为:

rte_pktmbuf_prepend(m,
        BTG_IP_VHL_HL(ip->version_ihl) << 2);