|
| 1 | +--- |
| 2 | +title: Microsoft Azure Network Adapter (MANA) and DPDK on Linux |
| 3 | +description: Learn about MANA and DPDK for Linux Azure VMs. |
| 4 | +author: mcgov |
| 5 | +ms.service: virtual-network |
| 6 | +ms.topic: how-to |
| 7 | +ms.date: 07/10/2023 |
| 8 | +ms.author: mamcgove |
| 9 | +--- |
| 10 | + |
| 11 | +# Microsoft Azure Network Adapter (MANA) and DPDK on Linux |
| 12 | + |
| 13 | +The Microsoft Azure Network Adapter (MANA) is new hardware for Azure virtual machines to enables higher throughput and reliability. |
| 14 | +To make use of MANA, users must modify their DPDK initialization routines. MANA requires two changes compared to legacy hardware: |
| 15 | +- [MANA EAL arguments](#mana-dpdk-eal-arguments) for the poll-mode driver (PMD) differ from previous hardware. |
| 16 | +- The Linux kernel must release control of the MANA network interfaces before DPDK initialization begins. |
| 17 | + |
| 18 | +The setup procedure for MANA DPDK is outlined in the [example code.](#example-testpmd-setup-and-netvsc-test). |
| 19 | + |
| 20 | +## Introduction |
| 21 | + |
| 22 | +Legacy Azure Linux VMs rely on the mlx4 or mlx5 drivers and the accompanying hardware for accelerated networking. Azure DPDK users would select specific interfaces to include or exclude by passing bus addresses to the DPDK EAL. The setup procedure for MANA DPDK differs slightly, since the assumption of one bus address per Accelerated Networking interface no longer holds true. Rather than using a PCI bus address, the MANA PMD uses the MAC address to determine which interface it should bind to. |
| 23 | + |
| 24 | +## MANA DPDK EAL Arguments |
| 25 | +The MANA PMD probes all devices and ports on the system when no `--vdev` argument is present; the `--vdev` argument is not mandatory. In testing environments it's often desirable to leave one (primary) interface available for servicing the SSH connection to the VM. To use DPDK with a subset of the available VFs, users should pass both the bus address of the MANA device and the MAC address of the interfaces in the `--vdev` argument. For more detail, example code is available to demonstrate [DPDK EAL initialization on MANA](#example-testpmd-setup-and-netvsc-test). |
| 26 | + |
| 27 | +For general information about the DPDK Environment Abstraction Layer (EAL): |
| 28 | +- [DPDK EAL Arguments for Linux](https://doc.dpdk.org/guides/prog_guide/env_abstraction_layer.html#eal-in-a-linux-userland-execution-environment) |
| 29 | +- [DPDK EAL Overview](https://doc.dpdk.org/guides/prog_guide/env_abstraction_layer.html) |
| 30 | + |
| 31 | +## DPDK requirements for MANA |
| 32 | + |
| 33 | +Utilizing DPDK on MANA hardware requires the Linux kernel 6.2 or later or a backport of the Ethernet and InfiniBand drivers from the latest Linux kernel. It also requires specific versions of DPDK and user-space drivers. |
| 34 | + |
| 35 | +MANA DPDK requires the following set of drivers: |
| 36 | +1. [Linux kernel Ethernet driver](https://github.com/torvalds/linux/tree/master/drivers/net/ethernet/microsoft/mana) (5.15 kernel and later) |
| 37 | +1. [Linux kernel InfiniBand driver](https://github.com/torvalds/linux/tree/master/drivers/infiniband/hw/mana) (6.2 kernel and later) |
| 38 | +1. [DPDK MANA poll-mode driver](https://github.com/DPDK/dpdk/tree/main/drivers/net/mana) (DPDK 22.11 and later) |
| 39 | +1. [Libmana user-space drivers](https://github.com/linux-rdma/rdma-core/tree/master/providers/mana) (rdma-core v44 and later) |
| 40 | + |
| 41 | +>[!NOTE] |
| 42 | +>MANA DPDK is not available for Windows; it will only work on Linux VMs. |
| 43 | +
|
| 44 | +## Example: Check for MANA |
| 45 | + |
| 46 | +>[!NOTE] |
| 47 | +>This article assumes the pciutils package containing the lspci command is installed on the system. |
| 48 | +
|
| 49 | +```bash |
| 50 | +# check for pci devices with ID: |
| 51 | +# vendor: Microsoft Corporation (1414) |
| 52 | +# class: Ethernet Controller (0200) |
| 53 | +# device: Microsft Azure Network Adapter VF (00ba) |
| 54 | +if [[ -n `lspci -d 1414:00ba:0200` ]]; then |
| 55 | + echo "MANA device is available." |
| 56 | +else |
| 57 | + echo "MANA was not detected." |
| 58 | +fi |
| 59 | + |
| 60 | +``` |
| 61 | + |
| 62 | +## Example: DPDK installation (Ubuntu 22.04) |
| 63 | + |
| 64 | +>[!NOTE] |
| 65 | +>This article assumes compatible kernel and rdma-core are installed on the system. |
| 66 | +
|
| 67 | +```bash |
| 68 | +DEBIAN_FRONTEND=noninteractive sudo apt-get install -q -y build-essential libudev-dev libnl-3-dev libnl-route-3-dev ninja-build libssl-dev libelf-dev python3-pip meson libnuma-dev |
| 69 | + |
| 70 | +pip3 install pyelftools |
| 71 | + |
| 72 | +# Try latest LTS DPDK, example uses DPDK tag v23.07-rc3 |
| 73 | +git clone https://github.com/DPDK/dpdk.git -b v23.07-rc3 --depth 1 |
| 74 | +pushd dpdk |
| 75 | +meson build |
| 76 | +cd build |
| 77 | +ninja |
| 78 | +sudo ninja install |
| 79 | +popd |
| 80 | +``` |
| 81 | + |
| 82 | +## Example: Testpmd setup and netvsc test |
| 83 | + |
| 84 | +Note the following example code for running DPDK with MANA. The direct-to-vf 'netvsc' configuration on Azure is recommended for maximum performance with MANA. |
| 85 | + |
| 86 | +>[!NOTE] |
| 87 | +>DPDK requires either 2MB or 1GB hugepages to be enabled |
| 88 | +
|
| 89 | +```bash |
| 90 | +# Enable 2MB hugepages. |
| 91 | +echo 1024 | tee /sys/devices/system/node/node*/hugepages/hugepages-2048kB/nr_hugepages |
| 92 | + |
| 93 | +# Assuming use of eth1 for DPDK in this demo |
| 94 | +PRIMARY="eth1" |
| 95 | + |
| 96 | +# $ ip -br link show master eth1 |
| 97 | +# > enP30832p0s0 UP f0:0d:3a:ec:b4:0a <... # truncated |
| 98 | +# grab interface name for device bound to primary |
| 99 | +SECONDARY="`ip -br link show master $PRIMARY | awk '{ print $1 }'`" |
| 100 | +# Get mac address for MANA interface (should match primary) |
| 101 | +MANA_MAC="`ip -br link show master $PRIMARY | awk '{ print $3 }'`" |
| 102 | + |
| 103 | + |
| 104 | +# $ ethtool -i enP30832p0s0 | grep bus-info |
| 105 | +# > bus-info: 7870:00:00.0 |
| 106 | +# get MANA device bus info to pass to DPDK |
| 107 | +BUS_INFO="`ethtool -i $SECONDARY | grep bus-info | awk '{ print $2 }'`" |
| 108 | + |
| 109 | +# Set MANA interfaces DOWN before starting DPDK |
| 110 | +ip link set $PRIMARY down |
| 111 | +ip link set $SECONDARY down |
| 112 | + |
| 113 | + |
| 114 | +## Move synthetic channel to user mode and allow it to be used by NETVSC PMD in DPDK |
| 115 | +DEV_UUID=$(basename $(readlink /sys/class/net/$PRIMARY/device)) |
| 116 | +NET_UUID="f8615163-df3e-46c5-913f-f2d2f965ed0e" |
| 117 | +modprobe uio_hv_generic |
| 118 | +echo $NET_UUID > /sys/bus/vmbus/drivers/uio_hv_generic/new_id |
| 119 | +echo $DEV_UUID > /sys/bus/vmbus/drivers/hv_netvsc/unbind |
| 120 | +echo $DEV_UUID > /sys/bus/vmbus/drivers/uio_hv_generic/bind |
| 121 | + |
| 122 | +# MANA single queue test |
| 123 | +dpdk-testpmd -l 1-3 --vdev="$BUS_INFO,mac=$MANA_MAC" -- --forward-mode=txonly --auto-start --txd=128 --rxd=128 --stats 2 |
| 124 | + |
| 125 | +# MANA multiple queue test (example assumes > 9 cores) |
| 126 | +dpdk-testpmd -l 1-9 --vdev="$BUS_INFO,mac=$MANA_MAC" -- --forward-mode=txonly --auto-start --nb-cores=8 --txd=128 --rxd=128 --txq=8 --rxq=8 --stats 2 |
| 127 | + |
| 128 | +``` |
| 129 | + |
| 130 | +## Troubleshooting |
| 131 | + |
| 132 | +### Fail to set interface down. |
| 133 | +Failure to set the MANA bound device to DOWN can result in low or zero packet throughput. |
| 134 | +The failure to release the device can result the EAL error message related to transmit queues. |
| 135 | +``` |
| 136 | +mana_start_tx_queues(): Failed to create qp queue index 0 |
| 137 | +mana_dev_start(): failed to start tx queues -19 |
| 138 | +``` |
| 139 | + |
| 140 | +### Failure to enable huge pages. |
| 141 | + |
| 142 | +Try enabling huge pages and ensuring the information is visible in meminfo. |
| 143 | +``` |
| 144 | +EAL: No free 2048 kB hugepages reported on node 0 |
| 145 | +EAL: FATAL: Cannot get hugepage information. |
| 146 | +EAL: Cannot get hugepage information. |
| 147 | +EAL: Error - exiting with code: 1 |
| 148 | +Cause: Cannot init EAL: Permission denied |
| 149 | +``` |
| 150 | + |
| 151 | +### Low throughput with use of --vdev="net_vdev_netvsc0,iface=eth1" |
| 152 | + |
| 153 | +Failover configuration of either the `net_failsafe` or `net_vdev_netvsc` poll-mode-drivers isn't recommended for high performance on Azure. The netvsc configuration with DPDK version 20.11 or higher may give better results. For optimal performance, ensure your Linux kernel, rdma-core, and DPDK packages meet the listed requirements for DPDK and MANA. |
0 commit comments