SmartNIC/DPU refers to a new generation of network adapters. DPU is a SoC, with its own processor, memory, network interface, etc., and serves as the network interface for host machine(s). With specialized and programmable modules(i.e. encryption engines, RegEX engines, etc.), DPUs can offload and accelerate packet processing, communication, security and related functionalities in data centers.

Setting Up BlueField-2 DPU

Preparations

Host-side Configuration

[todo]

DPU-side Configuration

  • Generate a password hash by

    openssl passwd -1
    

    This will generate a prompt for you to input the password and generate the password hash. This password is for the user ubuntu on targeted DPU.

  • Create a bf.cfg file that contains the password hash generated last step.

    ubuntu_PASSWORD='[PASSWD_HASH]'
    

    Replace the [PASSWD_HASH] with the password hash generated by openssl.

  • Use the bootstream file to install OS onto the DPU. The command is

    bfb-install --rshim rshim0 --bfb [BDF_FILENAME.bfb] --config bf.cfg
    

    This will take a while. We can use minicom to connect to the DPU to view the installation process while installing.

    minicom -D /dev/rshim0/console
    
  • After successful installation, the minicom connection will prompt. We can also ssh into DPU with:

    ssh ubuntu@192.168.100.2
    

    Note that the ip_address for tmfifo_net0 is burnt as 192.168.100.2 on the DPU side. And in order to use tmfifo_net0 interface, an IP address should be assigned to the interface. A setting like this would work:

    • IP: 198.168.100.x
    • netmask: 255.255.255.0

Accessing Network from SmartNIC 3

Preparation

  • Stop ovs.
  • Make sure interfaces tmfifo_net0 are assigned with an ip address on both host and SmartNIC.

Setting Host Iptables

# Turn on IPv4 forwarding
sfwu22@dpu:~$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

# Configure IP forwarding rules for the internet-facing interface eno1
sfwu22@dpu:~$ iptables -A FORWARD -o eno1 -j ACCEPT
sfwu22@dpu:~$ iptables -A FORWARD -m state --state ESTABLISHED,RELATED -i eno1 - j ACCEPT

# Configure the NAT rule for the internet-facing interface eno1
sfwu22@dpu:~$ iptables -t nat -A POSTROUTING -o eno1 -j MASQUERADE

DNS Server

Check the DNS server in current domain. The DNS server address can be checked and configured with:

# On host/SmartNIC
sfwu22@proj88:~$ systemd-resolve --status

# Set DNS server of SmartNIC
# For group SmartNIC
sfwu22@dpu:~$ echo "nameserver 192.168.50.254" | sudo tee /etc/resolv.conf
# For CloudLab SmartNIC
sfwu22@dpu:~$ echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

Proxy Server

If host sits behind a proxy server, SmartNIC should be configured with the same proxy server.

Then SmartNIC is good to go!

Additional Configuration

  • Firmware update.

  • Subfunction configuration2.

  • Running examples. Examples are located in /opt/mellanox/doca/application in DPU. Take url_filter as the example1.

    • Preparation 1: configure corresponding SF and start regx engine.

    • Preparation 2: configure hugepage for url_filter.

    • Run application

      /opt/mellanox/doca/applications/url_filter/bin/doca_url_filter -a 0000:03:00.0,class=regex -a auxiliary:mlx5_core.sf.4,sft_en=1 -a auxiliary:mlx5_core.sf.5,sft_en=1 -c3 -- -p
      

Reference