image image image image image image



On This Page

Created on Jul 11, 2019

Introduction

This QSG (Quick Start Guide) will demonstrate a methodology for testing VLAN/VXLAN offloading capabilities with high volume of flows.

ASAP2 technology enables packet processing operations to be offloaded from OpenVswitch to the ConnectX NIC hardware. There are few flavors of ASAP2 and in this post we will demonstrate the ASAP2 Direct offloading capabilities. ASAP2 Direct technology is available in upstream Openstack community, integrated with generic offloading API for smart NICs.
  

For your attention Click here for video walkthrough of this document ->YouTube tutorials video

References

ASAP2 Direct Technology Overview

ASAP2 technology enables packet processing operations to be offloaded from OpenVswitch to the hardware of ConnectX eSwitch forwarding plane, while keeping the SDN control plane intact.
In this deployment model, VMs establish direct access to Nvidia's ConnectX-5 and ConnectX-4 NIC hardware through Single Root IO Virtualization (SR-IOV) Virtual Function (VF) while offloading OpenVswitch (OVS) forwarding plane to hardware e-Switch forwarding plane.
This combination designed to achieve the highest network I/O performance in virtualized environment.
 
Benchmarks show that on a server with a 25Gb interface, OVS accelerated by ASAP2 Direct achieves 33 million packets per second (mpps) for a single flow and thousands of flows, utilizing full 25Gb bandwidth.
 


Understanding representor ports

Ports R1 and R2 in this diagram are representors ports representing VF1 and VF2 respectively.Representors ports are a netdev modeling of eSwitch ports. These ports acts as if it is fully paravirtualized environment connecting each VM1 and VM2 to OpenVswitch (OVS) via R1 and R2.
Openflow rules which applies for R1 or R2 ports are being offloaded to e-witch and applies VF1 or VF2 respectively and directly. This way the control plane stays intact while working with SRIOV mode.
 

 

ASAP2 Direct Technology vs OVS-DPDK sample results over VLAN

Here are test results over ConnectX-5 25Gb NIC comparing OVS-DPDK to ASAP2 Direct with multiple flows of 1000/5000/100000 and packet size of 64/512:
Core type: Intel Xeon CPU E5-2670 v3 2.30GHz


 Prerequisites

It is assumed Openstack environment is provisioned already and ASAP2 Direct is enabled with Nvidia NICs.
Example for install procedure of OSP 13 can be found here: 

TRex Server deployment

We will use bare metal server for TRex traffic generator to get best test performance possible.
The TRex servers shall be connected by single port to Compute Nodes via L2 switch on the same Tenant Network VLAN.
Please follow this guide for TRex server installation: TRrex in few steps - Using ConnectX-4 or ConnectX-5. Section 4 for GUI installation may be skipped.

Topology

Minimum of two compute nodes and single bare metal TRex servers connected via L2 switch on the same VLAN.
device under test (DUT) server is a guest VM running on top one of the compute nodes. This guest VM will run testpmd dpdk application in order to loop back traffic towards traffic generator (TG) server.
TRex traffic generator (TG) server will inject UDP packets over VXLAN or VLAN towards the device under test (DUT).
 


Set Openstack environment

Set Openstack flavor

Define guest VM resources by setting flavor:

Cli commands
openstack flavor create m1.asapsmall --id 5 --ram 8192 --disk 20 --vcpus 6 nova flavor-key m1.asapsmall set hw:mem_page_size=large openstack flavor set m1.asapsmall --property hw:cpu_policy=dedicated

Upload guest VM image

Make sure the image used contains Nvidia ethernet nic drivers and compiled testpmd DPDK application with Nvidia PMD.If you would like to add newly compiled DPDK testpmd APP into your cloud image, please refer to Appendix section for "Compiling DPDK with Nvidia PMD example".


If you would like to fetch a pre prepared cloud image which contains testpmd application already, you can download such here:

Cli command
wget http://13.74.249.42/images/CentOS7.5_testpmd.qcow2

OS credentials - User: "root" Password: "3tango"

Upload the image to Openstack glance repository:

Cli command
glance --os-image-api-version 2 image-create --file CentOS7.5_testpmd.qcow2 --disk-format qcow2 --container-format bare --name testpmd --progress

Create VXLAN/VLAN network and Subent

VXLAN network:

Cli command
private_network_id1=`openstack network create private1 --disable-port-security --provider-network-type vxlan --share | grep ' id ' | awk '{print $4}'`

Or VLAN network: 

Cli command
private_network_id1=`openstack network create private1 --disable-port-security --provider-physical-network tenant --provider-network-type vlan --share | grep ' id ' | awk '{print $4}'`

Subnet creation

CLI command
openstack subnet create private_subnet --network private1 --subnet-range 11.11.11.0/24

Create ASAP2 based port

Enabling Openstack smart nic port awareness by adding libvirt 'switchdev' attribute to port capabilities.

CLI commands
direct_port1=`openstack port create direct1 --vnic-type=direct --no-security-group --network $private_network_id1 --binding-profile '{"capabilities":["switchdev"]}' | grep ' id ' | awk '{print $4}'` direct_port2=`openstack port create direct1 --vnic-type=direct --no-security-group --network $private_network_id1 --binding-profile '{"capabilities":["switchdev"]}' | grep ' id ' | awk '{print $4}'`

Provision a guest VM with ASAP2 port binding

Launch 2 guest VMs on separated compute nodes.

CLI commands
nova boot -flavor m1.asapsmall -image <IMAGE_NAME> --nic port-id=$direct_port1 <VM1_NAME> nova boot -flavor m1.asapsmall -image <IMAGE_NAME> --nic port-id=$direct_port2 <VM2_NAME>

Perform Sanity check

Start continuous ping request between guest VMs.
At the same time from hypervisor CLI past the following command:

CLI command
sudo ovs-dpctl dump-flows type=offloaded --name

The output will show the incoming and outcoming offloaded rules for the continuous ping request.
 
VXLAN example output:

VLAN example output:

Increasing number of Open flow rules via script


OpenVswitch by default create a single flow for multiple sessions per single client in order to optimize data plane traffic handling with small forwarding lookup tables.In order to test high volume of flows we will add a drop rule per odd source UDP port numbers. This way if we inject packets from single client with even source UDP port packets OpenVswitch will create a flow per each different even source port number.Set this script on Compute node-2:

BASH Script
#!/bin/bash START_PORT=2001 END_PORT=$2 P=$START_PORT while [ $P -lt $END_PORT ]; do if [ "$1" = "del" ] then sudo ovs-ofctl del-flows br-int dl_type=0x0800,nw_proto=0x11,udp_src=$P fi if [ "$1" = "add" ] then sudo ovs-ofctl add-flow br-int dl_type=0x0800,nw_proto=0x11,udp_src=$P,priority=11,action=drop fi let P=P+2 done

Add flows

This example will add flows per odd source UDP numbers between 2001-3001 (script port increment is by step +2). 

CLI Command
 ./add_flows.sh add 3001

Delete flows

CLI Command
./add_flows.sh del 3001

Verify number of logical flows in user space

CLI Command
ovs-ofctl dump-flows br-int | wc -l

Verify number of live flows in kernel space (only relevant during live and active packets stream)

CLI Command
ovs-dpctl dump-flows type=offloaded --name | wc -l

Set device under test (DUT) guest VM with looping back DPDK testpmd

Running testpmd application.

First allocate huge pages

CLI Command
echo 4096 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

Mount Hugepages

CLI Command
mount -t hugetlbfs -o pagesize=2MB none /dev/hugepages

Launch testpmd:

CLI Command
$DPDK_DIR/./testpmd -c 0x1f -n 4 -m 2048 -w 0000:00:04.0 – --burst=64 --txd=1024 --rxd=1024 --mbcache=512 --rxq=4 --txq=4 --nb-cores=4 --rss-udp --forward-mode=macswap -a -i --port-topology=chained

 Parameters definition:

  • Number of cores mask (example for 5 cores) -c 0x1f

  • Number Numa Channels -n 4

  • Hugepages amount of memory -m 2048

  • PCI slot -w <number>

  • Amount of RX/TX queues and PMD cores --rxq=4 --txq=4 --nb-cores=4

  • L2 forwarding mechanism --forward-mode=macswap

Extract packets statistics

CLI Command
testpmd> show port stats all

Set TRex traffic generator

This section explains how to generate packets which their metadata structure is imitating traffic flow from compute-node1 VM1 -> TO -> compute-node2 VM2.Upload udp_1pkt_vxlan.py and udp_1pkt_vlan.py (Attach to this post) to TRex server in its main installation older.

For VXLAN edit udp_1pkt_vxlan.py as following

Assuming traffic direction is from Trex TG server to VM2 on compute node-2

  • Src outer mac = TRex physical interface MAC address

  • Dst outer mac = Compute node-2 physical interface MAC address (Of VXLAN vtep)

  • Src outer ip = VXLAN vtep source IP address of compute node-1

  • Dst outer ip = VXLAN vtep source IP address of compute node-2

  • Src inner mac = MAC address of VM1 interface

  • Dst inner mac = MAC address of VM2 interface

  • Src inner ip = IP address of VM1 interface

  • Dst inner ip = IP address of VM2 interface

  • vni = VNI number -> can be discovered in output of section "Perform sanity check"

    CLI Command
    sudo ovs-dpctl dump-flows type=offloaded --name




Note:

The packet size coefficient  highlighted by green in explained in Section 4

For VLAN edit udp_1pkt_vlan.py as following

Assuming traffic direction is from Trex TG server to VM2 on compute node-2

  • Src outer mac = TRex physical interface MAC address

  • Dst outer mac = MAC address of VM2 interface

  • Src inner ip = IP address of VM1 interface

  • Dst inner ip = IP address of VM2 interface

  • Outer vlan = Network VLAN number. Can be identified by looking into network details:

  • Extract VLAN ID:

CLI command
openstack network show private1




Note:

The packet size coefficient  highlighted by green in explained in Section 4


Set Packet size (Marked in green above section 3 and 4 diagram) following the below examples

TRex packet sizes VXLAN script:
('x'*18) = 110 byte
('x'*164) = 256 byte
('x'*420) = 512 byte
('x'*932) = 1024 byte
('x'*1426) = 1518 byte
TRex packet sizes UDP only VLAN script:
('x'*22) = 64 byte
('x'*214) = 256 byte
('x'*470) = 512 byte
('x'*982) = 1024 byte
('x'*1476) = 1518 byte

Set minimum and maximum source UDP port number

Defining even numbers in port range (script port increment is by step +2)

Note:

The port range should complete the odd numbers range defined in section "Increasing number of OpenFlow rules via script"

In this post example range source UDP of even port number is set between 2000-3000


VXLAN setting example in udp_1pkt_vxlan.py:

udp_1pkt_vxlan.py

VLAN setting example in udp_1pkt_vlan.py:

udp_1pkt_vlan.py

Inject packets

Enter Trex console from Trex main directory

CLI Command
./trex-console

Run Trex script

CLI Command
trex> start -f udp_1pkt_vxlan.py -m 50mpps -p 0

-f specify the script file

-m specify number of millions packets per second

-p set Trex port to be used

View traffic statistics

Note:

Incase VXLAN is used traffic will not be looped back to TRex TG server, but to compute-node1 VM1, hence statistics should be measured via testpmd only


TRex statistics view

CLI Command
trex> tui

Testpmd statistics view

CLI Command
testpmd> show port stats all


This command will measure the amount of receiving RX and transmitting packets per second.
RX and TX numbers should be very close with small delta. If there is a big gap between RX to TX numbers, it means testpmd packet processing engine fails to keep up with the number of injected packets. In other words, you hit a performance bottleneck.


Appendix

Compiling DPDK with Nvidia PMD example

Install MLNX_OFED version is 4.2-1.0.0.0

OFED download link: Nvidia ethernet drivers
Make sure OFED installation script done as follow:
 

CLI Command
/mnt/mlnxofedinstall --dpdk --upstream-libs

Check OFED version

CLI Command
ofed_info -s

IMPORTANT

Incase OS is RHEL7.5/CentOS7.5 there is no need to install OFED. DPDK is supported upstream.There is only needing to install upstream packages instead of OFED as follows:

CLI Command
yum install rdma-core-devel numactl -y

Download and extract DPDK 17.11 package

CLI Command
cd /usr/src/ # wget {*}https://git.dpdk.org/dpdk-stable/snapshot/dpdk-stable-17.11.4.zip*# unzip dpdk-stable-17.11.4.zip

Set DPDK environment variables as follows:

CLI Command
export DPDK_DIR=/usr/src/dpdk-stable-17.11.4 # cd $DPDK_DIR # export DPDK_TARGET=x86_64-native-linuxapp-gcc # export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET

Modify compilation settings to support ConnectX-4 and ConnectX-5 interfaces

CLI Command
sed -i 's/(CONFIG_RTE_LIBRTE_MLX5_PMD=)n/\1y/g' $DPDK_DIR/config/common_base


Compile your DPDK code

CLI Command
make -j install T=$DPDK_TARGET DESTDIR=install



Notice

This document is provided for information purposes only and shall not be regarded as a warranty of a certain functionality, condition, or quality of a product. Neither NVIDIA Corporation nor any of its direct or indirect subsidiaries and affiliates (collectively: “NVIDIA”) make any representations or warranties, expressed or implied, as to the accuracy or completeness of the information contained in this document and assumes no responsibility for any errors contained herein. NVIDIA shall have no liability for the consequences or use of such information or for any infringement of patents or other rights of third parties that may result from its use. This document is not a commitment to develop, release, or deliver any Material (defined below), code, or functionality.
NVIDIA reserves the right to make corrections, modifications, enhancements, improvements, and any other changes to this document, at any time without notice.
Customer should obtain the latest relevant information before placing orders and should verify that such information is current and complete.
NVIDIA products are sold subject to the NVIDIA standard terms and conditions of sale supplied at the time of order acknowledgement, unless otherwise agreed in an individual sales agreement signed by authorized representatives of NVIDIA and customer (“Terms of Sale”). NVIDIA hereby expressly objects to applying any customer general terms and conditions with regards to the purchase of the NVIDIA product referenced in this document. No contractual obligations are formed either directly or indirectly by this document.
NVIDIA products are not designed, authorized, or warranted to be suitable for use in medical, military, aircraft, space, or life support equipment, nor in applications where failure or malfunction of the NVIDIA product can reasonably be expected to result in personal injury, death, or property or environmental damage. NVIDIA accepts no liability for inclusion and/or use of NVIDIA products in such equipment or applications and therefore such inclusion and/or use is at customer’s own risk.
NVIDIA makes no representation or warranty that products based on this document will be suitable for any specified use. Testing of all parameters of each product is not necessarily performed by NVIDIA. It is customer’s sole responsibility to evaluate and determine the applicability of any information contained in this document, ensure the product is suitable and fit for the application planned by customer, and perform the necessary testing for the application in order to avoid a default of the application or the product. Weaknesses in customer’s product designs may affect the quality and reliability of the NVIDIA product and may result in additional or different conditions and/or requirements beyond those contained in this document. NVIDIA accepts no liability related to any default, damage, costs, or problem which may be based on or attributable to: (i) the use of the NVIDIA product in any manner that is contrary to this document or (ii) customer product designs.
No license, either expressed or implied, is granted under any NVIDIA patent right, copyright, or other NVIDIA intellectual property right under this document. Information published by NVIDIA regarding third-party products or services does not constitute a license from NVIDIA to use such products or services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other intellectual property rights of the third party, or a license from NVIDIA under the patents or other intellectual property rights of NVIDIA.
Reproduction of information in this document is permissible only if approved in advance by NVIDIA in writing, reproduced without alteration and in full compliance with all applicable export laws and regulations, and accompanied by all associated conditions, limitations, and notices.
THIS DOCUMENT AND ALL NVIDIA DESIGN SPECIFICATIONS, REFERENCE BOARDS, FILES, DRAWINGS, DIAGNOSTICS, LISTS, AND OTHER DOCUMENTS (TOGETHER AND SEPARATELY, “MATERIALS”) ARE BEING PROVIDED “AS IS.” NVIDIA MAKES NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL NVIDIA BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF ANY USE OF THIS DOCUMENT, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Notwithstanding any damages that customer might incur for any reason whatsoever, NVIDIA’s aggregate and cumulative liability towards customer for the products described herein shall be limited in accordance with the Terms of Sale for the product.

Trademarks
NVIDIA, the NVIDIA logo, and Mellanox are trademarks and/or registered trademarks of NVIDIA Corporation and/or Mellanox Technologies Ltd. in the U.S. and in other countries. Other company and product names may be trademarks of the respective companies with which they are associated.

Copyright
© 2022 NVIDIA Corporation & affiliates. All Rights Reserved.