Prerequisites
-------------

DPDK <= 19
~~~~~~~~~~

You need to install and compile DPDK in your HOME directory as explained in
See http://core.dpdk.org/doc/quick-start/ for DPDK installation and setup

Once DPDK is built make sure to create a symbolic link:

$ cd ~ && ln -s dpdk-18.08 DPDK

so the build process will use the DPDK directory letting you have multiple
DPDK versions available on your system

Build ftflow_dpdk:

$ cd - && make -f Makefile.dpdk.old

DPDK >= 20
~~~~~~~~~~

Download dpdk:

$ tar xJf dpdk-<version>.tar.xz
$ cd dpdk-<version>

Intall required tools:

$ apt-get install meson ninja-build
$ pip3 install pyelftools

Build dpdk:

$ meson build
$ cd build
$ ninja

Install dpdk:

$ sudo ninja install
$ sudo ldconfig

Build ftflow_dpdk:

$ cd ~/PF_RING/userland/examples_ft
$ make -f Makefile.dpdk

Run Application
---------------
Supposing to capture packets from device eno1 you can start the
application as follows:

sudo ./ftflow_dpdk -c 1 --vdev=net_pcap0,iface=eno1 -- -v -7

Mellanox Notes
--------------

In order to enable Mellanox support, libibverbs is required when building dpdk.
It is also suggested to disable mlx4 if you are using mlx5 to avoid linking issues.

$ sudo apt install libibverbs-dev
$ meson -Ddisable_drivers=net/mlx4 build
$ cd build
$ ninja

After installing dpdk, download Mellanox OFED/EN from https://www.mellanox.com/products/infiniband-drivers/linux/mlnx_ofed
and install it (this also installs dependencies including libibverbs):

$ cd MLNX_OFED_LINUX-5.4-1.0.3.0-ubuntu20.04-x86_64
$ ./mlnxofedinstall --upstream-libs --dpdk

Verify the fw:

$ ibv_devinfo

Load the required modules and load hugepages:

$ modprobe -a ib_uverbs mlx5_core mlx5_ib
$ dpdk-hugepages.py --setup 2G

Check the interfaces and get the Bus IDs:

$ ls -d /sys/class/net/*/device/infiniband_verbs/uverbs* | cut -d / -f 5
enp1s0f0
enp1s0f1

$ cd /sys/class/net/enp1s0f0/device/ && pwd -P| sed -n 's,.*/\(.*\),-a \1,p'
0000:01:00.0
$ cd /sys/class/net/enp1s0f1/device/ && pwd -P| sed -n 's,.*/\(.*\),-a \1,p'
0000:01:00.1

Test the driver:

$ dpdk-testpmd -l 1-2 -n 4 -a 0000:01:00.0 -a 0000:01:00.1 -- --rxq=1 --txq=1 -i

Run ftflow_dpdk:

$ sudo ./ftflow_dpdk -l 1 -n 2 -a 0000:01:00.1 -- -p 0 -0

