A new boolean meson build flag is introduced with this patch: rte_debug. To enable this option add -Drte_debug=true to the meson configure command.
By enabling this flag the globaly defined macro RTE_DEBUG becomes defined. It should be used for enabling debug code in all dpdk project components. Using this flag allows to make additional checks or tests and provide additional logs even in performance sensitive parts of code. The flag is disabled by default. Additionally for all enabled to be built libraries a RTE_DEBUG_{library name} is defined and assigned a value 1. This standardize names of library specific debug macros. Those can be used also without rte_debug option by using CFLAGS="-D..." build parameter. Code put inside RTE_DEBUG* #ifdef sections should be also put inside if (rte_log_can_log(...)) condition to allow run-time filtering of sanity checks, validations, logs and dumps when using rte_debug option. Libraries will be adjusted to the change in separate patches. Similarly for all enabled to be built drivers a RTE_DEBUG_{driver_class}_{driver_name} is defined and assigned value 1. Suggested-by: Bruce Richardson <bruce.richard...@intel.com> Signed-off-by: Lukasz Wojciechowski <l.wojciec...@partner.samsung.com> --- config/meson.build | 4 ++++ drivers/baseband/meson.build | 1 + drivers/bus/meson.build | 1 + drivers/common/meson.build | 1 + drivers/compress/meson.build | 1 + drivers/crypto/meson.build | 1 + drivers/event/meson.build | 1 + drivers/mempool/meson.build | 1 + drivers/meson.build | 3 +++ drivers/net/meson.build | 1 + drivers/raw/meson.build | 1 + drivers/vdpa/meson.build | 1 + lib/meson.build | 4 ++++ meson_options.txt | 2 ++ 14 files changed, 23 insertions(+) diff --git a/config/meson.build b/config/meson.build index cff8b33dd..c65c6412a 100644 --- a/config/meson.build +++ b/config/meson.build @@ -179,6 +179,10 @@ endif # add -include rte_config to cflags add_project_arguments('-include', 'rte_config.h', language: 'c') +if get_option('rte_debug') + dpdk_conf.set('RTE_DEBUG', 1) +endif + # enable extra warnings and disable any unwanted warnings warning_flags = [ # -Wall is added by meson by default, so add -Wextra only diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build index 415b6724b..11ff30e5a 100644 --- a/drivers/baseband/meson.build +++ b/drivers/baseband/meson.build @@ -9,3 +9,4 @@ drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec'] config_flag_fmt = 'RTE_LIBRTE_PMD_BBDEV_@0@' driver_name_fmt = 'rte_pmd_bbdev_@0@' +rte_debug_fmt = 'RTE_DEBUG_BASEBAND_@0@' diff --git a/drivers/bus/meson.build b/drivers/bus/meson.build index 80de2d91d..8ccbce75b 100644 --- a/drivers/bus/meson.build +++ b/drivers/bus/meson.build @@ -5,3 +5,4 @@ drivers = ['dpaa', 'fslmc', 'ifpga', 'pci', 'vdev', 'vmbus'] std_deps = ['eal'] config_flag_fmt = 'RTE_LIBRTE_@0@_BUS' driver_name_fmt = 'rte_bus_@0@' +rte_debug_fmt = 'RTE_DEBUG_BUS_@0@' diff --git a/drivers/common/meson.build b/drivers/common/meson.build index 5db7e29b1..a72f14905 100644 --- a/drivers/common/meson.build +++ b/drivers/common/meson.build @@ -9,3 +9,4 @@ std_deps = ['eal'] drivers = ['cpt', 'dpaax', 'iavf', 'mlx5', 'mvep', 'octeontx', 'octeontx2', 'qat'] config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON' driver_name_fmt = 'rte_common_@0@' +rte_debug_fmt = 'RTE_DEBUG_COMMON_@0@' diff --git a/drivers/compress/meson.build b/drivers/compress/meson.build index ee883c3f9..b446bd988 100644 --- a/drivers/compress/meson.build +++ b/drivers/compress/meson.build @@ -10,3 +10,4 @@ drivers = ['isal', 'octeontx', 'qat', 'zlib'] std_deps = ['compressdev'] # compressdev pulls in all other needed deps config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' driver_name_fmt = 'rte_pmd_@0@' +rte_debug_fmt = 'RTE_DEBUG_COMPRESS_@0@' diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build index a2423507a..02c2c8752 100644 --- a/drivers/crypto/meson.build +++ b/drivers/crypto/meson.build @@ -28,3 +28,4 @@ drivers = ['aesni_gcm', std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' driver_name_fmt = 'rte_pmd_@0@' +rte_debug_fmt = 'RTE_DEBUG_CRYPTO_@0@' diff --git a/drivers/event/meson.build b/drivers/event/meson.build index ebe76a75c..3e3c221c3 100644 --- a/drivers/event/meson.build +++ b/drivers/event/meson.build @@ -13,3 +13,4 @@ endif std_deps = ['eventdev', 'kvargs'] config_flag_fmt = 'RTE_LIBRTE_@0@_EVENTDEV_PMD' driver_name_fmt = 'rte_pmd_@0@_event' +rte_debug_fmt = 'RTE_DEBUG_EVENT_@0@' diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build index c9609f145..ada93a75a 100644 --- a/drivers/mempool/meson.build +++ b/drivers/mempool/meson.build @@ -9,3 +9,4 @@ drivers = ['bucket', 'dpaa', 'dpaa2', 'octeontx', 'octeontx2', 'ring', 'stack'] std_deps = ['mempool'] config_flag_fmt = 'RTE_LIBRTE_@0@_MEMPOOL' driver_name_fmt = 'rte_mempool_@0@' +rte_debug_fmt = 'RTE_DEBUG_MEMPOOL_@0@' diff --git a/drivers/meson.build b/drivers/meson.build index 161cfda04..975e1774b 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -99,6 +99,9 @@ foreach class:dpdk_driver_classes fmt_name = name endif dpdk_conf.set(config_flag_fmt.format(fmt_name.to_upper()),1) + if get_option('rte_debug') + dpdk_conf.set(rte_debug_fmt.format(fmt_name.to_upper()),1) + endif lib_name = driver_name_fmt.format(fmt_name) dpdk_extra_ldflags += pkgconfig_extra_libs diff --git a/drivers/net/meson.build b/drivers/net/meson.build index d56b24051..0b4037b5f 100644 --- a/drivers/net/meson.build +++ b/drivers/net/meson.build @@ -60,3 +60,4 @@ std_deps += ['bus_pci'] # very many PMDs depend on PCI, so make std std_deps += ['bus_vdev'] # same with vdev bus config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' driver_name_fmt = 'rte_pmd_@0@' +rte_debug_fmt = 'RTE_DEBUG_NET_@0@' diff --git a/drivers/raw/meson.build b/drivers/raw/meson.build index 2c1e65ec7..703c2b8a8 100644 --- a/drivers/raw/meson.build +++ b/drivers/raw/meson.build @@ -13,3 +13,4 @@ drivers = ['dpaa2_cmdif', 'dpaa2_qdma', std_deps = ['rawdev'] config_flag_fmt = 'RTE_LIBRTE_PMD_@0@_RAWDEV' driver_name_fmt = 'rte_rawdev_@0@' +rte_debug_fmt = 'RTE_DEBUG_RAW_@0@' diff --git a/drivers/vdpa/meson.build b/drivers/vdpa/meson.build index 798eb3830..7e86a0c49 100644 --- a/drivers/vdpa/meson.build +++ b/drivers/vdpa/meson.build @@ -11,3 +11,4 @@ std_deps = ['bus_pci', 'kvargs'] std_deps += ['vhost'] config_flag_fmt = 'RTE_LIBRTE_@0@_PMD' driver_name_fmt = 'rte_pmd_@0@' +rte_debug_fmt = 'RTE_DEBUG_VDPA_@0@' diff --git a/lib/meson.build b/lib/meson.build index 3852c0156..a06099a15 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -99,6 +99,10 @@ foreach l:libraries dpdk_conf.set('RTE_LIBRTE_' + name.to_upper(), 1) install_headers(headers) + if get_option('rte_debug') + dpdk_conf.set('RTE_DEBUG_' + name.to_upper(), 1) + endif + libname = 'rte_' + name includes += include_directories(dir_name) diff --git a/meson_options.txt b/meson_options.txt index 9bf18ab6b..fc0fedd69 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -32,6 +32,8 @@ option('max_numa_nodes', type: 'integer', value: 4, description: 'maximum number of NUMA nodes supported by EAL') option('enable_trace_fp', type: 'boolean', value: false, description: 'enable fast path trace points.') +option('rte_debug', type: 'boolean', value: false, + description: 'build with additional sanity checks, validations and logs') option('tests', type: 'boolean', value: true, description: 'build unit tests') option('use_hpet', type: 'boolean', value: false, -- 2.17.1