DPDK pdump 无法热插拔添加设备

2023-12-30

我正在尝试使用 dpdk-pdump 从 dpdk 控制下的 NIC 捕获 tx 数据包。

Setup

  • DPDK 18.11.4
  • In config/common_base, CONFIG_RTE_LIBRTE_PMD_PCAP=y and CONFIG_RTE_LIBRTE_PDUMP=y已经设置了
  • 重建后,CONFIG_RTE_LIBRTE_PMD_PCAP=y and CONFIG_RTE_LIBRTE_PDUMP=y也设置在x86_64-native-linuxapp-gcc/.config
  • rte_pdump_init(NULL) and rte_pdump_uninit()在主进程的 init 和 destroy 函数中调用
  • DPDK接口
Network devices using DPDK-compatible driver
============================================
0000:03:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' drv=igb_uio unused=ixgbe,uio_pci_generic

Network devices using kernel driver
===================================
0000:03:00.1 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' if=ens1f1 drv=ixgbe unused=igb_uio,uio_pci_generic
0000:05:00.0 'I210 Gigabit Network Connection 1533' if=enp5s0 drv=igb unused=igb_uio,uio_pci_generic *Active*
0000:06:00.0 'I210 Gigabit Network Connection 1533' if=enp6s0 drv=igb unused=igb_uio,uio_pci_generic

Output

初级过程

EAL: Detected 24 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Probing VFIO support...
EAL: PCI device 0000:03:00.0 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:03:00.1 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:05:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
EAL: PCI device 0000:06:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
INFO: eth dev count 1.
Port 0 MAC: 9c 69 b4 60 90 1c

WARNING: Too many lcores enabled. Only 1 used.

Core 0 forwarding packets. [Ctrl+C to quit]
EAL: failed to parse device "vdev:net_pcap_tx_0"
EAL: Failed to hotplug add device on primary

二次加工

run by sudo ./build/app/dpdk-pdump -- --pdump 'port=0,queue=*,tx-dev=./tx.pcap'

EAL: Detected 24 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket_16018_96447662088dc
EAL: Probing VFIO support...
EAL: PCI device 0000:03:00.0 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:03:00.1 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:05:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
EAL: PCI device 0000:06:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
EAL: Failed to hotplug add device
EAL: Error - exiting with code: 1
  Cause: vdev creation failed

期待

我怎样才能正确使用 dpdk-pdump?

[EDIT] 更新2020/7/12

修改后skeleton(fix port为 0 并添加rte_pdump_init/uninit()),还是没能成功。

PS: skeleton and my program是用共享库.

骨架代码

static __attribute__((noreturn)) void
lcore_main(void)
{
    uint16_t port;

    /*
     * Check that the port is on the same NUMA node as the polling thread
     * for best performance.
     */
    RTE_ETH_FOREACH_DEV(port)
        if (rte_eth_dev_socket_id(port) > 0 &&
                rte_eth_dev_socket_id(port) !=
                        (int)rte_socket_id())
            printf("WARNING, port %u is on remote NUMA node to "
                    "polling thread.\n\tPerformance will "
                    "not be optimal.\n", port);

    printf("\nCore %u forwarding packets. [Ctrl+C to quit]\n",
            rte_lcore_id());

    /* Run until the application is quit or killed. */
    for (;;) {
        /*
         * Receive packets on a port and forward them on the paired
         * port. The mapping is 0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2, etc.
         */
        port = 0;

        /* Get burst of RX packets, from first port of pair. */
        struct rte_mbuf *bufs[BURST_SIZE];
        const uint16_t nb_rx = rte_eth_rx_burst(port, 0,
                bufs, BURST_SIZE);

        if (unlikely(nb_rx == 0))
            continue;

        /* Send burst of TX packets, to second port of pair. */
        const uint16_t nb_tx = rte_eth_tx_burst(port ^ 1, 0,
                bufs, nb_rx);

        /* Free any unsent packets. */
        if (unlikely(nb_tx < nb_rx)) {
            uint16_t buf;
            for (buf = nb_tx; buf < nb_rx; buf++)
                rte_pktmbuf_free(bufs[buf]);
        }
    }
}

static void
signal_handler(int signum)
{
    if (signum == SIGINT || signum == SIGTERM) {
        printf("\nSignal %d received, preparing to exit...\n",
                signum);
        /* uninitialize packet capture framework */
        rte_pdump_uninit();
        /* exit with the expected status */
        signal(signum, SIG_DFL);
        kill(getpid(), signum);
    }
}

/*
 * The main function, which does initialization and calls the per-lcore
 * functions.
 */
int
main(int argc, char *argv[])
{
    struct rte_mempool *mbuf_pool;
    unsigned nb_ports;
    uint16_t portid;

    signal(SIGINT, signal_handler);
    signal(SIGTERM, signal_handler);

    /* Initialize the Environment Abstraction Layer (EAL). */
    int ret = rte_eal_init(argc, argv);
    if (ret < 0)
        rte_exit(EXIT_FAILURE, "Error with EAL initialization\n");

    argc -= ret;
    argv += ret;
    rte_pdump_init(NULL);
    /* Check that there is an even number of ports to send/receive on. */
    nb_ports = rte_eth_dev_count_avail();
    // if (nb_ports < 2 || (nb_ports & 1))
    //  rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n");

    /* Creates a new mempool in memory to hold the mbufs. */
    mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports,
        MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());

    if (mbuf_pool == NULL)
        rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n");

    /* Initialize all ports. */
    RTE_ETH_FOREACH_DEV(portid)
        if (port_init(portid, mbuf_pool) != 0)
            rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu16 "\n",
                    portid);

    if (rte_lcore_count() > 1)
        printf("\nWARNING: Too many lcores enabled. Only 1 used.\n");

    /* Call lcore_main on the master core only. */
    lcore_main();

    return 0;
}

初级过程

EAL: Detected 24 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Probing VFIO support...
EAL: PCI device 0000:03:00.0 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:03:00.1 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:05:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
EAL: PCI device 0000:06:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
Port 0 MAC: 9c 69 b4 60 90 1c

WARNING: Too many lcores enabled. Only 1 used.

Core 0 forwarding packets. [Ctrl+C to quit]
EAL: Failed to hotplug add device on secondary

第二道工序

command sudo ./build/app/dpdk-pdump -- --pdump 'port=0,queue=*,tx-dev=./tx.pcap'

EAL: Detected 24 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket_27816_cdf9e536de2e0
EAL: Probing VFIO support...
EAL: PCI device 0000:03:00.0 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:03:00.1 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:05:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
EAL: PCI device 0000:06:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1533 net_e1000_igb
EAL: failed to parse device "vdev:net_pcap_tx_0"
EAL: failed to parse device "vdev:net_pcap_tx_0"
EAL: Failed to hotplug add device
EAL: Error - exiting with code: 1
  Cause: vdev creation failed

我也尝试过dpdk-pdump 9.4 示例 https://doc.dpdk.org/guides/howto/packet_capture_framework.html,错误消息类似。

初级过程

testpmd>
Port 0: link state change event
EAL: Failed to hotplug add device on secondary

第二道工序

EAL: failed to parse device "vdev:net_pcap_rx_0"
EAL: failed to parse device "vdev:net_pcap_rx_0"
EAL: Failed to hotplug add device
EAL: Error - exiting with code: 1
  Cause: vdev creation failed:create_mp_ring_vdev:722

我能够让它正常工作,没有任何问题。以下是遵循的步骤

  1. DPDK:下载18.11.4http://static.dpdk.org/rel/dpdk-18.11.4.tar.gz
  2. 内置启用 PCAP PMD 的 DPDK
  3. 修改骨架主要:添加rte_pdump_init(NULL)就在之后rte_eal_init
  4. 修改骨架lcore_main:修改RTE_ETH_FOREACH_DEV(port) with for (port = 0; port < 2; port++)
  5. bullt: LD_FLAGS="-lrte_pmd_pcap" make
  6. 运行主要
  7. 运行 pdump secondary(如果在主要传递中传递了白名单,则此处传递相同)
EAL: request: eal_dev_mp_request
EAL: msg: eal_dev_mp_request
EAL: request: bus_vdev_mp
EAL: msg: bus_vdev_mp
EAL: msg: bus_vdev_mp
EAL: reply: eal_dev_mp_request
EAL: msg: eal_dev_mp_request
Port 2 MAC: 02 70 63 61 70 00
EAL: request: mp_pdump
EAL: msg: mp_pdump
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

DPDK pdump 无法热插拔添加设备 的相关文章

  • 一次DPDK-L3FWD-ACL的问题排查

    其实说起来不是什么大问题 xff0c 所有的配置按照下面这个来的 包括写入arp和配置默认路由 xff0c 不过我用的单文件那个l3fwd acl https blog csdn net sinat 20184565 article det
  • dpdk探究1-理解dpdk的运行逻辑

    DPDK介绍 DPDK主要功能 xff1a 利用IA xff08 intel architecture xff09 多核处理器进行高性能数据包处理 Linux下传统的网络设备驱动包处理的动作可以概括如下 xff1a 数据包到达网卡设备网卡设
  • DPDK pdump抓包说明

    一 xff0e 环境与编译 pdump库是在16 07版本引入的 xff0c 提供了一个抓包调试功能 在 RTE SDK app目录下就有一个dpdk pdump的工具 配置这个这个工具可以用于抓取指定接口 队列的数据包 1 1 库及依赖
  • ovs-vswitchd的启动分析

    ovs vswitchd的启动分析 无修改源码 一 主要数据结构和概念了解 1 概念 在 OVS 中 有几个非常重要的概念 Bridge Bridge 代表一个以太网交换机 Switch 一个主机中可以创建一个或者多个 Bridge 设备
  • 万亿级KV存储架构与实践

    一 KV 存储发展历程 我们第一代的分布式 KV 存储如下图左侧的架构所示 相信很多公司都经历过这个阶段 在客户端内做一致性哈希 在后端部署很多的 Memcached 实例 这样就实现了最基本的 KV 存储分布式设计 但这样的设计存在很明显
  • KVM虚拟机热扩容

    创建一个虚拟机用于练习在线扩容 virt install name centos8 3 memory 4096 currentMemory 1024 vcpus 2 maxvcpus 8 disk var lib libvirt image
  • docker安装和基本操作

    简介 docker的三个基本概念 镜像 Image Docker 镜像可以看作是一个特殊的文件系统 除了提供容器运行时所需的程序 库 资源 配置等文件外 还包含了一些为运行时准备的一些配置参数 如匿名卷 环境变量 用户等 容器 Contai
  • SPDK块设备

    SPDK视角每个App由多个子系统 subsystem 构成 同时每个子系统又包含多个模块 module 子系统和模块的注入都是可插拔的 通过相关的宏定义声明集成到SPDK组件容器里 其中子系统的注入可通过声明SPDK SUBSYSTEM
  • Linux内核网络结构,和收发数据基本流程

    不管是大型虚拟化云网络 还是嵌入式物联网系统 Linux网络都扮演着重要的角色 借用一句话说 如果说网络是信息系统的基石 那么Linux网络系统就是基石中的钢筋 它经过几十年的发展 它千锤百炼 几乎包含了市面上所有的网络通讯功能 要想一下子
  • Linux系统中如何查看TCP连接数

    这篇文章主要为大家展示了 Linux系统中如何查看TCP连接数 内容简而易懂 条理清晰 希望能够帮助大家解决疑惑 下面让小编带领大家一起研究并学习一下 Linux系统中如何查看TCP连接数 这篇文章吧 一 查看哪些IP连接本机 netsta
  • 软件和硬件数据交互接口的的演进

    编者按AMD Kria SOM及KV260视觉入门套件介绍 电子发烧友在线研讨会 软件和硬件 既相互依存又需要某种程度上的相互独立 通过软件和硬件之间的接口把两者连接在一起 软硬件接口 有很多含义 比如指令集是CPU软件和硬件之间的接口 比
  • trex-bird使用过程解析

    trex bird原理 TRex Bird架构图 trex 结合bird服务是采用linux上的veth及网络命名空间的技术 bird运行在trex a bird ns 网络namespace里 创建veth虚接口对bird 0 0 T和b
  • 网络性能评估

    在Linux中常见的网络性能指标如下 l 带宽 表示链路的最大传输速率 单位是b s 比特 秒 在位服务器选网卡时 带宽就是最核心的参考指标 常用的带宽有1000M 10G 40G 100G等 网络带宽测试 测试的不是带宽 而是网络吞吐量
  • 【安装文档】TRex流量分析仪保姆级安装指南--基于VMware虚拟机(ubantu18.04@Intel 82545EM

    前言 DPDK 网络数据开发中文网开发中文网致力于整理收录dpdk spdk ovs vpp dpvs virtiohost sdn ovn qemu等方向 的github开源项目 资料文档 书籍 讲解视频 各大企业招聘信息 23 1 12
  • QEMU/KVM PCI Passthrough(i350) & DPDK 网络性能测试

    QEMU KVM PCI Passthrough i350 DPDK 网络性能测试 硬件要求 CPU必须支持硬件虚拟化 Intel VT d or AMD Vi 和 IOMMU 原图链接 主机配置 设置iommu IOMMU kernel
  • DPDK+Pktgen 高速发包测试

    Pktgen概述 Pktgen Packet Gen erator 是一个基于DPDK的软件框架 发包速率可达线速 提供运行时管理 端口实时测量 可以控制 UDP TCP ARP ICMP GRE MPLS and Queue in Que
  • DPDK-流分类与多队列

    1 前言 多队列与流分类技术基本被应用到所有DPDK网关类项目中 比如开源的DPVS 美团的四层网关等等 利用多队列及分流技术可以使得网卡更好地与多核处理器 多任务系统配合 从而达到更高效IO处理的目的 这章节以英特尔的网卡为例 介绍多队列
  • 查看linux中的TCP连接数

    一 查看哪些IP连接本机 netstat an 二 查看TCP连接数 1 统计80端口连接数 netstat nat grep i 80 wc l 2 统计httpd协议连接数 ps ef grep httpd wc l 3 统计已连接上的
  • 您可以以非 root 用户身份在非特权容器中运行 DPDK 吗?

    我正在尝试在非特权 Docker 容器中运行 DPDK 虽然我可以限制容器的权限并将容器指定为非特权容器 但我仍然需要以 root 身份运行 dpdk 应用程序 例如 testpmd 我还可以以非 root 身份运行容器并使用 sudo 启
  • ubuntu 18.04 中 dpdk 和 ovs 上的 testpmd 出现问题

    我有一个 X520 SR2 10G 网卡 我将用它来创建 2 个使用 dpdk 编译的 OpenvSwitch 虚拟接口 从 ubuntu 18 04 的存储库安装 并使用 testpmd 测试这个虚拟接口 我做了以下工作 创建桥梁 ovs

随机推荐