[dpdk-dev] [RFC][PATCH V2 0/3] example/vhost: Introduce Vswitch Framework

Pankaj Chauhan pankaj.chauhan at nxp.com
Mon Sep 5 12:54:28 CEST 2016


Introduce generic vswitch framework in vhost-switch application. Following
are the goals/aim of the framework:

1. Make vhost-switch application generic so that it can support devices 
which don't support VMDQ.

2. Provide a framework so that any switching logic (generic in software or
vendor specefic like VMDQ) can work with vhost-switch. Thus making vhost-switch
applicable for multiple platforms of different vendors.

3. Make vhost-switch and switching logic scalable in terms of ports or policies
of doing rx/tx across the ports added to switch.

The patchset includes three patches:
1. "Add vswitch(generic switch) framework": This adds the generic framework, it provides
the APIs/accessor functions which the vhos-switch application uses without knowing
anything about underlying switching logic. The framework introduces the concept of
vswitch_device, vswitch_port, and vswitch_ops. The idea is that vhost-switch will
sit over the framework and different switching logics will plug into the framework
underneath it. Please refer the patch description for more details of devices, ports
and ops.

2. "Add vswitch command line options": Adds two new command line options for vswitch.
3. "Add VMDQ vswitch device": This patch basically delinks existing vhost/main.[c,h]
from VMDQ and adds VMDQ as a vswitch device implmentation which plugs into the vswitch
framework. Any other vendor logic for switching can also be plugged in same way.

Thanks to Tan Jianfeng, Yuanhan Liu, Maxime coquelin for early discussions and inputs
on this concept.

TODO list:
1. Addd constructor based logic for registration of Vswitch implmentations like VMDQ.
we will use similar mechanism as registration of PMD drivers (base on constructor function)
to register all the switch implmentations in vhost-switch and then select the required
implementation using command line option 'switch'.

2. Test VM2VM hardware mode: I tried following command it didn't work:

vhost-switch -c f -n 4 --socket-mem 1024 --huge-dir /mnt/huge  -- -p 0x1  --vm2vm 2 
  	--vlan-strip 1 --dev-basename usvhost
I tried same command on upstream master also but it didn't work, that means i am doing something
wrong, please help me with correct method to test it. Or now the patches are working, so
if possible please give a try to hardware VM2VM mode.

3. Changes for Maxime's comment on freeing of buffers in vs_looup_n_fwd(). I wasn't clear about
what is the right way to handle, we'll fix it after getting feedback from Maxime.

Change Log
==========

v1->v2
------
1. Tested following:
	- Ping and iperf from VM to external machine connected to Phys port.
	- Ping and iperf betweeen 2 VMs in software vm2vm mode

	- My testsetup is:
		-  vhost & VM machine: xeonD1521 with Network card: X552/X557-AT 10GBASE-T
		- Peer connected to VM machine: OptiPlex-790 with 82574L Gigabit card
2. Incorporated changes for all the comments from Maxime Coquelin. One comment is not yet
   taken care off, and it is listed in TODO list.

Pankaj Chauhan (3):
  examples/vhost: Add vswitch (generic switch) framework
  examples/vhost: Add vswitch command line options
  examples/vhost: Add VMDQ vswitch device

 examples/vhost/Makefile         |   2 +-
 examples/vhost/main.c           | 651 +++++++++++++-------------------------
 examples/vhost/main.h           |  10 +
 examples/vhost/vmdq.c           | 669 ++++++++++++++++++++++++++++++++++++++++
 examples/vhost/vmdq.h           |  57 ++++
 examples/vhost/vswitch_common.c | 499 ++++++++++++++++++++++++++++++
 examples/vhost/vswitch_common.h | 186 +++++++++++
 examples/vhost/vswitch_txrx.c   |  97 ++++++
 examples/vhost/vswitch_txrx.h   |  71 +++++
 9 files changed, 1800 insertions(+), 442 deletions(-)
 create mode 100644 examples/vhost/vmdq.c
 create mode 100644 examples/vhost/vmdq.h
 create mode 100644 examples/vhost/vswitch_common.c
 create mode 100644 examples/vhost/vswitch_common.h
 create mode 100644 examples/vhost/vswitch_txrx.c
 create mode 100644 examples/vhost/vswitch_txrx.h

-- 
1.9.1



More information about the dev mailing list