Created on Apr 16, 2020 by Amir Zeidner
As of today, using SRIOV VF (Virtual Function) port attachment for virtualized workload is missing support for link aggregation.
Mellanox ASAP2 technology extends legacy SRIOV capabilities by offloading LAG (link aggregation group) functionality to the Smart Network Interface Card (SmartNIC) hardware. This means that a VM can be attached with single VF backed up by LAG implemented on the NIC level.
This guide will highlight the benefits of having offloaded LAG functionality and walk you through configuration and evaluation of offloaded LAG on a standalone Linux server.
There are few options to implement LAG in a virtual environment, depending on the system configuration and the performance needs:
|VM attached with virtual interface (virtio) to host LAG.|
This solution is appropriate for workloads and applications which do not require high performance networking.
|SRIOV is a default choice for network-demanding applications. In this case, Link Aggregation is performed within VM (VM aware LAG) and only HA mode may be implemented.|
SRIOV switchdev mode and ASAP2 (Accelerated Switching and Packet Processing®) are enhanced SR-IOV technologies which offload network processing from the Host and VM into the network adapter hardware.
Solution Logical Design
Referring to Figure 4, the two network interfaces from the NIC PFs are bounded in the hypervisor. The bond mode is reflected to all VFs of the same NIC. For example: If the BOND is, configured to LACP (Link Aggregation Control Protocol) mode then all VF LAG interfaces will share the same configuration.
To enable VF-LAG, the NIC should be in SRIOV switchdev mode. Unlike SRIOV legacy mode, switchdev mode requires a control plane to configure the steering and forwarding behavior of VFs. In this document we use OVS for this purpose. Please see OVS offload document for more details.
Host Configuration and Prerequisites
- BIOS: VT-D and SRIOV enabled
- OpenVswitch => 2.12
- OS => RHEL 7.7
- Kernel => 4.10
Host Deployment and Configuration
Set Mellanox firmware to support SRIOV
First install the mstflint tool:
Extract PFs PCI BUS slot number:
Set firmware to enable SRIOV with number of desired VFs using PCI slot number taken from previous step:
Configure Linux bond
Configure the BOND interface.
This example demonstrates BOND LACP configuration:
To learn more about bond modes please refer to:
Supported modes are 1, 2, 4.
Configure slave interfaces
Replace <first_interface_name>, <second_interface_name> with the respective PFs BOND slave names.
Restart network services
Enable ASAP2 VF-LAG capabilities
This example uses 2 VFs per PF (it is possible to configure more).
Extract PFs PCI BUS slot number:
Enable switchdev mode per each PF bond slave interface:
Once switchdev mode is enabled, new representor ports will be present in Linux bridge.
Now it is possible to discover representor ports mapping.
First download attached map_rep.py script from this section and run it as explained here:
Add the desired representor ports to OpenVswitch bridge which represent the designated VFs:
Test deployment (figure 5) overview:
First spawn up a guest VM with VF interface using SRIOV attachment based on VF PCI slot number.
Here is Virsh XML section for SRIOV interface attachment of VF with PCI slot number 0000:61:01.2
- Set IP of 22.214.171.124 to the VF interface in the Guest VM.
- Set IP of 126.96.36.199 to the Iperf client interface which is connected to L2 switch.
- Make sure there is connectivity between the Iperf client to the guest VM by issuing ICMP requests.
Start iperf server on the Guest VM:
6. Start iperf client on the iperf client server:
7. Validate that packets are received and transmitted on both bond slaves.
From the guest VM hypervisor command line run:
8. Fail one of the bond links and repeat step 7. You will observe packet are received and transmitted only for single bond slave.
Tearing Down VF-LAG BOND
In case user would like to teardown VF-LAG BOND it is very important to follow this sequence:
1. First teardown VFs from a VM.
2. Unbind VF drivers as follows:
3. Undo steps for building VF-LAG BOND which are described in this post.
About the Author
For the past several years, Amir has worked as a Solutions Architect primarily in the Telco space, leading advanced solutions to answer 5G, NFV, and SDN networking infrastructures requirements. Amir’s expertise in data plane acceleration technologies, such as Accelerated Switching and Network Processing (ASAP²) and DPDK, together with a deep knowledge of open source cloud-based infrastructures, allows him to promote and deliver unique end-to-end NVIDIA Networking solutions throughout the Telco world.