* [dts] [PATCH V1 2/5] framework/dts:add parameters parse for shared library
2020-01-15 9:12 [dts] [PATCH V1 1/5] framework/settings:add two global variable for shared library Haiyang Zhao
@ 2020-01-15 9:12 ` Haiyang Zhao
2020-01-15 9:12 ` [dts] [PATCH V1 3/5] framework/dut:add -d parameters in create_eal_parameters when use shared mode Haiyang Zhao
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Haiyang Zhao @ 2020-01-15 9:12 UTC (permalink / raw)
To: dts; +Cc: zhaoyan.chen, Haiyang Zhao
*.save shared lib parameters into settings.
Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
framework/dts.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/framework/dts.py b/framework/dts.py
index 634a569..26836a9 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -79,6 +79,14 @@ def dts_parse_param(config, section):
performance = False
functional = False
# Set parameters
+ shared_lib_parameters = ''
+ try:
+ shared_lib_parameters = config.get(section, 'shared_lib_param')
+ except Exception as e:
+ log_handler.info("{}".format(e))
+ shared_lib_parameters = ''
+ shared_lib_parameters = shared_lib_parameters.split(':')
+
parameters = config.get(section, 'parameters').split(':')
drivername = config.get(section, 'drivername').split('=')[-1]
@@ -92,6 +100,21 @@ def dts_parse_param(config, section):
settings.save_global_setting(settings.HOST_DRIVER_SETTING, drivername)
+ shared_lib_paramDict = dict()
+ for param in shared_lib_parameters:
+ (key, _, value) = param.partition('=')
+ shared_lib_paramDict[key] = value
+ if 'use_shared_lib' in shared_lib_paramDict and shared_lib_paramDict['use_shared_lib'].lower() == 'true':
+ settings.save_global_setting(settings.HOST_SHARED_LIB_SETTING, 'true')
+ else:
+ settings.save_global_setting(settings.HOST_SHARED_LIB_SETTING, 'false')
+
+ if 'shared_lib_path' in shared_lib_paramDict:
+ if not shared_lib_paramDict['shared_lib_path'] \
+ and settings.load_global_setting(settings.HOST_SHARED_LIB_SETTING):
+ raise ValueError("use shared lib but shared lib path is empty")
+ settings.save_global_setting(settings.HOST_SHARED_LIB_PATH, shared_lib_paramDict['shared_lib_path'])
+
paramDict = dict()
for param in parameters:
(key, _, value) = param.partition('=')
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH V1 3/5] framework/dut:add -d parameters in create_eal_parameters when use shared mode
2020-01-15 9:12 [dts] [PATCH V1 1/5] framework/settings:add two global variable for shared library Haiyang Zhao
2020-01-15 9:12 ` [dts] [PATCH V1 2/5] framework/dts:add parameters parse " Haiyang Zhao
@ 2020-01-15 9:12 ` Haiyang Zhao
2020-01-15 9:12 ` [dts] [PATCH V1 4/5] framework/project_dpdk:set shared lib in config/common_base " Haiyang Zhao
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Haiyang Zhao @ 2020-01-15 9:12 UTC (permalink / raw)
To: dts; +Cc: zhaoyan.chen, Haiyang Zhao
*.add -d parameters in create_eal_parameters.
*.fix pep8 issues.
*.when out returned by self.tester.send_ping is None,
the judgement statement will cause an exception, fixed it.
Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
framework/dut.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/framework/dut.py b/framework/dut.py
index 5409b93..60745e6 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -190,7 +190,7 @@ class Dut(Crb):
+ blank + b_ports_str \
+ blank + no_pci \
+ blank + vdev
- self.prefix_list = []
+ self.prefix_list = []
else:
eal_str = '-l ' + ','.join(map(str, core_list)) \
+ blank + '-n %d' % self.get_memory_channels() \
@@ -215,12 +215,16 @@ class Dut(Crb):
eal_str = '-l ' + ','.join(map(str, core_list)) \
+ blank + '-n %d' % self.get_memory_channels() \
+ blank + pci_str
- self.prefix_list = []
+ self.prefix_list = []
else:
eal_str = '-l ' + ','.join(map(str, core_list)) \
+ blank + '-n %d' % self.get_memory_channels() \
+ blank + pci_str \
+ blank + '--file-prefix=' + file_prefix
+ use_shared_lib = settings.load_global_setting(settings.HOST_SHARED_LIB_SETTING)
+ shared_lib_path = settings.load_global_setting(settings.HOST_SHARED_LIB_PATH)
+ if use_shared_lib == 'true' and shared_lib_path and 'Virt' not in str(self):
+ eal_str = eal_str + ' -d {}'.format(shared_lib_path)
return eal_str
@@ -1185,7 +1189,7 @@ class Dut(Crb):
out = self.tester.send_ping6(
remotePort, ipv6, self.get_mac_address(dutPort))
- if ('64 bytes from' in out):
+ if out and '64 bytes from' in out:
self.logger.info("PORT MAP: [dut %d: tester %d]" % (dutPort, remotePort))
self.ports_map[dutPort] = remotePort
hits[remotePort] = True
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH V1 4/5] framework/project_dpdk:set shared lib in config/common_base when use shared mode
2020-01-15 9:12 [dts] [PATCH V1 1/5] framework/settings:add two global variable for shared library Haiyang Zhao
2020-01-15 9:12 ` [dts] [PATCH V1 2/5] framework/dts:add parameters parse " Haiyang Zhao
2020-01-15 9:12 ` [dts] [PATCH V1 3/5] framework/dut:add -d parameters in create_eal_parameters when use shared mode Haiyang Zhao
@ 2020-01-15 9:12 ` Haiyang Zhao
2020-01-15 9:12 ` [dts] [PATCH V1 5/5] framework/virt_dut:optimize code Haiyang Zhao
2020-01-16 6:02 ` [dts] [PATCH V1 1/5] framework/settings:add two global variable for shared library Tu, Lijuan
4 siblings, 0 replies; 6+ messages in thread
From: Haiyang Zhao @ 2020-01-15 9:12 UTC (permalink / raw)
To: dts; +Cc: zhaoyan.chen, Haiyang Zhao
*.when need to commpile DPDK with shared lib mode,
set it in config/common_base, only for host dut.
Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
framework/project_dpdk.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index 7ec3aad..7030abb 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -34,6 +34,7 @@ import re
from settings import NICS, load_global_setting, accepted_nic
from settings import DPDK_RXMODE_SETTING, HOST_DRIVER_SETTING, HOST_DRIVER_MODE_SETTING
+from settings import HOST_SHARED_LIB_SETTING, HOST_SHARED_LIB_PATH
from ssh_connection import SSHConnection
from crb import Crb
from dut import Dut
@@ -207,6 +208,11 @@ class DPDKdut(Dut):
"""
Build DPDK source code with specified target.
"""
+ use_shared_lib = load_global_setting(HOST_SHARED_LIB_SETTING)
+ shared_lib_path = load_global_setting(HOST_SHARED_LIB_PATH)
+ if use_shared_lib == 'true' and 'Virt' not in str(self):
+ self.send_expect("sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g' "
+ "config/common_base", '#')
build_install_dpdk = getattr(self, 'build_install_dpdk_%s' % self.get_os_type())
build_install_dpdk(target, extra_options)
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH V1 5/5] framework/virt_dut:optimize code
2020-01-15 9:12 [dts] [PATCH V1 1/5] framework/settings:add two global variable for shared library Haiyang Zhao
` (2 preceding siblings ...)
2020-01-15 9:12 ` [dts] [PATCH V1 4/5] framework/project_dpdk:set shared lib in config/common_base " Haiyang Zhao
@ 2020-01-15 9:12 ` Haiyang Zhao
2020-01-16 6:02 ` [dts] [PATCH V1 1/5] framework/settings:add two global variable for shared library Tu, Lijuan
4 siblings, 0 replies; 6+ messages in thread
From: Haiyang Zhao @ 2020-01-15 9:12 UTC (permalink / raw)
To: dts; +Cc: zhaoyan.chen, Haiyang Zhao
*.when out returned by self.tester.send_ping6 is None,
it will raise an exception, and cause VM init failed, fixed it.
*.fix pep8 issue.
Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
---
framework/virt_dut.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index a916b72..ebd48d8 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -411,7 +411,7 @@ class VirtDut(DPDKdut):
out = self.tester.send_ping6(
remotePort, ipv6, self.get_mac_address(vmPort))
- if ('64 bytes from' in out):
+ if out and '64 bytes from' in out:
self.logger.info(
"PORT MAP: [dut %d: tester %d]" % (vmPort, remotePort))
self.ports_map[vmPort] = remotePort
--
1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dts] [PATCH V1 1/5] framework/settings:add two global variable for shared library
2020-01-15 9:12 [dts] [PATCH V1 1/5] framework/settings:add two global variable for shared library Haiyang Zhao
` (3 preceding siblings ...)
2020-01-15 9:12 ` [dts] [PATCH V1 5/5] framework/virt_dut:optimize code Haiyang Zhao
@ 2020-01-16 6:02 ` Tu, Lijuan
4 siblings, 0 replies; 6+ messages in thread
From: Tu, Lijuan @ 2020-01-16 6:02 UTC (permalink / raw)
To: Zhao, HaiyangX, dts; +Cc: Chen, Zhaoyan, Zhao, HaiyangX
Applied the series
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Haiyang Zhao
> Sent: Wednesday, January 15, 2020 5:12 PM
> To: dts@dpdk.org
> Cc: Chen, Zhaoyan <zhaoyan.chen@intel.com>; Zhao, HaiyangX
> <haiyangx.zhao@intel.com>
> Subject: [dts] [PATCH V1 1/5] framework/settings:add two global variable for
> shared library
>
> Signed-off-by: Haiyang Zhao <haiyangx.zhao@intel.com>
> ---
> framework/settings.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/framework/settings.py b/framework/settings.py index
> 7e8944e..fe430fd 100644
> --- a/framework/settings.py
> +++ b/framework/settings.py
> @@ -242,6 +242,8 @@ FUNC_SETTING = "DTS_FUNC_ONLY"
> HOST_DRIVER_SETTING = "DTS_HOST_DRIVER"
> HOST_DRIVER_MODE_SETTING = "DTS_HOST_DRIVER_MODE"
> HOST_NIC_SETTING = "DTS_HOST_NIC"
> +HOST_SHARED_LIB_SETTING = "DTS_HOST_SHARED_LIB"
> +HOST_SHARED_LIB_PATH = "DTS_HOST_SHARED_LIB_PATH"
> DEBUG_SETTING = "DTS_DEBUG_ENABLE"
> DEBUG_CASE_SETTING = "DTS_DEBUGCASE_ENABLE"
> DPDK_RXMODE_SETTING = "DTS_DPDK_RXMODE"
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 6+ messages in thread