]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/dpdk: add NIC whitelist configuration 44275/head
authorChunsong Feng <fengchunsong@huawei.com>
Fri, 10 Dec 2021 02:27:58 +0000 (02:27 +0000)
committerChunsong Feng <fengchunsong@huawei.com>
Sat, 25 Dec 2021 13:10:01 +0000 (13:10 +0000)
Each DPDK process uses some exclusive network adapters.The network adapters to
be used are specified in the whitelist to prevent data sharing between multiple
DPDK process.The following is an example:
1)Configure a single NIC.
-a 0000:7d:010 or --allow=0000:7d:010
2)Configure the Bond Network Adapter
ms_dpdk_port_options=--allow=0000:7d:01.0 --allow=0000:7d:02.6
--vdev=net_bonding0,mode=2,slave=0000:7d:01.0,slave=0000:7d:02.6

Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
Reviewed-by: luo rixin <luorixin@huawei.com>
Reviewed-by: Han Fengzhe <hanfengzhe@hisilicon.com>
src/common/options/global.yaml.in
src/msg/async/dpdk/dpdk_rte.cc

index 80e7b9dc34a5c7a4ee3a6d19bfb38b09ec9b1e2b..1c81c3a1701cbb68d72cbbfea88f8f6deda32d02 100644 (file)
@@ -1441,6 +1441,13 @@ options:
   type: str
   level: advanced
   with_legacy: true
+- name: ms_dpdk_devs_allowlist
+  type: str
+  level: advanced
+  desc: NIC's PCIe address are allowed to use
+  long_desc: for a single NIC use ms_dpdk_devs_allowlist=-a 0000:7d:010 or --allow=0000:7d:010;
+    for a bond nics use ms_dpdk_devs_allowlist=--allow=0000:7d:01.0 --allow=0000:7d:02.6
+    --vdev=net_bonding0,mode=2,slave=0000:7d:01.0,slave=0000:7d:02.6.
 - name: ms_dpdk_host_ipv4_addr
   type: str
   level: advanced
index 3ebb64360b04a8f6cb79cef3d99650a054820b80..9b0c43329cb5be04cb03a1387927bcfbe030a46a 100644 (file)
@@ -23,6 +23,8 @@
 #include <rte_ethdev.h>
 #include <rte_version.h>
 
+#include "include/str_map.h"
+
 #include "DPDK.h"
 #include "dpdk_rte.h"
 
@@ -123,6 +125,14 @@ namespace dpdk {
         args.push_back(string2vector("--no-huge"));
       }
 
+      for_each_pair(cct->_conf.get_val<std::string>("ms_dpdk_devs_allowlist"), " ",
+                   [&args] (std::string_view key, std::string_view val) {
+                     args.push_back(string2vector(std::string(key)));
+                     if (!val.empty()) {
+                        args.push_back(string2vector(std::string(val)));
+                      }
+                   });
+
       std::string rte_file_prefix;
       rte_file_prefix = "rte_";
       rte_file_prefix += cct->_conf->name.to_str();