DPDK: Data Plane Development Kit

MEMNIC PMD

DESCRIPTION

This is a Poll-Mode Driver (PMD) for DPDK, provided as a DPDK extension that must be loaded at DPDK startup.

It allows creating virtual NICs based on a shared memory. On guest side, it uses an ivshmem virtual PCI device. On host side, the shared memory is a mmap'd file.

This virtual NIC permits to achieve high performance for virtualized environment by directly sharing rings between the host and the guest VMs, bypassing the Virtual Machine Manager and thus, removing any hypercalls that would have taken place otherwise.

This virtual NIC also avoids to share the whole DPDK memory between the host and the guest. When transmitting a packet from guest to host, the packets are copied from rte_mbufs owned by a guest to the shared memory, then from the shared memory to a rte_mbuf structure owned by the host. The same approach is applied when transmitting from host to guest. This approach prevents a guest to modify a packet owned by the host or another guest, providing more security.

HOW TO BUILD

There is only one build dependency: DPDK.

This driver aims to be compiled and run on guest side. See in HOW TO RUN for how to boot your guest.

DPDK must be built first in order to have all its header files in the same directory, that RTE_INCLUDE must point to:

cd /path/to/dpdk
make config T=x86_64-native-linuxapp-gcc
make
cd /path/to/memnic/pmd
make RTE_INCLUDE=/path/to/dpdk/build/include

It results in creating a library librte_pmd_memnic_copy.so in current directory. To install it, use:

make install

The default installation path is /usr/local/lib/librte_pmd_memnic_copy.so. It can be overidden by setting DESTDIR variable when invoking make install command. In this case, the library will be copied in $(DESTDIR)/usr/local/lib/librte_pmd_memnic_copy.so.

Build options can be displayed using make help.

HOW TO RUN

On host, the shared memory must be initialized by an application using memnic.

Only QEMU hypervised systems are supported at the moment. We assume that the DPDK and librte_pmd_memnic_copy are already installed on the guest. To run the guest with qemu, you can use a command line similar to this one:

qemu-system-x86_64 -enable-kvm -cpu host -smp 3 -m 512 \
    -device ivshmem,size=16,shm=/../../mnt/huge/ivshm

Run the testpmd application on the guest:

echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
mount -t hugetlbfs nodev /mnt/huge
/path/to/dpdk/testpmd -c7 -n3 \
    -d /path/to/librte_pmd_memnic_copy.so \
    -- -i --nb-cores=2 --nb-ports=1 --port-topology=chained