记录一下,方便以后查阅。
错误如下
1、
EAL: VFIO support initialized
EAL: Probe PCI driver: mlx5_pci (15b3:101e) device: 0000:12:01.0 (socket 0)
mlx5_pci: no Verbs device matches PCI device 0000:12:01.0, are kernel drivers loaded?
common_mlx5: Failed to load driver = mlx5_pci.
EAL: Requested device 0000:b5:01.2 cannot be used
EAL: Bus (pci) probe failed.
EAL: No legacy callbacks, legacy socket not created
代码如下
code from:
https://github.com/zartbot/learn_dpdk
#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
#include <rte_eal.h>
#include <rte_ethdev.h>
#include <rte_cycles.h>
#include <rte_lcore.h>
#include <rte_mbuf.h>
#include <rte_ether.h>
#include <rte_ip.h>
#include <rte_udp.h>
#include <pthread.h>
#include <string.h>
#define MAX_PORTS 16
#define RX_RING_SIZE 1024
#define TX_RING_SIZE 1024
#define NUM_MBUFS 8191
#define MBUF_CACHE_SIZE 250
#define BURST_SIZE 32
static int hwts_dynfield_offset = -1;
static inline rte_mbuf_timestamp_t *
hwts_field(struct rte_mbuf *mbuf)
{
return RTE_MBUF_DYNFIELD(mbuf,
hwts_dynfield_offset, rte_mbuf_timestamp_t *);
}
typedef uint64_t tsc_t;
static int tsc_dynfield_offset = -1;
static inline tsc_t *
tsc_field(struct rte_mbuf *mbuf)
{
return RTE_MBUF_DYNFIELD(mbuf, tsc_dynfield_offset, tsc_t *);
}
static uint16_t
add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused,
struct rte_mbuf **pkts, uint16_t nb_pkts,
uint16_t max_pkts __rte_unused, void *_ __rte_unused)
{
unsigned i;
uint64_t now = rte_rdtsc();
for (i = 0; i < nb_pkts; i++)
printf("packet[%d] sendtime: %ld\n",i,now);
return nb_pkts;
}
static const struct rte_eth_conf port_conf_default = {
.rxmode = {
.max_rx_pkt_len = RTE_ETHER_MAX_LEN,
},
};
static inline int
port_init(uint16_t port, struct rte_mempool *mbuf_pool)
{
struct rte_eth_conf port_conf = port_conf_default;
const uint16_t rx_rings = 1, tx_rings = 1;
uint16_t nb_rxd = RX_RING_SIZE;
uint16_t nb_txd = TX_RING_SIZE;
int retval;
uint16_t q;
struct rte_eth_dev_info dev_info;
struct rte_eth_txconf txconf;
if (!rte_eth_dev_is_valid_port(port))
return -1;
retval = rte_eth_dev_info_get(port, &dev_info);
if (retval != 0)
{
printf("Error during getting device (port %u) info: %s\n",
port, strerror(-retval));
return retval;
}
printf("\n\ninitializing port %d...\n", port);
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_CHECKSUM)
{
printf("port[%u] support RX cheksum offload.\n", port);
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_CHECKSUM;
}
if (!(dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP)) {
printf("\nERROR: Port %u does not support hardware timestamping\n"
, port);
return -1;
}
port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
rte_mbuf_dyn_rx_timestamp_register(&hwts_dynfield_offset, NULL);
if

博客内容主要涉及DPDK初始化过程中遇到的VFIO支持问题,包括如何创建和配置VF,以及解决VF无法被使用的错误。作者详细解释了错误原因,并给出了从检查VFIO驱动到调整设备状态的一系列步骤,如设置VF为可信,以及在容器环境中正确使用VF的注意事项。最后,展示了成功初始化的输出示例。
最低0.47元/天 解锁文章
593

被折叠的 条评论
为什么被折叠?



