* [dts] [PATCH 1/5] Support virtualization scenario that use dpdk as host PF driver
2015-07-16 13:54 [dts] [PATCH 0/5] support virutal scenario that host drived by dpdk Yong Liu
@ 2015-07-16 13:54 ` Yong Liu
2015-07-16 13:54 ` [dts] [PATCH 2/5] Add dpdk host virtualization scenario configuration file Yong Liu
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Yong Liu @ 2015-07-16 13:54 UTC (permalink / raw)
To: dts
From: Marvin Liu <yong.liu@intel.com>
With 'host' option in scenario configuration file, virtual scene module will
setup scenario that host pf drived by dpdk. First bind host pf devices to
igb_uio driver. Then generate vf devices by max_vfs attribute. Before start VM,
start dpdk application as host pf driver.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/virt_scene.py b/framework/virt_scene.py
index 73d2cdf..cf4a416 100644
--- a/framework/virt_scene.py
+++ b/framework/virt_scene.py
@@ -29,6 +29,7 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import time
import dts
from settings import CONFIG_ROOT_PATH, get_netdev
@@ -36,6 +37,7 @@ from config import VirtConf
from config import VIRTCONF
from exception import *
from qemu_kvm import QEMUKvm
+from pmd_output import PmdOutput
# scenario module for handling scenario
# 1. load configurations
@@ -65,6 +67,8 @@ class VirtScene(object):
self.vm_dut_enable = False
self.auto_portmap = True
self.vm_type = 'kvm'
+ self.def_target = "x86_64-native-linuxapp-gcc"
+ self.host_bound = False
# for vm dut init_log
self.host_dut.test_classname = 'dts'
@@ -82,10 +86,15 @@ class VirtScene(object):
raise VirtConfigParseException
def prepare_vm(self):
+ host_cfg = None
for conf in self.vm_confs.keys():
if conf == 'scene':
- suite_cfg = self.vm_confs['scene'][0]
- self.prepare_suite(suite_cfg)
+ for cfg in self.vm_confs['scene']:
+ if 'suite' in cfg.keys():
+ self.prepare_suite(cfg['suite'])
+ if 'host' in cfg.keys():
+ self.host_bound = True
+ host_cfg = cfg['host'][0]
self.vm_confs.pop('scene')
else:
vm_name = conf
@@ -94,6 +103,10 @@ class VirtScene(object):
self.prepare_devices(vm_conf)
self.prepare_vmdevice(vm_conf)
+ # dpdk should start after vf devices created
+ if host_cfg:
+ self.prepare_host(**host_cfg)
+
def cleanup_vm(self):
# reload config for has been changed when handle config
self.load_config()
@@ -104,23 +117,45 @@ class VirtScene(object):
self.cleanup_devices(vm_conf)
def prepare_suite(self, conf):
- if 'suite' in conf.keys():
- for param in conf['suite']:
- if 'dut' in param.keys():
- if param['dut'] == 'vm_dut':
- self.vm_dut_enable = True
- if 'type' in param.keys():
- if param['type'] == 'xen':
- self.vm_type = 'xen'
- # not implement yet
- if param['type'] == 'vmware':
- self.vm_type = 'vmware'
- # not implement yet
- if param['type'] == 'container':
- self.vm_type = 'container'
- if 'portmap' in param.keys():
- if param['portmap'] == 'cfg':
- self.auto_portmap = False
+ for param in conf:
+ if 'dut' in param.keys():
+ if param['dut'] == 'vm_dut':
+ self.vm_dut_enable = True
+ if 'type' in param.keys():
+ if param['type'] == 'xen':
+ self.vm_type = 'xen'
+ # not implement yet
+ if param['type'] == 'vmware':
+ self.vm_type = 'vmware'
+ # not implement yet
+ if param['type'] == 'container':
+ self.vm_type = 'container'
+ if 'portmap' in param.keys():
+ if param['portmap'] == 'cfg':
+ self.auto_portmap = False
+
+ def prepare_host(self, **opts):
+ if 'dpdk' not in opts.keys():
+ print dts.RED("Scenario host parameter request dpdk option!!!")
+ raise VirtConfigParamException('host')
+
+ if 'cores' not in opts.keys():
+ print dts.RED("Scenario host parameter request cores option!!!")
+ raise VirtConfigParamException('host')
+
+ if 'target' in opts.keys():
+ target = opts['target']
+ else:
+ target = self.def_target
+
+ self.host_dut.set_target(target, bind_dev=True)
+
+ if opts['dpdk'] == 'testpmd':
+ self.pmdout = PmdOutput(self.host_dut)
+ cores = opts['cores'].split()
+ out = self.pmdout.start_testpmd(cores)
+ if 'Error' in out:
+ raise VirtHostPrepareException()
def prepare_cpu(self, vm_name, conf):
cpu_param = {}
@@ -241,9 +276,10 @@ class VirtScene(object):
def reset_pf_cmds(self, port):
command = {}
command['type'] = 'host'
- intf = self.host_dut.ports_info[port]['intf']
- command['command'] = 'ifconfig %s up' % intf
- self.reg_postvm_cmds(command)
+ if not self.host_bound:
+ intf = self.host_dut.ports_info[port]['intf']
+ command['command'] = 'ifconfig %s up' % intf
+ self.reg_postvm_cmds(command)
def handle_dev_gen(self, **opts):
if 'pf_idx' in opts.keys():
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH 2/5] Add dpdk host virtualization scenario configuration file
2015-07-16 13:54 [dts] [PATCH 0/5] support virutal scenario that host drived by dpdk Yong Liu
2015-07-16 13:54 ` [dts] [PATCH 1/5] Support virtualization scenario that use dpdk as host PF driver Yong Liu
@ 2015-07-16 13:54 ` Yong Liu
2015-07-16 13:54 ` [dts] [PATCH 3/5] Add new exception type for dpdk host environment failure Yong Liu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Yong Liu @ 2015-07-16 13:54 UTC (permalink / raw)
To: dts
From: Marvin Liu <yong.liu@intel.com>
This configuration file defined one scenario that two host PF devices drived
by dpdk and 2 generated VF devices pass-throughed in VM. Host dpdk application
is testpmd and allocate first four cores for it.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/conf/scene/dpdk_vf_passthrough.cfg b/conf/scene/dpdk_vf_passthrough.cfg
new file mode 100644
index 0000000..2f3c008
--- /dev/null
+++ b/conf/scene/dpdk_vf_passthrough.cfg
@@ -0,0 +1,32 @@
+# vm configuration for host dpdk and vf passthrough cases
+# host application is testpmd and allocated lcore 0-3 for it
+# default target will be x86_64-native-linuxapp-gcc
+# numa 0,1,yes yes mean cpu numa match the first port
+# skipcores list mean those core will not used by vm
+# dut=vm_dut; mean vm_dut act as dut
+# dut=dut; mean host dut act as dut
+# portmap=cfg; mean vm_dut port map will be load from cfg
+# portmap=auto; mean vm_dut will create portmap automatically
+# devices = dev_gen/host/dev_gen+host not useful now
+[scene]
+suite =
+ dut=vm_dut,portmap=cfg;
+ tester=tester;
+ type=kvm;
+host =
+ dpdk=testpmd,cores=0 1 2 3,target=x86_64-native-linuxapp-gcc;
+[vm0]
+cpu =
+ model=host,number=4,numa=auto,skipcores=0 1 2 3;
+mem =
+ size=2048,hugepage=no;
+disk =
+ file=/storage/vm-image/vm0.img;
+dev_gen =
+ pf_idx=0,vf_num=1,driver=igb_uio;
+ pf_idx=1,vf_num=1,driver=igb_uio;
+device =
+ vf_idx=0,pf_dev=0,guestpci=auto;
+ vf_idx=0,pf_dev=1,guestpci=auto;
+vnc =
+ displayNum=1;
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH 3/5] Add new exception type for dpdk host environment failure
2015-07-16 13:54 [dts] [PATCH 0/5] support virutal scenario that host drived by dpdk Yong Liu
2015-07-16 13:54 ` [dts] [PATCH 1/5] Support virtualization scenario that use dpdk as host PF driver Yong Liu
2015-07-16 13:54 ` [dts] [PATCH 2/5] Add dpdk host virtualization scenario configuration file Yong Liu
@ 2015-07-16 13:54 ` Yong Liu
2015-07-16 13:54 ` [dts] [PATCH 4/5] Support start testpmd with assigned core list Yong Liu
2015-07-16 13:54 ` [dts] [PATCH 5/5] Skip setup host target when virtual scenario module has done it Yong Liu
4 siblings, 0 replies; 6+ messages in thread
From: Yong Liu @ 2015-07-16 13:54 UTC (permalink / raw)
To: dts
From: Marvin Liu <yong.liu@intel.com>
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/exception.py b/framework/exception.py
index facbeed..0e7a344 100644
--- a/framework/exception.py
+++ b/framework/exception.py
@@ -137,3 +137,6 @@ class VirtDeviceCreateException(Exception):
class VirtVmOperationException(Exception):
pass
+
+class VirtHostPrepareException(Exception):
+ pass
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH 4/5] Support start testpmd with assigned core list
2015-07-16 13:54 [dts] [PATCH 0/5] support virutal scenario that host drived by dpdk Yong Liu
` (2 preceding siblings ...)
2015-07-16 13:54 ` [dts] [PATCH 3/5] Add new exception type for dpdk host environment failure Yong Liu
@ 2015-07-16 13:54 ` Yong Liu
2015-07-16 13:54 ` [dts] [PATCH 5/5] Skip setup host target when virtual scenario module has done it Yong Liu
4 siblings, 0 replies; 6+ messages in thread
From: Yong Liu @ 2015-07-16 13:54 UTC (permalink / raw)
To: dts
From: Marvin Liu <yong.liu@intel.com>
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/pmd_output.py b/framework/pmd_output.py
index 4ccdd0d..23d4c0d 100644
--- a/framework/pmd_output.py
+++ b/framework/pmd_output.py
@@ -65,17 +65,16 @@ class PmdOutput():
return None
else:
return int(m.group(2))
-
+
def set_default_corelist(self):
"""
set default cores for start testpmd
- """
+ """
core_number = len(self.dut.cores)
if core_number < 2:
raise
else:
self.default_cores = "1S/2C/1T"
-
def get_pmd_stats(self, portid):
stats = {}
@@ -105,7 +104,9 @@ class PmdOutput():
if "--txqflags" not in param:
param += " --txqflags=0"
- if cores == "Default":
+ if type(cores) == list:
+ core_list = cores
+ elif cores == "Default":
core_list = self.dut.get_core_list(self.default_cores)
else:
core_list = self.dut.get_core_list(cores, socket)
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH 5/5] Skip setup host target when virtual scenario module has done it
2015-07-16 13:54 [dts] [PATCH 0/5] support virutal scenario that host drived by dpdk Yong Liu
` (3 preceding siblings ...)
2015-07-16 13:54 ` [dts] [PATCH 4/5] Support start testpmd with assigned core list Yong Liu
@ 2015-07-16 13:54 ` Yong Liu
4 siblings, 0 replies; 6+ messages in thread
From: Yong Liu @ 2015-07-16 13:54 UTC (permalink / raw)
To: dts
From: Marvin Liu <yong.liu@intel.com>
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/dts.py b/framework/dts.py
index 6e38cac..cc3744b 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -301,7 +301,9 @@ def dts_run_target(crbInst, targets, test_suites, nic, scenario):
try:
if scene:
scene.set_target(target)
- dut.set_target(target, bind_dev=False)
+ # skip set_target when host has been setup by scenario
+ if not scene.host_bound:
+ dut.set_target(target, bind_dev=False)
else:
dut.set_target(target)
except AssertionError as ex:
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread