# Build DPDK 20.11
###### tags: `ORAN`
* [Reference - Build DPDK](https://docs.o-ran-sc.org/projects/o-ran-sc-o-du-phy/en/latest/Setup-Configuration_fh.html#a-2-prerequisites)
---
###### tags: `CHT Technical Document`
:::success
**Outline:**
[TOC]
:::
---
## Version
:::info
- For O-DU Emerald version, can use DPDK 19.11
- For O-DU F Version, use DPDK 20.11
:::
---
## DPDK 20.11
### 1. Install python3 & pip3
:::info
- Python3 is used to install DPDK 20.11
:::
```shell=
$ yum install epel-release -y
$ yum install python36 -y
$ yum install -y python3-pip
```
### 2. Install meson & ninja
:::info
- DPDK 20.11 used Ninja build file
- The Meson program is used to configure the source directory and generates either a Ninja build file or Visual Studio® build files
:::
```shell=
$ sudo pip3 install meson
$ sudo yum -y install ninja-build
```
### 3. Download DPDK
```shell=
## Download DPDK
$ wget http://static.dpdk.org/rel/dpdk-20.11.3.tar.xz
## Extract tar file
$ tar -xf dpdk-20.11.3.tar.xz -C
```
### 4. Set up the environment variable
:::info
- Add dpdk path to bashrc so that linux can recognize installed DPDK
:::
```shell=
## Set the environment variable and append them into ~/.bashrc
$ vim ~/.bashrc
$ export RTE_TARGET=x86_64-native-linuxapp-icx
$ export RTE_SDK=<DPDK_Path>/dpdk-stable-20.11.3
$ export WIRELESS_SDK_TOOLCHAIN=icx
$ export SDK_BUILD=build-avx512-icc
$ export PATH=$PATH:/opt/intel/oneapi/compiler/2022.0.1/linux/bin-llvm/
```
### 5. Modify the meson_options.txt
```shell=
$ cd <Intallation_DIR>/dpdk-stable-20.11.3
$ vim meson_options.txt
```
:::success
**In meson_options.txt**
Before:
```shell=23
option('machine', type: 'string', value: 'native',
description: 'set the target machine type')
```
After:
```shell=23
option('machine', type: 'string', value: 'default',
description: 'set the target machine type')
```
:::
### 6. Patch some files
:::info
- Some files are patched as guided by intel to run O-DU more efficiently
:::
#### 1. Edit i40e_ethdev.c
```shell
[oai@ee705-7-ip120 DPDK]$ sudo vi dpdk-20.11.3/drivers/net/i40e/i40e_ethdev.c
```
:::info
- Change i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT); into i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_NONE); (in about line 2207)

- Add some lines in about line 2220
```
i40e_aq_debug_write_global_register(hw,
0x0012A504,
0, NULL);
```

:::
#### 2. Edit i40e_ethdev_vf.c
```shell
[oai@ee705-7-ip120 DPDK]$ sudo vi dpdk-20.11.3/drivers/net/i40e/i40e_ethdev_vf.c
```
:::info
- Change map_info->vecmap[0].rxitr_idx = I40E_ITR_INDEX_DEFAULT; into map_info->vecmap[0].rxitr_idx = I40E_ITR_INDEX_NONE; (in about line 640)

:::
#### 3. Edit ixgbe_ethdev.c
```shell
[oai@ee705-7-ip120 DPDK]$ sudo vi dpdk-20.11.3/drivers/net/ixgbe/ixgbe_ethdev.c
```
:::info
- Change hw->mac.type != ixgbe_mac_82598EB) into hw->mac.type != ixgbe_mac_82598EB && hw->mac.type != ixgbe_mac_82599EB) (in about line 3705)

:::
### 7. Build DPDK
:::info
- Build DPDK using meson and ninja
:::
```shell=
$ meson build
$ cd build
$ ninja
$ ninja install
```
---
## Install IGB_UIO driver
:::info
- If you need to bind some devices to IGB_UIO
- Install driver from other sources
:::
```shell=
cd /DPDK
yum install git
git clone git://dpdk.org/dpdk-kmods dpdk_igb_uio_driver
cd ./dpdk_igb_uio_driver/linux/igb_uio
make clean && make
# Load IGB_UIO module
sudo modprobe uio
cd /dpdk_igb_uio_driver/linux/igb_uio
$ sudo insmod igb_uio.ko
```