From: LihongX Ma <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: LihongX Ma <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1] framework: modify the method of set options of dpdk
Date: Tue, 3 Nov 2020 07:54:18 +0800 [thread overview]
Message-ID: <1604361258-24750-1-git-send-email-lihongx.ma@intel.com> (raw)
- As now many options can not been setted by meson build parameter, so
modify the config file directly to change it
- add api to modify the config file of makefile
Signed-off-by: LihongX Ma <lihongx.ma@intel.com>
---
framework/project_dpdk.py | 89 ++++++++++++++++++++++-------------------------
framework/virt_dut.py | 1 -
2 files changed, 41 insertions(+), 49 deletions(-)
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index d45ce47..6e17d59 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -65,7 +65,6 @@ class DPDKdut(Dut):
self.build_type = load_global_setting(HOST_BUILD_TYPE_SETTING)
if self.build_type not in self.apps_name_conf:
raise Exception('please config the apps name in app_name.cfg of build type:%s' % self.build_type)
- self.config_build_options = {}
self.target = target
self.set_toolchain(target)
@@ -194,26 +193,12 @@ class DPDKdut(Dut):
mode = load_global_setting(DPDK_RXMODE_SETTING)
if mode == 'scalar':
- self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=.*$/"
- + "CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=n/' config/common_base", "# ", 30)
- self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=.*$/"
- + "CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=y/' config/common_base", "# ", 30)
self.set_build_options({'RTE_LIBRTE_I40E_INC_VECTOR': 'n',
'RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC': 'y'})
if mode == 'full':
- self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=.*$/"
- + "CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=n/' config/common_base", "# ", 30)
- self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=.*$/"
- + "CONFIG_RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC=n/' config/common_base", "# ", 30)
self.set_build_options({'RTE_LIBRTE_I40E_INC_VECTOR': 'n',
'RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC': 'n'})
if mode == 'novector':
- self.send_expect("sed -i -e 's/CONFIG_RTE_IXGBE_INC_VECTOR=.*$/"
- + "CONFIG_RTE_IXGBE_INC_VECTOR=n/' config/common_base", "# ", 30)
- self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=.*$/"
- + "CONFIG_RTE_LIBRTE_I40E_INC_VECTOR=n/' config/common_base", "# ", 30)
- self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR=.*$/"
- + "CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR=n/' config/common_base", "# ", 30)
self.set_build_options({'RTE_IXGBE_INC_VECTOR': 'n',
'RTE_LIBRTE_I40E_INC_VECTOR': 'n',
'RTE_LIBRTE_FM10K_INC_VECTOR': 'n'})
@@ -223,43 +208,55 @@ class DPDKdut(Dut):
self.patches = patch_list
def set_build_options(self, config_parms, config_file=''):
+ build_type = load_global_setting(HOST_BUILD_TYPE_SETTING)
+ set_build_options = getattr(self, 'set_build_options_%s' % (build_type))
+ set_build_options(config_parms, config_file)
+
+ def set_build_options_makefile(self, config_parms, config_file=''):
"""
- Set dpdk build options of meson
+ Set dpdk build options of makefile
"""
if len(config_parms) == 0:
- return options
+ return;
+ if config_file == '':
+ config_file = 'config/common_base'
+
for key in config_parms.keys():
value = config_parms[key]
- if value == '' or value == 'y':
- value = 1
+ if isinstance(value, int):
+ self.send_expect("sed -i -e 's/CONFIG_%s=.*$/CONFIG_%s=%d/' %s" % (key, key, value, config_file), "# ")
else:
- # does not need to set the configuration if the value is, mean do not define it
- if type(value) == str and value != 'n':
- value = '\\"%s\\"' % config_parms[key]
+ if value == '':
+ value = 'y'
+ elif len(value) > 1:
+ value = '\\"%s\\"' % value
+ self.send_expect("sed -i -e 's/CONFIG_%s=.*$/CONFIG_%s=%s/' %s" % (key, key, value, config_file), "# ")
- self.config_build_options[key] = value
-
- def generator_build_option_string(self):
+ def set_build_options_meson(self, config_parms, config_file=''):
"""
- Generator the build option string according to self.config_build_options dictionary
+ Set dpdk build options of meson
"""
- params = []
- for key in self.config_build_options.keys():
- value = self.config_build_options[key]
+ if len(config_parms) == 0:
+ return
+ if config_file == '':
+ config_file = 'config/rte_config.h'
+
+ for key in config_parms.keys():
+ value = config_parms[key]
if value == 'n':
- continue
+ def_str = '#undef' + ' ' + key
else:
- params.append('-D%s=%s' % (key, value))
+ if isinstance(value, int):
+ def_str = '#define %s %d' % (key, value)
+ elif value == '' or value == 'y':
+ def_str = '#define %s %d' % (key, 1)
+ else:
+ value = '\\"%s\\"' % value
+ def_str = '#define %s %s' % (key, value)
- if len(params) == 0:
- return ''
- else:
- # if will compile 32bit app, should add the parameter of -m32
- if 'i686' in self.target:
- args = '-Dc_args=' + '\'-m32 %s\'' % ' '.join(params)
- else:
- args = '-Dc_args=' + '\'%s\'' % ' '.join(params)
- return args
+ # delete the marco define in the config file
+ self.send_expect("sed -i '/%s/d' %s" % (key, config_file), "# ")
+ self.send_expect("sed -i '$a\%s' %s" % (def_str, config_file), "# ")
def build_install_dpdk(self, target, extra_options=''):
"""
@@ -268,11 +265,7 @@ class DPDKdut(Dut):
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", '#')
self.set_build_options({'RTE_BUILD_SHARED_LIB': 'y'})
- self.send_expect("sed -i 's/CONFIG_RTE_EAL_IGB_UIO=n/CONFIG_RTE_EAL_IGB_UIO=y/g' "
- "config/common_base", '#')
build_type = load_global_setting(HOST_BUILD_TYPE_SETTING)
build_install_dpdk = getattr(self, 'build_install_dpdk_%s_%s' % (self.get_os_type(), build_type))
build_install_dpdk(target, extra_options)
@@ -308,11 +301,9 @@ class DPDKdut(Dut):
self.send_expect("export CFLAGS=-m32", "# ")
self.send_expect("export PKG_CONFIG_LIBDIR=%s" % pkg_path, "# ")
- options_config = self.generator_build_option_string()
-
self.send_expect("rm -rf " + target, "#")
- out = self.send_expect("CC=%s meson --werror -Denable_kmods=True %s -Dlibdir=lib %s --default-library=%s %s" % (
- toolchain, extra_options, options_config, default_library, target), "# ", build_time)
+ out = self.send_expect("CC=%s meson --werror -Denable_kmods=True -Dlibdir=lib %s --default-library=%s %s" % (
+ toolchain, extra_options, default_library, target), "# ", build_time)
assert ("FAILED" not in out), "meson setup failed ..."
out = self.send_expect("ninja -C %s -j %d" % (target, self.number_of_cores), "# ", build_time)
@@ -339,6 +330,8 @@ class DPDKdut(Dut):
self.send_expect("rm -rf %s" % r'./app/test/test_resource_tar.res.o' , "#")
self.send_expect("rm -rf %s" % r'./app/test/test_pci_sysfs.res.o' , "#")
+ self.set_build_options({'RTE_EAL_IGB_UIO': 'y'})
+
# compile
out = self.send_expect("make -j %d install T=%s %s MAKE_PAUSE=n" %
(self.number_of_cores, target, extra_options), "# ", build_time)
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index b6078e1..03569ba 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -231,7 +231,6 @@ class VirtDut(DPDKdut):
for app in self.apps_name:
cur_app_path = self.apps_name[app].replace('target', self.target)
self.apps_name[app] = cur_app_path + ' '
- self.config_build_options = {}
def init_core_list(self):
self.cores = []
--
2.7.4
next reply other threads:[~2020-11-03 7:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 23:54 LihongX Ma [this message]
2020-11-03 8:30 ` Zhou, JunX W
2020-11-06 3:10 ` Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1604361258-24750-1-git-send-email-lihongx.ma@intel.com \
--to=lihongx.ma@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).