Running the Experiment

To run the experiment, first of all you need to start the server providing the virtio ports through the DPDK's vhost-user driver (this is the virtual bridge or virtual switch connecting the two containers), then you can start the containers and run the test applications.

Since the vhost and virtio drivers use 1GB hugepages, before starting the experiment it is important to mount the hugetlbfs on the host with the appropriate options. For example:


	sudo mount -t hugetlbfs hugetlbfs /dev/hugepages -o rw,relatime,pagesize=1G
    

testpmd as a virtual bridge

The testpmd application has been installed in the $(pwd)/I/bin/ directory of the host when you built DPDK. Assuming that the PMD environment variable points to the testpmd binary, the virtual bridge can be started with:


	mkdir /tmp/VIO
	sudo $PMD -l 0-1 -n 2 --socket-mem 1024,1024 \
		--vdev 'eth_vhost0,iface=/tmp/VIO/sock0' \
		--vdev 'eth_vhost1,iface=/tmp/VIO/sock1' \
		--file-prefix=host --no-pci -- -i
    

After the testpmd program is started, it presents a prompt where it is possible to start packets forwarding with


	start
    

and to print some statistics about the forwarded packets rate with


	show port stats all
    

After terminating the experiments, packet forwarding can be stopped with "stop" before exiting testpmd (with ctrl-d).

Starting the Containers

The previously created containers can be started with:


	sudo lxc-start NewTest; sudo lxc-console -n NewTest 
    

and


	sudo lxc-start Client2; sudo lxc-console -n Client2 
    

(notice that these commands also connect a console to the started containers).

At this point, the DPDK test application can be started in the first container (to send packets at a specified rate), and a testpmd instance can be started in the second container (to receive the packets and print the received rate). Start testpmd first, with


	sudo ln -s /var/run/hugepages /dev/hugepages
	sudo /testpmd -n 4 -m 1024 --vdev 'virtio_user0,path=/var/run/VIO/sock1' --file-prefix=container-c1 --no-pci -- -i
    

and then instruct testpmd to receive packets by typing


	set fwd rxonly
	start
	show port stats all
    

at its prompt (repeat the "show port stats all" later to print the received rate). Finally, start sending packets with


	sudo /my_test1 -l 8,9 -n 4 -m 1024 --vdev 'virtio_user0,path=/var/run/VIO/sock0' --file-prefix=container-c2 --no-pci -- -r 14000000 -b 64
    

where "-r ..." sets the sent packet rate and "-b ..." sets the packet size. All the previous options are standard DPDK options (for example, "-l 8,9" specifies the CPU cores to be used and must be adjusted, etc...). As an alternative, you could use testpmd to send packets at the maximum rate, by starting it with


	sudo /testpmd -n 4 -m 1024 --vdev 'virtio_user0,path=/var/run/VIO/sock0' --file-prefix=container-c2 --no-pci -- -i
    

and then typing


	set fwd txonly
	start
	show port stats all
    

at its prompt.

vpp as a virtual bridge

Start the vpp daemon with:


	sudo ./install-vpp-native/vpp/bin/vpp -c ./deb/debian/vpp/etc/vpp/startup.conf
    

and then configure the virtual switch (creating the virtio ports) with:


	P=./fdio.1704/build-root/install-vpp-native/vpp/bin/
	# Create and bring up three vhost-user interfaces:
	sudo $P/vppctl create vhost-user socket /tmp/VIO/sock0 server
	sudo $P/vppctl create vhost-user socket /tmp/VIO/sock1 server
	sudo $P/vppctl set interface state VirtualEthernet0/0/0 up
	sudo $P/vppctl set interface state VirtualEthernet0/0/1 up

	#Add virtual interfaces to L2 bridges:
	sudo $P/vppctl set interface l2 bridge VirtualEthernet0/0/0 1
	sudo $P/vppctl set interface l2 bridge VirtualEthernet0/0/1 1
    

At this point, start the two containers as in the testpmd case.