gpt4 book ai didi

c - dpdk 18.08 中的 rte_mbuf 没有 struct rte_pktmbuf pkt

转载 作者:太空宇宙 更新时间:2023-11-04 10:03:58 25 4
gpt4 key购买 nike

升级到 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 版本一起使用,这意味着数据包消息缓冲区中数据的起始地址,以解决此编译错误。提前致谢。

最佳答案

它是 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);

关于c - dpdk 18.08 中的 rte_mbuf 没有 struct rte_pktmbuf pkt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53923097/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com