安装包下载

创建时间:2024-04-02 最近修改时间:2025-10-24

#1. 安装包下载

目前 iso 中没有 deepflow-agent-dpdk 的 rpm 安装包,可以通过在 deepflow-core 下载获取

#2. 依赖检查

DPDK 采集器必须使用rpm部署方式(2023/12/26)

  • DPDK Primary 进程需要满足
    • 支持 Multi-Process,代码中不能调用rte_mp_disable, rte_thread_register
    • 支持 pdump 功能,代码中需要调用rte_pdump_init
    • 内存模式必须使用传统内存模式,即 DPDK 中的--legacy-mem选项, 不能使用选项--in-memory
    • 注意 DPDK 19.11 版本需要手动添加依赖库:
      • librte_mempool_ring
      • librte_mempool_octeontx2
      • librte_pmd_pcap
      • librte_pmd_ixgbe(网卡对应的 PMD ,需要根据实际使用场景调整)
  • 运行需要 Linux x86 环境
  • 运行需要 DPDK 动态链接库
  • 检查采集器节点与控制器、数据节点控制平面的连通性

#3. 部署 DPDK 采集器流程

目前仅 deepflow-agent 支持 DPDK

#3.1.1 一 采集器组配置

  • 在前端页面-系统-采集器-采集器组-新建采集器组
  • 在前端页面-系统-采集器-配置-新建采集器组配置
  • 修改配置中的流量镜像方式虚拟镜像(1)
    虚拟镜像

    虚拟镜像

  • 修改采集器组高级配置,填入 dpdk-enabled: true
  • 记录采集器组ID供下一步骤使用

#3.1.2 二 部署采集器

rpm 部署:

  1. 参考 KVM 采集器类型,部署 rpm 采集器包
  2. 修改vtap-group-id-request为上面创建的采集器组ID

#3.1.3 三 采集器配置优化

若出现采集器丢包或者 Primary 进程因开启 pdump 功能导致丢包,可以将采集器绑定到和采集 网卡同 NUMA Socket 的 CPU 上, 具体步骤如下:

  • 通过采集器日志查询采集网卡所在的 NUMA Socket grep -rn "Run at socket" /var/log/deepflow-agent/deepflow-agent.log
    [root@analyzer3 dpdk]# grep -rn "Run at socket" /var/log/deepflow-agent/deepflow-agent.log
    629:[2024-07-16 15:35:57.571298 +08:00] INFO [plugins/special_recv_engine/src/dpdk.rs:121] [DPDK] INFO Run at socket 1
    
    1
    2
  • 查询对应 NUMA Socket 上有哪些 CPU lscpu | grep -i NUMA
    [root@analyzer3 dpdk]#  lscpu | grep -i NUMA
    NUMA 节点:         2
    NUMA 节点0 CPU:    0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38
    NUMA 节点1 CPU:    1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39
    
    1
    2
    3
    4
  • 根据上面的结果在采集器组高级配置设置 CPU 亲和性,例如: cpu-affinity: 1,3,5,7

#4. 对接 Open vSwitch 2.17.8

这里使用的 DPDK 版本为 22.11.3,若使用其他版本代码修改可能有差别

lib/dpdk.c 修改内容为:

  • 添加 DPDK 中对 rte_pdump_init 的调用
  • 删除 DPDK 中对 rte_thread_register 的调用
  • 删除 DPDK 中对 rte_mp_disable 的调用

--- lib/dpdk.c	2023-10-17 21:39:15.856542792 +0800
+++ ../../openvswitch-2.17.8/lib/dpdk.c	2023-12-07 10:08:44.534485718 +0800
@@ -28,6 +28,7 @@
 #include <rte_malloc.h>
 #include <rte_memzone.h>
 #include <rte_version.h>
+#include <rte_pdump.h>

 #include "dirs.h"
 #include "fatal-signal.h"
@@ -468,6 +469,9 @@
     free(argv);
     svec_destroy(&args);

+    rte_pdump_init();
+
     /* Set the main thread affinity back to pre rte_eal_init() value */
     if (affinity) {
         ovs_numa_thread_setaffinity_dump(affinity);
@@ -479,11 +483,12 @@
         return false;
     }

-    if (!rte_mp_disable()) {
-        VLOG_EMER("Could not disable multiprocess, DPDK won't be available.");
-        rte_eal_cleanup();
-        return false;
-    }

     if (VLOG_IS_DBG_ENABLED()) {
         size_t size;
@@ -601,11 +606,11 @@
         return false;
     }

-    if (rte_thread_register() < 0) {
-        VLOG_WARN("DPDK max threads count has been reached. "
-                  "PMD thread performance may be impacted.");
-        return false;
-    }

     VLOG_INFO("PMD thread uses DPDK lcore %u.", rte_lcore_id());
     return true;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

修改 lib/netdev-dpdk.c 的原因是 DPDK 和 Open vSwitch 版本不匹配导致的,修改内容为:

  • 删除 rte_eth_conf 结构中 split_hdr_size 的操作
  • 删除 rte_bus 结构中 name 的操作

--- lib/netdev-dpdk.c	2023-10-17 21:39:15.864542799 +0800
+++ ../../openvswitch-2.17.8/lib/netdev-dpdk.c	2023-12-04 10:32:23.292393047 +0800
@@ -157,7 +157,7 @@

 static const struct rte_eth_conf port_conf = {
     .rxmode = {
-        .split_hdr_size = 0,
         .offloads = 0,
     },
     .rx_adv_conf = {
@@ -3605,13 +3605,13 @@
     uint16_t vendor_id = RTE_PCI_ANY_ID;
     uint16_t device_id = RTE_PCI_ANY_ID;
     bus = rte_bus_find_by_device(dev_info.device);
-    if (bus && !strcmp(bus->name, "pci")) {
-        pci_dev = RTE_DEV_TO_PCI(dev_info.device);
-        if (pci_dev) {
-            vendor_id = pci_dev->id.vendor_id;
-            device_id = pci_dev->id.device_id;
-        }
-    }
     ovs_mutex_unlock(&dpdk_mutex);

     smap_add_format(args, "port_no", DPDK_PORT_ID_FMT, dev->port_id);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25