QSG:NVIDIA BlueField DPU 与 OVS 硬件卸载

创建于 2019 年 6 月 30 日。简介 BlueField 的以太网 DPU 解决方案将 Arm® 处理能力与高级网络卸载相结合,以加速多种安全、网络和存储应用。

文档目录

创建于 2019 年 6 月 30 日

简介

BlueField 的以太网 DPU 解决方案将 Arm® 处理能力与高级网络卸载相结合,以加速多种安全、网络和存储应用。

基于 BlueField 片上系统 (SoC) 可编程网络引擎,BlueField DPU 集成了 NVIDIA ConnectX 网络控制器与 Arm 多核处理器和加密选项,提供创新且高性能的可编程平台。

通过本文的 QSG(快速入门指南),您将能够快速搭建一个简单的测试实验室,以实验和探索 BlueField DPU 的功能。该设置包括一台裸机服务器,搭载 BlueField 25GbE DPU,与另一台搭载 ConnectX-5 网卡的裸机服务器背靠背连接。

设备

数量 项目 备注
2 运行 CentOS 7.5 的 x86 服务器 -
1 ConnectX-5 网卡(固件:16.24.0328 及以上) -
1 带 Arm 处理器的 BlueField 25GbE DPU(固件:18.24.1000 及以上) -
1 25GB/s SFP28 网络线缆 -
1 QSA28 适配器(100GB 转 25GB 适配器) -
1 UART 转 USB 线缆 用于 DPU USB 控制台访问
1 Mini USB Type B 线缆 用于 DPU USB 控制台访问
1 需加载到 BlueField DPU Arm 上的 bfb 镜像 镜像包含:
  • 基于 Arm 架构的 CentOS 7.5
  • MLNX_OFED_LINUX-4.4-2.5.11.0(使用 DPDK 和 BlueField 标志编译)
  • DPDK 库版本 18.11
  • 预配置的网络设置,便于 DPU 管理 |

物理配置图

下图显示了 BlueField DPU 与 ConnectX-5 网卡之间的物理配置。

img1.png

物理配置说明

  1. 将 ConnectX-5 网卡插入服务器 A
  2. 将 BlueField DPU 插入服务器 B
  3. 将 DPU UART 线缆从 DPU 连接到其宿主服务器 B 的 USB 端口 #1。
  4. 将 Mini USB 线缆从 DPU 连接到其宿主服务器 B 的 USB 端口 #2。
  5. 将 QSA28 适配器插入服务器 B 的 100GB 端口。
  6. 使用 25GB 线缆将 DPU 的一个端口连接到 ConnectX-5。
  7. 将两台服务器连接到管理 LAN。

DPU 服务器准备

  • 安装有用的软件包:

    yum install -y screen minicom net-tools tcpdump usbutils net-utils sshpass iptables-services fio epel-release iperf wget git unzip perl pciutils lsof tcl libxml2-python tk unbound gtk2 atk cairo gcc-gfortran tcsh nvme-cli
    
  • 使用以下标志安装 MLNX_OFED:

    tar -xzvf MLNX_OFED_LINUX-4.4-2.5.11.0-rhel7.5-x86_64.tgz
    cd MLNX_OFED_LINUX-4.4-2.5.11.0-rhel7.5-x86_64
    ./mlnxofedinstall --with-nvmf --bluefield --without-fw-update
    

    注意:

    • 仅在当前 BlueField 固件版本为 18.24.1000 (GA) 或更高时,在 MLNX_OFED 安装期间使用自动固件更新。如果固件较旧,请在 MLNX_OFED 安装后手动烧录固件。
    • 如果计划在主机上运行 DPDK,请使用 --dpdk --upstream-libs 标志安装 MLNX_OFED。
    • 在某些 MLNX_OFED 版本和操作系统发行版中,不需要 --bluefield 标志。
  • (可选)在固件上启用 SR-IOV:

    mlxconfig -y -d /dev/mst/mt41682_pciconf0 s SRIOV_EN=1
    mlxconfig -y -d /dev/mst/mt41682_pciconf0 s NUM_OF_VFS=8
    
  • 取消注释 /etc/modprobe.d/rshim.conf 中的以下行,以设置默认的 RShim 访问方法为 DPU:

    options rshim backend_driver=rshim_usb
    

    注意:

    • 当此行被注释时,将使用第一个可用的驱动程序。
    • 当未使用 Mini USB 线缆时,驱动程序应为 rshim_pcie
  • /etc/sysconfig/network-scripts/ 目录下创建名为 ifcfg-tmfifo_net0 的文件,内容如下:

    NAME="tmfifo_net0"
    HWADDR="00:1a:ca:ff:ff:02"
    ONBOOT=yes
    NETBOOT=yes
    IPV6INIT=yes
    BOOTPROTO=static
    TYPE=Ethernet
    IPADDR=192.168.100.1
    NETMASK=255.255.255.0
    

    ifcfg-tmfifo_net0 是用于 x86 主机与 DPU 之间通过 rshim_net 驱动程序进行 IP 通信的网络接口。

  • 启用 IP 转发并设置 NAT 规则,以允许 DPU 操作系统通过主机管理接口与外部通信:

    sysctl -w net.ipv4.ip_forward=1
    systemctl enable iptables
    systemctl start iptables
    iptables -F
    iptables -t nat -A POSTROUTING -o <host_mgmt_interface> -j MASQUERADE
    service iptables save
    
  • 禁用防火墙和网络管理器服务:

    systemctl disable firewalld.service
    systemctl disable NetworkManager
    
  • 重启服务器。服务器重新启动后,运行一些配置健全性测试:

    • 验证 BlueField 固件版本:

      mlxfwmanager
      

QSG: NVIDIA BlueField DPU 与 OVS 硬件卸载

创建于 2019 年 6 月 30 日

简介

BlueField 的以太网 DPU 解决方案将 Arm® 处理能力与高级网络卸载相结合,以加速多种应用。

...

验证 RShim 模块已加载:

lsmod | grep -i rshim

识别后端活动的 RShim 驱动:

cat /dev/rshim0/misc

验证用于 DPU 与外部通信的 NAT 规则:

iptables -L -n -t nat
  • 联系 NVIDIA 支持以获取 BlueField 快速启动 bfb 镜像。
  • 将 bfb 镜像放置在主机上,并使用以下命令将其加载到 BlueField DPU:
cat /home/CentOS7.5ALT-aarch64-QuickStart.bfb > /dev/rshim0/boot

注意: 使用下文“DPU 管理方法”部分中描述的控制台访问方法之一来跟踪镜像安装过程。 当 bfb 镜像安装过程完成后,如下所述通过控制台或 SSH 连接到 DPU,并测试从 SmartNIC OS 到外部世界的连接。

DPU 管理方法

要从主机服务器管理 DPU,请使用以下方法之一。

img2.png

访问凭据: root\centos

  1. 通过 USB-Serial / 串口的控制台属性:速率 115200,硬件流控制关闭。

    minicom -D /dev/ttyUSB0
    
  2. 通过 USB (rshim_usb) / 串口的控制台属性:速率 115200,硬件流控制关闭。

    minicom -D /dev/rshim0/console
    
  3. SSH (rshim_net)

    ssh root@192.168.100.2
    

注意: DPU 操作系统配置为通过其主机服务器访问互联网。

基本 DPU 管理操作

如何通过主机服务器软重置 DPU:

  • 在服务器上执行以下命令:

    echo "SW_RESET 1" > /dev/rshim0/misc
    
  • 使用控制台访问跟踪启动过程:

    minicom -D /dev/ttyUSB0
    

注意: 这不是 DPU 的电源循环。

如何从主机服务器加载 BlueField DPU 操作系统镜像:

  • 将 bfb 镜像放置在服务器上。

  • 在服务器上执行以下命令:

    cat <image>.bfb > /dev/rshim0/boot
    
  • 使用控制台访问跟踪安装和启动过程:

    minicom -D /dev/ttyUSB0
    

DPU 模式

BlueField DPU 可以在两种模式下运行:

  • SEPERATED_HOST(默认模式)

    在此模式下,x86 主机服务器和 DPU Arm 操作系统作为独立的实体运行;两者都可以通过 DPU 的 ConnectX-5 模块相互通信或与网络通信。

  • EMBEDDED

    在此模式下,x86 主机服务器仅通过 DPU Arm 与外部世界通信。

img3.png

注意: 要识别 DPU 当前模式,请在 x86 主机服务器上执行以下命令:

x86_host#mst start
x86_host#mlxconfig -d /dev/mst/mt41682_pciconf0 q | grep -i model

从 SEPERATED_HOST 模式切换到 EMBEDDED 模式

在 x86 主机上:

  • 启用 EMBEDDED 模式:

    x86_host #mst start
    x86_host #mlxconfig -d /dev/mst/mt41682_pciconf0 s INTERNAL_CPU_MODEL=1
    
  • 重启。

  • 验证:

    x86_host#mst start
    x86_host#mlxconfig -d /dev/mst/mt41682_pciconf0 q | grep -i model
    

在 Arm 上:

  • 执行以下命令以启用 ECPF 参数(按端口应用):

    注意: 只有在完成前面的步骤后,才能设置 ECPF 参数。

    Snic#mst start
    Snic#mst status -v
    Snic#mlxconfig -d /dev/mst/mt41682_pciconf0 s ECPF_ESWITCH_MANAGER=1 ECPF_PAGE_SUPPLIER=1
    Snic#mlxconfig -d /dev/mst/mt41682_pciconf0.1 s ECPF_ESWITCH_MANAGER=1 ECPF_PAGE_SUPPLIER=1
    
  • 重启 x86 主机。

  • 验证配置:

    • 过程完成后,在 x86 主机和 Arm 上执行以下命令:

      /opt/mellanox/iproute2/sbin/rdma link
      

      在 x86 主机上: 输出应列出两个网络设备。

      1/1: mlx5_0/1: state ACTIVE physical_state LINK_UP netdev ens1f0
      2/1: mlx5_1/1: state DOWN physical_state DISABLED netdev ens1f1
      

      在 Arm 上: 输出应列出四个代表端口:

      1/1: mlx5_0/1: state ACTIVE physical_state LINK_UP netdev rep0-ffff
      2/1: mlx5_1/1: state ACTIVE physical_state LINK_UP netdev rep0-0
      3/1: mlx5_2/1: state DOWN physical_state DISABLED netdev rep1-ffff
      4/1: mlx5_3/1: state DOWN physical_state DISABLED netdev rep1-0
      

  

  • Issue the following commands on the Arm to see the correlation between PCI device and its representors:

    mst start
    mst status -v
    
    PCI devices:
    ------------
    DEVICE_TYPE MST PCI RDMA NET NUMA
    BlueField(rev:0) NA 03:00.1 mlx5_3,mlx5_2 net-eth2,net-rep1-ffff -1
    BlueField(rev:0) NA 03:00.0 mlx5_1,mlx5_0 net-rep0-ffff,net-eth1 -1
    

Note: The rep0-0 / rep1-0 are the representors facing the x86 host and the rep0-ffff / rep1-ffff are the representors facing the network.

Switching to SEPERATED_HOST Mode from EMBEDDED Mode

On the x86 host:

  • Enable SEPERATED_HOST mode:

    x86_host #mst start
    x86_host #mlxconfig -d /dev/mst/mt41682_pciconf0 s INTERNAL_CPU_MODEL=0
    
  • Reboot.

  • Verify:

    x86_host#mst start
    x86_host#mlxconfig -d /dev/mst/mt41682_pciconf0 q | grep -i model
    

Testing Traffic in EMBEDDED Mode using OVS Offload

In Embedded mode, traffic from the x86 server hosting the DPU to the remote x86 server hosting the ConnectX-5 is going via the DPU Arm. OVS with offload capabilities is used to forward the traffic.

Follow the steps below to test traffic from x86 DPU hosting server, via Arm with OVS offload, to the remote ConnectX-5 server:

  • On the Arm OS create OVS bridge with the 2 representors of the used port and Offload capabilities:

    ovs-vsctl add-br bf
    ovs-vsctl add-port bf rep0-ffff
    ovs-vsctl add-port bf rep0-0
    ifconfig rep0-ffff up
    ifconfig rep0-0 up
    ovs-vsctl set Open_vSwitch . other_config:hw-offload=true
    systemctl restart openvswitch
    ovs-vsctl show
    
    
  • Set IP addresses on interface ens1f0 of the x86 host and on the ConnectX-5 host.

  • Test ping between x86 host and ConnectX-5 host (it will flow via the Arm OVS). To verify that traffic from Arm OVS is Offloaded to the HW, you can either:

    • Run tcpdump on the representors - only the first ICMP packets will be captured"

      tcpdump -en -i rep0-0
      
    • Dump the OVS offloaded flows:

      ovs-dpctl dump-flows type=offloaded --name
      
    • Dump the HW TC flow rules of the representors and look for the "in_hw" flag:

      tc -s filter show dev rep0-0 parent ffff:
      

        

  • On the ConnectX-5 external host, start iperf server:

    iperf -s
    
  • On the x86 host start iperf client:

    iperf -c 172.16.0.2 -P12
    
    

Authors

image-2025-9-15_10-4-30.png Itai LevyOver the past few years, Itai Levy has worked as a 解决方案 Architect and member of the NVIDIA Networking “解决方案 Labs” team. Itai designs and executes cutting-edge solutions around Cloud Computing, Software-Defined Networking, Storage and Security. His main areas of expertise include NVIDIA BlueField Data Processing Unit (DPU) solutions and accelerated K8s/OpenStack platforms.

Related Documents