我正在尝试使用 dpdk 发送自定义包,但我发现某些包结构会使其无法接收。例如,我这样定义包结构:
union my_pkt{
struct hdr{
uint32_t id;
uint32_t name_len;
uint64_t tsc;
uint8_t name[100];
}__attribute__((__packed__)) pkt_hdr;
char buff[500];
};
我运行 dpdk 的服务器只能接收第一批 pkts,但是 rte_eth_tx_burst() 的返回值显示了更多已发送的包。
但是,如果我修改结构如下:
union my_pkt{
struct hdr{
uint32_t id;
uint32_t name_len;
uint32_t tsc[2];//modify this line
uint8_t name[100];
}__attribute__((__packed__)) pkt_hdr;
char buff[500];
};
发送和接收都正常工作。两个结构之间的唯一区别是 uint64_t 时间戳被替换为由 2 个项目组成的 uint32_t 数组。我调试到 i40e 驱动程序代码,但不明白哪里出错了。
有谁能够帮我?谢谢!