[dpdk-dev] [README]:Running DPDK in a LXC-based Container

Xie, Huawei huawei.xie at intel.com
Fri Oct 10 02:26:55 CEST 2014


Here is the docker step, it is quite straightforward. Basically they are the same as LXC.

UIO:
docker run -i -t  --device=/dev/uio0:/dev/uio0 --device=/dev/uio1:/dev/uio1 -v /mnt:/mnt    fedora20-dpdk-2 /bin/bash

VFIO:
docker run -i -t  --privileged  --device=/dev/vfio/vfio:/dev/vfio/vfio --device=/dev/vfio/22:/dev/vfio/22  -v /mnt:/mnt    -v /var/run:/var/run  fedora20-dpdk-2 /bin/bash 
There are open/ioctl calls on vfio device files, and I haven't figured out exactly the capability we need to give to docker for each sys call, otherwise we could remove --privilege option.

MP process:
With /var/run or /var/run/.rte_* mounted to docker, we could run multiple process between dockers.  
(We could generate the dpdk cfg files in /var/run/dpdk, then we could mount whole directories to docker without specify each file).


> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Murthy, Krishna J
> Sent: Wednesday, October 08, 2014 6:44 AM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [README]:Running DPDK in a LXC-based Container
> 
>                  Running DPDK in a LXC-based Container
> =================================================================
> ===============
> Author: Krishnamurthy Jambur
> 
> Note: This README assumes you have the a LXC based container running on
>       the IA platform. This was tested on Windriver OVP Linux 6.0
> 
> In this README we are will go through some of the unique steps involved
> in attaching a NIC to the LXC-based Container and the running a sample
> DPDP application in the container.
> 
> 1. Attaching NIC device to the container
> ----------------------------------------
> Let's assume for this example that you would like to have a management
> interface
> and then separate dedicated 10G NIC to run DPDK. With this requirement your
> LXC
> config file should have one networking sections one for veth. For the 10G NIC
> we
> need to use uio device file system
> 
> veth uses a paired set of network interfaces, one inside the container specified
> by the option lxc.network.name, and one in the host specified by the option
> lxc.network.pair. The latter is attached automatically to a bridge in the host
> if the name of the bridge is specified by the option lxc.network.link.
> 
> # networking-veth
> lxc.network.type = veth
> lxc.network.link = virbr0
> lxc.network.veth.pair = vc0
> lxc.network.name = eth0
> lxc.network.hwaddr = ac:de:48:34:01:01
> lxc.network.flags = up
> lxc.network.ipv4 = 192.168.122.12/24
> lxc.network.ipv4.gateway = 192.168.122.1
> 
> once you have this your LXC container will have an IP using bridge. Next step
> is to install DPDK igb_uio on the host and then bind it to the the 10G Niantic
> NIC ports as usual. Once installed do ls -l /dev/uio* on the host. These are the
> uioX interface corresponding to the the NIC ports to which DPDK igb_uio is
> binded. DPDK application will use these device files. In order to provide access
> to these device files inside the LXC container not down the major number [e.g.
> in this case 249] and add this config to the LXC config file
> 
> lxc.cgroup.devices.allow = c 249:* rwm
> 
> once you start the container then you need to create these uio0, uio1,...
> devices nodes inside the container file system using mknod command as usual
> with the same major and minor numbers.
> 
> mknod /dev/uio3 c 249 0
> mknod /dev/uio3 c 249 3
> mknod /dev/uio2 c 249 2
> mknod /dev/uio1 c 249 1
> 
> 2. Host allocated Huge page access inside container
> ----------------------------------------------------
> For this set it is assumes that you would have pre-allocated hugepages and
> mounted on the on the host. Once you have this set-up then you need to provide
> access to hugetlbfs file system to the container using the LXC config file.
> 
> lxc.mount.entry = /mnt/huge mnt/huge none bind,create=dir 0 0
> 
> once you have this DPDK application will be able to use the host mounted huge
> pages in the container.
> 
> Next step is run the DPDK application as usual in the LXC Container
> 
> Regards,
> Krishna
> 
> --------------------------------------------------------------
> Intel Shannon Limited
> Registered in Ireland
> Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
> Registered Number: 308263
> Business address: Dromore House, East Park, Shannon, Co. Clare
> 
> This e-mail and any attachments may contain confidential material for the sole
> use of the intended recipient(s). Any review or distribution by others is strictly
> prohibited. If you are not the intended recipient, please contact the sender and
> delete all copies.
> 



More information about the dev mailing list