Francesco Spinelli | 22e9c03 | 2019-02-28 11:51:24 +0100 | [diff] [blame] | 1 | .. _vppinazure: |
| 2 | |
| 3 | .. toctree:: |
| 4 | |
| 5 | VPP in Azure |
| 6 | ___________________ |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | Before starting, a few notes: |
| 12 | |
| 13 | * in our configuration we use only DPDK 18.02, since with the newer versions, such as DPDK 18.05, we obtained several problems during VPP installation (mostly related with MLX4 PMD Drivers). |
| 14 | |
| 15 | * Some of the commands are taken from `Azure’s DPDK page <https://docs.microsoft.com/en-us/azure/virtual-network/setup-dpdk>`_. |
| 16 | |
| 17 | To bring DPDK inside Azure, we perform the following procedure: |
| 18 | |
| 19 | Firstly, we install the DPDK dependencies: |
| 20 | |
| 21 | .. code-block:: console |
| 22 | |
| 23 | $ sudo add-apt-repository ppa:canonical-server/dpdk-azure –y |
| 24 | $ sudo apt-get update |
| 25 | $ sudo apt-get install -y librdmacm-dev librdmacm1 build-essential libnuma-dev libmnl-dev |
| 26 | |
| 27 | Then, we download DPDK 18.02: |
| 28 | |
| 29 | .. code-block:: console |
| 30 | |
| 31 | $ sudo wget https://fast.dpdk.org/rel/dpdk-18.02.2.tar.xz |
| 32 | $ tar -xvf dpdk-18.02.2.tar.xz |
| 33 | |
| 34 | Finally, we build DPDK, modifying first its configuration files in order to make VPP compatible with MLX4 drivers: |
| 35 | |
| 36 | Inside config/common_base, modify: |
| 37 | |
| 38 | .. code-block:: console |
| 39 | |
| 40 | CONFIG_RTE_BUILD_SHARED_LIB=n |
| 41 | CONFIG_RTE_LIBRTE_MLX4_PMD=y |
| 42 | CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS=y |
| 43 | CONFIG_RTE_LIBRTE_TAP_PMD=y |
| 44 | CONFIG_RTE_LIBRTE_FAILSAFE_PMD=y |
| 45 | |
| 46 | and then: |
| 47 | |
| 48 | .. code-block:: console |
| 49 | |
| 50 | $ make config T=x86_64-native-linuxapp-gcc |
| 51 | $ sed -ri 's,(MLX._PMD=)n,\1y,' build/.config |
| 52 | $ make |
| 53 | |
| 54 | Finally we build DPDK: |
| 55 | |
| 56 | .. code-block:: console |
| 57 | |
| 58 | $ make install T=x86_64-native-linuxapp-gcc DESTDIR=/home/ciscotest/test EXTRA_CFLAGS='-fPIC -pie' |
| 59 | |
| 60 | And we reboot the instance: |
| 61 | |
| 62 | .. code-block:: console |
| 63 | |
Paul Vinciguerra | 7fa3dd2 | 2019-10-27 17:28:10 -0400 | [diff] [blame^] | 64 | $ reboot instance |
Francesco Spinelli | 22e9c03 | 2019-02-28 11:51:24 +0100 | [diff] [blame] | 65 | |
| 66 | After the reboot, we type these commands: |
| 67 | |
| 68 | .. code-block:: console |
| 69 | |
| 70 | $ echo 1024 | sudo tee /sys/devices/system/node/node*/hugepages/hugepages-2048kB/nr_hugepages |
| 71 | $ mkdir /mnt/huge |
| 72 | $ sudo mount -t hugetlbfs nodev /mnt/huge |
| 73 | $ grep Huge /proc/meminfo |
| 74 | $ modprobe -a ib_uverbs |
| 75 | $ cd x86_64-native-linuxapp-gcc/ |
| 76 | $ ls |
| 77 | $ cd lib/ |
| 78 | $ ls |
| 79 | $ sudo cp librte_pmd_mlx4_glue.so.18.02.0 /usr/lib |
| 80 | |
| 81 | **Now we focus on VPP installation:** |
| 82 | |
| 83 | In our configuration we use VPP 18.07. |
| 84 | |
| 85 | We perform this procedure in order to install VPP 18.07 with an external DPDK configuration inside Azure. |
| 86 | |
| 87 | Firstly, we download VPP |
| 88 | |
| 89 | .. code-block:: console |
| 90 | |
| 91 | $ git clone https://gerrit.fd.io/r/vpp |
| 92 | $ git checkout v18.07 |
| 93 | |
| 94 | Then, we build VPP, using the external DPDK configuration we previously made: |
| 95 | |
| 96 | We modify the path inside the vpp.mk file: |
| 97 | |
| 98 | .. code-block:: console |
| 99 | |
| 100 | $ build-data/platforms/vpp.mk |
| 101 | $ vpp_uses_external_dpdk = yes |
| 102 | $ vpp_dpdk_inc_dir = <PATH_TO_DESTDIR_NAME_FROM_ABOVE>/include/dpdk/ |
| 103 | $ vpp_dpdk_lib_dir =<PATH_TO_DESTDIR_NAME_FROM_ABOVE>/lib |
| 104 | |
| 105 | <PATH_TO_DESTDIR_NAME_FROM_ABOVE> is whatever the path used when compiling DPDK above. These paths have to be absolute path in order for it to work. |
| 106 | |
| 107 | we modify build-data/platforms/vpp.mk to use |
| 108 | |
| 109 | .. code-block:: console |
| 110 | |
| 111 | vpp_uses_dpdk_mlx4_pmd = yes |
| 112 | |
| 113 | .. code-block:: console |
| 114 | |
| 115 | $ make build |
| 116 | $ cd build-root/ |
| 117 | $ make V=0 PLATFORM=vpp TAG=vpp install-deb |
| 118 | $ sudo dpkg -i *.deb |
| 119 | |
| 120 | Finally, we modify the startup.conf file: |
| 121 | |
| 122 | .. code-block:: console |
| 123 | |
| 124 | $ cd /etc/vpp |
| 125 | $ sudo nano startup.conf |
| 126 | |
| 127 | Inside the DPDK block, the following commands: |
| 128 | |
| 129 | .. code-block:: console |
| 130 | |
| 131 | |
| 132 | ## Whitelist specific interface by specifying PCI address |
| 133 | dev 000X:00:0X.0 |
| 134 | dev 000X:00:0X.0 |
| 135 | |
| 136 | # Running failsafe |
| 137 | vdev net_vdev_netvsc0,iface=eth1 |
| 138 | vdev net_vdev_netvsc1,iface=eth2 |
| 139 | |
| 140 | *Please refer to Azure DPDK document to pick the right iface to use for failsafe vdev.* |
| 141 | |
| 142 | |
| 143 | and finally: |
| 144 | |
| 145 | .. code-block:: console |
| 146 | |
| 147 | $ sudo service vpp stop |
| 148 | $ sudo service vpp start |
| 149 | $ sudo service vpp status |
| 150 | $ sudo vppctl |
| 151 | |
| 152 | Now VPP will work inside Azure! |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |