* [dts] [PATCH v1 1/3] framework/project_dpdk: add new arguments in setup_modules function
@ 2018-03-07 17:06 Marvin Liu
2018-03-07 17:06 ` [dts] [PATCH v1 2/3] framework/virt_base: add default kernel driver option Marvin Liu
2018-03-07 17:06 ` [dts] [PATCH v1 3/3] framework/virt_dut: setup configured kernel module Marvin Liu
0 siblings, 2 replies; 3+ messages in thread
From: Marvin Liu @ 2018-03-07 17:06 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Add driver name and driver mode arguments in setup_modules function.
For DUT, these two agruments should be stripped from execution file.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index 40c862a..f87fd13 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -79,21 +79,23 @@ class DPDKdut(Dut):
self.build_install_dpdk(target)
self.setup_memory()
- self.setup_modules(target)
+
+ drivername = load_global_setting(HOST_DRIVER_SETTING)
+ drivermode = load_global_setting(HOST_DRIVER_MODE_SETTING)
+ self.setup_modules(target, drivername, drivermode)
if bind_dev and self.get_os_type() == 'linux':
self.bind_interfaces_linux(drivername)
self.extra_nic_setup()
- def setup_modules(self, target):
+ def setup_modules(self, target, drivername, drivermode):
"""
Install DPDK required kernel module on DUT.
"""
setup_modules = getattr(self, 'setup_modules_%s' % self.get_os_type())
- setup_modules(target)
+ setup_modules(target, drivername, drivermode)
- def setup_modules_linux(self, target):
- drivername = load_global_setting(HOST_DRIVER_SETTING)
+ def setup_modules_linux(self, target, drivername, drivermode):
if drivername == "vfio-pci":
self.send_expect("rmmod vfio_pci", "#", 70)
self.send_expect("rmmod vfio_iommu_type1", "#", 70)
@@ -103,7 +105,6 @@ class DPDKdut(Dut):
out = self.send_expect("lsmod | grep vfio_iommu_type1", "#")
assert ("vfio_iommu_type1" in out), "Failed to setup vfio-pci"
- drivermode = load_global_setting(HOST_DRIVER_MODE_SETTING)
if drivermode == "noiommu":
self.send_expect("echo 1 > /sys/module/vfio/parameters/enable_unsafe_noiommu_mode", "#", 70)
@@ -113,7 +114,7 @@ class DPDKdut(Dut):
out = self.send_expect("lsmod | grep uio_pci_generic", "#")
assert ("uio_pci_generic" in out), "Failed to setup uio_pci_generic"
- else:
+ elif drivername == "igb_uio":
self.send_expect("modprobe uio", "#", 70)
out = self.send_expect("lsmod | grep igb_uio", "#")
if "igb_uio" in out:
@@ -123,7 +124,7 @@ class DPDKdut(Dut):
out = self.send_expect("lsmod | grep igb_uio", "#")
assert ("igb_uio" in out), "Failed to insmod igb_uio"
- def setup_modules_freebsd(self, target):
+ def setup_modules_freebsd(self, target, drivername, drivermode):
"""
Install DPDK required Freebsd kernel module on DUT.
"""
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts] [PATCH v1 2/3] framework/virt_base: add default kernel driver option
2018-03-07 17:06 [dts] [PATCH v1 1/3] framework/project_dpdk: add new arguments in setup_modules function Marvin Liu
@ 2018-03-07 17:06 ` Marvin Liu
2018-03-07 17:06 ` [dts] [PATCH v1 3/3] framework/virt_dut: setup configured kernel module Marvin Liu
1 sibling, 0 replies; 3+ messages in thread
From: Marvin Liu @ 2018-03-07 17:06 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
If default driver is configured for VM, it will be setup when
initializing VM. Default kernel driver is DPDK igb_uio, suite owner can
change the default setting in VM local configuration file.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/conf/virt_global.cfg b/conf/virt_global.cfg
index 58ca061..e47c6f3 100644
--- a/conf/virt_global.cfg
+++ b/conf/virt_global.cfg
@@ -24,6 +24,8 @@ cpu =
number=4,cpupin=3 4 5 6;
mem =
size=2048;
+def_driver =
+ driver_name=igb_uio;
[KVM]
cpu =
model=host,number=4,cpupin=3 4 5 6;
@@ -35,6 +37,8 @@ control =
type=qga;
vnc =
disable=False;
+def_driver =
+ driver_name=igb_uio;
[XEN]
cpu =
number=4,cpupin=3 4 5 6;
@@ -42,3 +46,5 @@ mem =
size=2048;
vif =
mac=random,bridge=br0
+def_driver =
+ driver_name=igb_uio;
diff --git a/framework/virt_base.py b/framework/virt_base.py
index b26a25a..fd2faeb 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -92,6 +92,10 @@ class VirtBase(object):
# vm status is running by default, only be changed in internal module
self.vm_status = ST_RUNNING
+ # by default no special kernel module is required
+ self.def_driver = ''
+ self.driver_mode = ''
+
def get_virt_type(self):
"""
Get the virtual type, such as KVM, XEN or LIBVIRT.
@@ -184,6 +188,15 @@ class VirtBase(object):
self.host_logger.error(traceback.print_exception(*sys.exc_info()))
raise exception.VirtConfigParamException(key)
+ def add_vm_def_driver(self, **options):
+ """
+ Set default driver which may required when setup VM
+ """
+ if 'driver_name' in options.keys():
+ self.def_driver = options['driver_name']
+ if 'driver_mode' in options.keys():
+ self.driver_mode = options['driver_mode']
+
def find_option_index(self, option):
"""
Find the boot option in the params which is generated from
@@ -423,7 +436,7 @@ class VirtBase(object):
vm_dut.prerequisites(self.host_dut.package, self.host_dut.patches, autodetect_topo)
if set_target:
target = self.host_dut.target
- vm_dut.set_target(target, bind_dev)
+ vm_dut.set_target(target, bind_dev, self.def_driver, self.driver_mode)
except:
raise exception.VirtDutInitException(vm_dut)
return None
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts] [PATCH v1 3/3] framework/virt_dut: setup configured kernel module
2018-03-07 17:06 [dts] [PATCH v1 1/3] framework/project_dpdk: add new arguments in setup_modules function Marvin Liu
2018-03-07 17:06 ` [dts] [PATCH v1 2/3] framework/virt_base: add default kernel driver option Marvin Liu
@ 2018-03-07 17:06 ` Marvin Liu
1 sibling, 0 replies; 3+ messages in thread
From: Marvin Liu @ 2018-03-07 17:06 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
When initializing virtual dut, configured kernel module should be
insmod. Module name and related parameter should be loaded from VM
configuration.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index 62688dc..cd89cb5 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -132,7 +132,7 @@ class VirtDut(DPDKdut):
pci_idx = self.tester.get_local_index(tester_pci)
self.ports_map[index] = pci_idx
- def set_target(self, target, bind_dev=True):
+ def set_target(self, target, bind_dev=True, driver_name="", driver_mode=""):
"""
Set env variable, these have to be setup all the time. Some tests
need to compile example apps by themselves and will fail otherwise.
@@ -150,10 +150,11 @@ class VirtDut(DPDKdut):
self.build_install_dpdk(target)
self.setup_memory(hugepages=1024)
- self.setup_modules(target)
+
+ self.setup_modules(target, driver_name, driver_mode)
if bind_dev:
- self.bind_interfaces_linux('igb_uio')
+ self.bind_interfaces_linux(driver_name)
def prerequisites(self, pkgName, patch, autodetect_topo):
"""
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-07 9:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 17:06 [dts] [PATCH v1 1/3] framework/project_dpdk: add new arguments in setup_modules function Marvin Liu
2018-03-07 17:06 ` [dts] [PATCH v1 2/3] framework/virt_base: add default kernel driver option Marvin Liu
2018-03-07 17:06 ` [dts] [PATCH v1 3/3] framework/virt_dut: setup configured kernel module Marvin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).