Add a stricter headers check
Subsystems (5)
cover Add a stricter headers check
As explained in patch 6, the current headers check can not catch issues when a public header includes an internal header. Fixing this from meson does not seem an easy task.
The approach of this RFC is to reimplement the check in a Makefile invoked out of DPDK (like what is done for external compilation of examples). This has the advantage of being simple, and avoiding any (non intentional) implicit include path coming from the meson framework.
As there was no easy way to distinguish "indirect" headers in an installed DPDK, I chose to move those headers in a new sub directory (patch 5).
Patch 1-4 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling enable_driver_sdk option).
For now, I left the check_includes= option untouched, as there may be users of this check and this check still catches issues without requiring to install DPDK.
Signature · 38 lines
David Marchand David Marchand (6): baseband/acc: fix exported header drivers: drop export of driver headers eventdev: do not include driver header in DMA adapter drivers: fix exported headers build: install indirect headers to a dedicated directory buildtools: externally check exported headers .ci/linux-build.sh | 7 +- buildtools/chkincs/Makefile | 77 +++++++++++++++++++ buildtools/pkg-config/meson.build | 8 +- devtools/test-meson-builds.sh | 6 +- drivers/baseband/acc/meson.build | 2 +- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 4 + drivers/net/dpaa/rte_pmd_dpaa.h | 2 + drivers/net/iavf/rte_pmd_iavf.h | 6 ++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 + drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 16 ++++ drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h | 3 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 + drivers/raw/ntb/rte_pmd_ntb.h | 2 + lib/bbdev/meson.build | 5 +- lib/eal/x86/include/meson.build | 3 +- lib/ethdev/meson.build | 6 +- lib/eventdev/rte_event_dma_adapter.h | 2 +- lib/meson.build | 2 +- lib/mldev/meson.build | 5 +- lib/rawdev/meson.build | 3 +- lib/regexdev/meson.build | 3 +- lib/security/meson.build | 3 +- 23 files changed, 153 insertions(+), 23 deletions(-) create mode 100644 buildtools/chkincs/Makefile -- 2.47.0
RFC 1/6 baseband/acc: fix exported header
rte_acc_cfg.h relies on rte_acc_common_cfg.h.
--- drivers/baseband/acc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/baseband/acc/meson.build +1 -1
@@ -26,4 +26,4 @@ deps += ['bus_pci'] sources = files('acc_common.c', 'rte_acc100_pmd.c', 'rte_vrb_pmd.c') -headers = files('rte_acc_cfg.h') +headers = files('rte_acc_cfg.h', 'rte_acc_common_cfg.h')
Signature · 1 line
2.47.0
RFC 2/6 drivers: drop export of driver headers
In reply to David MarchandMany classes are exposing driver only headers as public headers. Move them to the driver_sdk_headers list.
--- lib/bbdev/meson.build | 5 ++--- lib/ethdev/meson.build | 6 +++--- lib/mldev/meson.build | 5 +---- lib/rawdev/meson.build | 3 ++- lib/regexdev/meson.build | 3 ++- lib/security/meson.build | 3 ++- 6 files changed, 12 insertions(+), 13 deletions(-)
lib/bbdev/meson.build +2 -3
@@ -8,7 +8,6 @@ if is_windows endif sources = files('rte_bbdev.c') -headers = files('rte_bbdev.h', - 'rte_bbdev_pmd.h', - 'rte_bbdev_op.h') +headers = files('rte_bbdev.h', 'rte_bbdev_op.h') +driver_sdk_headers = files('rte_bbdev_pmd.h') deps += ['mbuf']
lib/ethdev/meson.build +3 -3
@@ -26,11 +26,8 @@ headers = files( 'rte_ethdev_trace_fp.h', 'rte_dev_info.h', 'rte_flow.h', - 'rte_flow_driver.h', 'rte_mtr.h', - 'rte_mtr_driver.h', 'rte_tm.h', - 'rte_tm_driver.h', ) indirect_headers += files(
@@ -42,6 +39,9 @@ driver_sdk_headers += files( 'ethdev_driver.h', 'ethdev_pci.h', 'ethdev_vdev.h', + 'rte_flow_driver.h', + 'rte_mtr_driver.h', + 'rte_tm_driver.h', ) if is_linux
lib/mldev/meson.build +1 -4
@@ -32,11 +32,8 @@ headers = files( 'rte_mldev.h', ) -indirect_headers += files( - 'rte_mldev_core.h', -) - driver_sdk_headers += files( + 'rte_mldev_core.h', 'rte_mldev_pmd.h', 'mldev_utils.h', )
lib/rawdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_rawdev.c') -headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h') +headers = files('rte_rawdev.h') +driver_sdk_headers = files('rte_rawdev_pmd.h') deps += ['telemetry']
lib/regexdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_regexdev.c') -headers = files('rte_regexdev.h', 'rte_regexdev_driver.h') +headers = files('rte_regexdev.h') indirect_headers += files('rte_regexdev_core.h') +driver_sdk_headers = files('rte_regexdev_driver.h') deps += ['mbuf']
lib/security/meson.build +2 -1
@@ -2,5 +2,6 @@ # Copyright(c) 2017-2019 Intel Corporation sources = files('rte_security.c') -headers = files('rte_security.h', 'rte_security_driver.h') +headers = files('rte_security.h') +driver_sdk_headers = files('rte_security_driver.h') deps += ['mempool', 'cryptodev', 'net']
Signature · 1 line
2.47.0
RFC 3/6 eventdev: do not include driver header in DMA adapter
In reply to David MarchandThe dma adapter header does not require including rte_dmadev_pmd.h which is a driver header.
--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_dma_adapter.h +1 -1
@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplus
Signature · 1 line
2.47.0
RE: [EXTERNAL] [RFC 3/6] eventdev: do not include driver header in DMA adapter
Quoted 10 lines
Subject: [EXTERNAL] [RFC 3/6] eventdev: do not include driver header in DMA adapter
The dma adapter header does not require including rte_dmadev_pmd. h which is a driver header. Fixes:
66a30a29387a("eventdev/dma: introduce DMA adapter") Signed-off-by: David Marchand
<david. marchand@ redhat. com> --- lib/eventdev/rte_event_dma_adapter. h The dma adapter header does not require includingrte_dmadev_pmd.hwhich is a driver header.
Quoted 7 lines
Fixes 66a30a29387a ("eventdev/dma: introduce DMA adapter")Signed-off-by David Marchand <[email protected]>--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks
Quoted 16 lines
lib/eventdev/rte_event_dma_adapter.h +1
-2@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplus --2.47.0
RFC 4/6 drivers: fix exported headers
In reply to David MarchandThose headers could not be included individually as they were not including their dependencies, or were subject to some build warnings.
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 4 ++++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 16 ++++++++++++++++ drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 9 files changed, 44 insertions(+)
drivers/bus/vmbus/rte_vmbus_reg.h +6 -0
@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +4 -0
@@ -11,8 +11,12 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> +#include <rte_crypto.h> +/* Forward declarations */ /**
drivers/net/dpaa/rte_pmd_dpaa.h +2 -0
@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h *
drivers/net/iavf/rte_pmd_iavf.h +6 -0
@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h>
@@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())
@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false); +#endif } #ifdef __cplusplus
drivers/net/mlx5/rte_pmd_mlx5.h +3 -0
@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h> /**
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +16 -0
@@ -391,6 +391,7 @@ rte_pmd_bphy_intr_init(uint16_t dev_id) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_INIT , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -411,6 +412,7 @@ rte_pmd_bphy_intr_fini(uint16_t dev_id) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_FINI , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -470,6 +472,9 @@ rte_pmd_bphy_intr_unregister(uint16_t dev_id, int irq_num) {struct cnxk_bphy_irq_info info = { .irq_num = irq_num, + .handler =NULL , + .data =NULL , + .cpu =-1 , };struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_UNREGISTER ,
@@ -496,6 +501,7 @@ rte_pmd_bphy_intr_mem_get(uint16_t dev_id, struct cnxk_bphy_mem *mem) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -518,6 +524,7 @@ rte_pmd_bphy_npa_pf_func_get(uint16_t dev_id, uint16_t *pf_func) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_MSG_TYPE_NPA_PF_FUNC , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -540,6 +547,7 @@ rte_pmd_bphy_sso_pf_func_get(uint16_t dev_id, uint16_t *pf_func) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_MSG_TYPE_SSO_PF_FUNC , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -565,6 +573,7 @@ rte_pmd_bphy_cgx_get_link_info(uint16_t dev_id, uint16_t lmac, {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_GET_LINKINFO , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg, info,sizeof (*info));
@@ -586,6 +595,7 @@ rte_pmd_bphy_cgx_intlbk_disable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_INTLBK_DISABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -607,6 +617,7 @@ rte_pmd_bphy_cgx_intlbk_enable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_INTLBK_ENABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -628,6 +639,7 @@ rte_pmd_bphy_cgx_ptp_rx_disable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_DISABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -649,6 +661,7 @@ rte_pmd_bphy_cgx_ptp_rx_enable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_ENABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -720,6 +733,7 @@ rte_pmd_bphy_cgx_start_rxtx(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_START_RXTX , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -741,6 +755,7 @@ rte_pmd_bphy_cgx_stop_rxtx(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_STOP_RXTX , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -765,6 +780,7 @@ rte_pmd_bphy_cgx_get_supported_fec(uint16_t dev_id, uint16_t lmac, {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_GET_SUPPORTED_FEC , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg, fec,sizeof (*fec));
drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h +3 -0
@@ -261,6 +261,7 @@ rte_pmd_gpio_get_pin_value(uint16_t dev_id, int gpio, int *val) {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_VALUE , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, val,sizeof (*val));
@@ -285,6 +286,7 @@ rte_pmd_gpio_get_pin_edge(uint16_t dev_id, int gpio, {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_EDGE , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, edge,sizeof (*edge));
@@ -308,6 +310,7 @@ rte_pmd_gpio_get_pin_dir(uint16_t dev_id, int gpio, enum cnxk_gpio_pin_dir *dir) {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_DIR , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, dir,sizeof (*dir));
drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h +2 -0
@@ -12,6 +12,8 @@* */ +#include <stdint.h> +#ifdef __cplusplusextern "C" {#endif
drivers/raw/ntb/rte_pmd_ntb.h +2 -0
@@ -5,6 +5,8 @@#ifndef _RTE_PMD_NTB_H_#define _RTE_PMD_NTB_H_ +#include <stdint.h> +/* App needs to set/get these attrs */ #define NTB_QUEUE_SZ_NAME "queue_size"#define NTB_QUEUE_NUM_NAME "queue_num"
Signature · 1 line
2.47.0
RFC 5/6 build: install indirect headers to a dedicated directory
In reply to David MarchandThe headers check currently skips "indirect" headers as instrusted via the indirect_headers meson variable.
This headers check has some limitation that will be addressed in a next change by inspected all exported headers.
However, exported headers lack the information about "indirect" quality.
Separate "indirect" headers by exporting them in a internal/ sub directory. This also makes it more obvious which headers are not to be directly used by an application.
--- buildtools/pkg-config/meson.build | 8 +++++++- lib/eal/x86/include/meson.build | 3 ++- lib/meson.build | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-)
buildtools/pkg-config/meson.build +7 -1
@@ -27,12 +27,18 @@ endif # are skipped in the case of static linkage thanks to the flag --as-needed. +subdirs = [ '.', 'internal' ] +if get_option('include_subdir_arch') != '' + subdirs = [ subdirs, get_option('include_subdir_arch') ] + subdirs = [ subdirs, join_paths(get_option('include_subdir_arch'), 'internal')] +endif + pkg.generate(name: 'dpdk-libs', filebase: 'libdpdk-libs', description: '''Internal-only DPDK pkgconfig file. Not for direct use. Use libdpdk.pc instead of this file to query DPDK compile/link arguments''', version: meson.project_version(), - subdirs: [get_option('include_subdir_arch'), '.'], + subdirs: subdirs, extra_cflags: pkg_extra_cflags, libraries: ['-Wl,--as-needed'] + dpdk_libraries, libraries_private: dpdk_extra_ldflags)
lib/eal/x86/include/meson.build +2 -1
@@ -22,5 +22,6 @@ arch_indirect_headers = files( 'rte_byteorder_32.h', 'rte_byteorder_64.h', ) -install_headers(arch_headers + arch_indirect_headers, subdir: get_option('include_subdir_arch')) +install_headers(arch_headers, subdir: get_option('include_subdir_arch')) +install_headers(arch_indirect_headers, subdir: join_paths(get_option('include_subdir_arch'), 'internal')) dpdk_chkinc_headers += arch_headers
lib/meson.build +1 -1
@@ -202,7 +202,7 @@ foreach l:libraries dpdk_libs_enabled += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) install_headers(headers) - install_headers(indirect_headers) + install_headers(indirect_headers, subdir: 'internal') if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif
Signature · 1 line
2.47.0
Re: [RFC 5/6] build: install indirect headers to a dedicated directory
Quoted 23 lines · David Marchand
The headers check currently skips "indirect" headers as instrusted via the
indirect_headersmeson variable.This headers check has some limitation that will be addressed in a next change by inspected all exported headers.
However, exported headers lack the information about "indirect" quality.Separate "indirect" headers by exporting them in a internal/ sub directory. This also makes it more obvious which headers are not to be directly used by an application.
Signed-off-by David Marchand <[email protected]>--- buildtools/pkg-config/meson.build | 8 +++++++- lib/eal/x86/include/meson.build | 3 ++- lib/meson.build | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-)buildtools/pkg-config/meson.build +0
-0
buildtools/pkg-config/meson.build endif · line 33
Quoted 7 lines
buildtools/pkg-config/meson.build +4
-0@@ -27,12 +27,18 @@ endif # are skipped in the case of static linkage thanks to the flag --as-needed. +subdirs = [ '.', 'internal' ] +if get_option('include_subdir_arch') != '' + subdirs = [ subdirs, get_option('include_subdir_arch') ] + subdirs = [ subdirs, join_paths(get_option('include_subdir_arch'), 'internal')]
minor nit, I tend to prefer using "+=" rather than relying on flattening to extend the arrays.
Quoted 40 lines
buildtools/pkg-config/meson.build +3
-1+endif + pkg.generate(name: 'dpdk-libs', filebase: 'libdpdk-libs', description: '''Internal-only DPDK pkgconfig file. Not for direct use. Use libdpdk.pc instead of this file to query DPDK compile/link arguments''', version: meson.project_version(), - subdirs: [get_option('include_subdir_arch'), '.'], + subdirs: subdirs, extra_cflags: pkg_extra_cflags, libraries: ['-Wl,--as-needed'] + dpdk_libraries, libraries_private: dpdk_extra_ldflags)lib/eal/x86/include/meson.build +2
-1@@ -22,5 +22,6 @@ arch_indirect_headers = files( 'rte_byteorder_32.h', 'rte_byteorder_64.h', ) -install_headers(arch_headers + arch_indirect_headers, subdir: get_option('include_subdir_arch')) +install_headers(arch_headers, subdir: get_option('include_subdir_arch')) +install_headers(arch_indirect_headers, subdir: join_paths(get_option('include_subdir_arch'), 'internal')) dpdk_chkinc_headers += arch_headerslib/meson.build +1
-1@@ -202,7 +202,7 @@ foreach l:libraries dpdk_libs_enabled += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) install_headers(headers) - install_headers(indirect_headers) + install_headers(indirect_headers, subdir: 'internal') if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endifSignature · 1 line
2.47.0
Re: [RFC 5/6] build: install indirect headers to a dedicated directory
Quoted 8 lines · Bruce Richardson
Quoted 8 lines
buildtools/pkg-config/meson.build +0
-0@@ -27,12 +27,18 @@ endif # are skipped in the case of static linkage thanks to the flag --as-needed.
Quoted 7 lines
buildtools/pkg-config/meson.build endif · line 33
Quoted 4 lines
buildtools/pkg-config/meson.build +4
-0+subdirs = [ '.', 'internal' ] +if get_option('include_subdir_arch') != '' + subdirs = [ subdirs, get_option('include_subdir_arch') ] + subdirs = [ subdirs, join_paths(get_option('include_subdir_arch'), 'internal')]minor nit, I tend to prefer using "+=" rather than relying on flattening to extend the arrays.
Hum, yes, I also prefer +=.
I think I mixed this with a different warning I hit when playing with other meson objects...
I'll update in next revision.
--
David Marchand
RFC 6/6 buildtools: externally check exported headers
In reply to David MarchandAt the moment, the headers check (triggered via the check_includes meson option) is run "internally", iow with compilation flags and include path coming from the meson components.
One issue is that both internal and public headers are usually stored in a single directory in the DPDK components.
If a lib/foo library exports a header rte_foo.h (iow rte_foo.h is part of the headers list in lib/foo/meson.build) and this rte_foo.h includes an internal header foo_internal.h, then the headers check won't detect such an issue as rte_foo.h is compiled with -Ilib/foo.
Reimplement the headers check by inspecting (compiling) all DPDK headers installed in a staging directory.
To identify the directory where DPDK headers are, this check relies on pkg-config and skips EAL generic/ and internal/ headers.
The existing headers check (though less accurate) is kept as is, as it provides a first level of check and may have existing users.
--- .ci/linux-build.sh | 7 ++-- buildtools/chkincs/Makefile | 77 +++++++++++++++++++++++++++++++++++ devtools/test-meson-builds.sh | 6 ++- 3 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 buildtools/chkincs/Makefile
.ci/linux-build.sh +4 -3
@@ -95,8 +95,6 @@ OPTS="$OPTS -Ddefault_library=$DEF_LIB" OPTS="$OPTS -Dbuildtype=$buildtype" if [ "$STDATOMIC" = "true" ]; then OPTS="$OPTS -Denable_stdatomic=true" -else - OPTS="$OPTS -Dcheck_includes=true" fi if [ "$MINI" = "true" ]; then OPTS="$OPTS -Denable_drivers=net/null"
@@ -176,13 +174,16 @@ if [ "$RUN_TESTS" = "true" ]; then [ "$failed" != "true" ] fi -# Test examples compilation with an installed dpdk +# Test headers and examples compilation with an installed dpdk if [ "$BUILD_EXAMPLES" = "true" ]; then [ -d install ] || DESTDIR=$(pwd)/install meson install -C build export LD_LIBRARY_PATH=$(dirname $(find $(pwd)/install -name librte_eal.so)):$LD_LIBRARY_PATH export PATH=$(dirname $(find $(pwd)/install -name dpdk-devbind.py)):$PATH export PKG_CONFIG_PATH=$(dirname $(find $(pwd)/install -name libdpdk.pc)):$PKG_CONFIG_PATH export PKGCONF="pkg-config --define-prefix" + + make -C buildtools/chkincs O=build/buildtools/chkincs + find build/examples -maxdepth 1 -type f -name "dpdk-*" | while read target; do target=${target%%:*}
buildtools/chkincs/Makefile new file +77 -0
77 lines not on this page · raw message
devtools/test-meson-builds.sh +4 -2
@@ -248,7 +248,7 @@ generic_isa='nehalem' if ! check_cc_flags "-march=$generic_isa" ; then generic_isa='corei7' fi -build build-x86-generic cc skipABI -Dcheck_includes=true \ +build build-x86-generic cc skipABI \ -Dlibdir=lib -Dcpu_instruction_set=$generic_isa $use_shared # 32-bit with default compiler
@@ -318,9 +318,11 @@ if [ "$examples" = 'all' ]; then done | sort -u | tr '\n' ' ') fi -# if pkg-config defines the necessary flags, test building some examples +# if pkg-config defines the necessary flags, check headers and test building some examples if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then export PKGCONF="pkg-config --define-prefix" + echo "## Checking exported headers" + $MAKE -C buildtools/chkincs O=$build_path/buildtools/chkincs -j for example in $examples; do echo "## Building $example" [ $example = helloworld ] && static=static || static= # save disk space
Signature · 1 line
2.47.0
v2 cover Add a stricter headers check
In reply to David MarchandAs explained in patch 6, the current headers check can not catch issues when a public header includes an internal header. Fixing this from meson does not seem an easy task.
This series approach is to reimplement the check in a Makefile invoked out of DPDK (like what is done for external compilation of examples). This has the advantage of being simple, and avoiding any (non intentional) implicit include path coming from the meson framework.
As there was no easy way to distinguish "indirect" headers in an installed DPDK, I chose to move those headers in a new sub directory (patch 5).
Patch 1-4 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling enable_driver_sdk option).
For now, I left the check_includes= option untouched, as there may be users of this check and this check still catches issues without requiring to install DPDK.
Signature · 38 lines
David Marchand David Marchand (6): baseband/acc: fix exported header drivers: drop export of driver headers eventdev: do not include driver header in DMA adapter drivers: fix exported headers build: install indirect headers to a dedicated directory buildtools: externally check exported headers .ci/linux-build.sh | 7 +- buildtools/chkincs/Makefile | 77 +++++++++++++++++++ buildtools/pkg-config/meson.build | 8 +- devtools/test-meson-builds.sh | 6 +- drivers/baseband/acc/meson.build | 2 +- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 4 + drivers/net/dpaa/rte_pmd_dpaa.h | 2 + drivers/net/iavf/rte_pmd_iavf.h | 6 ++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 + drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 16 ++++ drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h | 3 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 + drivers/raw/ntb/rte_pmd_ntb.h | 2 + lib/bbdev/meson.build | 5 +- lib/eal/x86/include/meson.build | 3 +- lib/ethdev/meson.build | 6 +- lib/eventdev/rte_event_dma_adapter.h | 2 +- lib/meson.build | 2 +- lib/mldev/meson.build | 5 +- lib/rawdev/meson.build | 3 +- lib/regexdev/meson.build | 3 +- lib/security/meson.build | 3 +- 23 files changed, 153 insertions(+), 23 deletions(-) create mode 100644 buildtools/chkincs/Makefile -- 2.47.0
PATCH v2 1/6 baseband/acc: fix exported header
rte_acc_cfg.h relies on rte_acc_common_cfg.h.
--- drivers/baseband/acc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/baseband/acc/meson.build +1 -1
@@ -26,4 +26,4 @@ deps += ['bus_pci'] sources = files('acc_common.c', 'rte_acc100_pmd.c', 'rte_vrb_pmd.c') -headers = files('rte_acc_cfg.h') +headers = files('rte_acc_cfg.h', 'rte_acc_common_cfg.h')
Signature · 1 line
2.47.0
Re: [PATCH v2 1/6] baseband/acc: fix exported header
Quoted 6 lines · David Marchand
rte_acc_cfg.hrelies onrte_acc_common_cfg.h.Fixes 32e8b7ea35dd ("baseband/acc100: refactor to segregate common code")Signed-off-by David Marchand <[email protected]>---
Indeed it does depend on it!
PATCH v2 2/6 drivers: drop export of driver headers
In reply to David MarchandMany classes are exposing driver only headers as public headers. Move them to the driver_sdk_headers list.
--- lib/bbdev/meson.build | 5 ++--- lib/ethdev/meson.build | 6 +++--- lib/mldev/meson.build | 5 +---- lib/rawdev/meson.build | 3 ++- lib/regexdev/meson.build | 3 ++- lib/security/meson.build | 3 ++- 6 files changed, 12 insertions(+), 13 deletions(-)
lib/bbdev/meson.build +2 -3
@@ -8,7 +8,6 @@ if is_windows endif sources = files('rte_bbdev.c') -headers = files('rte_bbdev.h', - 'rte_bbdev_pmd.h', - 'rte_bbdev_op.h') +headers = files('rte_bbdev.h', 'rte_bbdev_op.h') +driver_sdk_headers = files('rte_bbdev_pmd.h') deps += ['mbuf']
lib/ethdev/meson.build +3 -3
@@ -26,11 +26,8 @@ headers = files( 'rte_ethdev_trace_fp.h', 'rte_dev_info.h', 'rte_flow.h', - 'rte_flow_driver.h', 'rte_mtr.h', - 'rte_mtr_driver.h', 'rte_tm.h', - 'rte_tm_driver.h', ) indirect_headers += files(
@@ -42,6 +39,9 @@ driver_sdk_headers += files( 'ethdev_driver.h', 'ethdev_pci.h', 'ethdev_vdev.h', + 'rte_flow_driver.h', + 'rte_mtr_driver.h', + 'rte_tm_driver.h', ) if is_linux
lib/mldev/meson.build +1 -4
@@ -32,11 +32,8 @@ headers = files( 'rte_mldev.h', ) -indirect_headers += files( - 'rte_mldev_core.h', -) - driver_sdk_headers += files( + 'rte_mldev_core.h', 'rte_mldev_pmd.h', 'mldev_utils.h', )
lib/rawdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_rawdev.c') -headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h') +headers = files('rte_rawdev.h') +driver_sdk_headers = files('rte_rawdev_pmd.h') deps += ['telemetry']
lib/regexdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_regexdev.c') -headers = files('rte_regexdev.h', 'rte_regexdev_driver.h') +headers = files('rte_regexdev.h') indirect_headers += files('rte_regexdev_core.h') +driver_sdk_headers = files('rte_regexdev_driver.h') deps += ['mbuf']
lib/security/meson.build +2 -1
@@ -2,5 +2,6 @@ # Copyright(c) 2017-2019 Intel Corporation sources = files('rte_security.c') -headers = files('rte_security.h', 'rte_security_driver.h') +headers = files('rte_security.h') +driver_sdk_headers = files('rte_security_driver.h') deps += ['mempool', 'cryptodev', 'net']
Signature · 1 line
2.47.0
Re: [PATCH v2 2/6] drivers: drop export of driver headers
Quoted 5 lines · David Marchand
Many classes are exposing driver only headers as public headers. Move them to the
driver_sdk_headerslist.Signed-off-by David Marchand <[email protected]>---
LGTM. The names of most of the headers are pretty clear that they should be sdk-only headers.
Andrew Rybchenko
Acked-byRe: [PATCH v2 2/6] drivers: drop export of driver headers
Quoted 4 lines · Bruce Richardson
Quoted 3 lines · David Marchand
Many classes are exposing driver only headers as public headers. Move them to the
driver_sdk_headerslist.
Quoted 8 lines
Quoted 2 lines
Signed-off-by David Marchand <[email protected]>---
LGTM. The names of most of the headers are pretty clear that they should be sdk-only headers.
Acked-by Bruce Richardson <[email protected]>
PATCH v2 3/6 eventdev: do not include driver header in DMA adapter
In reply to David MarchandThe dma adapter header does not require including rte_dmadev_pmd.h which is a driver header.
--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_dma_adapter.h +1 -1
@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplus
Signature · 1 line
2.47.0
Re: [PATCH v2 3/6] eventdev: do not include driver header in DMA adapter
Quoted 7 lines · David Marchand
The dma adapter header does not require including
rte_dmadev_pmd.hwhich is a driver header.Fixes 66a30a29387a ("eventdev/dma: introduce DMA adapter")Signed-off-by David Marchand <[email protected]>
Quoted 20 lines
--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/eventdev/rte_event_dma_adapter.h +1
-1@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplusSignature · 1 line
2.47.0
PATCH v2 4/6 drivers: fix exported headers
In reply to David MarchandThose headers could not be included individually as they were not including their dependencies, or were subject to some build warnings.
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 4 ++++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 16 ++++++++++++++++ drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 9 files changed, 44 insertions(+)
drivers/bus/vmbus/rte_vmbus_reg.h +6 -0
@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +4 -0
@@ -11,8 +11,12 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> +#include <rte_crypto.h> +/* Forward declarations */ /**
drivers/net/dpaa/rte_pmd_dpaa.h +2 -0
@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h *
drivers/net/iavf/rte_pmd_iavf.h +6 -0
@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h>
@@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())
@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false); +#endif } #ifdef __cplusplus
drivers/net/mlx5/rte_pmd_mlx5.h +3 -0
@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h> /**
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +16 -0
@@ -391,6 +391,7 @@ rte_pmd_bphy_intr_init(uint16_t dev_id) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_INIT , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -411,6 +412,7 @@ rte_pmd_bphy_intr_fini(uint16_t dev_id) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_FINI , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -470,6 +472,9 @@ rte_pmd_bphy_intr_unregister(uint16_t dev_id, int irq_num) {struct cnxk_bphy_irq_info info = { .irq_num = irq_num, + .handler =NULL , + .data =NULL , + .cpu =-1 , };struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_UNREGISTER ,
@@ -496,6 +501,7 @@ rte_pmd_bphy_intr_mem_get(uint16_t dev_id, struct cnxk_bphy_mem *mem) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -518,6 +524,7 @@ rte_pmd_bphy_npa_pf_func_get(uint16_t dev_id, uint16_t *pf_func) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_MSG_TYPE_NPA_PF_FUNC , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -540,6 +547,7 @@ rte_pmd_bphy_sso_pf_func_get(uint16_t dev_id, uint16_t *pf_func) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_MSG_TYPE_SSO_PF_FUNC , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,
@@ -565,6 +573,7 @@ rte_pmd_bphy_cgx_get_link_info(uint16_t dev_id, uint16_t lmac, {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_GET_LINKINFO , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg, info,sizeof (*info));
@@ -586,6 +595,7 @@ rte_pmd_bphy_cgx_intlbk_disable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_INTLBK_DISABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -607,6 +617,7 @@ rte_pmd_bphy_cgx_intlbk_enable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_INTLBK_ENABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -628,6 +639,7 @@ rte_pmd_bphy_cgx_ptp_rx_disable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_DISABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -649,6 +661,7 @@ rte_pmd_bphy_cgx_ptp_rx_enable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_ENABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -720,6 +733,7 @@ rte_pmd_bphy_cgx_start_rxtx(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_START_RXTX , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -741,6 +755,7 @@ rte_pmd_bphy_cgx_stop_rxtx(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_STOP_RXTX , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );
@@ -765,6 +780,7 @@ rte_pmd_bphy_cgx_get_supported_fec(uint16_t dev_id, uint16_t lmac, {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_GET_SUPPORTED_FEC , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg, fec,sizeof (*fec));
drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h +3 -0
@@ -261,6 +261,7 @@ rte_pmd_gpio_get_pin_value(uint16_t dev_id, int gpio, int *val) {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_VALUE , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, val,sizeof (*val));
@@ -285,6 +286,7 @@ rte_pmd_gpio_get_pin_edge(uint16_t dev_id, int gpio, {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_EDGE , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, edge,sizeof (*edge));
@@ -308,6 +310,7 @@ rte_pmd_gpio_get_pin_dir(uint16_t dev_id, int gpio, enum cnxk_gpio_pin_dir *dir) {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_DIR , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, dir,sizeof (*dir));
drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h +2 -0
@@ -12,6 +12,8 @@* */ +#include <stdint.h> +#ifdef __cplusplusextern "C" {#endif
drivers/raw/ntb/rte_pmd_ntb.h +2 -0
@@ -5,6 +5,8 @@#ifndef _RTE_PMD_NTB_H_#define _RTE_PMD_NTB_H_ +#include <stdint.h> +/* App needs to set/get these attrs */ #define NTB_QUEUE_SZ_NAME "queue_size"#define NTB_QUEUE_NUM_NAME "queue_num"
Signature · 1 line
2.47.0
Re: [PATCH v2 4/6] drivers: fix exported headers
Quoted 16 lines · David Marchand
Those headers could not be included individually as they were not including their dependencies, or were subject to some build warnings.
Fixes 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")Fixes 5b2a1a02dcaf ("crypto/cnxk: fix experimental version for PMD API")Fixes e5abbeeeefa5 ("crypto/cnxk: add PMD API for getting CPTR")Fixes 3ca607402c4d ("crypto/cnxk: add PMD API to flush CTX")Fixes 8c3495f5d2dd ("net/dpaa: support loopback API")Fixes 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")Fixes 23f627e0ed28 ("net/mlx5: add flow sync API")Fixes f5177bdc8b76 ("net/mlx5: add GENEVE TLV options parser API")Fixes 7cf197684589 ("raw/cnxk_bphy: support interrupt init and cleanup")Fixes 633dae698070 ("raw/cnxk_gpio: add standard GPIO operations")Fixes 53c71586c789 ("raw/dpaa2_cmdif: support enqueue/dequeue operations")Fixes c39d1e082a4b ("raw/ntb: setup queues")
Quoted 1 line
Signed-off-by David Marchand <[email protected]>
Generally LGTM, some queries inline below.
/Bruce
Quoted 80 lines
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 4 ++++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 16 ++++++++++++++++ drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 9 files changed, 44 insertions(+)drivers/bus/vmbus/rte_vmbus_reg.h +6
-0@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +4
-0@@ -11,8 +11,12 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> +#include <rte_crypto.h> +/* Forward declarations */ /** drivers/net/dpaa/rte_pmd_dpaa.h +2
-0@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h * drivers/net/iavf/rte_pmd_iavf.h +2
-0@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h> @@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())
drivers/net/iavf/rte_pmd_iavf.h rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) · line 250
Quoted 6 lines
drivers/net/iavf/rte_pmd_iavf.h +3
-0@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false);
Is panicking the behaviour we want here? Seems rather severe, no?
Quoted 23 lines
drivers/net/iavf/rte_pmd_iavf.h +1
-0+#endif }#ifdef __cplusplusdrivers/net/mlx5/rte_pmd_mlx5.h +3
-0@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h> /** drivers/raw/cnxk_bphy/rte_pmd_bphy.h +0
-0
drivers/raw/cnxk_bphy/rte_pmd_bphy.h rte_pmd_bphy_intr_init(uint16_t dev_id) · line 396
Quoted 6 lines
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +1
-0@@ -391,6 +391,7 @@ rte_pmd_bphy_intr_init(uint16_t dev_id) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_INIT , + .data =NULL , };
Why is this addition necessary? Is it for C++ compile?
Quoted 164 lines
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +15
-0return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,@@ -411,6 +412,7 @@ rte_pmd_bphy_intr_fini(uint16_t dev_id) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_FINI , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,@@ -470,6 +472,9 @@ rte_pmd_bphy_intr_unregister(uint16_t dev_id, int irq_num) {struct cnxk_bphy_irq_info info = { .irq_num = irq_num, + .handler =NULL , + .data =NULL , + .cpu =-1 , };struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_UNREGISTER ,@@ -496,6 +501,7 @@ rte_pmd_bphy_intr_mem_get(uint16_t dev_id, struct cnxk_bphy_mem *mem) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,@@ -518,6 +524,7 @@ rte_pmd_bphy_npa_pf_func_get(uint16_t dev_id, uint16_t *pf_func) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_MSG_TYPE_NPA_PF_FUNC , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,@@ -540,6 +547,7 @@ rte_pmd_bphy_sso_pf_func_get(uint16_t dev_id, uint16_t *pf_func) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_MSG_TYPE_SSO_PF_FUNC , + .data =NULL , }; return __rte_pmd_bphy_enq_deq(dev_id, CNXK_BPHY_DEF_QUEUE, &msg,@@ -565,6 +573,7 @@ rte_pmd_bphy_cgx_get_link_info(uint16_t dev_id, uint16_t lmac, {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_GET_LINKINFO , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg, info,sizeof (*info));@@ -586,6 +595,7 @@ rte_pmd_bphy_cgx_intlbk_disable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_INTLBK_DISABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );@@ -607,6 +617,7 @@ rte_pmd_bphy_cgx_intlbk_enable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_INTLBK_ENABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );@@ -628,6 +639,7 @@ rte_pmd_bphy_cgx_ptp_rx_disable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_DISABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );@@ -649,6 +661,7 @@ rte_pmd_bphy_cgx_ptp_rx_enable(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_PTP_RX_ENABLE , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );@@ -720,6 +733,7 @@ rte_pmd_bphy_cgx_start_rxtx(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_START_RXTX , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );@@ -741,6 +755,7 @@ rte_pmd_bphy_cgx_stop_rxtx(uint16_t dev_id, uint16_t lmac) {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_STOP_RXTX , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg,NULL ,0 );@@ -765,6 +780,7 @@ rte_pmd_bphy_cgx_get_supported_fec(uint16_t dev_id, uint16_t lmac, {struct cnxk_bphy_cgx_msg msg = { .type =CNXK_BPHY_CGX_MSG_TYPE_GET_SUPPORTED_FEC , + .data =NULL , };return __rte_pmd_bphy_enq_deq (dev_id, lmac, &msg, fec,sizeof (*fec));drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h +3
-0@@ -261,6 +261,7 @@ rte_pmd_gpio_get_pin_value(uint16_t dev_id, int gpio, int *val) {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_VALUE , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, val,sizeof (*val));@@ -285,6 +286,7 @@ rte_pmd_gpio_get_pin_edge(uint16_t dev_id, int gpio, {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_EDGE , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, edge,sizeof (*edge));@@ -308,6 +310,7 @@ rte_pmd_gpio_get_pin_dir(uint16_t dev_id, int gpio, enum cnxk_gpio_pin_dir *dir) {struct cnxk_gpio_msg msg = { .type =CNXK_GPIO_MSG_TYPE_GET_PIN_DIR , + .data =NULL , };return __rte_pmd_gpio_enq_deq (dev_id, gpio, &msg, dir,sizeof (*dir));drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h +2
-0@@ -12,6 +12,8 @@* */ +#include <stdint.h> +#ifdef __cplusplusextern "C" {#endif drivers/raw/ntb/rte_pmd_ntb.h +2
-0@@ -5,6 +5,8 @@#ifndef _RTE_PMD_NTB_H_#define _RTE_PMD_NTB_H_ +#include <stdint.h> +/* App needs to set/get these attrs */ #define NTB_QUEUE_SZ_NAME "queue_size"#define NTB_QUEUE_NUM_NAME "queue_num"Signature · 1 line
2.47.0
Re: [PATCH v2 4/6] drivers: fix exported headers
Quoted 102 lines · Bruce Richardson
Quoted 16 lines · David Marchand
Those headers could not be included individually as they were not including their dependencies, or were subject to some build warnings.
Fixes 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")Fixes 5b2a1a02dcaf ("crypto/cnxk: fix experimental version for PMD API")Fixes e5abbeeeefa5 ("crypto/cnxk: add PMD API for getting CPTR")Fixes 3ca607402c4d ("crypto/cnxk: add PMD API to flush CTX")Fixes 8c3495f5d2dd ("net/dpaa: support loopback API")Fixes 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")Fixes 23f627e0ed28 ("net/mlx5: add flow sync API")Fixes f5177bdc8b76 ("net/mlx5: add GENEVE TLV options parser API")Fixes 7cf197684589 ("raw/cnxk_bphy: support interrupt init and cleanup")Fixes 633dae698070 ("raw/cnxk_gpio: add standard GPIO operations")Fixes 53c71586c789 ("raw/dpaa2_cmdif: support enqueue/dequeue operations")Fixes c39d1e082a4b ("raw/ntb: setup queues")Quoted 1 line
Signed-off-by David Marchand <[email protected]>Generally LGTM, some queries inline below.
/Bruce
Quoted 78 lines
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 4 ++++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 16 ++++++++++++++++ drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 9 files changed, 44 insertions(+)drivers/bus/vmbus/rte_vmbus_reg.h +6
-0@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +4
-0@@ -11,8 +11,12 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> +#include <rte_crypto.h> +/* Forward declarations */ /** drivers/net/dpaa/rte_pmd_dpaa.h +2
-0@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h * drivers/net/iavf/rte_pmd_iavf.h +2
-0@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h> @@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;
Quoted 10 lines
drivers/net/iavf/rte_pmd_iavf.h rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) · line 250
Quoted 8 lines
drivers/net/iavf/rte_pmd_iavf.h +3
-0if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false);Is panicking the behaviour we want here? Seems rather severe, no?
You are not supposed to call this symbol without building with ALLOW_EXPERIMENTAL_API.
Another option would be to mark those symbols as stable (they have been untouched for years).12b435bf8f2 (Jeff Guo 2020-10-30 16:40:30 +0800 186)rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m)
Quoted 18 lines
Quoted 18 lines
drivers/net/iavf/rte_pmd_iavf.h +1
-0+#endif }#ifdef __cplusplusdrivers/net/mlx5/rte_pmd_mlx5.h +3
-0@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h>
Quoted 14 lines
drivers/raw/cnxk_bphy/rte_pmd_bphy.h rte_pmd_bphy_intr_init(uint16_t dev_id) · line 396
Quoted 12 lines
drivers/net/mlx5/rte_pmd_mlx5.h +0
-0/** drivers/raw/cnxk_bphy/rte_pmd_bphy.h +1
-0@@ -391,6 +391,7 @@ rte_pmd_bphy_intr_init(uint16_t dev_id) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_INIT , + .data =NULL , };Why is this addition necessary? Is it for C++ compile?
IIRC, this is because DPDK meson passes -Wno-missing-field-initializers globally, and the Makefile I wrote does not.
I'll double check.
Signature · 1 line
David Marchand
Re: [PATCH v2 4/6] drivers: fix exported headers
Quoted 14 lines · David Marchand
Quoted 5 lines
Quoted 5 lines
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +0
-0@@ -391,6 +391,7 @@ rte_pmd_bphy_intr_init(uint16_t dev_id)Quoted 8 lines
drivers/raw/cnxk_bphy/rte_pmd_bphy.h rte_pmd_bphy_intr_init(uint16_t dev_id) · line 396
Quoted 6 lines
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +1
-0{struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_INIT , + .data =NULL , };Why is this addition necessary? Is it for C++ compile?
Quoted 4 lines
IIRC, this is because DPDK meson passes -Wno-missing-field-initializers globally, and the
MakefileI wrote does not.
I'll double check.
Yep, confirmed.
...
In file included from /home/dmarchan/builds/main/build-x86-generic/buildtools/chkincs/rte_pmd_cnxk_gpio.c:1:/home/dmarchan/builds/main/build-x86-generic/install/usr/local/include/rte_pmd_cnxk_gpio.h:
In function ‘int rte_pmd_gpio_get_pin_value(uint16_t, int, int*)’:/home/dmarchan/builds/main/build-x86-generic/install/usr/local/include/rte_pmd_cnxk_gpio.h:264:9:
error: missing initializer for member ‘cnxk_gpio_msg::data’ [-Werror=missing-field-initializers]
264 | };
| ^...
On the other hand, -Wmissing-field-initializers comes from -Wextra and it is explicitly disabled in meson.
If we want to stick with -Wmissing-field-initializers "internally", I will drop those changes (and disable missing-field-initializers, trying to keep -Wextra in the "external" check)
Signature · 1 line
David Marchand
Re: [PATCH v2 4/6] drivers: fix exported headers
In reply to David Marchanddrivers/raw/cnxk_bphy/rte_pmd_bphy.h rte_pmd_bphy_intr_mem_get(uint16_t dev_id, struct cnxk_bphy_mem *mem) · line 506
Quoted 7 lines · On Fri, 13 Dec 2024 11:50:08 +0100 David Marchand <[email protected]>…
drivers/raw/cnxk_bphy/rte_pmd_bphy.h +1
-0@@ -496,6 +501,7 @@ rte_pmd_bphy_intr_mem_get(uint16_t dev_id, struct cnxk_bphy_mem *mem) {struct cnxk_bphy_irq_msg msg = { .type =CNXK_BPHY_IRQ_MSG_TYPE_MEM_GET , + .data =NULL , };
Why add these, compiler already initializes these to NULL. Are you trying to enable -Wmissing-field-initializers?
PATCH v2 5/6 build: install indirect headers to a dedicated directory
In reply to David MarchandThe headers check currently skips "indirect" headers as instructed via the indirect_headers meson variable.
This headers check has some limitation that will be addressed in a next change by inspected all exported headers.
However, exported headers lack the information about "indirect" quality.
Separate "indirect" headers by exporting them in a internal/ sub directory. This also makes it more obvious which headers are not to be directly used by an application.
--- buildtools/pkg-config/meson.build | 8 +++++++- lib/eal/x86/include/meson.build | 3 ++- lib/meson.build | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-)
buildtools/pkg-config/meson.build +7 -1
@@ -27,12 +27,18 @@ endif # are skipped in the case of static linkage thanks to the flag --as-needed. +subdirs = ['.', 'internal'] +if get_option('include_subdir_arch') != '' + subdirs += [get_option('include_subdir_arch')] + subdirs += [join_paths(get_option('include_subdir_arch'), 'internal')] +endif + pkg.generate(name: 'dpdk-libs', filebase: 'libdpdk-libs', description: '''Internal-only DPDK pkgconfig file. Not for direct use. Use libdpdk.pc instead of this file to query DPDK compile/link arguments''', version: meson.project_version(), - subdirs: [get_option('include_subdir_arch'), '.'], + subdirs: subdirs, extra_cflags: pkg_extra_cflags, libraries: ['-Wl,--as-needed'] + dpdk_libraries, libraries_private: dpdk_extra_ldflags)
lib/eal/x86/include/meson.build +2 -1
@@ -22,5 +22,6 @@ arch_indirect_headers = files( 'rte_byteorder_32.h', 'rte_byteorder_64.h', ) -install_headers(arch_headers + arch_indirect_headers, subdir: get_option('include_subdir_arch')) +install_headers(arch_headers, subdir: get_option('include_subdir_arch')) +install_headers(arch_indirect_headers, subdir: join_paths(get_option('include_subdir_arch'), 'internal')) dpdk_chkinc_headers += arch_headers
lib/meson.build +1 -1
@@ -202,7 +202,7 @@ foreach l:libraries dpdk_libs_enabled += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) install_headers(headers) - install_headers(indirect_headers) + install_headers(indirect_headers, subdir: 'internal') if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif
Signature · 1 line
2.47.0
PATCH v2 6/6 buildtools: externally check exported headers
In reply to David MarchandAt the moment, the headers check (triggered via the check_includes meson option) is run "internally", iow with compilation flags and include path coming from the meson components.
One issue is that both internal and public headers are usually stored in a single directory in the DPDK components.
If a lib/foo library exports a header rte_foo.h (iow rte_foo.h is part of the headers list in lib/foo/meson.build) and this rte_foo.h includes an internal header foo_internal.h, then the headers check won't detect such an issue as rte_foo.h is compiled with -Ilib/foo.
Reimplement the headers check by inspecting (compiling) all DPDK headers installed in a staging directory.
To identify the directory where DPDK headers are, this check relies on pkg-config and skips EAL generic/ and internal/ headers.
The existing headers check (though less accurate) is kept as is, as it provides a first level of check and may have existing users.
--- .ci/linux-build.sh | 7 ++-- buildtools/chkincs/Makefile | 77 +++++++++++++++++++++++++++++++++++ devtools/test-meson-builds.sh | 6 ++- 3 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 buildtools/chkincs/Makefile
.ci/linux-build.sh +4 -3
@@ -95,8 +95,6 @@ OPTS="$OPTS -Ddefault_library=$DEF_LIB" OPTS="$OPTS -Dbuildtype=$buildtype" if [ "$STDATOMIC" = "true" ]; then OPTS="$OPTS -Denable_stdatomic=true" -else - OPTS="$OPTS -Dcheck_includes=true" fi if [ "$MINI" = "true" ]; then OPTS="$OPTS -Denable_drivers=net/null"
@@ -176,13 +174,16 @@ if [ "$RUN_TESTS" = "true" ]; then [ "$failed" != "true" ] fi -# Test examples compilation with an installed dpdk +# Test headers and examples compilation with an installed dpdk if [ "$BUILD_EXAMPLES" = "true" ]; then [ -d install ] || DESTDIR=$(pwd)/install meson install -C build export LD_LIBRARY_PATH=$(dirname $(find $(pwd)/install -name librte_eal.so)):$LD_LIBRARY_PATH export PATH=$(dirname $(find $(pwd)/install -name dpdk-devbind.py)):$PATH export PKG_CONFIG_PATH=$(dirname $(find $(pwd)/install -name libdpdk.pc)):$PKG_CONFIG_PATH export PKGCONF="pkg-config --define-prefix" + + make -C buildtools/chkincs O=build/buildtools/chkincs + find build/examples -maxdepth 1 -type f -name "dpdk-*" | while read target; do target=${target%%:*}
buildtools/chkincs/Makefile new file +77 -0
77 lines not on this page · raw message
devtools/test-meson-builds.sh +4 -2
@@ -248,7 +248,7 @@ generic_isa='nehalem' if ! check_cc_flags "-march=$generic_isa" ; then generic_isa='corei7' fi -build build-x86-generic cc skipABI -Dcheck_includes=true \ +build build-x86-generic cc skipABI \ -Dlibdir=lib -Dcpu_instruction_set=$generic_isa $use_shared # 32-bit with default compiler
@@ -318,9 +318,11 @@ if [ "$examples" = 'all' ]; then done | sort -u | tr '\n' ' ') fi -# if pkg-config defines the necessary flags, test building some examples +# if pkg-config defines the necessary flags, check headers and test building some examples if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then export PKGCONF="pkg-config --define-prefix" + echo "## Checking exported headers" + $MAKE -C buildtools/chkincs O=$build_path/buildtools/chkincs -j for example in $examples; do echo "## Building $example" [ $example = helloworld ] && static=static || static= # save disk space
Signature · 1 line
2.47.0
Quoted 13 lines · David Marchand
As explained in patch 6, the current headers check can not catch issues when a public header includes an internal header. Fixing this from meson does not seem an easy task.
This series approach is to reimplement the check in a
Makefileinvoked out of DPDK (like what is done for external compilation of examples). This has the advantage of being simple, and avoiding any (non intentional) implicit include path coming from the meson framework.As there was no easy way to distinguish "indirect" headers in an installed DPDK, I chose to move those headers in a new sub directory (patch 5).
Quoted 8 lines
Patch 1-4 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling
enable_driver_sdkoption).For now, I left the check_includes= option untouched, as there may be users of this check and this check still catches issues without requiring to install DPDK.
For patches 5 & 6, I wonder if we can find a slightly different way to do this. I like the idea of using make to build chkincs free from possible environmental contamination from meson, but I really don't like the complexity of the resulting makefile!
Rather than having to move the indirect headers to a subdirectory, and then have a makefile run a scan from the headers directory, how about instead generating the makefile (or possibly a build.ninja file) directly from meson itself? This means the makefile can already have the list of headers and C files necessary - no need for an extra subdirectory - and no need for large amounts of wildcard matching and replacements.
The downside is that the makefile is no longer with the source, but in the build directory. However, since the most likely use for this makefile is from the test-meson-builds script and from automated CIs, I don't see this being a major issue.
WDYT?
/Bruce
Quoted 19 lines · Bruce Richardson
Quoted 17 lines · David Marchand
As explained in patch 6, the current headers check can not catch issues when a public header includes an internal header. Fixing this from meson does not seem an easy task.
This series approach is to reimplement the check in a
Makefileinvoked out of DPDK (like what is done for external compilation of examples). This has the advantage of being simple, and avoiding any (non intentional) implicit include path coming from the meson framework.As there was no easy way to distinguish "indirect" headers in an installed DPDK, I chose to move those headers in a new sub directory (patch 5).
Patch 1-4 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling
enable_driver_sdkoption).
Quoted 8 lines
Quoted 4 lines
For now, I left the check_includes= option untouched, as there may be users of this check and this check still catches issues without requiring to install DPDK.
For patches 5 & 6, I wonder if we can find a slightly different way to do this. I like the idea of using make to build chkincs free from possible environmental contamination from meson, but I really don't like the complexity of the resulting makefile!
Well, I am no makefile expert, though I find this one straightforward. Thomas could probably enhance it :-).
Quoted 6 lines
Rather than having to move the indirect headers to a subdirectory, and then have a makefile run a scan from the headers directory, how about instead generating the makefile (or possibly a build.ninja file) directly from meson itself? This means the makefile can already have the list of headers and C files necessary - no need for an extra subdirectory - and no need for large amounts of wildcard matching and replacements.
Scanning a staging directory insulates from bugs in meson and this is the main point of this series.
If we add a new framework in meson (a list of headers or whatever), any driver can still add some install_headers() somewhere and we are back with a new hole.
What will ensure that nobody introduce a bug back with some include path to the sources, being passed into the generated Makefile?
Headers should be checked from an installed directory (like a final user) with minimal (ideally no) knowledge of what header is safe to include.
Quoted 4 lines
The downside is that the makefile is no longer with the source, but in the build directory. However, since the most likely use for this makefile is from the test-meson-builds script and from automated CIs, I don't see this being a major issue.
This part is not an issue.
Signature · 1 line
David Marchand
v3 cover Add a stricter headers check
In reply to David MarchandAs explained in patch 6, the current headers check can not catch issues when a public header includes an internal header.
Patch 1-5 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling enable_driver_sdk option).
Signature · 60 lines
David Marchand Changes since v2: - major rework, dropping the makefile approach, and instead copying headers to a staging directory used by the check, - rebased, - dropped changes on raw cnxk drivers and disabled the associated build warning in the headers check, David Marchand (7): baseband/acc: fix exported header drivers: drop export of driver headers eventdev: do not include driver header in DMA adapter gpudev: fix driver header for Windows drivers: fix some exported headers buildtools/chkincs: use a staging directory for headers power: separate public and driver headers MAINTAINERS | 3 ++ buildtools/chkincs/meson.build | 41 +++++++++---------- buildtools/meson.build | 1 + buildtools/stage-headers.py | 32 +++++++++++++++ drivers/baseband/acc/meson.build | 2 +- drivers/bus/vmbus/rte_vmbus_reg.h | 6 +++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 + drivers/meson.build | 28 +++++++++++-- drivers/net/dpaa/rte_pmd_dpaa.h | 2 + drivers/net/intel/iavf/rte_pmd_iavf.h | 6 +++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 ++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 + drivers/raw/ntb/rte_pmd_ntb.h | 2 + lib/bbdev/meson.build | 14 ++++--- lib/eal/include/meson.build | 8 ++++ lib/eal/meson.build | 10 +++++ lib/ethdev/meson.build | 6 +-- lib/eventdev/rte_event_dma_adapter.h | 2 +- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 +- lib/meson.build | 41 +++++++++++++++---- lib/mldev/meson.build | 5 +-- lib/power/meson.build | 7 +++- lib/power/power_cpufreq.h | 14 +------ lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 ++++++- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 +- lib/rawdev/meson.build | 3 +- lib/regexdev/meson.build | 3 +- lib/security/meson.build | 3 +- meson.build | 4 ++ staging/drivers/meson.build | 5 +++ staging/meson.build | 7 ++++ 35 files changed, 217 insertions(+), 73 deletions(-) create mode 100644 buildtools/stage-headers.py create mode 100644 staging/drivers/meson.build create mode 100644 staging/meson.build -- 2.51.0
PATCH v3 1/7 baseband/acc: fix exported header
rte_acc_cfg.h relies on rte_acc_common_cfg.h.
--- drivers/baseband/acc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/baseband/acc/meson.build +1 -1
@@ -26,4 +26,4 @@ deps += ['bus_pci'] sources = files('acc_common.c', 'rte_acc100_pmd.c', 'rte_vrb_pmd.c') -headers = files('rte_acc_cfg.h') +headers = files('rte_acc_cfg.h', 'rte_acc_common_cfg.h')
Signature · 1 line
2.51.0
PATCH v3 2/7 drivers: drop export of driver headers
In reply to David MarchandMany classes are exposing driver only headers as public headers. Move them to the driver_sdk_headers list.
---
Changes since v2:
- rebased,
--- lib/bbdev/meson.build | 14 +++++++++----- lib/ethdev/meson.build | 6 +++--- lib/mldev/meson.build | 5 +---- lib/rawdev/meson.build | 3 ++- lib/regexdev/meson.build | 3 ++- lib/security/meson.build | 3 ++- 6 files changed, 19 insertions(+), 15 deletions(-)
lib/bbdev/meson.build +9 -5
@@ -1,10 +1,14 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_bbdev.c', - 'bbdev_trace_points.c') -headers = files('rte_bbdev.h', - 'rte_bbdev_pmd.h', +sources = files( + 'rte_bbdev.c', + 'bbdev_trace_points.c', +) +headers = files( + 'rte_bbdev.h', 'rte_bbdev_op.h', - 'rte_bbdev_trace_fp.h') + 'rte_bbdev_trace_fp.h', +) +driver_sdk_headers = files('rte_bbdev_pmd.h') deps += ['mbuf']
lib/ethdev/meson.build +3 -3
@@ -26,11 +26,8 @@ headers = files( 'rte_ethdev_trace_fp.h', 'rte_dev_info.h', 'rte_flow.h', - 'rte_flow_driver.h', 'rte_mtr.h', - 'rte_mtr_driver.h', 'rte_tm.h', - 'rte_tm_driver.h', ) indirect_headers += files(
@@ -42,6 +39,9 @@ driver_sdk_headers += files( 'ethdev_driver.h', 'ethdev_pci.h', 'ethdev_vdev.h', + 'rte_flow_driver.h', + 'rte_mtr_driver.h', + 'rte_tm_driver.h', ) if is_linux
lib/mldev/meson.build +1 -4
@@ -26,11 +26,8 @@ headers = files( 'rte_mldev.h', ) -indirect_headers += files( - 'rte_mldev_core.h', -) - driver_sdk_headers += files( + 'rte_mldev_core.h', 'rte_mldev_pmd.h', 'mldev_utils.h', )
lib/rawdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_rawdev.c') -headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h') +headers = files('rte_rawdev.h') +driver_sdk_headers = files('rte_rawdev_pmd.h') deps += ['telemetry']
lib/regexdev/meson.build +2 -1
@@ -2,6 +2,7 @@ # Copyright 2020 Mellanox Technologies, Ltd sources = files('rte_regexdev.c') -headers = files('rte_regexdev.h', 'rte_regexdev_driver.h') +headers = files('rte_regexdev.h') indirect_headers += files('rte_regexdev_core.h') +driver_sdk_headers = files('rte_regexdev_driver.h') deps += ['mbuf']
lib/security/meson.build +2 -1
@@ -2,5 +2,6 @@ # Copyright(c) 2017-2019 Intel Corporation sources = files('rte_security.c') -headers = files('rte_security.h', 'rte_security_driver.h') +headers = files('rte_security.h') +driver_sdk_headers = files('rte_security_driver.h') deps += ['mempool', 'cryptodev', 'net']
Signature · 1 line
2.51.0
PATCH v3 3/7 eventdev: do not include driver header in DMA adapter
In reply to David MarchandThe dma adapter header does not require including rte_dmadev_pmd.h which is a driver header.
--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_dma_adapter.h +1 -1
@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplus
Signature · 1 line
2.51.0
PATCH v3 4/7 gpudev: fix driver header for Windows
In reply to David MarchandUse rte_os.h and its RTE_TAILQ_HEAD definition compatible with BSD sys/queue.h
--- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
lib/gpudev/gpudev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdlib.h> +#include <sys/queue.h> #include <eal_export.h> #include <rte_eal.h>
lib/gpudev/gpudev_driver.h +2 -2
@@ -12,11 +12,11 @@#define RTE_GPUDEV_DRIVER_H #include <stdint.h> -#include <sys/queue.h> #include <dev_driver.h> #include <rte_compat.h> +#include <rte_os.h> #include "rte_gpudev.h" #ifdef __cplusplus
@@ -80,7 +80,7 @@ struct __rte_cache_aligned rte_gpu {/* Driver functions. */ struct rte_gpu_ops ops;/* Event callback list. */ - TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks; + RTE_TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks;/* Current state (used or not) in the running process. */ enum rte_gpu_state process_state;/* Updated by this library. */ /* Driver-specific private data for the running process. */
Signature · 1 line
2.51.0
Re: [PATCH v3 4/7] gpudev: fix driver header for Windows
Quoted 16 lines · David Marchand
Use
rte_os.hand itsRTE_TAILQ_HEADdefinition compatible with BSDsys/queue.hFixes 18cb07563165 ("gpudev: add event notification")Signed-off-by David Marchand <[email protected]>--- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)lib/gpudev/gpudev.c +0
-0
lib/gpudev/gpudev.c line 9
Quoted 7 lines
lib/gpudev/gpudev.c +1
-0@@ -3,6 +3,7 @@*/ #include <stdlib.h> +#include <sys/queue.h> #include <eal_export.h> #include <rte_eal.h>
A bit confused. Why do we add sys/queue.h here but replace it below with rte_os.h?
Quoted 29 lines
lib/gpudev/gpudev_driver.h +2
-2@@ -12,11 +12,11 @@#define RTE_GPUDEV_DRIVER_H #include <stdint.h> -#include <sys/queue.h> #include <dev_driver.h> #include <rte_compat.h> +#include <rte_os.h> #include "rte_gpudev.h" #ifdef __cplusplus@@ -80,7 +80,7 @@ struct __rte_cache_aligned rte_gpu {/* Driver functions. */ struct rte_gpu_ops ops;/* Event callback list. */ - TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks; + RTE_TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks;/* Current state (used or not) in the running process. */ enum rte_gpu_state process_state;/* Updated by this library. */ /* Driver-specific private data for the running process. */ Signature · 1 line
2.51.0
Re: [PATCH v3 4/7] gpudev: fix driver header for Windows
Hello Bruce,
Quoted 20 lines · Bruce Richardson
Quoted 18 lines · David Marchand
Use
rte_os.hand itsRTE_TAILQ_HEADdefinition compatible with BSDsys/queue.hFixes 18cb07563165 ("gpudev: add event notification")Signed-off-by David Marchand <[email protected]>--- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)lib/gpudev/gpudev.c +0
-0@@ -3,6 +3,7 @@*/
Quoted 8 lines
lib/gpudev/gpudev.c line 9
Quoted 5 lines
lib/gpudev/gpudev.c +1
-0#include <stdlib.h> +#include <sys/queue.h> #include <eal_export.h> #include <rte_eal.h> A bit confused. Why do we add
sys/queue.hhere but replace it below withrte_os.h?
I only fixed the minimum possible in the exported header.
To reuse rte_os.h here, I would have to change more code in the library as this code uses the sys/queue.h API.
(EAL Windows provides one for internal consumption, if you did not notice, see lib/eal/windows/include).
Signature · 1 line
David Marchand
PATCH v3 5/7 drivers: fix some exported headers
In reply to David MarchandThose headers could not be included individually as they were not including their dependencies, were subject to some build warnings, or were not compiling on Windows.
---
Changes since v2:
- rebased,
- dropped changes on raw/cnxk drivers,
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 ++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 7 files changed, 23 insertions(+)
drivers/bus/vmbus/rte_vmbus_reg.h +6 -0
@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +2 -0
@@ -11,8 +11,10 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> #include <rte_crypto.h> #include <rte_security.h>
drivers/net/dpaa/rte_pmd_dpaa.h +2 -0
@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h *
drivers/net/intel/iavf/rte_pmd_iavf.h +6 -0
@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h>
@@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())
@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false); +#endif } #ifdef __cplusplus
drivers/net/mlx5/rte_pmd_mlx5.h +3 -0
@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h> /**
drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h +2 -0
@@ -12,6 +12,8 @@* */ +#include <stdint.h> +#ifdef __cplusplusextern "C" {#endif
drivers/raw/ntb/rte_pmd_ntb.h +2 -0
@@ -5,6 +5,8 @@#ifndef _RTE_PMD_NTB_H_#define _RTE_PMD_NTB_H_ +#include <stdint.h> +/* App needs to set/get these attrs */ #define NTB_QUEUE_SZ_NAME "queue_size"#define NTB_QUEUE_NUM_NAME "queue_num"
Signature · 1 line
2.51.0
PATCH v3 6/7 buildtools/chkincs: use a staging directory for headers
In reply to David MarchandA problem with the current headers check is that it relies on meson dependencies objects that come with their include_directories directives, and all of those point at the library / driver sources.
This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
--- MAINTAINERS | 3 +++ buildtools/chkincs/meson.build | 41 ++++++++++++++++------------------ buildtools/meson.build | 1 + buildtools/stage-headers.py | 32 ++++++++++++++++++++++++++ drivers/meson.build | 28 ++++++++++++++++++++--- lib/eal/include/meson.build | 8 +++++++ lib/eal/meson.build | 10 +++++++++ lib/meson.build | 41 ++++++++++++++++++++++++++-------- meson.build | 4 ++++ staging/drivers/meson.build | 5 +++++ staging/meson.build | 7 ++++++ 11 files changed, 146 insertions(+), 34 deletions(-) create mode 100644 buildtools/stage-headers.py create mode 100644 staging/drivers/meson.build create mode 100644 staging/meson.build
MAINTAINERS +3 -0
@@ -131,10 +131,13 @@ F: buildtools/get-numa-count.py F: buildtools/list-dir-globs.py F: buildtools/map-list-symbol.sh F: buildtools/pkg-config/ +F: buildtools/stage-headers.py F: buildtools/symlink-drivers-solibs.sh F: buildtools/symlink-drivers-solibs.py F: devtools/test-meson-builds.sh F: devtools/check-meson.py +F: staging/drivers/meson.build +F: staging/meson.build Public CI M: Aaron Conole <[email protected]>
buildtools/chkincs/meson.build +19 -22
76 lines not on this page · raw message
buildtools/meson.build +1 -0
@@ -27,6 +27,7 @@ get_min_meson_version_cmd = py3 + files('get-min-meson-version.py') get_test_suites_cmd = py3 + files('get-test-suites.py') header_gen_cmd = py3 + files('gen-header.py') has_hugepages_cmd = py3 + files('has-hugepages.py') +stage_headers_cmd = py3 + files('stage-headers.py') cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py') check_dts_requirements = py3 + files('check-dts-requirements.py')
buildtools/stage-headers.py new file +32 -0
@@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +""" +Headers staging script for DPDK build system. +""" + +import sys +import os +import shutil +from pathlib import Path + +def main(): + if len(sys.argv) < 4: + print("Usage: stage-headers.py <staging_dir> <meson_stamp> [headers...]") + sys.exit(1) + + staging_dir = Path(sys.argv[1]) + meson_stamp = Path(sys.argv[2]) + headers = sys.argv[3:] + + staging_dir.mkdir(parents=True, exist_ok=True) + + for header in headers: + file = Path(header) + shutil.copy2(file, staging_dir / file.name) + + meson_stamp.touch() + +if __name__ == "__main__": + main()
drivers/meson.build +25 -3
@@ -245,7 +245,29 @@ foreach subpath:subdirs if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif - dpdk_chkinc_headers += driver_sdk_headers + dpdk_chkinc_headers += headers + dpdk_chkinc_driver_headers += driver_sdk_headers + + if headers.length() != 0 + staged_headers_deps += declare_dependency(sources: + custom_target(lib_name + '_header_staging', + output: lib_name + '_header_staging.stamp', + command: [stage_headers_cmd, staging_dir, '@OUTPUT@', headers], + install: false, + ) + ) + endif + + if driver_sdk_headers.length() != 0 + staged_headers_deps += declare_dependency(sources: + custom_target(lib_name + '_driver_header_staging', + output: lib_name + '_driver_header_staging.stamp', + command: [stage_headers_cmd, drivers_staging_dir, '@OUTPUT@', + driver_sdk_headers], + install: false, + ) + ) + endif if headers.length() > 0 dpdk_includes += include_directories(drv_path)
@@ -348,10 +370,10 @@ foreach subpath:subdirs # testpmd or other built-in apps can find it if necessary shared_dep = declare_dependency(link_with: shared_lib, include_directories: includes, - dependencies: shared_deps) + dependencies: shared_deps + staged_headers_deps) static_dep = declare_dependency( include_directories: includes, - dependencies: static_deps) + dependencies: static_deps + staged_headers_deps) dpdk_drivers += static_lib
lib/eal/include/meson.build +8 -0
@@ -79,3 +79,11 @@ generic_headers = files( 'generic/rte_vect.h', ) install_headers(generic_headers, subdir: 'generic') +staged_headers_deps += declare_dependency(sources: + custom_target('eal_generic_header_staging', + output: 'eal_generic_header_staging.stamp', + command: [stage_headers_cmd, join_paths(staging_dir, 'generic'), '@OUTPUT@', + generic_headers], + install: false, + ) +)
lib/eal/meson.build +10 -0
@@ -12,7 +12,17 @@ endif subdir(exec_env) +arch_headers = [] +arch_indirect_headers = [] subdir(arch_subdir) +staged_headers_deps += declare_dependency(sources: + custom_target('eal_arch_header_staging', + output: 'eal_arch_header_staging.stamp', + command: [stage_headers_cmd, staging_dir, '@OUTPUT@', + arch_headers + arch_indirect_headers], + install: false, + ) +) deps += ['log', 'kvargs'] if not is_windows
lib/meson.build +32 -9
94 lines not on this page · raw message
meson.build +4 -0
@@ -38,6 +38,7 @@ dpdk_static_libraries = [] dpdk_shared_lib_deps = [] dpdk_static_lib_deps = [] dpdk_chkinc_headers = [] +dpdk_chkinc_driver_headers = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = []
@@ -47,6 +48,8 @@ dpdk_apps_enabled = [] dpdk_libs_disabled = [] dpdk_libs_enabled = [] dpdk_drvs_disabled = [] +staging_dir = [] +drivers_staging_dir = [] testpmd_drivers_sources = [] testpmd_drivers_deps = [] abi_version_file = files('ABI_VERSION')
@@ -73,6 +76,7 @@ global_inc = [include_directories('.', 'config', )] # do configuration and get tool paths +subdir('staging') subdir('buildtools') subdir('config')
staging/drivers/meson.build new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +global_inc += [include_directories('.')] +drivers_staging_dir = meson.current_build_dir()
staging/meson.build new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +global_inc += [include_directories('.')] +staging_dir = meson.current_build_dir() + +subdir('drivers')
Signature · 1 line
2.51.0
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 7 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
Quoted 7 lines
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Signed-off-by David Marchand <[email protected]>
In general looks ok to me.
One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, or even the chkincs directory? I dislike having too many subdirectories directly off the root of the project, especially ones purely for internal tooling.
Quoted 17 lines
--- MAINTAINERS | 3 +++ buildtools/chkincs/meson.build | 41 ++++++++++++++++------------------ buildtools/meson.build | 1 + buildtools/stage-headers.py | 32 ++++++++++++++++++++++++++ drivers/meson.build | 28 ++++++++++++++++++++--- lib/eal/include/meson.build | 8 +++++++ lib/eal/meson.build | 10 +++++++++ lib/meson.build | 41 ++++++++++++++++++++++++++-------- meson.build | 4 ++++ staging/drivers/meson.build | 5 +++++ staging/meson.build | 7 ++++++ 11 files changed, 146 insertions(+), 34 deletions(-) create mode 100644 buildtools/stage-headers.py create mode 100644 staging/drivers/meson.build create mode 100644 staging/meson.build
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
Hello Bruce,
Quoted 15 lines · Bruce Richardson
Quoted 13 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Quoted 7 lines
Quoted 1 line
Signed-off-by David Marchand <[email protected]>In general looks ok to me.
One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, or even the chkincs directory? I dislike having too many subdirectories directly off the root of the project, especially ones purely for internal tooling.
Well, at first I was trying to change the whole build process iow rely only on the staging directory and remove all the include_directories:
directives from the declare_dependency() objects.
Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute force this :-).
For now, I gave up but did not reconsider the location of the staging part. Moving to buildtools is indeed saner as it is only for the check now, and I can also make this staging stuff dependent on the check_includes option now.
I have a strange build error with Windows + clang target that I'll need to understand (maybe a problem in how we reference DPDK public headers via "" instead of <>?).
Signature · 1 line
David Marchand
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 27 lines · David Marchand
Hello Bruce,
Quoted 15 lines · Bruce Richardson
Quoted 13 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Quoted 7 lines
Quoted 1 line
Signed-off-by David Marchand <[email protected]>In general looks ok to me. One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, or even the chkincs directory? I dislike having too many subdirectories directly off the root of the project, especially ones purely for internal tooling.
Quoted 8 lines
Well, at first I was trying to change the whole build process iow rely only on the staging directory and remove all the
include_directories:
directives from thedeclare_dependency()objects. Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute force this :-).
One note of caution here: if doing this, you may want to consider using run_command rather than a custom_target to copy the headers in order to avoid potentially slowing down the build.
We used to do this copying of header files in the old make build system, and one downside of it is that it means that the build of ".c" files in one directory cannot be started until the copying of headers from the dependent components are completed. The decision to use the include paths in the dependency objects rather than copying the headers to a central location was a deliberate decision when moving build system because it means that when you run "ninja", every single .c file can be compiled to a .o file in parallel, because all dependent headers are available at their original locations. For most components, it's only the final link stage that has any dependencies, the compile commands are all independent.
On the other hand, using run_command is not necessarily a good solution either, because it means that all changes to the headers require a re-run of meson, which will also be slower because of all the copying. :-(
Therefore, I'd tend towards keeping things as they are here, in order to minimise reconfiguration and build times.
/Bruce
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 52 lines · Bruce Richardson
Quoted 27 lines · David Marchand
Hello Bruce,
Quoted 15 lines · Bruce Richardson
Quoted 13 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Quoted 7 lines
Quoted 1 line
Signed-off-by David Marchand <[email protected]>In general looks ok to me. One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, or even the chkincs directory? I dislike having too many subdirectories directly off the root of the project, especially ones purely for internal tooling.
Quoted 8 lines
Well, at first I was trying to change the whole build process iow rely only on the staging directory and remove all the
include_directories:
directives from thedeclare_dependency()objects. Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute force this :-).One note of caution here: if doing this, you may want to consider using
run_commandrather than acustom_targetto copy the headers in order to avoid potentially slowing down the build.We used to do this copying of header files in the old make build system, and one downside of it is that it means that the build of ".c" files in one directory cannot be started until the copying of headers from the dependent components are completed. The decision to use the include paths in the dependency objects rather than copying the headers to a central location was a deliberate decision when moving build system because it means that when you run "ninja", every single .c file can be compiled to a .o file in parallel, because all dependent headers are available at their original locations. For most components, it's only the final link stage that has any dependencies, the compile commands are all independent.
Quoted 6 lines
On the other hand, using
run_commandis not necessarily a good solution either, because it means that all changes to the headers require a re-run of meson, which will also be slower because of all the copying. :-(Therefore, I'd tend towards keeping things as they are here, in order to minimise reconfiguration and build times.
I am sticking to the headers check update atm.
The slow down should only concern developers using check_includes, once I properly gate those deps to the meson option.
Is it still a concern for you?
Signature · 1 line
David Marchand
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 58 lines · David Marchand
Quoted 56 lines · Bruce Richardson
Quoted 27 lines · David Marchand
Hello Bruce,
Quoted 15 lines · Bruce Richardson
Quoted 13 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Quoted 7 lines
Quoted 1 line
Signed-off-by David Marchand <[email protected]>In general looks ok to me. One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, or even the chkincs directory? I dislike having too many subdirectories directly off the root of the project, especially ones purely for internal tooling.
Quoted 8 lines
Well, at first I was trying to change the whole build process iow rely only on the staging directory and remove all the
include_directories:
directives from thedeclare_dependency()objects. Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute force this :-).One note of caution here: if doing this, you may want to consider using
run_commandrather than acustom_targetto copy the headers in order to avoid potentially slowing down the build.We used to do this copying of header files in the old make build system, and one downside of it is that it means that the build of ".c" files in one directory cannot be started until the copying of headers from the dependent components are completed. The decision to use the include paths in the dependency objects rather than copying the headers to a central location was a deliberate decision when moving build system because it means that when you run "ninja", every single .c file can be compiled to a .o file in parallel, because all dependent headers are available at their original locations. For most components, it's only the final link stage that has any dependencies, the compile commands are all independent.
On the other hand, using
run_commandis not necessarily a good solution either, because it means that all changes to the headers require a re-run of meson, which will also be slower because of all the copying. :-(
Quoted 9 lines
Quoted 2 lines
Therefore, I'd tend towards keeping things as they are here, in order to minimise reconfiguration and build times.
I am sticking to the headers check update atm.
The slow down should only concern developers usingcheck_includes, once I properly gate those deps to the meson option.Is it still a concern for you?
No, no concerns about copying the headers over for check_includes checks, that makes sense. I'm just flagging a potential issue if you want to switch back to the old model of copying the headers as part of a normal build.
/Bruce
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
In reply to David MarchandQuoted 35 lines · David Marchand
Hello Bruce,
Quoted 15 lines · Bruce Richardson
Quoted 13 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Quoted 7 lines
Quoted 1 line
Signed-off-by David Marchand <[email protected]>In general looks ok to me.
One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, or even the chkincs directory? I dislike having too many subdirectories directly off the root of the project, especially ones purely for internal tooling.Well, at first I was trying to change the whole build process iow rely only on the staging directory and remove all the
include_directories:
directives from thedeclare_dependency()objects.
Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute force this :-).
Quoted 5 lines
For now, I gave up but did not reconsider the location of the staging part. Moving to buildtools is indeed saner as it is only for the check now, and I can also make this staging stuff dependent on the
check_includesoption now.
I wonder should we just consider making chkincs an install-time job rather than a build-time one? We could look to build chkincs using a custom install script (meson.add_install_script) after the header copies are already done for us. That should cut down on the complexity within the build system, but it does mean an additional install step to a temporary directory to get it to run. However, for use in our CI I don't see why having an install step with DEST_DIR set to /tmp shouldn't be feasible.
/Bruce
RE: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 57 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 25 September 2025 11.32Quoted 8 lines · David Marchand
Hello Bruce,
Quoted 4 lines · Bruce Richardson
Quoted 2 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesQuoted 1 line
Quoted 1 line
Quoted 1 line
directives, and all of those point at the library / driver
sources.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This means that we won't detect a public header including a
private
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every
header
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
is copied to it.
Drivers and library headers are staged to two different
directories
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
and the check is updated accordingly.
Signed-off-by David Marchand <[email protected]>In general looks ok to me.
One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, oreven the
Quoted 1 line
Quoted 1 line
chkincs directory? I dislike having too many subdirectories
directly off
Quoted 1 line
Quoted 1 line
the root of the project, especially ones purely for internal
tooling.
Quoted 2 lines
Well, at first I was trying to change the whole build process iow
rely
Quoted 6 lines
only on the staging directory and remove all the
include_directories:
directives from thedeclare_dependency()objects. Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute forcethis :-).
Quoted 2 lines
For now, I gave up but did not reconsider the location of the staging
part.
Quoted 2 lines
Moving to buildtools is indeed saner as it is only for the check now, and I can also make this staging stuff dependent on the
check_includesQuoted 2 lines
option now.
Quoted 9 lines
I wonder should we just consider making chkincs an install-time job rather
than a build-time one? We could look to build chkincs using a custom install script (meson.add_install_script) after the header copies are already done for us. That should cut down on the complexity within the build system, but it does mean an additional install step to a temporary
directory to get it to run. However, for use in our CI I don't see why having an install step withDEST_DIRset to /tmp shouldn't be feasible.
Such a temporary directory should be local to the developer's working directory. (The CI might have different needs; that's not what I'm commenting.)
Furthermore, test building for upstreaming should remain simple. I use something like:
meson setup -Dplatform=generic -Dcheck_includes=true build
ninja -C build
Disclaimer: Haven't really followed this discussion, so maybe my comments above are irrelevant.
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 67 lines · Morten Brørup
Quoted 57 lines
From: Bruce Richardson [mailto:[email protected]]
Sent: Thursday, 25 September 2025 11.32Quoted 8 lines · David Marchand
Hello Bruce,
Quoted 4 lines · Bruce Richardson
Quoted 2 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesQuoted 1 line
Quoted 1 line
Quoted 1 line
directives, and all of those point at the library / driver
sources.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This means that we won't detect a public header including a
private
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every
header
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
is copied to it.
Drivers and library headers are staged to two different
directories
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
and the check is updated accordingly.
Signed-off-by David Marchand <[email protected]>In general looks ok to me.
One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, oreven the
Quoted 1 line
Quoted 1 line
chkincs directory? I dislike having too many subdirectories
directly off
Quoted 1 line
Quoted 1 line
the root of the project, especially ones purely for internal
tooling.
Quoted 2 lines
Well, at first I was trying to change the whole build process iow
rely
Quoted 6 lines
only on the staging directory and remove all the
include_directories:
directives from thedeclare_dependency()objects. Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute forcethis :-).
Quoted 2 lines
For now, I gave up but did not reconsider the location of the staging
part.
Quoted 2 lines
Moving to buildtools is indeed saner as it is only for the check now, and I can also make this staging stuff dependent on the
check_includesQuoted 2 lines
option now.
Quoted 9 lines
I wonder should we just consider making chkincs an install-time job rather
than a build-time one? We could look to build chkincs using a custom install script (meson.add_install_script) after the header copies are already done for us. That should cut down on the complexity within the build system, but it does mean an additional install step to a temporary
directory to get it to run. However, for use in our CI I don't see why having an install step withDEST_DIRset to /tmp shouldn't be feasible.
Quoted 7 lines
Such a temporary directory should be local to the developer's working directory. (The CI might have different needs; that's not what I'm commenting.)
Furthermore, test building for upstreaming should remain simple. I use something like:
meson setup -Dplatform=generic -Dcheck_includes=true build
ninja -C build
Build testing for upstreaming should really be done using test-meson-builds.sh to test a variety of scenarios and cross-compilation - including 32-bit - if possible. That script also does a test install, so running the check_includes from the install step would be automatically covered there.
/Bruce
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
In reply to Bruce RichardsonQuoted 20 lines · Bruce Richardson
Quoted 14 lines
Quoted 5 lines
In general looks ok to me.
One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, or even the chkincs directory? I dislike having too many subdirectories directly off the root of the project, especially ones purely for internal tooling.Well, at first I was trying to change the whole build process iow rely only on the staging directory and remove all the
include_directories:
directives from thedeclare_dependency()objects.
Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute force this :-).Quoted 5 lines
For now, I gave up but did not reconsider the location of the staging part. Moving to buildtools is indeed saner as it is only for the check now, and I can also make this staging stuff dependent on the
check_includesoption now.
Quoted 4 lines
I wonder should we just consider making chkincs an install-time job rather than a build-time one? We could look to build chkincs using a custom install script (meson.add_install_script) after the header copies are already done for us. That should cut down on the complexity within the
Not sure I follow, what would this install script look like? Is it not similar to the makefile solution I proposed previously?
Quoted 3 lines
build system, but it does mean an additional install step to a temporary directory to get it to run. However, for use in our CI I don't see why having an install step with
DEST_DIRset to /tmp shouldn't be feasible.
Signature · 1 line
David Marchand
Re: [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 22 lines · David Marchand
Quoted 20 lines · Bruce Richardson
Quoted 19 lines
Quoted 5 lines
In general looks ok to me.
One small comment though - can we not have "staging" as a top-level directory, but instead hide it inside the buildtools directory, or even the chkincs directory? I dislike having too many subdirectories directly off the root of the project, especially ones purely for internal tooling.Well, at first I was trying to change the whole build process iow rely only on the staging directory and remove all the
include_directories:
directives from thedeclare_dependency()objects.
Libraries and apps were ok, but there were a *lot* of complications with drivers (what a *huge mess*, especially for NXP drivers with "compat.h" includes, and Marvell drivers to a smaller extent). I may retry in the future with some AI tool that will brute force this :-).For now, I gave up but did not reconsider the location of the staging part. Moving to buildtools is indeed saner as it is only for the check now, and I can also make this staging stuff dependent on the
check_includesoption now.
Quoted 8 lines
Quoted 4 lines
I wonder should we just consider making chkincs an install-time job rather than a build-time one? We could look to build chkincs using a custom install script (meson.add_install_script) after the header copies are already done for us. That should cut down on the complexity within the
Not sure I follow, what would this install script look like? Is it not similar to the makefile solution I proposed previously?
I don't remember that proposal, sorry, so it may well be something you proposed previously!
/Bruce
PATCH v3 7/7 power: separate public and driver headers
In reply to David Marchandpower_cpufreq.h, power_common.h and power_uncore_ops.h look like driver only headers, but were included from public headers.
Move them to the driver_sdk_headers list.
There is one complication though for power_cpufreq.h as it was included from a public header rte_power_cpufreq.h.
Move the rte_power_core_capabilities struct definition to the public header, since a (stable) public symbol relies on it.
--- lib/power/meson.build | 7 +++++-- lib/power/power_cpufreq.h | 14 +------------- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++++++++++++-- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 ++- 7 files changed, 24 insertions(+), 20 deletions(-)
lib/power/meson.build +5 -2
@@ -22,12 +22,15 @@ sources = files( 'rte_power_uncore.c', ) headers = files( - 'power_cpufreq.h', - 'power_uncore_ops.h', 'rte_power_cpufreq.h', 'rte_power_pmd_mgmt.h', 'rte_power_qos.h', 'rte_power_uncore.h', ) +driver_sdk_headers = files( + 'power_common.h', + 'power_cpufreq.h', + 'power_uncore_ops.h', +) deps += ['timer', 'ethdev']
lib/power/power_cpufreq.h +1 -13
@@ -14,6 +14,7 @@#include <rte_common.h> #include <rte_log.h> #include <rte_compat.h> +#include <rte_power_cpufreq.h> #define RTE_POWER_DRIVER_NAMESZ 24
@@ -131,19 +132,6 @@ typedef int (*rte_power_freq_change_t)(unsigned int lcore_id);* - Negative on error. */ -/** -* Power capabilities summary. -*/ -struct rte_power_core_capabilities { -union { -uint64_t capabilities; -struct { -uint64_t turbo:1 ;/**< Turbo can be enabled. */ -uint64_t priority:1 ;/**< SST-BF high freq core */ - }; - }; -}; -typedef int (*rte_power_get_capabilities_t )(unsigned int lcore_id,struct rte_power_core_capabilities *caps);
lib/power/power_uncore_ops.h +1 -0
@@ -13,6 +13,7 @@#include <rte_compat.h> #include <rte_common.h> +#include <rte_power_uncore.h> #define RTE_POWER_UNCORE_DRIVER_NAMESZ 24
lib/power/rte_power_cpufreq.c +1 -1
@@ -6,8 +6,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_cpufreq.h" #include "power_common.h" +#include "power_cpufreq.h" static enum power_management_env global_default_env =PM_ENV_NOT_SET ;static struct rte_power_cpufreq_ops *global_cpufreq_ops;
lib/power/rte_power_cpufreq.h +13 -2
@@ -14,8 +14,6 @@#include <rte_common.h> #include <rte_log.h> -#include "power_cpufreq.h" -#ifdef __cplusplusextern "C" {#endif
@@ -248,6 +246,19 @@ int rte_power_freq_enable_turbo(unsigned int lcore_id);*/ int rte_power_freq_disable_turbo (unsigned int lcore_id); +/** +* Power capabilities summary. +*/ +struct rte_power_core_capabilities { +union { +uint64_t capabilities; +struct { +uint64_t turbo:1 ;/**< Turbo can be enabled. */ +uint64_t priority:1 ;/**< SST-BF high freq core */ + }; + }; +}; +/** * Returns power capabilities for a specific lcore. * Function pointer definition. Review each environments
lib/power/rte_power_uncore.c +1 -1
@@ -7,8 +7,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_uncore.h" #include "power_common.h" +#include "power_uncore_ops.h" static enum rte_uncore_power_mgmt_env global_uncore_env =RTE_UNCORE_PM_ENV_NOT_SET ;static struct rte_power_uncore_ops *global_uncore_ops;
lib/power/rte_power_uncore.h +2 -1
@@ -11,7 +11,8 @@* Uncore Frequency Management */ -#include "power_uncore_ops.h" +#include <rte_compat.h> +#include <rte_common.h> #ifdef __cplusplusextern "C" {
Signature · 1 line
2.51.0
v4 cover Add a stricter headers check
In reply to David MarchandAs explained in patch 6, the current headers check can not catch issues when a public header includes an internal header.
Patch 1-5 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling enable_driver_sdk option).
Signature · 64 lines
David Marchand Changes since v3: - narrowed down the changes under a check on check_includes= option, - moved the staging directories under buildtools/chkincs, Changes since v2: - major rework, dropping the makefile approach, and instead copying headers to a staging directory used by the check, - rebased, - dropped changes on raw cnxk drivers and disabled the associated build warning in the headers check, David Marchand (7): baseband/acc: fix exported header drivers: drop export of driver headers eventdev: do not include driver header in DMA adapter gpudev: fix driver header for Windows drivers: fix some exported headers buildtools/chkincs: use a staging directory for headers power: separate public and driver headers MAINTAINERS | 1 + buildtools/chkincs/meson.build | 69 +++++++++++++------ .../chkincs/staging/drivers/meson.build | 4 ++ buildtools/chkincs/staging/meson.build | 5 ++ buildtools/meson.build | 1 + buildtools/stage-headers.py | 32 +++++++++ drivers/baseband/acc/meson.build | 2 +- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 + drivers/meson.build | 26 ++++++- drivers/net/dpaa/rte_pmd_dpaa.h | 2 + drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 + drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 + drivers/raw/ntb/rte_pmd_ntb.h | 2 + lib/bbdev/meson.build | 14 ++-- lib/eal/include/meson.build | 10 +++ lib/eal/meson.build | 12 ++++ lib/ethdev/meson.build | 6 +- lib/eventdev/rte_event_dma_adapter.h | 2 +- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 +- lib/meson.build | 27 +++++++- lib/mldev/meson.build | 5 +- lib/power/meson.build | 7 +- lib/power/power_cpufreq.h | 14 +--- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 +- lib/rawdev/meson.build | 3 +- lib/regexdev/meson.build | 3 +- lib/security/meson.build | 3 +- meson.build | 8 +++ 35 files changed, 242 insertions(+), 63 deletions(-) create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build create mode 100644 buildtools/stage-headers.py -- 2.51.0
PATCH v4 1/7 baseband/acc: fix exported header
rte_acc_cfg.h relies on rte_acc_common_cfg.h.
--- drivers/baseband/acc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/baseband/acc/meson.build +1 -1
@@ -26,4 +26,4 @@ deps += ['bus_pci'] sources = files('acc_common.c', 'rte_acc100_pmd.c', 'rte_vrb_pmd.c') -headers = files('rte_acc_cfg.h') +headers = files('rte_acc_cfg.h', 'rte_acc_common_cfg.h')
Signature · 1 line
2.51.0
PATCH v4 2/7 drivers: drop export of driver headers
In reply to David MarchandMany classes are exposing driver only headers as public headers. Move them to the driver_sdk_headers list.
---
Changes since v2:
- rebased,
--- lib/bbdev/meson.build | 14 +++++++++----- lib/ethdev/meson.build | 6 +++--- lib/mldev/meson.build | 5 +---- lib/rawdev/meson.build | 3 ++- lib/regexdev/meson.build | 3 ++- lib/security/meson.build | 3 ++- 6 files changed, 19 insertions(+), 15 deletions(-)
lib/bbdev/meson.build +9 -5
@@ -1,10 +1,14 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_bbdev.c', - 'bbdev_trace_points.c') -headers = files('rte_bbdev.h', - 'rte_bbdev_pmd.h', +sources = files( + 'rte_bbdev.c', + 'bbdev_trace_points.c', +) +headers = files( + 'rte_bbdev.h', 'rte_bbdev_op.h', - 'rte_bbdev_trace_fp.h') + 'rte_bbdev_trace_fp.h', +) +driver_sdk_headers = files('rte_bbdev_pmd.h') deps += ['mbuf']
lib/ethdev/meson.build +3 -3
@@ -26,11 +26,8 @@ headers = files( 'rte_ethdev_trace_fp.h', 'rte_dev_info.h', 'rte_flow.h', - 'rte_flow_driver.h', 'rte_mtr.h', - 'rte_mtr_driver.h', 'rte_tm.h', - 'rte_tm_driver.h', ) indirect_headers += files(
@@ -42,6 +39,9 @@ driver_sdk_headers += files( 'ethdev_driver.h', 'ethdev_pci.h', 'ethdev_vdev.h', + 'rte_flow_driver.h', + 'rte_mtr_driver.h', + 'rte_tm_driver.h', ) if is_linux
lib/mldev/meson.build +1 -4
@@ -26,11 +26,8 @@ headers = files( 'rte_mldev.h', ) -indirect_headers += files( - 'rte_mldev_core.h', -) - driver_sdk_headers += files( + 'rte_mldev_core.h', 'rte_mldev_pmd.h', 'mldev_utils.h', )
lib/rawdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_rawdev.c') -headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h') +headers = files('rte_rawdev.h') +driver_sdk_headers = files('rte_rawdev_pmd.h') deps += ['telemetry']
lib/regexdev/meson.build +2 -1
@@ -2,6 +2,7 @@ # Copyright 2020 Mellanox Technologies, Ltd sources = files('rte_regexdev.c') -headers = files('rte_regexdev.h', 'rte_regexdev_driver.h') +headers = files('rte_regexdev.h') indirect_headers += files('rte_regexdev_core.h') +driver_sdk_headers = files('rte_regexdev_driver.h') deps += ['mbuf']
lib/security/meson.build +2 -1
@@ -2,5 +2,6 @@ # Copyright(c) 2017-2019 Intel Corporation sources = files('rte_security.c') -headers = files('rte_security.h', 'rte_security_driver.h') +headers = files('rte_security.h') +driver_sdk_headers = files('rte_security_driver.h') deps += ['mempool', 'cryptodev', 'net']
Signature · 1 line
2.51.0
RE: [EXTERNAL] [PATCH v4 2/7] drivers: drop export of driver headers
Quoted 10 lines
Many classes are exposing driver only headers as public headers. Move them to the
driver_sdk_headerslist.Signed-off-by David Marchand <[email protected]>Acked-by Bruce Richardson <[email protected]>Acked-by Andrew Rybchenko <[email protected]>---
Changes since v2:
- rebased,
PATCH v4 3/7 eventdev: do not include driver header in DMA adapter
In reply to David MarchandThe dma adapter header does not require including rte_dmadev_pmd.h which is a driver header.
--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_dma_adapter.h +1 -1
@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplus
Signature · 1 line
2.51.0
PATCH v4 4/7 gpudev: fix driver header for Windows
In reply to David MarchandUse rte_os.h and its RTE_TAILQ_HEAD definition compatible with BSD sys/queue.h
--- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
lib/gpudev/gpudev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdlib.h> +#include <sys/queue.h> #include <eal_export.h> #include <rte_eal.h>
lib/gpudev/gpudev_driver.h +2 -2
@@ -12,11 +12,11 @@#define RTE_GPUDEV_DRIVER_H #include <stdint.h> -#include <sys/queue.h> #include <dev_driver.h> #include <rte_compat.h> +#include <rte_os.h> #include "rte_gpudev.h" #ifdef __cplusplus
@@ -80,7 +80,7 @@ struct __rte_cache_aligned rte_gpu {/* Driver functions. */ struct rte_gpu_ops ops;/* Event callback list. */ - TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks; + RTE_TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks;/* Current state (used or not) in the running process. */ enum rte_gpu_state process_state;/* Updated by this library. */ /* Driver-specific private data for the running process. */
Signature · 1 line
2.51.0
Re: [PATCH v4 4/7] gpudev: fix driver header for Windows
Quoted 10 lines · David Marchand
Use
rte_os.hand itsRTE_TAILQ_HEADdefinition compatible with BSDsys/queue.hFixes 18cb07563165 ("gpudev: add event notification")Signed-off-by David Marchand <[email protected]>--- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 1 line
PATCH v4 5/7 drivers: fix some exported headers
In reply to David MarchandThose headers could not be included individually as they were not including their dependencies, were subject to some build warnings, or were not compiling on Windows.
---
Changes since v2:
- rebased,
- dropped changes on raw/cnxk drivers,
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 ++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 7 files changed, 23 insertions(+)
drivers/bus/vmbus/rte_vmbus_reg.h +6 -0
@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +2 -0
@@ -11,8 +11,10 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> #include <rte_crypto.h> #include <rte_security.h>
drivers/net/dpaa/rte_pmd_dpaa.h +2 -0
@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h *
drivers/net/intel/iavf/rte_pmd_iavf.h +6 -0
@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h>
@@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())
@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false); +#endif } #ifdef __cplusplus
drivers/net/mlx5/rte_pmd_mlx5.h +3 -0
@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h> /**
drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h +2 -0
@@ -12,6 +12,8 @@* */ +#include <stdint.h> +#ifdef __cplusplusextern "C" {#endif
drivers/raw/ntb/rte_pmd_ntb.h +2 -0
@@ -5,6 +5,8 @@#ifndef _RTE_PMD_NTB_H_#define _RTE_PMD_NTB_H_ +#include <stdint.h> +/* App needs to set/get these attrs */ #define NTB_QUEUE_SZ_NAME "queue_size"#define NTB_QUEUE_NUM_NAME "queue_num"
Signature · 1 line
2.51.0
Re: [PATCH v4 5/7] drivers: fix some exported headers
Quoted 15 lines · David Marchand
Those headers could not be included individually as they were not including their dependencies, were subject to some build warnings, or were not compiling on Windows.
Fixes 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")Fixes 5b2a1a02dcaf ("crypto/cnxk: fix experimental version for PMD API")Fixes e5abbeeeefa5 ("crypto/cnxk: add PMD API for getting CPTR")Fixes 3ca607402c4d ("crypto/cnxk: add PMD API to flush CTX")Fixes 8c3495f5d2dd ("net/dpaa: support loopback API")Fixes 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")Fixes 23f627e0ed28 ("net/mlx5: add flow sync API")Fixes f5177bdc8b76 ("net/mlx5: add GENEVE TLV options parser API")Fixes 53c71586c789 ("raw/dpaa2_cmdif: support enqueue/dequeue operations")Fixes c39d1e082a4b ("raw/ntb: setup queues")
Quoted 2 lines
Signed-off-by David Marchand <[email protected]>---
PATCH v4 6/7 buildtools/chkincs: use a staging directory for headers
In reply to David MarchandA problem with the current headers check is that it relies on meson dependencies objects that come with their include_directories directives, and all of those point at the library / driver sources.
This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
---
Changes since v3:
- removed update of global_inc (which was unneeded, and probably was what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),
--- MAINTAINERS | 1 + buildtools/chkincs/meson.build | 69 +++++++++++++------ .../chkincs/staging/drivers/meson.build | 4 ++ buildtools/chkincs/staging/meson.build | 5 ++ buildtools/meson.build | 1 + buildtools/stage-headers.py | 32 +++++++++ drivers/meson.build | 26 ++++++- lib/eal/include/meson.build | 10 +++ lib/eal/meson.build | 12 ++++ lib/meson.build | 27 +++++++- meson.build | 8 +++ 11 files changed, 171 insertions(+), 24 deletions(-) create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build create mode 100644 buildtools/stage-headers.py
MAINTAINERS +1 -0
@@ -131,6 +131,7 @@ F: buildtools/get-numa-count.py F: buildtools/list-dir-globs.py F: buildtools/map-list-symbol.sh F: buildtools/pkg-config/ +F: buildtools/stage-headers.py F: buildtools/symlink-drivers-solibs.sh F: buildtools/symlink-drivers-solibs.py F: devtools/test-meson-builds.sh
buildtools/chkincs/meson.build +47 -22
106 lines not on this page · raw message
buildtools/chkincs/staging/drivers/meson.build new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +dpdk_chkinc_drivers_staging_dir = meson.current_build_dir()
buildtools/chkincs/staging/meson.build new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +dpdk_chkinc_staging_dir = meson.current_build_dir() +subdir('drivers')
buildtools/meson.build +1 -0
@@ -27,6 +27,7 @@ get_min_meson_version_cmd = py3 + files('get-min-meson-version.py') get_test_suites_cmd = py3 + files('get-test-suites.py') header_gen_cmd = py3 + files('gen-header.py') has_hugepages_cmd = py3 + files('has-hugepages.py') +stage_headers_cmd = py3 + files('stage-headers.py') cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py') check_dts_requirements = py3 + files('check-dts-requirements.py')
buildtools/stage-headers.py new file +32 -0
@@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +""" +Headers staging script for DPDK build system. +""" + +import sys +import os +import shutil +from pathlib import Path + +def main(): + if len(sys.argv) < 4: + print("Usage: stage-headers.py <staging_dir> <meson_stamp> [headers...]") + sys.exit(1) + + staging_dir = Path(sys.argv[1]) + meson_stamp = Path(sys.argv[2]) + headers = sys.argv[3:] + + staging_dir.mkdir(parents=True, exist_ok=True) + + for header in headers: + file = Path(header) + shutil.copy2(file, staging_dir / file.name) + + meson_stamp.touch() + +if __name__ == "__main__": + main()
drivers/meson.build +25 -1
@@ -245,7 +245,31 @@ foreach subpath:subdirs if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif - dpdk_chkinc_headers += driver_sdk_headers + dpdk_chkinc_headers += headers + dpdk_chkinc_drivers_headers += driver_sdk_headers + + if get_option('check_includes') + if headers.length() > 0 + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target(lib_name + '_header_staging', + output: lib_name + '_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@', + headers], + install: false, + ) + ) + endif + if driver_sdk_headers.length() > 0 + dpdk_chkinc_drivers_staging_deps += declare_dependency(sources: + custom_target(lib_name + '_driver_header_staging', + output: lib_name + '_driver_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_drivers_staging_dir, + '@OUTPUT@', driver_sdk_headers], + install: false, + ) + ) + endif + endif if headers.length() > 0 dpdk_includes += include_directories(drv_path)
lib/eal/include/meson.build +10 -0
@@ -79,3 +79,13 @@ generic_headers = files( 'generic/rte_vect.h', ) install_headers(generic_headers, subdir: 'generic') +if get_option('check_includes') + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target('eal_generic_header_staging', + output: 'eal_generic_header_staging.stamp', + command: [stage_headers_cmd, join_paths(dpdk_chkinc_staging_dir, 'generic'), + '@OUTPUT@', generic_headers], + install: false, + ) + ) +endif
lib/eal/meson.build +12 -0
@@ -12,7 +12,19 @@ endif subdir(exec_env) +arch_headers = [] +arch_indirect_headers = [] subdir(arch_subdir) +if get_option('check_includes') + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target('eal_arch_header_staging', + output: 'eal_arch_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@', + arch_headers + arch_indirect_headers], + install: false, + ) + ) +endif deps += ['log', 'kvargs'] if not is_windows
lib/meson.build +26 -1
@@ -214,7 +214,32 @@ foreach l:libraries install_headers(driver_sdk_headers) endif dpdk_chkinc_headers += headers - dpdk_chkinc_headers += driver_sdk_headers + dpdk_chkinc_drivers_headers += driver_sdk_headers + + if get_option('check_includes') + lib_headers = headers + indirect_headers + if lib_headers.length() != 0 + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target(l + '_header_staging', + output: l + '_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@', + lib_headers], + install: false, + ) + ) + endif + + if driver_sdk_headers.length() != 0 + dpdk_chkinc_drivers_staging_deps += declare_dependency(sources: + custom_target(l + '_driver_header_staging', + output: l + '_driver_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_drivers_staging_dir, + '@OUTPUT@', driver_sdk_headers], + install: false, + ) + ) + endif + endif libname = 'rte_' + name includes += include_directories(l)
meson.build +8 -0
@@ -38,6 +38,11 @@ dpdk_static_libraries = [] dpdk_shared_lib_deps = [] dpdk_static_lib_deps = [] dpdk_chkinc_headers = [] +dpdk_chkinc_staging_dir = [] +dpdk_chkinc_staging_deps = [] +dpdk_chkinc_drivers_headers = [] +dpdk_chkinc_drivers_staging_dir = [] +dpdk_chkinc_drivers_staging_deps = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = []
@@ -74,6 +79,9 @@ global_inc = [include_directories('.', 'config', # do configuration and get tool paths subdir('buildtools') +if get_option('check_includes') + subdir('buildtools/chkincs/staging') +endif subdir('config') if is_linux
Signature · 1 line
2.51.0
Re: [PATCH v4 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 14 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Signed-off-by David Marchand <[email protected]>
Quoted 11 lines
---
Changes since v3:
- removed update ofglobal_inc(which was unneeded, and probably was what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),
Hi,
a few ideas and suggestions inline below. One I feel most strongly about is removing the extra meson.build files and just assigning the paths at init time to save the extra subdir calls. Otherwise, with or without any of the other suggestions:
Quoted 35 lines
--- MAINTAINERS | 1 + buildtools/chkincs/meson.build | 69 +++++++++++++------ .../chkincs/staging/drivers/meson.build | 4 ++ buildtools/chkincs/staging/meson.build | 5 ++ buildtools/meson.build | 1 + buildtools/stage-headers.py | 32 +++++++++ drivers/meson.build | 26 ++++++- lib/eal/include/meson.build | 10 +++ lib/eal/meson.build | 12 ++++ lib/meson.build | 27 +++++++- meson.build | 8 +++ 11 files changed, 171 insertions(+), 24 deletions(-) create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build create mode 100644 buildtools/stage-headers.pyMAINTAINERS +1
-0@@ -131,6 +131,7 @@ F: buildtools/get-numa-count.py F: buildtools/list-dir-globs.py F: buildtools/map-list-symbol.sh F: buildtools/pkg-config/ +F: buildtools/stage-headers.py F: buildtools/symlink-drivers-solibs.sh F: buildtools/symlink-drivers-solibs.py F: devtools/test-meson-builds.shbuildtools/chkincs/meson.build +0
-0
buildtools/chkincs/meson.build gen_c_files = generator(gen_c_file_for_header, · line 20
Quoted 9 lines
buildtools/chkincs/meson.build +4
-0@@ -12,38 +12,47 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args +cflags += '-Wno-missing-field-initializers' cflags += no_wvla_cflag +cflags += '-I' + dpdk_source_root + '/config' +cflags += '-I' + dpdk_build_root +cflags += '-I' + dpdk_chkinc_staging_dir
Two minor suggestions, 1) should we not use "include_directories()" here to pass these properly? and 2) would using the existing "global_inc" value as include path not work ok? Is the reason for not using the latter the fact it includes too many source dirs?
Quoted 104 lines
buildtools/chkincs/meson.build +43
-22sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) -# some driver SDK headers depend on these two buses, which are mandatory in build -# so we always include them in deps list -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] -if dpdk_conf.has('RTE_BUS_VMBUS') - deps += get_variable('shared_rte_bus_vmbus') -endif -# add the rest of the libs to the dependencies -foreach l:dpdk_libs_enabled - deps += get_variable('shared_rte_' + l) -endforeach +cflags_drivers = '-I' + dpdk_chkinc_drivers_staging_dir +sources_drivers = files('main.c') +sources_drivers += gen_c_files.process(dpdk_chkinc_drivers_headers) executable('chkincs', sources, c_args: cflags, - include_directories: includes, - dependencies: deps, + dependencies: dpdk_chkinc_staging_deps, install: false) executable('chkincs-exp', sources, c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], - include_directories: includes, - dependencies: deps, + dependencies: dpdk_chkinc_staging_deps, install: false) executable('chkincs-all', sources, c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], - include_directories: includes, - dependencies: deps, + dependencies: dpdk_chkinc_staging_deps, + install: false) + +executable('chkincs-drv', sources_drivers, + c_args: [cflags, cflags_drivers], + dependencies: dpdk_chkinc_staging_deps + dpdk_chkinc_drivers_staging_deps, + install: false) + +executable('chkincs-drv-exp', sources_drivers, + c_args: [cflags, cflags_drivers, '-DALLOW_EXPERIMENTAL_API'], + dependencies: dpdk_chkinc_staging_deps + dpdk_chkinc_drivers_staging_deps, + install: false) + +executable('chkincs-drv-all', sources_drivers, + c_args: [cflags, cflags_drivers, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], + dependencies: dpdk_chkinc_staging_deps + dpdk_chkinc_drivers_staging_deps, install: false) # run tests for c++ builds also@@ -58,21 +67,37 @@ gen_cpp_files = generator(gen_c_file_for_header, cpp_sources = files('main.cpp') cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers) +cpp_sources_drivers = files('main.cpp') +cpp_sources_drivers += gen_cpp_files.process(dpdk_chkinc_drivers_headers) + executable('chkincs-cpp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags], - include_directories: includes, - dependencies: deps, + dependencies: dpdk_chkinc_staging_deps, install: false) executable('chkincs-cpp-exp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'], - include_directories: includes, - dependencies: deps, + dependencies: dpdk_chkinc_staging_deps, install: false) executable('chkincs-cpp-all', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], - include_directories: includes, - dependencies: deps, + dependencies: dpdk_chkinc_staging_deps, + install: false) + +executable('chkincs-drv-cpp', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, cflags_drivers], + dependencies: dpdk_chkinc_staging_deps + dpdk_chkinc_drivers_staging_deps, + install: false) + +executable('chkincs-drv-cpp-exp', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, cflags_drivers, '-DALLOW_EXPERIMENTAL_API'], + dependencies: dpdk_chkinc_staging_deps + dpdk_chkinc_drivers_staging_deps, + install: false) + +executable('chkincs-drv-cpp-all', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, cflags_drivers, '-DALLOW_EXPERIMENTAL_API', + '-DALLOW_INTERNAL_API'], + dependencies: dpdk_chkinc_staging_deps + dpdk_chkinc_drivers_staging_deps, install: false)buildtools/chkincs/staging/drivers/meson.build new file +0
-0
buildtools/chkincs/staging/drivers/meson.build line 4
Quoted 4 lines
buildtools/chkincs/staging/drivers/meson.build new file +4
-0@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +dpdk_chkinc_drivers_staging_dir = meson.current_build_dir()
Minor nit, but I don't think we need to have this file and the staging/meson.build file either. Since all they do is assign paths, I'd suggest that we just assign the paths directly in the top-level meson.build file where we define the staging dir variables. (Even if not, I'd suggest assigning the vars to '' rather than [], since they are not array vars anyway).
Quoted 73 lines
buildtools/chkincs/staging/meson.build new file +5
-0@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +dpdk_chkinc_staging_dir = meson.current_build_dir() +subdir('drivers')buildtools/meson.build +1
-0@@ -27,6 +27,7 @@ get_min_meson_version_cmd = py3 + files('get-min-meson-version.py') get_test_suites_cmd = py3 + files('get-test-suites.py') header_gen_cmd = py3 + files('gen-header.py') has_hugepages_cmd = py3 + files('has-hugepages.py') +stage_headers_cmd = py3 + files('stage-headers.py') cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py') check_dts_requirements = py3 + files('check-dts-requirements.py')buildtools/stage-headers.py new file +32
-0@@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +""" +Headers staging script for DPDK build system. +""" + +import sys +import os +import shutil +from pathlib import Path + +def main(): + if len(sys.argv) < 4: + print("Usage: stage-headers.py <staging_dir> <meson_stamp> [headers...]") + sys.exit(1) + + staging_dir = Path(sys.argv[1]) + meson_stamp = Path(sys.argv[2]) + headers = sys.argv[3:] + + staging_dir.mkdir(parents=True, exist_ok=True) + + for header in headers: + file = Path(header) + shutil.copy2(file, staging_dir / file.name) + + meson_stamp.touch() + +if __name__ == "__main__": + main()drivers/meson.build +3
-1@@ -245,7 +245,31 @@ foreach subpath:subdirs if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif - dpdk_chkinc_headers += driver_sdk_headers + dpdk_chkinc_headers += headers + dpdk_chkinc_drivers_headers += driver_sdk_headers +
drivers/meson.build foreach subpath:subdirs · line 260
Quoted 10 lines
drivers/meson.build +10
-0+ if get_option('check_includes') + if headers.length() > 0 + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target(lib_name + '_header_staging', + output: lib_name + '_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@', + headers], + install: false, + ) + )
Rather than using an external script and custom target for this, would the configure_file() meson function, with "copy" set to true also work for us?
https://mesonbuild.com/Reference-manual_functions.html#configure_file
Quoted 100 lines
drivers/meson.build +12
-0+ endif + if driver_sdk_headers.length() > 0 + dpdk_chkinc_drivers_staging_deps += declare_dependency(sources: + custom_target(lib_name + '_driver_header_staging', + output: lib_name + '_driver_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_drivers_staging_dir, + '@OUTPUT@', driver_sdk_headers], + install: false, + ) + ) + endif + endif if headers.length() > 0 dpdk_includes += include_directories(drv_path)lib/eal/include/meson.build +10
-0@@ -79,3 +79,13 @@ generic_headers = files( 'generic/rte_vect.h', ) install_headers(generic_headers, subdir: 'generic') +if get_option('check_includes') + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target('eal_generic_header_staging', + output: 'eal_generic_header_staging.stamp', + command: [stage_headers_cmd, join_paths(dpdk_chkinc_staging_dir, 'generic'), + '@OUTPUT@', generic_headers], + install: false, + ) + ) +endiflib/eal/meson.build +12
-0@@ -12,7 +12,19 @@ endif subdir(exec_env) +arch_headers = [] +arch_indirect_headers = [] subdir(arch_subdir) +if get_option('check_includes') + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target('eal_arch_header_staging', + output: 'eal_arch_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@', + arch_headers + arch_indirect_headers], + install: false, + ) + ) +endif deps += ['log', 'kvargs'] if not is_windowslib/meson.build +26
-1@@ -214,7 +214,32 @@ foreach l:libraries install_headers(driver_sdk_headers) endif dpdk_chkinc_headers += headers - dpdk_chkinc_headers += driver_sdk_headers + dpdk_chkinc_drivers_headers += driver_sdk_headers + + if get_option('check_includes') + lib_headers = headers + indirect_headers + if lib_headers.length() != 0 + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target(l + '_header_staging', + output: l + '_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@', + lib_headers], + install: false, + ) + ) + endif + + if driver_sdk_headers.length() != 0 + dpdk_chkinc_drivers_staging_deps += declare_dependency(sources: + custom_target(l + '_driver_header_staging', + output: l + '_driver_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_drivers_staging_dir, + '@OUTPUT@', driver_sdk_headers], + install: false, + ) + ) + endif + endif libname = 'rte_' + name includes += include_directories(l)meson.build +0
-0
meson.build dpdk_static_libraries = [] · line 45
Quoted 8 lines
meson.build +5
-0@@ -38,6 +38,11 @@ dpdk_static_libraries = [] dpdk_shared_lib_deps = [] dpdk_static_lib_deps = [] dpdk_chkinc_headers = [] +dpdk_chkinc_staging_dir = [] +dpdk_chkinc_staging_deps = [] +dpdk_chkinc_drivers_headers = [] +dpdk_chkinc_drivers_staging_dir = [] +dpdk_chkinc_drivers_staging_deps = []
As called out above, the staging dirs are not array variables, so I would initialize them to the empty string instead. However, we could also just give them their final values immediately here e.g.
dpdk_chkincs_staging_dir = meson.current_build_path() / 'staging' dpdk_chkincs_drivers_staging_dir = dpdk_chkincs_staging_dir / 'drivers'
Quoted 16 lines
meson.build +3
-0dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = []@@ -74,6 +79,9 @@ global_inc = [include_directories('.', 'config', # do configuration and get tool paths subdir('buildtools') +if get_option('check_includes') + subdir('buildtools/chkincs/staging') +endif subdir('config') if is_linuxSignature · 1 line
2.51.0
Re: [PATCH v4 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 7 lines · Bruce Richardson
Quoted 7 lines
buildtools/chkincs/meson.build +0
-0@@ -12,38 +12,47 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@'])
Quoted 12 lines
buildtools/chkincs/meson.build gen_c_files = generator(gen_c_file_for_header, · line 20
Quoted 7 lines
buildtools/chkincs/meson.build +4
-0cflags = machine_args +cflags += '-Wno-missing-field-initializers' cflags += no_wvla_cflag +cflags += '-I' + dpdk_source_root + '/config' +cflags += '-I' + dpdk_build_root +cflags += '-I' + dpdk_chkinc_staging_dirTwo minor suggestions, 1) should we not use "
include_directories()" here to pass these properly? and 2) would using the existing "global_inc" value as include path not work ok? Is the reason for not using the latter the fact it includes too many source dirs?
1) include_directories() requires a source directory to exist, so I would need to keep almost empty directories with minimal meson.build in them.
2) Indeed, global_inc is not usable as is.
meson.build:global_inc = [include_directories('.', 'config',
meson.build- 'lib/eal/include', meson.build- 'lib/eal/@0@/include'.format(host_machine.system()), meson.build- 'lib/eal/@0@/include'.format(arch_subdir),
meson.build-)]
global_inc refers to the EAL sources, so anything in those directories is reachable.
There are a number of non exported headers in there, like lib/eal/include/rte_eal_paging.h or Windows specific/internal headers in lib/eal/windows/include.
I can split it as two variables.
Quoted 10 lines
Quoted 10 lines
buildtools/chkincs/meson.build +0
-6sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) -# some driver SDK headers depend on these two buses, which are mandatory in build -# so we always include them in deps list -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] -if dpdk_conf.has('RTE_BUS_VMBUS') - deps += get_variable('shared_rte_bus_vmbus') -endif
[snip]
Quoted 18 lines
Quoted 18 lines
drivers/meson.build +9
-1@@ -245,7 +245,31 @@ foreach subpath:subdirs if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif - dpdk_chkinc_headers += driver_sdk_headers + dpdk_chkinc_headers += headers + dpdk_chkinc_drivers_headers += driver_sdk_headers + + if get_option('check_includes') + if headers.length() > 0 + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target(lib_name + '_header_staging', + output: lib_name + '_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@',
Quoted 8 lines
drivers/meson.build foreach subpath:subdirs · line 260
Quoted 4 lines
drivers/meson.build +4
-0+ headers], + install: false, + ) + )Rather than using an external script and custom target for this, would the
configure_file()meson function, with "copy" set to true also work for us?
https://mesonbuild.com/Reference-manual_functions.html#configure_file
I don't like configure_file().
Touching any of those headers will trigger a meson reconfigure, right? I think I am not the only one who dislike meson reconfigurations that pollutes your terminal a lot when you do many compilations (Thomas?).
But let's say this is acceptable.
I had tried but configure_file() won't accept outputting to a specific directory, or I am doing it wrong?
Trying again as an example in lib/meson.build:
foreach header: headers + indirect_headers
configure_file(input: header,
output: 'staging/@[email protected]',
copy: true,
install: false,
)
endforeachGives:
../lib/meson.build:221:12: ERROR: configure_file keyword argument "output" Output 'staging/@[email protected]' must not contain a path segment.
Relooking *again* at all this (la nuit porte conseil), if we tracked headers in global variables, for "normal" headers, arch headers, generic headers and drivers headers, all of the changes could be isolated in the buildtools/chkincs directory.
This would also make it possible to factorize install_headers() calls, and avoid drivers doing it behind drivers/meson.build back (I spotted one).
I just pushed an experiment:
- single headers install:
https://github.com/david-marchand/dpdk/commit/headers_rework~2
- chkincs rework (still not using configure_file):
https://github.com/david-marchand/dpdk/commit/headers_rework~1
WDYT?
Quoted 16 lines
Quoted 16 lines
drivers/meson.build +12
-0+ endif + if driver_sdk_headers.length() > 0 + dpdk_chkinc_drivers_staging_deps += declare_dependency(sources: + custom_target(lib_name + '_driver_header_staging', + output: lib_name + '_driver_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_drivers_staging_dir, + '@OUTPUT@', driver_sdk_headers], + install: false, + ) + ) + endif + endif if headers.length() > 0 dpdk_includes += include_directories(drv_path)
Signature · 1 line
David Marchand
Re: [PATCH v4 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 22 lines · David Marchand
Quoted 7 lines · Bruce Richardson
Quoted 7 lines
buildtools/chkincs/meson.build +0
-0@@ -12,38 +12,47 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@'])Quoted 12 lines
buildtools/chkincs/meson.build gen_c_files = generator(gen_c_file_for_header, · line 20
Quoted 7 lines
buildtools/chkincs/meson.build +4
-0cflags = machine_args +cflags += '-Wno-missing-field-initializers' cflags += no_wvla_cflag +cflags += '-I' + dpdk_source_root + '/config' +cflags += '-I' + dpdk_build_root +cflags += '-I' + dpdk_chkinc_staging_dirTwo minor suggestions, 1) should we not use "
include_directories()" here to pass these properly? and 2) would using the existing "global_inc" value as include path not work ok? Is the reason for not using the latter the fact it includes too many source dirs?
Quoted 4 lines
1)
include_directories()requires a source directory to exist, so I would need to keep almost empty directories with minimal meson.build in them.
Ack.
Quoted 8 lines
2) Indeed,
global_incis not usable as is.meson.build:global_inc = [include_directories('.', 'config',
meson.build- 'lib/eal/include', meson.build- 'lib/eal/@0@/include'.format(host_machine.system()), meson.build- 'lib/eal/@0@/include'.format(arch_subdir),meson.build-)]
Quoted 8 lines
global_increfers to the EAL sources, so anything in those directories is reachable.
There are a number of non exported headers in there, likelib/eal/include/rte_eal_paging.hor Windows specific/internal headers inlib/eal/windows/include.I can split it as two variables.
Ok, thanks. Was just making suggestions to try and improve things.
Quoted 72 lines
Quoted 10 lines
Quoted 10 lines
buildtools/chkincs/meson.build +0
-6sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) -# some driver SDK headers depend on these two buses, which are mandatory in build -# so we always include them in deps list -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] -if dpdk_conf.has('RTE_BUS_VMBUS') - deps += get_variable('shared_rte_bus_vmbus') -endif[snip]
Quoted 18 lines
Quoted 18 lines
drivers/meson.build +9
-1@@ -245,7 +245,31 @@ foreach subpath:subdirs if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif - dpdk_chkinc_headers += driver_sdk_headers + dpdk_chkinc_headers += headers + dpdk_chkinc_drivers_headers += driver_sdk_headers + + if get_option('check_includes') + if headers.length() > 0 + dpdk_chkinc_staging_deps += declare_dependency(sources: + custom_target(lib_name + '_header_staging', + output: lib_name + '_header_staging.stamp', + command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@',Quoted 8 lines
drivers/meson.build foreach subpath:subdirs · line 260
Quoted 4 lines
drivers/meson.build +4
-0+ headers], + install: false, + ) + )Rather than using an external script and custom target for this, would the
configure_file()meson function, with "copy" set to true also work for us?
https://mesonbuild.com/Reference-manual_functions.html#configure_fileI don't like
configure_file().
Touching any of those headers will trigger a meson reconfigure, right? I think I am not the only one who dislike meson reconfigurations that pollutes your terminal a lot when you do many compilations (Thomas?).But let's say this is acceptable.
I had tried but
configure_file()won't accept outputting to a specific directory, or I am doing it wrong?
Trying again as an example inlib/meson.build:foreach header: headers + indirect_headers configure_file(input: header, output: 'staging/@[email protected]', copy: true, install: false, ) endforeachGives:
../lib/meson.build:221:12: ERROR:configure_filekeyword argument "output" Output 'staging/@[email protected]' must not contain a path segment.Relooking *again* at all this (la nuit porte conseil), if we tracked headers in global variables, for "normal" headers, arch headers, generic headers and drivers headers, all of the changes could be isolated in the buildtools/chkincs directory.
This would also make it possible to factorizeinstall_headers()calls, and avoid drivers doing it behinddrivers/meson.buildback (I spotted one).
Quoted 8 lines
I just pushed an experiment:
- single headers install:
https://github.com/david-marchand/dpdk/commit/headers_rework~2
- chkincs rework (still not usingconfigure_file):
https://github.com/david-marchand/dpdk/commit/headers_rework~1WDYT?
Those changes seem good to me.
One final idea/suggestion (apologies for the many suggestions here). Rather than having a new script and dependency tracking for the header copies, would it be easier to do the header copy as part of the existing C file generation script? It's already writing a C file to an output directory, would it make sense to have that script just copy the header file to the same location too?
/Bruce
Re: [PATCH v4 6/7] buildtools/chkincs: use a staging directory for headers
Quoted 9 lines · Bruce Richardson
Quoted 8 lines
I just pushed an experiment:
- single headers install:
https://github.com/david-marchand/dpdk/commit/headers_rework~2
- chkincs rework (still not usingconfigure_file):
https://github.com/david-marchand/dpdk/commit/headers_rework~1WDYT?
Quoted 8 lines
Those changes seem good to me.
One final idea/suggestion (apologies for the many suggestions here). Rather than having a new script and dependency tracking for the header copies, would it be easier to do the header copy as part of the existing C file generation script? It's already writing a C file to an output directory, would it make sense to have that script just copy the header file to the same location too?
We still need something to stage "indirect" headers that are not preprocessed by this generation script.
Signature · 1 line
David Marchand
PATCH v4 7/7 power: separate public and driver headers
In reply to David Marchandpower_cpufreq.h, power_common.h and power_uncore_ops.h look like driver only headers, but were included from public headers.
Move them to the driver_sdk_headers list.
There is one complication though for power_cpufreq.h as it was included from a public header rte_power_cpufreq.h.
Move the rte_power_core_capabilities struct definition to the public header, since a (stable) public symbol relies on it.
--- lib/power/meson.build | 7 +++++-- lib/power/power_cpufreq.h | 14 +------------- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++++++++++++-- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 ++- 7 files changed, 24 insertions(+), 20 deletions(-)
lib/power/meson.build +5 -2
@@ -22,12 +22,15 @@ sources = files( 'rte_power_uncore.c', ) headers = files( - 'power_cpufreq.h', - 'power_uncore_ops.h', 'rte_power_cpufreq.h', 'rte_power_pmd_mgmt.h', 'rte_power_qos.h', 'rte_power_uncore.h', ) +driver_sdk_headers = files( + 'power_common.h', + 'power_cpufreq.h', + 'power_uncore_ops.h', +) deps += ['timer', 'ethdev']
lib/power/power_cpufreq.h +1 -13
@@ -14,6 +14,7 @@#include <rte_common.h> #include <rte_log.h> #include <rte_compat.h> +#include <rte_power_cpufreq.h> #define RTE_POWER_DRIVER_NAMESZ 24
@@ -131,19 +132,6 @@ typedef int (*rte_power_freq_change_t)(unsigned int lcore_id);* - Negative on error. */ -/** -* Power capabilities summary. -*/ -struct rte_power_core_capabilities { -union { -uint64_t capabilities; -struct { -uint64_t turbo:1 ;/**< Turbo can be enabled. */ -uint64_t priority:1 ;/**< SST-BF high freq core */ - }; - }; -}; -typedef int (*rte_power_get_capabilities_t )(unsigned int lcore_id,struct rte_power_core_capabilities *caps);
lib/power/power_uncore_ops.h +1 -0
@@ -13,6 +13,7 @@#include <rte_compat.h> #include <rte_common.h> +#include <rte_power_uncore.h> #define RTE_POWER_UNCORE_DRIVER_NAMESZ 24
lib/power/rte_power_cpufreq.c +1 -1
@@ -6,8 +6,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_cpufreq.h" #include "power_common.h" +#include "power_cpufreq.h" static enum power_management_env global_default_env =PM_ENV_NOT_SET ;static struct rte_power_cpufreq_ops *global_cpufreq_ops;
lib/power/rte_power_cpufreq.h +13 -2
@@ -14,8 +14,6 @@#include <rte_common.h> #include <rte_log.h> -#include "power_cpufreq.h" -#ifdef __cplusplusextern "C" {#endif
@@ -248,6 +246,19 @@ int rte_power_freq_enable_turbo(unsigned int lcore_id);*/ int rte_power_freq_disable_turbo (unsigned int lcore_id); +/** +* Power capabilities summary. +*/ +struct rte_power_core_capabilities { +union { +uint64_t capabilities; +struct { +uint64_t turbo:1 ;/**< Turbo can be enabled. */ +uint64_t priority:1 ;/**< SST-BF high freq core */ + }; + }; +}; +/** * Returns power capabilities for a specific lcore. * Function pointer definition. Review each environments
lib/power/rte_power_uncore.c +1 -1
@@ -7,8 +7,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_uncore.h" #include "power_common.h" +#include "power_uncore_ops.h" static enum rte_uncore_power_mgmt_env global_uncore_env =RTE_UNCORE_PM_ENV_NOT_SET ;static struct rte_power_uncore_ops *global_uncore_ops;
lib/power/rte_power_uncore.h +2 -1
@@ -11,7 +11,8 @@* Uncore Frequency Management */ -#include "power_uncore_ops.h" +#include <rte_compat.h> +#include <rte_common.h> #ifdef __cplusplusextern "C" {
Signature · 1 line
2.51.0
v5 cover Add a stricter headers check
In reply to David MarchandAs explained in patch 8, the current headers check can not catch issues when a public header includes an internal header.
Patch 1-5 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling enable_driver_sdk option).
Signature · 77 lines
David Marchand Changes since v4: - reworked headers install, - fixed issue in ARM memcpy header, - further simplified the header check modifications, Changes since v3: - narrowed down the changes under a check on check_includes= option, - moved the staging directories under buildtools/chkincs, Changes since v2: - major rework, dropping the makefile approach, and instead copying headers to a staging directory used by the check, - rebased, - dropped changes on raw cnxk drivers and disabled the associated build warning in the headers check, David Marchand (9): baseband/acc: fix exported header drivers: drop export of driver headers eventdev: do not include driver header in DMA adapter gpudev: fix driver header for Windows drivers: fix some exported headers eal/arm: fix C++ build for 32-bit memcpy build: factorize headers installation buildtools/chkincs: use a staging directory for headers power: separate public and driver headers buildtools/chkincs/meson.build | 70 +++++++++++++++---- buildtools/chkincs/stage-headers.py | 32 +++++++++ .../chkincs/staging/drivers/meson.build | 12 ++++ buildtools/chkincs/staging/meson.build | 30 ++++++++ config/meson.build | 3 +- devtools/checkpatches.sh | 9 +++ drivers/baseband/acc/meson.build | 2 +- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 + drivers/meson.build | 7 +- drivers/net/dpaa/rte_pmd_dpaa.h | 2 + drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 + drivers/net/txgbe/meson.build | 2 +- drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 + drivers/raw/ntb/rte_pmd_ntb.h | 2 + lib/bbdev/meson.build | 14 ++-- lib/eal/arm/include/meson.build | 3 +- lib/eal/arm/include/rte_memcpy_32.h | 6 +- lib/eal/include/meson.build | 3 +- lib/eal/loongarch/include/meson.build | 3 +- lib/eal/ppc/include/meson.build | 3 +- lib/eal/riscv/include/meson.build | 3 +- lib/eal/x86/include/meson.build | 6 +- lib/ethdev/meson.build | 6 +- lib/eventdev/rte_event_dma_adapter.h | 2 +- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 +- lib/meson.build | 10 +-- lib/mldev/meson.build | 5 +- lib/power/meson.build | 7 +- lib/power/power_cpufreq.h | 14 +--- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 +- lib/rawdev/meson.build | 3 +- lib/regexdev/meson.build | 3 +- lib/security/meson.build | 3 +- meson.build | 21 ++++-- 41 files changed, 247 insertions(+), 86 deletions(-) create mode 100644 buildtools/chkincs/stage-headers.py create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build -- 2.51.0
PATCH v5 1/9 baseband/acc: fix exported header
rte_acc_cfg.h relies on rte_acc_common_cfg.h.
--- drivers/baseband/acc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/baseband/acc/meson.build +1 -1
@@ -26,4 +26,4 @@ deps += ['bus_pci'] sources = files('acc_common.c', 'rte_acc100_pmd.c', 'rte_vrb_pmd.c') -headers = files('rte_acc_cfg.h') +headers = files('rte_acc_cfg.h', 'rte_acc_common_cfg.h')
Signature · 1 line
2.51.0
PATCH v5 2/9 drivers: drop export of driver headers
In reply to David MarchandMany classes are exposing driver only headers as public headers. Move them to the driver_sdk_headers list.
---
Changes since v2:
- rebased,
--- lib/bbdev/meson.build | 14 +++++++++----- lib/ethdev/meson.build | 6 +++--- lib/mldev/meson.build | 5 +---- lib/rawdev/meson.build | 3 ++- lib/regexdev/meson.build | 3 ++- lib/security/meson.build | 3 ++- 6 files changed, 19 insertions(+), 15 deletions(-)
lib/bbdev/meson.build +9 -5
@@ -1,10 +1,14 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_bbdev.c', - 'bbdev_trace_points.c') -headers = files('rte_bbdev.h', - 'rte_bbdev_pmd.h', +sources = files( + 'rte_bbdev.c', + 'bbdev_trace_points.c', +) +headers = files( + 'rte_bbdev.h', 'rte_bbdev_op.h', - 'rte_bbdev_trace_fp.h') + 'rte_bbdev_trace_fp.h', +) +driver_sdk_headers = files('rte_bbdev_pmd.h') deps += ['mbuf']
lib/ethdev/meson.build +3 -3
@@ -26,11 +26,8 @@ headers = files( 'rte_ethdev_trace_fp.h', 'rte_dev_info.h', 'rte_flow.h', - 'rte_flow_driver.h', 'rte_mtr.h', - 'rte_mtr_driver.h', 'rte_tm.h', - 'rte_tm_driver.h', ) indirect_headers += files(
@@ -42,6 +39,9 @@ driver_sdk_headers += files( 'ethdev_driver.h', 'ethdev_pci.h', 'ethdev_vdev.h', + 'rte_flow_driver.h', + 'rte_mtr_driver.h', + 'rte_tm_driver.h', ) if is_linux
lib/mldev/meson.build +1 -4
@@ -26,11 +26,8 @@ headers = files( 'rte_mldev.h', ) -indirect_headers += files( - 'rte_mldev_core.h', -) - driver_sdk_headers += files( + 'rte_mldev_core.h', 'rte_mldev_pmd.h', 'mldev_utils.h', )
lib/rawdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_rawdev.c') -headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h') +headers = files('rte_rawdev.h') +driver_sdk_headers = files('rte_rawdev_pmd.h') deps += ['telemetry']
lib/regexdev/meson.build +2 -1
@@ -2,6 +2,7 @@ # Copyright 2020 Mellanox Technologies, Ltd sources = files('rte_regexdev.c') -headers = files('rte_regexdev.h', 'rte_regexdev_driver.h') +headers = files('rte_regexdev.h') indirect_headers += files('rte_regexdev_core.h') +driver_sdk_headers = files('rte_regexdev_driver.h') deps += ['mbuf']
lib/security/meson.build +2 -1
@@ -2,5 +2,6 @@ # Copyright(c) 2017-2019 Intel Corporation sources = files('rte_security.c') -headers = files('rte_security.h', 'rte_security_driver.h') +headers = files('rte_security.h') +driver_sdk_headers = files('rte_security_driver.h') deps += ['mempool', 'cryptodev', 'net']
Signature · 1 line
2.51.0
PATCH v5 3/9 eventdev: do not include driver header in DMA adapter
In reply to David MarchandThe dma adapter header does not require including rte_dmadev_pmd.h which is a driver header.
--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_dma_adapter.h +1 -1
@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplus
Signature · 1 line
2.51.0
PATCH v5 4/9 gpudev: fix driver header for Windows
In reply to David MarchandUse rte_os.h and its RTE_TAILQ_HEAD definition compatible with BSD sys/queue.h
--- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
lib/gpudev/gpudev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdlib.h> +#include <sys/queue.h> #include <eal_export.h> #include <rte_eal.h>
lib/gpudev/gpudev_driver.h +2 -2
@@ -12,11 +12,11 @@#define RTE_GPUDEV_DRIVER_H #include <stdint.h> -#include <sys/queue.h> #include <dev_driver.h> #include <rte_compat.h> +#include <rte_os.h> #include "rte_gpudev.h" #ifdef __cplusplus
@@ -80,7 +80,7 @@ struct __rte_cache_aligned rte_gpu {/* Driver functions. */ struct rte_gpu_ops ops;/* Event callback list. */ - TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks; + RTE_TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks;/* Current state (used or not) in the running process. */ enum rte_gpu_state process_state;/* Updated by this library. */ /* Driver-specific private data for the running process. */
Signature · 1 line
2.51.0
PATCH v5 5/9 drivers: fix some exported headers
In reply to David MarchandThose headers could not be included individually as they were not including their dependencies, were subject to some build warnings, or were not compiling on Windows.
---
Changes since v2:
- rebased,
- dropped changes on raw/cnxk drivers,
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 ++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 7 files changed, 23 insertions(+)
drivers/bus/vmbus/rte_vmbus_reg.h +6 -0
@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +2 -0
@@ -11,8 +11,10 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> #include <rte_crypto.h> #include <rte_security.h>
drivers/net/dpaa/rte_pmd_dpaa.h +2 -0
@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h *
drivers/net/intel/iavf/rte_pmd_iavf.h +6 -0
@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h>
@@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())
@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false); +#endif } #ifdef __cplusplus
drivers/net/mlx5/rte_pmd_mlx5.h +3 -0
@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h> /**
drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h +2 -0
@@ -12,6 +12,8 @@* */ +#include <stdint.h> +#ifdef __cplusplusextern "C" {#endif
drivers/raw/ntb/rte_pmd_ntb.h +2 -0
@@ -5,6 +5,8 @@#ifndef _RTE_PMD_NTB_H_#define _RTE_PMD_NTB_H_ +#include <stdint.h> +/* App needs to set/get these attrs */ #define NTB_QUEUE_SZ_NAME "queue_size"#define NTB_QUEUE_NUM_NAME "queue_num"
Signature · 1 line
2.51.0
PATCH v5 6/9 eal/arm: fix C++ build for 32-bit memcpy
In reply to David MarchandThis was caught while checking ARM arch headers.
In file included from buildtools/chkincs/chkincs-cpp.p/rte_memcpy_32.cpp:1:/home/runner/work/dpdk/dpdk/lib/eal/arm/include/rte_memcpy_32.h:302:1:
error: expected declaration before ‘}’ token
302 | }
| ^
--- lib/eal/arm/include/rte_memcpy_32.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/eal/arm/include/rte_memcpy_32.h +5 -1
@@ -19,10 +19,14 @@/* ARM NEON Intrinsics are used to copy data */ #include <arm_neon.h> +#endif /* RTE_ARCH_ARM_NEON_MEMCPY */ +#ifdef __cplusplusextern "C" {#endif +#ifdef RTE_ARCH_ARM_NEON_MEMCPY +static inline void rte_mov16 (uint8_t *dst,const uint8_t *src) {
@@ -252,7 +256,7 @@ rte_memcpy_func(void *dst, const void *src, size_t n) return ret; } -#else +#else /* ! RTE_ARCH_ARM_NEON_MEMCPY */ static inline void rte_mov16 (uint8_t *dst,const uint8_t *src)
Signature · 1 line
2.51.0
Re: [PATCH v5 6/9] eal/arm: fix C++ build for 32-bit memcpy
Quoted 8 lines · David Marchand
This was caught while checking ARM arch headers.
In file included from buildtools/chkincs/chkincs-cpp.p/rte_memcpy_32.cpp:1:
/home/runner/work/dpdk/dpdk/lib/eal/arm/include/rte_memcpy_32.h:302:1:
error: expected declaration before ‘}’ token
302 | }| ^
Quoted 8 lines
Fixes 719834a6849e ("use C linkage where appropriate in headers")Signed-off-by David Marchand <[email protected]>--- lib/eal/arm/include/rte_memcpy_32.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Quoted 31 lines
lib/eal/arm/include/rte_memcpy_32.h +5
-1@@ -19,10 +19,14 @@/* ARM NEON Intrinsics are used to copy data */ #include <arm_neon.h> +#endif /* RTE_ARCH_ARM_NEON_MEMCPY */ +#ifdef __cplusplusextern "C" {#endif +#ifdef RTE_ARCH_ARM_NEON_MEMCPY +static inline void rte_mov16 (uint8_t *dst,const uint8_t *src) {@@ -252,7 +256,7 @@ rte_memcpy_func(void *dst, const void *src, size_t n) return ret; } -#else +#else /* ! RTE_ARCH_ARM_NEON_MEMCPY */ static inline void rte_mov16 (uint8_t *dst,const uint8_t *src)Signature · 1 line
2.51.0
RE: [PATCH v5 6/9] eal/arm: fix C++ build for 32-bit memcpy
In reply to David MarchandQuoted 10 lines
From: David Marchand [mailto:[email protected]]
Sent: Friday, 26 September 2025 14.41This was caught while checking ARM arch headers.
In file included from buildtools/chkincs/chkincs- cpp.p/rte_memcpy_32.cpp:1:
/home/runner/work/dpdk/dpdk/lib/eal/arm/include/rte_memcpy_32.h:302:1:
error: expected declaration before ‘}’ token
302 | }
Quoted 7 lines
| ^Fixes 719834a6849e ("use C linkage where appropriate in headers")Signed-off-by David Marchand <[email protected]>---
Re: [PATCH v5 6/9] eal/arm: fix C++ build for 32-bit memcpy
In reply to David MarchandQuoted 8 lines · David Marchand
This was caught while checking ARM arch headers.
In file included from buildtools/chkincs/chkincs-cpp.p/rte_memcpy_32.cpp:1:
/home/runner/work/dpdk/dpdk/lib/eal/arm/include/rte_memcpy_32.h:302:1:
error: expected declaration before ‘}’ token
302 | }| ^
Quoted 36 lines
Fixes 719834a6849e ("use C linkage where appropriate in headers")Signed-off-by David Marchand <[email protected]>--- lib/eal/arm/include/rte_memcpy_32.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)lib/eal/arm/include/rte_memcpy_32.h +5
-1@@ -19,10 +19,14 @@/* ARM NEON Intrinsics are used to copy data */ #include <arm_neon.h> +#endif /* RTE_ARCH_ARM_NEON_MEMCPY */ +#ifdef __cplusplusextern "C" {#endif +#ifdef RTE_ARCH_ARM_NEON_MEMCPY +static inline void rte_mov16 (uint8_t *dst,const uint8_t *src) {@@ -252,7 +256,7 @@ rte_memcpy_func(void *dst, const void *src, size_t n) return ret; } -#else +#else /* ! RTE_ARCH_ARM_NEON_MEMCPY */ static inline void rte_mov16 (uint8_t *dst,const uint8_t *src)
PATCH v5 7/9 build: factorize headers installation
In reply to David MarchandGather all headers in global variables, put headers installation in a single location and make the headers check use them instead of dpdk_chkinc_headers.
This rework reveals a number of issues:
- net/txgbe driver was directly installing its header, bypassing drivers/meson.build and skipping the headers check,
- arch headers were not checked except for x86,
- some driver headers were not checked,
For the last point, a build warning must be disabled (like it is globally in DPDK) for headers from raw drivers.
Finally, checkpatches is updated to avoid reintroductions of install_headers().
--- buildtools/chkincs/meson.build | 7 +++++-- config/meson.build | 3 +-- devtools/checkpatches.sh | 9 +++++++++ drivers/meson.build | 7 ++----- drivers/net/txgbe/meson.build | 2 +- lib/eal/arm/include/meson.build | 3 +-- lib/eal/include/meson.build | 3 +-- lib/eal/loongarch/include/meson.build | 3 +-- lib/eal/ppc/include/meson.build | 3 +-- lib/eal/riscv/include/meson.build | 3 +-- lib/eal/x86/include/meson.build | 6 ++---- lib/meson.build | 10 +++------- meson.build | 15 ++++++++++++++- 13 files changed, 42 insertions(+), 32 deletions(-)
buildtools/chkincs/meson.build +5 -2
@@ -12,10 +12,13 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args +if cc.has_argument('-Wno-missing-field-initializers') + cflags += '-Wno-missing-field-initializers' +endif cflags += no_wvla_cflag sources = files('main.c') -sources += gen_c_files.process(dpdk_chkinc_headers) +sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) # some driver SDK headers depend on these two buses, which are mandatory in build # so we always include them in deps list
@@ -56,7 +59,7 @@ gen_cpp_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cpp_sources = files('main.cpp') -cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers) +cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) executable('chkincs-cpp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags],
config/meson.build +1 -2
@@ -456,8 +456,7 @@ endif # set the install path for the drivers dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) -install_headers(['rte_config.h'], - subdir: get_option('include_subdir_arch')) +dpdk_arch_headers += files('rte_config.h') # enable VFIO only if it is linux OS dpdk_conf.set('RTE_EAL_VFIO', is_linux)
devtools/checkpatches.sh +9 -0
@@ -87,6 +87,15 @@ check_forbidden_additions() { # <patch> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # don't call directly install_headers() + awk -v FOLDERS="lib drivers" \ + -v SKIP_FILES='meson.build' \ + -v EXPRESSIONS="\\\<install_headers\\\>" \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using install_headers()' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # refrain from using compiler attribute without defining a common macro awk -v FOLDERS="lib drivers app examples" \ -v SKIP_FILES='lib/eal/include/rte_common.h' \
drivers/meson.build +2 -5
@@ -241,11 +241,8 @@ foreach subpath:subdirs dpdk_extra_ldflags += pkgconfig_extra_libs - install_headers(headers) - if get_option('enable_driver_sdk') - install_headers(driver_sdk_headers) - endif - dpdk_chkinc_headers += driver_sdk_headers + dpdk_headers += headers + dpdk_drivers_headers += driver_sdk_headers if headers.length() > 0 dpdk_includes += include_directories(drv_path)
drivers/net/txgbe/meson.build +1 -1
@@ -31,4 +31,4 @@ elif arch_subdir == 'arm' sources += files('txgbe_rxtx_vec_neon.c') endif -install_headers('rte_pmd_txgbe.h') +headers = files('rte_pmd_txgbe.h')
lib/eal/arm/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation. -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic_32.h', 'rte_atomic_64.h', 'rte_atomic.h',
@@ -28,4 +28,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/include/meson.build +1 -2
@@ -64,7 +64,7 @@ driver_sdk_headers = files( ) # special case install the generic headers, since they go in a subdir -generic_headers = files( +dpdk_generic_headers += files( 'generic/rte_atomic.h', 'generic/rte_byteorder.h', 'generic/rte_cpuflags.h',
@@ -78,4 +78,3 @@ generic_headers = files( 'generic/rte_spinlock.h', 'generic/rte_vect.h', ) -install_headers(generic_headers, subdir: 'generic')
lib/eal/loongarch/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 Loongson Technology Corporation Limited -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -15,4 +15,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/ppc/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi <[email protected]> -arch_headers = files( +dpdk_arch_headers += files( 'rte_altivec.h', 'rte_atomic.h', 'rte_byteorder.h',
@@ -16,4 +16,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/riscv/include/meson.build +1 -2
@@ -3,7 +3,7 @@ # Copyright(c) 2022 SiFive # Copyright(c) 2022 Semihalf -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -17,4 +17,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/x86/include/meson.build +2 -4
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -16,11 +16,9 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -arch_indirect_headers = files( +dpdk_arch_indirect_headers += files( 'rte_atomic_32.h', 'rte_atomic_64.h', 'rte_byteorder_32.h', 'rte_byteorder_64.h', ) -install_headers(arch_headers + arch_indirect_headers, subdir: get_option('include_subdir_arch')) -dpdk_chkinc_headers += arch_headers
lib/meson.build +3 -7
@@ -208,13 +208,9 @@ foreach l:libraries dpdk_libs_enabled += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) - install_headers(headers) - install_headers(indirect_headers) - if get_option('enable_driver_sdk') - install_headers(driver_sdk_headers) - endif - dpdk_chkinc_headers += headers - dpdk_chkinc_headers += driver_sdk_headers + dpdk_headers += headers + dpdk_indirect_headers += indirect_headers + dpdk_drivers_headers += driver_sdk_headers libname = 'rte_' + name includes += include_directories(l)
meson.build +14 -1
@@ -37,7 +37,12 @@ dpdk_libraries = [] dpdk_static_libraries = [] dpdk_shared_lib_deps = [] dpdk_static_lib_deps = [] -dpdk_chkinc_headers = [] +dpdk_arch_headers = [] +dpdk_arch_indirect_headers = [] +dpdk_generic_headers = [] +dpdk_headers = [] +dpdk_indirect_headers = [] +dpdk_drivers_headers = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = []
@@ -106,6 +111,14 @@ if get_option('check_includes') subdir('buildtools/chkincs') endif +install_headers(dpdk_arch_headers + dpdk_arch_indirect_headers, + subdir: get_option('include_subdir_arch')) +install_headers(dpdk_headers + dpdk_indirect_headers) +install_headers(dpdk_generic_headers, subdir: 'generic') +if get_option('enable_driver_sdk') + install_headers(dpdk_drivers_headers) +endif + # write the build config build_cfg = 'rte_build_config.h' configure_file(output: build_cfg,
Signature · 1 line
2.51.0
Re: [PATCH v5 7/9] build: factorize headers installation
Quoted 10 lines · David Marchand
Gather all headers in global variables, put headers installation in a single location and make the headers check use them instead of
dpdk_chkinc_headers.This rework reveals a number of issues:
- net/txgbe driver was directly installing its header, bypassingdrivers/meson.buildand skipping the headers check,
- arch headers were not checked except for x86,
- some driver headers were not checked,
Quoted 8 lines
For the last point, a build warning must be disabled (like it is globally in DPDK) for headers from raw drivers.
Finally, checkpatches is updated to avoid reintroductions of
install_headers().Signed-off-by David Marchand <[email protected]>---
Good cleanup, thanks.
PATCH v5 8/9 buildtools/chkincs: use a staging directory for headers
In reply to David MarchandA problem with the current headers check is that it relies on meson dependencies objects that come with their include_directories directives, and all of those point at the library / driver sources.
This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
---
Changes since v4:
- split global_inc (isolating config include path from EAL headers),
- moved all changes under buildtools/chkincs,
Changes since v3:
- removed update of global_inc (which was unneeded, and probably was what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),
---
buildtools/chkincs/meson.build | 67 +++++++++++++++---- buildtools/chkincs/stage-headers.py | 32 +++++++++ .../chkincs/staging/drivers/meson.build | 12 ++++ buildtools/chkincs/staging/meson.build | 30 +++++++++ meson.build | 6 +- 5 files changed, 131 insertions(+), 16 deletions(-) create mode 100644 buildtools/chkincs/stage-headers.py create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build
buildtools/chkincs/meson.build +54 -13
@@ -6,6 +6,15 @@ if not get_option('check_includes') subdir_done() endif +stage_headers_cmd = py3 + files('stage-headers.py') + +includes = [config_inc] +deps = [] +includes_drivers = [] +deps_drivers = [] + +subdir('staging') + gen_c_file_for_header = find_program('gen_c_file_for_header.py') gen_c_files = generator(gen_c_file_for_header, output: '@[email protected]',
@@ -18,18 +27,7 @@ endif cflags += no_wvla_cflag sources = files('main.c') -sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) - -# some driver SDK headers depend on these two buses, which are mandatory in build -# so we always include them in deps list -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] -if dpdk_conf.has('RTE_BUS_VMBUS') - deps += get_variable('shared_rte_bus_vmbus') -endif -# add the rest of the libs to the dependencies -foreach l:dpdk_libs_enabled - deps += get_variable('shared_rte_' + l) -endforeach +sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers) executable('chkincs', sources, c_args: cflags,
@@ -49,6 +47,27 @@ executable('chkincs-all', sources, dependencies: deps, install: false) +sources_drivers = files('main.c') +sources_drivers += gen_c_files.process(dpdk_drivers_headers) + +executable('chkincs-drv', sources_drivers, + c_args: cflags, + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-exp', sources_drivers, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-all', sources_drivers, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + # run tests for c++ builds also if not add_languages('cpp', required: false) subdir_done()
@@ -59,7 +78,7 @@ gen_cpp_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cpp_sources = files('main.cpp') -cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) +cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers) executable('chkincs-cpp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags],
@@ -79,3 +98,25 @@ executable('chkincs-cpp-all', cpp_sources, include_directories: includes, dependencies: deps, install: false) + +cpp_sources_drivers = files('main.cpp') +cpp_sources_drivers += gen_cpp_files.process(dpdk_drivers_headers) + +executable('chkincs-drv-cpp', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-cpp-exp', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-cpp-all', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API', + '-DALLOW_INTERNAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false)
buildtools/chkincs/stage-headers.py new file +32 -0
@@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +""" +Headers staging script for DPDK build system. +""" + +import sys +import os +import shutil +from pathlib import Path + +def main(): + if len(sys.argv) < 4: + print("Usage: stage-headers.py <staging_dir> <meson_stamp> [headers...]") + sys.exit(1) + + staging_dir = Path(sys.argv[1]) + meson_stamp = Path(sys.argv[2]) + headers = sys.argv[3:] + + staging_dir.mkdir(parents=True, exist_ok=True) + + for header in headers: + file = Path(header) + shutil.copy2(file, staging_dir / file.name) + + meson_stamp.touch() + +if __name__ == "__main__": + main()
buildtools/chkincs/staging/drivers/meson.build new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +includes += include_directories('.') +deps += declare_dependency(sources: + custom_target('drivers_headers_staging', + output: 'drivers_headers_staging.stamp', + command: [stage_headers_cmd, meson.current_build_dir(), '@OUTPUT@', + dpdk_drivers_headers], + install: false, + ) +)
buildtools/chkincs/staging/meson.build new file +30 -0
@@ -0,0 +1,30 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +subdir('drivers') + +includes += include_directories('.') +deps += declare_dependency(sources: + custom_target('arch_headers_staging', + output: 'arch_headers_staging.stamp', + command: [stage_headers_cmd, meson.current_build_dir(), '@OUTPUT@', + dpdk_arch_headers + dpdk_arch_indirect_headers], + install: false, + ) +) +deps += declare_dependency(sources: + custom_target('headers_staging', + output: 'headers_staging.stamp', + command: [stage_headers_cmd, meson.current_build_dir(), '@OUTPUT@', + dpdk_headers + dpdk_indirect_headers], + install: false, + ) +) +deps += declare_dependency(sources: + custom_target('generic_headers_staging', + output: 'generic_headers_staging.stamp', + command: [stage_headers_cmd, join_paths(meson.current_build_dir(), 'generic'), + '@OUTPUT@', dpdk_generic_headers], + install: false, + ) +)
meson.build +3 -3
@@ -69,9 +69,9 @@ elif host_machine.cpu_family().startswith('riscv') endif # configure the build, and make sure configs here and in config folder are -# able to be included in any file. We also store a global array of include dirs -# for passing to pmdinfogen scripts -global_inc = [include_directories('.', 'config', +# able to be included in any file +config_inc = [include_directories('.', 'config')] +global_inc = [config_inc, include_directories( 'lib/eal/include', 'lib/eal/@0@/include'.format(host_machine.system()), 'lib/eal/@0@/include'.format(arch_subdir),
Signature · 1 line
2.51.0
Re: [PATCH v5 8/9] buildtools/chkincs: use a staging directory for headers
Quoted 29 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Signed-off-by David Marchand <[email protected]>---
Changes since v4:
- splitglobal_inc(isolating config include path from EAL headers),
- moved all changes under buildtools/chkincs,Changes since v3:
- removed update ofglobal_inc(which was unneeded, and probably was what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),
Quoted 2 lines
---
Played around a bit last week with options for doing chkincs, however, I didn't find anything obviously simpler or better than this. Let's go with this solution!
Re: [PATCH v5 8/9] buildtools/chkincs: use a staging directory for headers
Quoted 31 lines · Bruce Richardson
Quoted 29 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Signed-off-by David Marchand <[email protected]>---
Changes since v4:
- splitglobal_inc(isolating config include path from EAL headers),
- moved all changes under buildtools/chkincs,Changes since v3:
- removed update ofglobal_inc(which was unneeded, and probably was what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),
Quoted 7 lines
Quoted 2 lines
---
Played around a bit last week with options for doing chkincs, however, I didn't find anything obviously simpler or better than this. Let's go with this solution!
Acked-by Bruce Richardson <[email protected]>
Thanks for the review.
I got an interesting comment from a rabbit (in the middle of a lot of noise ;-)).
https://github.com/ovsrobot/dpdk/pull/106#discussion_r2382870892
That's not a common case, but this could be tricky to someone moving around/renaming headers.
What do you think?
Signature · 1 line
David Marchand
Re: [PATCH v5 8/9] buildtools/chkincs: use a staging directory for headers
Quoted 43 lines · David Marchand
Quoted 31 lines · Bruce Richardson
Quoted 29 lines · David Marchand
A problem with the current headers check is that it relies on meson dependencies objects that come with their
include_directoriesdirectives, and all of those point at the library / driver sources.This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
Signed-off-by David Marchand <[email protected]>---
Changes since v4:
- splitglobal_inc(isolating config include path from EAL headers),
- moved all changes under buildtools/chkincs,Changes since v3:
- removed update ofglobal_inc(which was unneeded, and probably was what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),Quoted 7 lines
Quoted 2 lines
---
Played around a bit last week with options for doing chkincs, however, I didn't find anything obviously simpler or better than this. Let's go with this solution!
Acked-by Bruce Richardson <[email protected]>Thanks for the review.
Quoted 9 lines
I got an interesting comment from a rabbit (in the middle of a lot of noise ;-)).
https://github.com/ovsrobot/dpdk/pull/106#discussion_r2382870892That's not a common case, but this could be tricky to someone moving around/renaming headers.
What do you think?
I think we should probably do some cleanup for the headers, yes, because moving headers is one case where we would really like the CI to confirm everything is ok (since moving things probably implies other rework as well).
PATCH v5 9/9 power: separate public and driver headers
In reply to David Marchandpower_cpufreq.h, power_common.h and power_uncore_ops.h look like driver only headers, but were included from public headers.
Move them to the driver_sdk_headers list.
There is one complication though for power_cpufreq.h as it was included from a public header rte_power_cpufreq.h.
Move the rte_power_core_capabilities struct definition to the public header, since a (stable) public symbol relies on it.
--- lib/power/meson.build | 7 +++++-- lib/power/power_cpufreq.h | 14 +------------- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++++++++++++-- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 ++- 7 files changed, 24 insertions(+), 20 deletions(-)
lib/power/meson.build +5 -2
@@ -22,12 +22,15 @@ sources = files( 'rte_power_uncore.c', ) headers = files( - 'power_cpufreq.h', - 'power_uncore_ops.h', 'rte_power_cpufreq.h', 'rte_power_pmd_mgmt.h', 'rte_power_qos.h', 'rte_power_uncore.h', ) +driver_sdk_headers = files( + 'power_common.h', + 'power_cpufreq.h', + 'power_uncore_ops.h', +) deps += ['timer', 'ethdev']
lib/power/power_cpufreq.h +1 -13
@@ -14,6 +14,7 @@#include <rte_common.h> #include <rte_log.h> #include <rte_compat.h> +#include <rte_power_cpufreq.h> #define RTE_POWER_DRIVER_NAMESZ 24
@@ -131,19 +132,6 @@ typedef int (*rte_power_freq_change_t)(unsigned int lcore_id);* - Negative on error. */ -/** -* Power capabilities summary. -*/ -struct rte_power_core_capabilities { -union { -uint64_t capabilities; -struct { -uint64_t turbo:1 ;/**< Turbo can be enabled. */ -uint64_t priority:1 ;/**< SST-BF high freq core */ - }; - }; -}; -typedef int (*rte_power_get_capabilities_t )(unsigned int lcore_id,struct rte_power_core_capabilities *caps);
lib/power/power_uncore_ops.h +1 -0
@@ -13,6 +13,7 @@#include <rte_compat.h> #include <rte_common.h> +#include <rte_power_uncore.h> #define RTE_POWER_UNCORE_DRIVER_NAMESZ 24
lib/power/rte_power_cpufreq.c +1 -1
@@ -6,8 +6,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_cpufreq.h" #include "power_common.h" +#include "power_cpufreq.h" static enum power_management_env global_default_env =PM_ENV_NOT_SET ;static struct rte_power_cpufreq_ops *global_cpufreq_ops;
lib/power/rte_power_cpufreq.h +13 -2
@@ -14,8 +14,6 @@#include <rte_common.h> #include <rte_log.h> -#include "power_cpufreq.h" -#ifdef __cplusplusextern "C" {#endif
@@ -248,6 +246,19 @@ int rte_power_freq_enable_turbo(unsigned int lcore_id);*/ int rte_power_freq_disable_turbo (unsigned int lcore_id); +/** +* Power capabilities summary. +*/ +struct rte_power_core_capabilities { +union { +uint64_t capabilities; +struct { +uint64_t turbo:1 ;/**< Turbo can be enabled. */ +uint64_t priority:1 ;/**< SST-BF high freq core */ + }; + }; +}; +/** * Returns power capabilities for a specific lcore. * Function pointer definition. Review each environments
lib/power/rte_power_uncore.c +1 -1
@@ -7,8 +7,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_uncore.h" #include "power_common.h" +#include "power_uncore_ops.h" static enum rte_uncore_power_mgmt_env global_uncore_env =RTE_UNCORE_PM_ENV_NOT_SET ;static struct rte_power_uncore_ops *global_uncore_ops;
lib/power/rte_power_uncore.h +2 -1
@@ -11,7 +11,8 @@* Uncore Frequency Management */ -#include "power_uncore_ops.h" +#include <rte_compat.h> +#include <rte_common.h> #ifdef __cplusplusextern "C" {
Signature · 1 line
2.51.0
Re: [PATCH v5 9/9] power: separate public and driver headers
Quoted 11 lines · David Marchand
power_cpufreq.h,power_common.handpower_uncore_ops.hlook like driver only headers, but were included from public headers.
Move them to thedriver_sdk_headerslist.There is one complication though for
power_cpufreq.has it was included from a public headerrte_power_cpufreq.h.
Move therte_power_core_capabilitiesstruct definition to the public header, since a (stable) public symbol relies on it.Signed-off-by David Marchand <[email protected]>---
Change looks ok to me.
v6 cover Add a stricter headers check
In reply to David MarchandAs explained in patch 8, the current headers check can not catch issues when a public header includes an internal header.
Patch 1-5 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling enable_driver_sdk option).
Signature · 80 lines
David Marchand Changes since v5: - added headers staging cleanup, Changes since v4: - reworked headers install, - fixed issue in ARM memcpy header, - further simplified the header check modifications, Changes since v3: - narrowed down the changes under a check on check_includes= option, - moved the staging directories under buildtools/chkincs, Changes since v2: - major rework, dropping the makefile approach, and instead copying headers to a staging directory used by the check, - rebased, - dropped changes on raw cnxk drivers and disabled the associated build warning in the headers check, David Marchand (9): baseband/acc: fix exported header drivers: drop export of driver headers eventdev: do not include driver header in DMA adapter gpudev: fix driver header for Windows drivers: fix some exported headers eal/arm: fix C++ build for 32-bit memcpy build: factorize headers installation buildtools/chkincs: use a staging directory for headers power: separate public and driver headers buildtools/chkincs/meson.build | 68 +++++++++++++++---- .../chkincs/staging/drivers/meson.build | 13 ++++ buildtools/chkincs/staging/meson.build | 43 ++++++++++++ buildtools/chkincs/staging/stage-headers.py | 40 +++++++++++ config/meson.build | 3 +- devtools/checkpatches.sh | 9 +++ drivers/baseband/acc/meson.build | 2 +- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 + drivers/meson.build | 7 +- drivers/net/dpaa/rte_pmd_dpaa.h | 2 + drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 + drivers/net/txgbe/meson.build | 2 +- drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 + drivers/raw/ntb/rte_pmd_ntb.h | 2 + lib/bbdev/meson.build | 14 ++-- lib/eal/arm/include/meson.build | 3 +- lib/eal/arm/include/rte_memcpy_32.h | 6 +- lib/eal/include/meson.build | 3 +- lib/eal/loongarch/include/meson.build | 3 +- lib/eal/ppc/include/meson.build | 3 +- lib/eal/riscv/include/meson.build | 3 +- lib/eal/x86/include/meson.build | 6 +- lib/ethdev/meson.build | 6 +- lib/eventdev/rte_event_dma_adapter.h | 2 +- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 +- lib/meson.build | 10 +-- lib/mldev/meson.build | 5 +- lib/power/meson.build | 7 +- lib/power/power_cpufreq.h | 14 +--- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 +- lib/rawdev/meson.build | 3 +- lib/regexdev/meson.build | 3 +- lib/security/meson.build | 3 +- meson.build | 21 ++++-- 41 files changed, 267 insertions(+), 86 deletions(-) create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build create mode 100644 buildtools/chkincs/staging/stage-headers.py -- 2.51.0
PATCH v6 1/9 baseband/acc: fix exported header
rte_acc_cfg.h relies on rte_acc_common_cfg.h.
--- drivers/baseband/acc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/baseband/acc/meson.build +1 -1
@@ -26,4 +26,4 @@ deps += ['bus_pci'] sources = files('acc_common.c', 'rte_acc100_pmd.c', 'rte_vrb_pmd.c') -headers = files('rte_acc_cfg.h') +headers = files('rte_acc_cfg.h', 'rte_acc_common_cfg.h')
Signature · 1 line
2.51.0
PATCH v6 2/9 drivers: drop export of driver headers
In reply to David MarchandMany classes are exposing driver only headers as public headers. Move them to the driver_sdk_headers list.
---
Changes since v2:
- rebased,
--- lib/bbdev/meson.build | 14 +++++++++----- lib/ethdev/meson.build | 6 +++--- lib/mldev/meson.build | 5 +---- lib/rawdev/meson.build | 3 ++- lib/regexdev/meson.build | 3 ++- lib/security/meson.build | 3 ++- 6 files changed, 19 insertions(+), 15 deletions(-)
lib/bbdev/meson.build +9 -5
@@ -1,10 +1,14 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_bbdev.c', - 'bbdev_trace_points.c') -headers = files('rte_bbdev.h', - 'rte_bbdev_pmd.h', +sources = files( + 'rte_bbdev.c', + 'bbdev_trace_points.c', +) +headers = files( + 'rte_bbdev.h', 'rte_bbdev_op.h', - 'rte_bbdev_trace_fp.h') + 'rte_bbdev_trace_fp.h', +) +driver_sdk_headers = files('rte_bbdev_pmd.h') deps += ['mbuf']
lib/ethdev/meson.build +3 -3
@@ -26,11 +26,8 @@ headers = files( 'rte_ethdev_trace_fp.h', 'rte_dev_info.h', 'rte_flow.h', - 'rte_flow_driver.h', 'rte_mtr.h', - 'rte_mtr_driver.h', 'rte_tm.h', - 'rte_tm_driver.h', ) indirect_headers += files(
@@ -42,6 +39,9 @@ driver_sdk_headers += files( 'ethdev_driver.h', 'ethdev_pci.h', 'ethdev_vdev.h', + 'rte_flow_driver.h', + 'rte_mtr_driver.h', + 'rte_tm_driver.h', ) if is_linux
lib/mldev/meson.build +1 -4
@@ -26,11 +26,8 @@ headers = files( 'rte_mldev.h', ) -indirect_headers += files( - 'rte_mldev_core.h', -) - driver_sdk_headers += files( + 'rte_mldev_core.h', 'rte_mldev_pmd.h', 'mldev_utils.h', )
lib/rawdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_rawdev.c') -headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h') +headers = files('rte_rawdev.h') +driver_sdk_headers = files('rte_rawdev_pmd.h') deps += ['telemetry']
lib/regexdev/meson.build +2 -1
@@ -2,6 +2,7 @@ # Copyright 2020 Mellanox Technologies, Ltd sources = files('rte_regexdev.c') -headers = files('rte_regexdev.h', 'rte_regexdev_driver.h') +headers = files('rte_regexdev.h') indirect_headers += files('rte_regexdev_core.h') +driver_sdk_headers = files('rte_regexdev_driver.h') deps += ['mbuf']
lib/security/meson.build +2 -1
@@ -2,5 +2,6 @@ # Copyright(c) 2017-2019 Intel Corporation sources = files('rte_security.c') -headers = files('rte_security.h', 'rte_security_driver.h') +headers = files('rte_security.h') +driver_sdk_headers = files('rte_security_driver.h') deps += ['mempool', 'cryptodev', 'net']
Signature · 1 line
2.51.0
PATCH v6 3/9 eventdev: do not include driver header in DMA adapter
In reply to David MarchandThe dma adapter header does not require including rte_dmadev_pmd.h which is a driver header.
--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_dma_adapter.h +1 -1
@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplus
Signature · 1 line
2.51.0
PATCH v6 4/9 gpudev: fix driver header for Windows
In reply to David MarchandUse rte_os.h and its RTE_TAILQ_HEAD definition compatible with BSD sys/queue.h
--- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
lib/gpudev/gpudev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdlib.h> +#include <sys/queue.h> #include <eal_export.h> #include <rte_eal.h>
lib/gpudev/gpudev_driver.h +2 -2
@@ -12,11 +12,11 @@#define RTE_GPUDEV_DRIVER_H #include <stdint.h> -#include <sys/queue.h> #include <dev_driver.h> #include <rte_compat.h> +#include <rte_os.h> #include "rte_gpudev.h" #ifdef __cplusplus
@@ -80,7 +80,7 @@ struct __rte_cache_aligned rte_gpu {/* Driver functions. */ struct rte_gpu_ops ops;/* Event callback list. */ - TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks; + RTE_TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks;/* Current state (used or not) in the running process. */ enum rte_gpu_state process_state;/* Updated by this library. */ /* Driver-specific private data for the running process. */
Signature · 1 line
2.51.0
PATCH v6 5/9 drivers: fix some exported headers
In reply to David MarchandThose headers could not be included individually as they were not including their dependencies, were subject to some build warnings, or were not compiling on Windows.
---
Changes since v2:
- rebased,
- dropped changes on raw/cnxk drivers,
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 ++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 7 files changed, 23 insertions(+)
drivers/bus/vmbus/rte_vmbus_reg.h +6 -0
@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +2 -0
@@ -11,8 +11,10 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> #include <rte_crypto.h> #include <rte_security.h>
drivers/net/dpaa/rte_pmd_dpaa.h +2 -0
@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h *
drivers/net/intel/iavf/rte_pmd_iavf.h +6 -0
@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h>
@@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())
@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false); +#endif } #ifdef __cplusplus
drivers/net/mlx5/rte_pmd_mlx5.h +3 -0
@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h> /**
drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h +2 -0
@@ -12,6 +12,8 @@* */ +#include <stdint.h> +#ifdef __cplusplusextern "C" {#endif
drivers/raw/ntb/rte_pmd_ntb.h +2 -0
@@ -5,6 +5,8 @@#ifndef _RTE_PMD_NTB_H_#define _RTE_PMD_NTB_H_ +#include <stdint.h> +/* App needs to set/get these attrs */ #define NTB_QUEUE_SZ_NAME "queue_size"#define NTB_QUEUE_NUM_NAME "queue_num"
Signature · 1 line
2.51.0
PATCH v6 6/9 eal/arm: fix C++ build for 32-bit memcpy
In reply to David MarchandThis was caught while checking ARM arch headers.
In file included from buildtools/chkincs/chkincs-cpp.p/rte_memcpy_32.cpp:1:/home/runner/work/dpdk/dpdk/lib/eal/arm/include/rte_memcpy_32.h:302:1:
error: expected declaration before ‘}’ token
302 | }
| ^
--- lib/eal/arm/include/rte_memcpy_32.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/eal/arm/include/rte_memcpy_32.h +5 -1
@@ -19,10 +19,14 @@/* ARM NEON Intrinsics are used to copy data */ #include <arm_neon.h> +#endif /* RTE_ARCH_ARM_NEON_MEMCPY */ +#ifdef __cplusplusextern "C" {#endif +#ifdef RTE_ARCH_ARM_NEON_MEMCPY +static inline void rte_mov16 (uint8_t *dst,const uint8_t *src) {
@@ -252,7 +256,7 @@ rte_memcpy_func(void *dst, const void *src, size_t n) return ret; } -#else +#else /* ! RTE_ARCH_ARM_NEON_MEMCPY */ static inline void rte_mov16 (uint8_t *dst,const uint8_t *src)
Signature · 1 line
2.51.0
PATCH v6 7/9 build: factorize headers installation
In reply to David MarchandGather all headers in global variables, put headers installation in a single location and make the headers check use them instead of dpdk_chkinc_headers.
This rework reveals a number of issues:
- net/txgbe driver was directly installing its header, bypassing drivers/meson.build and skipping the headers check,
- arch headers were not checked except for x86,
- some driver headers were not checked,
For the last point, a build warning must be disabled (like it is globally in DPDK) for headers from raw drivers.
Finally, checkpatches is updated to avoid reintroductions of install_headers().
--- buildtools/chkincs/meson.build | 7 +++++-- config/meson.build | 3 +-- devtools/checkpatches.sh | 9 +++++++++ drivers/meson.build | 7 ++----- drivers/net/txgbe/meson.build | 2 +- lib/eal/arm/include/meson.build | 3 +-- lib/eal/include/meson.build | 3 +-- lib/eal/loongarch/include/meson.build | 3 +-- lib/eal/ppc/include/meson.build | 3 +-- lib/eal/riscv/include/meson.build | 3 +-- lib/eal/x86/include/meson.build | 6 ++---- lib/meson.build | 10 +++------- meson.build | 15 ++++++++++++++- 13 files changed, 42 insertions(+), 32 deletions(-)
buildtools/chkincs/meson.build +5 -2
@@ -12,10 +12,13 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args +if cc.has_argument('-Wno-missing-field-initializers') + cflags += '-Wno-missing-field-initializers' +endif cflags += no_wvla_cflag sources = files('main.c') -sources += gen_c_files.process(dpdk_chkinc_headers) +sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) # some driver SDK headers depend on these two buses, which are mandatory in build # so we always include them in deps list
@@ -56,7 +59,7 @@ gen_cpp_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cpp_sources = files('main.cpp') -cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers) +cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) executable('chkincs-cpp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags],
config/meson.build +1 -2
@@ -456,8 +456,7 @@ endif # set the install path for the drivers dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) -install_headers(['rte_config.h'], - subdir: get_option('include_subdir_arch')) +dpdk_arch_headers += files('rte_config.h') # enable VFIO only if it is linux OS dpdk_conf.set('RTE_EAL_VFIO', is_linux)
devtools/checkpatches.sh +9 -0
@@ -87,6 +87,15 @@ check_forbidden_additions() { # <patch> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # don't call directly install_headers() + awk -v FOLDERS="lib drivers" \ + -v SKIP_FILES='meson.build' \ + -v EXPRESSIONS="\\\<install_headers\\\>" \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using install_headers()' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # refrain from using compiler attribute without defining a common macro awk -v FOLDERS="lib drivers app examples" \ -v SKIP_FILES='lib/eal/include/rte_common.h' \
drivers/meson.build +2 -5
@@ -241,11 +241,8 @@ foreach subpath:subdirs dpdk_extra_ldflags += pkgconfig_extra_libs - install_headers(headers) - if get_option('enable_driver_sdk') - install_headers(driver_sdk_headers) - endif - dpdk_chkinc_headers += driver_sdk_headers + dpdk_headers += headers + dpdk_drivers_headers += driver_sdk_headers if headers.length() > 0 dpdk_includes += include_directories(drv_path)
drivers/net/txgbe/meson.build +1 -1
@@ -31,4 +31,4 @@ elif arch_subdir == 'arm' sources += files('txgbe_rxtx_vec_neon.c') endif -install_headers('rte_pmd_txgbe.h') +headers = files('rte_pmd_txgbe.h')
lib/eal/arm/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation. -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic_32.h', 'rte_atomic_64.h', 'rte_atomic.h',
@@ -28,4 +28,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/include/meson.build +1 -2
@@ -64,7 +64,7 @@ driver_sdk_headers = files( ) # special case install the generic headers, since they go in a subdir -generic_headers = files( +dpdk_generic_headers += files( 'generic/rte_atomic.h', 'generic/rte_byteorder.h', 'generic/rte_cpuflags.h',
@@ -78,4 +78,3 @@ generic_headers = files( 'generic/rte_spinlock.h', 'generic/rte_vect.h', ) -install_headers(generic_headers, subdir: 'generic')
lib/eal/loongarch/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 Loongson Technology Corporation Limited -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -15,4 +15,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/ppc/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi <[email protected]> -arch_headers = files( +dpdk_arch_headers += files( 'rte_altivec.h', 'rte_atomic.h', 'rte_byteorder.h',
@@ -16,4 +16,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/riscv/include/meson.build +1 -2
@@ -3,7 +3,7 @@ # Copyright(c) 2022 SiFive # Copyright(c) 2022 Semihalf -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -17,4 +17,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/x86/include/meson.build +2 -4
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -16,11 +16,9 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -arch_indirect_headers = files( +dpdk_arch_indirect_headers += files( 'rte_atomic_32.h', 'rte_atomic_64.h', 'rte_byteorder_32.h', 'rte_byteorder_64.h', ) -install_headers(arch_headers + arch_indirect_headers, subdir: get_option('include_subdir_arch')) -dpdk_chkinc_headers += arch_headers
lib/meson.build +3 -7
@@ -208,13 +208,9 @@ foreach l:libraries dpdk_libs_enabled += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) - install_headers(headers) - install_headers(indirect_headers) - if get_option('enable_driver_sdk') - install_headers(driver_sdk_headers) - endif - dpdk_chkinc_headers += headers - dpdk_chkinc_headers += driver_sdk_headers + dpdk_headers += headers + dpdk_indirect_headers += indirect_headers + dpdk_drivers_headers += driver_sdk_headers libname = 'rte_' + name includes += include_directories(l)
meson.build +14 -1
@@ -37,7 +37,12 @@ dpdk_libraries = [] dpdk_static_libraries = [] dpdk_shared_lib_deps = [] dpdk_static_lib_deps = [] -dpdk_chkinc_headers = [] +dpdk_arch_headers = [] +dpdk_arch_indirect_headers = [] +dpdk_generic_headers = [] +dpdk_headers = [] +dpdk_indirect_headers = [] +dpdk_drivers_headers = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = []
@@ -106,6 +111,14 @@ if get_option('check_includes') subdir('buildtools/chkincs') endif +install_headers(dpdk_arch_headers + dpdk_arch_indirect_headers, + subdir: get_option('include_subdir_arch')) +install_headers(dpdk_headers + dpdk_indirect_headers) +install_headers(dpdk_generic_headers, subdir: 'generic') +if get_option('enable_driver_sdk') + install_headers(dpdk_drivers_headers) +endif + # write the build config build_cfg = 'rte_build_config.h' configure_file(output: build_cfg,
Signature · 1 line
2.51.0
PATCH v6 8/9 buildtools/chkincs: use a staging directory for headers
In reply to David MarchandA problem with the current headers check is that it relies on meson dependencies objects that come with their include_directories directives, and all of those point at the library / driver sources.
This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
---
Changes since v5:
- flushed staging directory before copying again in case of a change in the list of headers,
Changes since v4:
- split global_inc (isolating config include path from EAL headers),
- moved all changes under buildtools/chkincs,
Changes since v3:
- removed update of global_inc (which was unneeded, and probably was what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),
--- buildtools/chkincs/meson.build | 65 +++++++++++++++---- .../chkincs/staging/drivers/meson.build | 13 ++++ buildtools/chkincs/staging/meson.build | 43 ++++++++++++ buildtools/chkincs/staging/stage-headers.py | 40 ++++++++++++ meson.build | 6 +- 5 files changed, 151 insertions(+), 16 deletions(-) create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build create mode 100644 buildtools/chkincs/staging/stage-headers.py
buildtools/chkincs/meson.build +52 -13
@@ -6,6 +6,13 @@ if not get_option('check_includes') subdir_done() endif +includes = [config_inc] +deps = [] +includes_drivers = [] +deps_drivers = [] + +subdir('staging') + gen_c_file_for_header = find_program('gen_c_file_for_header.py') gen_c_files = generator(gen_c_file_for_header, output: '@[email protected]',
@@ -18,18 +25,7 @@ endif cflags += no_wvla_cflag sources = files('main.c') -sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) - -# some driver SDK headers depend on these two buses, which are mandatory in build -# so we always include them in deps list -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] -if dpdk_conf.has('RTE_BUS_VMBUS') - deps += get_variable('shared_rte_bus_vmbus') -endif -# add the rest of the libs to the dependencies -foreach l:dpdk_libs_enabled - deps += get_variable('shared_rte_' + l) -endforeach +sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers) executable('chkincs', sources, c_args: cflags,
@@ -49,6 +45,27 @@ executable('chkincs-all', sources, dependencies: deps, install: false) +sources_drivers = files('main.c') +sources_drivers += gen_c_files.process(dpdk_drivers_headers) + +executable('chkincs-drv', sources_drivers, + c_args: cflags, + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-exp', sources_drivers, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-all', sources_drivers, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + # run tests for c++ builds also if not add_languages('cpp', required: false) subdir_done()
@@ -59,7 +76,7 @@ gen_cpp_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cpp_sources = files('main.cpp') -cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) +cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers) executable('chkincs-cpp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags],
@@ -79,3 +96,25 @@ executable('chkincs-cpp-all', cpp_sources, include_directories: includes, dependencies: deps, install: false) + +cpp_sources_drivers = files('main.cpp') +cpp_sources_drivers += gen_cpp_files.process(dpdk_drivers_headers) + +executable('chkincs-drv-cpp', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-cpp-exp', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-cpp-all', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API', + '-DALLOW_INTERNAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false)
buildtools/chkincs/staging/drivers/meson.build new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +includes += include_directories('.') +deps += declare_dependency(sources: + custom_target('drivers_headers_staging', + output: 'drivers_headers_staging.stamp', + depends: cleanup_target, + command: [stage_headers_cmd, meson.current_build_dir(), '@OUTPUT@', + dpdk_drivers_headers], + install: false, + ) +)
buildtools/chkincs/staging/meson.build new file +43 -0
43 lines not on this page · raw message
buildtools/chkincs/staging/stage-headers.py new file +40 -0
@@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +""" +Headers staging script for DPDK build system. +""" + +import sys +import os +import shutil +from pathlib import Path + +def main(): + if len(sys.argv) < 4: + print("Usage: stage-headers.py [--cleanup] <staging_dir> <meson_stamp> [headers...]") + sys.exit(1) + + if len(sys.argv) == 4 and sys.argv[1] == '--cleanup': + staging_dir = Path(sys.argv[2]) + meson_stamp = Path(sys.argv[3]) + + shutil.rmtree(staging_dir) + staging_dir.mkdir(parents=True, exist_ok=True) + + else: + staging_dir = Path(sys.argv[1]) + meson_stamp = Path(sys.argv[2]) + headers = sys.argv[3:] + + staging_dir.mkdir(parents=True, exist_ok=True) + + for header in headers: + file = Path(header) + shutil.copy2(file, staging_dir / file.name) + + meson_stamp.touch() + +if __name__ == "__main__": + main()
meson.build +3 -3
@@ -69,9 +69,9 @@ elif host_machine.cpu_family().startswith('riscv') endif # configure the build, and make sure configs here and in config folder are -# able to be included in any file. We also store a global array of include dirs -# for passing to pmdinfogen scripts -global_inc = [include_directories('.', 'config', +# able to be included in any file +config_inc = [include_directories('.', 'config')] +global_inc = [config_inc, include_directories( 'lib/eal/include', 'lib/eal/@0@/include'.format(host_machine.system()), 'lib/eal/@0@/include'.format(arch_subdir),
Signature · 1 line
2.51.0
PATCH v6 9/9 power: separate public and driver headers
In reply to David Marchandpower_cpufreq.h, power_common.h and power_uncore_ops.h look like driver only headers, but were included from public headers.
Move them to the driver_sdk_headers list.
There is one complication though for power_cpufreq.h as it was included from a public header rte_power_cpufreq.h.
Move the rte_power_core_capabilities struct definition to the public header, since a (stable) public symbol relies on it.
--- lib/power/meson.build | 7 +++++-- lib/power/power_cpufreq.h | 14 +------------- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++++++++++++-- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 ++- 7 files changed, 24 insertions(+), 20 deletions(-)
lib/power/meson.build +5 -2
@@ -22,12 +22,15 @@ sources = files( 'rte_power_uncore.c', ) headers = files( - 'power_cpufreq.h', - 'power_uncore_ops.h', 'rte_power_cpufreq.h', 'rte_power_pmd_mgmt.h', 'rte_power_qos.h', 'rte_power_uncore.h', ) +driver_sdk_headers = files( + 'power_common.h', + 'power_cpufreq.h', + 'power_uncore_ops.h', +) deps += ['timer', 'ethdev']
lib/power/power_cpufreq.h +1 -13
@@ -14,6 +14,7 @@#include <rte_common.h> #include <rte_log.h> #include <rte_compat.h> +#include <rte_power_cpufreq.h> #define RTE_POWER_DRIVER_NAMESZ 24
@@ -131,19 +132,6 @@ typedef int (*rte_power_freq_change_t)(unsigned int lcore_id);* - Negative on error. */ -/** -* Power capabilities summary. -*/ -struct rte_power_core_capabilities { -union { -uint64_t capabilities; -struct { -uint64_t turbo:1 ;/**< Turbo can be enabled. */ -uint64_t priority:1 ;/**< SST-BF high freq core */ - }; - }; -}; -typedef int (*rte_power_get_capabilities_t )(unsigned int lcore_id,struct rte_power_core_capabilities *caps);
lib/power/power_uncore_ops.h +1 -0
@@ -13,6 +13,7 @@#include <rte_compat.h> #include <rte_common.h> +#include <rte_power_uncore.h> #define RTE_POWER_UNCORE_DRIVER_NAMESZ 24
lib/power/rte_power_cpufreq.c +1 -1
@@ -6,8 +6,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_cpufreq.h" #include "power_common.h" +#include "power_cpufreq.h" static enum power_management_env global_default_env =PM_ENV_NOT_SET ;static struct rte_power_cpufreq_ops *global_cpufreq_ops;
lib/power/rte_power_cpufreq.h +13 -2
@@ -14,8 +14,6 @@#include <rte_common.h> #include <rte_log.h> -#include "power_cpufreq.h" -#ifdef __cplusplusextern "C" {#endif
@@ -248,6 +246,19 @@ int rte_power_freq_enable_turbo(unsigned int lcore_id);*/ int rte_power_freq_disable_turbo (unsigned int lcore_id); +/** +* Power capabilities summary. +*/ +struct rte_power_core_capabilities { +union { +uint64_t capabilities; +struct { +uint64_t turbo:1 ;/**< Turbo can be enabled. */ +uint64_t priority:1 ;/**< SST-BF high freq core */ + }; + }; +}; +/** * Returns power capabilities for a specific lcore. * Function pointer definition. Review each environments
lib/power/rte_power_uncore.c +1 -1
@@ -7,8 +7,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_uncore.h" #include "power_common.h" +#include "power_uncore_ops.h" static enum rte_uncore_power_mgmt_env global_uncore_env =RTE_UNCORE_PM_ENV_NOT_SET ;static struct rte_power_uncore_ops *global_uncore_ops;
lib/power/rte_power_uncore.h +2 -1
@@ -11,7 +11,8 @@* Uncore Frequency Management */ -#include "power_uncore_ops.h" +#include <rte_compat.h> +#include <rte_common.h> #ifdef __cplusplusextern "C" {
Signature · 1 line
2.51.0
v7 cover Add a stricter headers check
In reply to David MarchandAs explained in patch 8, the current headers check can not catch issues when a public header includes an internal header.
Patch 1-5 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling enable_driver_sdk option).
Signature · 84 lines
David Marchand Changes since v6: - a rabbit told me I should fix driver headers include path: https://github.com/david-marchand/dpdk/pull/2#discussion_r2390690589, Changes since v5: - added headers staging cleanup, Changes since v4: - reworked headers install, - fixed issue in ARM memcpy header, - further simplified the header check modifications, Changes since v3: - narrowed down the changes under a check on check_includes= option, - moved the staging directories under buildtools/chkincs, Changes since v2: - major rework, dropping the makefile approach, and instead copying headers to a staging directory used by the check, - rebased, - dropped changes on raw cnxk drivers and disabled the associated build warning in the headers check, David Marchand (9): baseband/acc: fix exported header drivers: drop export of driver headers eventdev: do not include driver header in DMA adapter gpudev: fix driver header for Windows drivers: fix some exported headers eal/arm: fix C++ build for 32-bit memcpy build: factorize headers installation buildtools/chkincs: use a staging directory for headers power: separate public and driver headers buildtools/chkincs/meson.build | 68 +++++++++++++++---- .../chkincs/staging/drivers/meson.build | 13 ++++ buildtools/chkincs/staging/meson.build | 43 ++++++++++++ buildtools/chkincs/staging/stage-headers.py | 50 ++++++++++++++ config/meson.build | 3 +- devtools/checkpatches.sh | 8 +++ drivers/baseband/acc/meson.build | 2 +- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 + drivers/meson.build | 7 +- drivers/net/dpaa/rte_pmd_dpaa.h | 2 + drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 + drivers/net/txgbe/meson.build | 2 +- drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 + drivers/raw/ntb/rte_pmd_ntb.h | 2 + lib/bbdev/meson.build | 14 ++-- lib/eal/arm/include/meson.build | 3 +- lib/eal/arm/include/rte_memcpy_32.h | 6 +- lib/eal/include/meson.build | 3 +- lib/eal/loongarch/include/meson.build | 3 +- lib/eal/ppc/include/meson.build | 3 +- lib/eal/riscv/include/meson.build | 3 +- lib/eal/x86/include/meson.build | 6 +- lib/ethdev/meson.build | 6 +- lib/eventdev/rte_event_dma_adapter.h | 2 +- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 +- lib/meson.build | 10 +-- lib/mldev/meson.build | 5 +- lib/power/meson.build | 7 +- lib/power/power_cpufreq.h | 14 +--- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 +- lib/rawdev/meson.build | 3 +- lib/regexdev/meson.build | 3 +- lib/security/meson.build | 3 +- meson.build | 21 ++++-- 41 files changed, 276 insertions(+), 86 deletions(-) create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build create mode 100755 buildtools/chkincs/staging/stage-headers.py -- 2.51.0
PATCH v7 1/9 baseband/acc: fix exported header
rte_acc_cfg.h relies on rte_acc_common_cfg.h.
--- drivers/baseband/acc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/baseband/acc/meson.build +1 -1
@@ -26,4 +26,4 @@ deps += ['bus_pci'] sources = files('acc_common.c', 'rte_acc100_pmd.c', 'rte_vrb_pmd.c') -headers = files('rte_acc_cfg.h') +headers = files('rte_acc_cfg.h', 'rte_acc_common_cfg.h')
Signature · 1 line
2.51.0
PATCH v7 2/9 drivers: drop export of driver headers
In reply to David MarchandMany classes are exposing driver only headers as public headers. Move them to the driver_sdk_headers list.
---
Changes since v2:
- rebased,
--- lib/bbdev/meson.build | 14 +++++++++----- lib/ethdev/meson.build | 6 +++--- lib/mldev/meson.build | 5 +---- lib/rawdev/meson.build | 3 ++- lib/regexdev/meson.build | 3 ++- lib/security/meson.build | 3 ++- 6 files changed, 19 insertions(+), 15 deletions(-)
lib/bbdev/meson.build +9 -5
@@ -1,10 +1,14 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -sources = files('rte_bbdev.c', - 'bbdev_trace_points.c') -headers = files('rte_bbdev.h', - 'rte_bbdev_pmd.h', +sources = files( + 'rte_bbdev.c', + 'bbdev_trace_points.c', +) +headers = files( + 'rte_bbdev.h', 'rte_bbdev_op.h', - 'rte_bbdev_trace_fp.h') + 'rte_bbdev_trace_fp.h', +) +driver_sdk_headers = files('rte_bbdev_pmd.h') deps += ['mbuf']
lib/ethdev/meson.build +3 -3
@@ -26,11 +26,8 @@ headers = files( 'rte_ethdev_trace_fp.h', 'rte_dev_info.h', 'rte_flow.h', - 'rte_flow_driver.h', 'rte_mtr.h', - 'rte_mtr_driver.h', 'rte_tm.h', - 'rte_tm_driver.h', ) indirect_headers += files(
@@ -42,6 +39,9 @@ driver_sdk_headers += files( 'ethdev_driver.h', 'ethdev_pci.h', 'ethdev_vdev.h', + 'rte_flow_driver.h', + 'rte_mtr_driver.h', + 'rte_tm_driver.h', ) if is_linux
lib/mldev/meson.build +1 -4
@@ -26,11 +26,8 @@ headers = files( 'rte_mldev.h', ) -indirect_headers += files( - 'rte_mldev_core.h', -) - driver_sdk_headers += files( + 'rte_mldev_core.h', 'rte_mldev_pmd.h', 'mldev_utils.h', )
lib/rawdev/meson.build +2 -1
@@ -8,6 +8,7 @@ if is_windows endif sources = files('rte_rawdev.c') -headers = files('rte_rawdev.h', 'rte_rawdev_pmd.h') +headers = files('rte_rawdev.h') +driver_sdk_headers = files('rte_rawdev_pmd.h') deps += ['telemetry']
lib/regexdev/meson.build +2 -1
@@ -2,6 +2,7 @@ # Copyright 2020 Mellanox Technologies, Ltd sources = files('rte_regexdev.c') -headers = files('rte_regexdev.h', 'rte_regexdev_driver.h') +headers = files('rte_regexdev.h') indirect_headers += files('rte_regexdev_core.h') +driver_sdk_headers = files('rte_regexdev_driver.h') deps += ['mbuf']
lib/security/meson.build +2 -1
@@ -2,5 +2,6 @@ # Copyright(c) 2017-2019 Intel Corporation sources = files('rte_security.c') -headers = files('rte_security.h', 'rte_security_driver.h') +headers = files('rte_security.h') +driver_sdk_headers = files('rte_security_driver.h') deps += ['mempool', 'cryptodev', 'net']
Signature · 1 line
2.51.0
PATCH v7 3/9 eventdev: do not include driver header in DMA adapter
In reply to David MarchandThe dma adapter header does not require including rte_dmadev_pmd.h which is a driver header.
--- lib/eventdev/rte_event_dma_adapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_dma_adapter.h +1 -1
@@ -144,7 +144,7 @@#include <stdint.h> #include <rte_common.h> -#include <rte_dmadev_pmd.h> +#include <rte_dmadev.h> #include <rte_eventdev.h> #ifdef __cplusplus
Signature · 1 line
2.51.0
PATCH v7 4/9 gpudev: fix driver header for Windows
In reply to David MarchandUse rte_os.h and its RTE_TAILQ_HEAD definition compatible with BSD sys/queue.h
--- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
lib/gpudev/gpudev.c +1 -0
@@ -3,6 +3,7 @@*/ #include <stdlib.h> +#include <sys/queue.h> #include <eal_export.h> #include <rte_eal.h>
lib/gpudev/gpudev_driver.h +2 -2
@@ -12,11 +12,11 @@#define RTE_GPUDEV_DRIVER_H #include <stdint.h> -#include <sys/queue.h> #include <dev_driver.h> #include <rte_compat.h> +#include <rte_os.h> #include "rte_gpudev.h" #ifdef __cplusplus
@@ -80,7 +80,7 @@ struct __rte_cache_aligned rte_gpu {/* Driver functions. */ struct rte_gpu_ops ops;/* Event callback list. */ - TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks; + RTE_TAILQ_HEAD(rte_gpu_callback_list, rte_gpu_callback) callbacks;/* Current state (used or not) in the running process. */ enum rte_gpu_state process_state;/* Updated by this library. */ /* Driver-specific private data for the running process. */
Signature · 1 line
2.51.0
PATCH v7 5/9 drivers: fix some exported headers
In reply to David MarchandThose headers could not be included individually as they were not including their dependencies, were subject to some build warnings, or were not compiling on Windows.
---
Changes since v2:
- rebased,
- dropped changes on raw/cnxk drivers,
--- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++++++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 ++ drivers/net/dpaa/rte_pmd_dpaa.h | 2 ++ drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++++++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 +++ drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 ++ drivers/raw/ntb/rte_pmd_ntb.h | 2 ++ 7 files changed, 23 insertions(+)
drivers/bus/vmbus/rte_vmbus_reg.h +6 -0
@@ -6,6 +6,12 @@#ifndef _VMBUS_REG_H_#define _VMBUS_REG_H_ +#include <stdint.h> + +#include <rte_common.h> +#include <rte_stdatomic.h> +#include <rte_uuid.h> +/* * Hyper-V SynIC message format. */
drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h +2 -0
@@ -11,8 +11,10 @@#ifndef _PMD_CNXK_CRYPTO_H_#define _PMD_CNXK_CRYPTO_H_ +#include <stdbool.h> #include <stdint.h> +#include <rte_compat.h> #include <rte_crypto.h> #include <rte_security.h>
drivers/net/dpaa/rte_pmd_dpaa.h +2 -0
@@ -5,6 +5,8 @@#ifndef _PMD_DPAA_H_#define _PMD_DPAA_H_ +#include <stdint.h> +/** * @file rte_pmd_dpaa.h *
drivers/net/intel/iavf/rte_pmd_iavf.h +6 -0
@@ -15,6 +15,7 @@*/ #include <stdio.h> +#include <rte_compat.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h>
@@ -184,6 +185,7 @@ __rte_experimentalstatic inline void rte_pmd_ifd_dump_proto_xtr_metadata (struct rte_mbuf *m) { +#ifdef ALLOW_EXPERIMENTAL_API union rte_pmd_ifd_proto_xtr_metadata data;if (!rte_pmd_ifd_dynf_proto_xtr_metadata_avail ())
@@ -243,6 +245,10 @@ rte_pmd_ifd_dump_proto_xtr_metadata(struct rte_mbuf *m) else if (m->ol_flags & RTE_IAVF_PKT_RX_DYNF_PROTO_XTR_IP_OFFSET) printf(" - Flexible descriptor's Extraction: ip_offset=%u", data.ip_ofs); +#else + RTE_SET_USED(m); + RTE_VERIFY(false); +#endif } #ifdef __cplusplus
drivers/net/mlx5/rte_pmd_mlx5.h +3 -0
@@ -5,6 +5,9 @@#ifndef RTE_PMD_PRIVATE_MLX5_H_ #define RTE_PMD_PRIVATE_MLX5_H_ +#include <stdint.h> + +#include <rte_byteorder.h> #include <rte_compat.h> /**
drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h +2 -0
@@ -12,6 +12,8 @@* */ +#include <stdint.h> +#ifdef __cplusplusextern "C" {#endif
drivers/raw/ntb/rte_pmd_ntb.h +2 -0
@@ -5,6 +5,8 @@#ifndef _RTE_PMD_NTB_H_#define _RTE_PMD_NTB_H_ +#include <stdint.h> +/* App needs to set/get these attrs */ #define NTB_QUEUE_SZ_NAME "queue_size"#define NTB_QUEUE_NUM_NAME "queue_num"
Signature · 1 line
2.51.0
PATCH v7 6/9 eal/arm: fix C++ build for 32-bit memcpy
In reply to David MarchandThis was caught while checking ARM arch headers.
In file included from buildtools/chkincs/chkincs-cpp.p/rte_memcpy_32.cpp:1:/home/runner/work/dpdk/dpdk/lib/eal/arm/include/rte_memcpy_32.h:302:1:
error: expected declaration before ‘}’ token
302 | }
| ^
--- lib/eal/arm/include/rte_memcpy_32.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/eal/arm/include/rte_memcpy_32.h +5 -1
@@ -19,10 +19,14 @@/* ARM NEON Intrinsics are used to copy data */ #include <arm_neon.h> +#endif /* RTE_ARCH_ARM_NEON_MEMCPY */ +#ifdef __cplusplusextern "C" {#endif +#ifdef RTE_ARCH_ARM_NEON_MEMCPY +static inline void rte_mov16 (uint8_t *dst,const uint8_t *src) {
@@ -252,7 +256,7 @@ rte_memcpy_func(void *dst, const void *src, size_t n) return ret; } -#else +#else /* ! RTE_ARCH_ARM_NEON_MEMCPY */ static inline void rte_mov16 (uint8_t *dst,const uint8_t *src)
Signature · 1 line
2.51.0
PATCH v7 7/9 build: factorize headers installation
In reply to David MarchandGather all headers in global variables, put headers installation in a single location and make the headers check use them instead of dpdk_chkinc_headers.
This rework reveals a number of issues:
- net/txgbe driver was directly installing its header, bypassing drivers/meson.build and skipping the headers check,
- arch headers were not checked except for x86,
- some driver headers were not checked,
For the last point, a build warning must be disabled (like it is globally in DPDK) for headers from raw drivers.
Finally, checkpatches is updated to avoid reintroductions of install_headers().
--- buildtools/chkincs/meson.build | 7 +++++-- config/meson.build | 3 +-- devtools/checkpatches.sh | 8 ++++++++ drivers/meson.build | 7 ++----- drivers/net/txgbe/meson.build | 2 +- lib/eal/arm/include/meson.build | 3 +-- lib/eal/include/meson.build | 3 +-- lib/eal/loongarch/include/meson.build | 3 +-- lib/eal/ppc/include/meson.build | 3 +-- lib/eal/riscv/include/meson.build | 3 +-- lib/eal/x86/include/meson.build | 6 ++---- lib/meson.build | 10 +++------- meson.build | 15 ++++++++++++++- 13 files changed, 41 insertions(+), 32 deletions(-)
buildtools/chkincs/meson.build +5 -2
@@ -12,10 +12,13 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args +if cc.has_argument('-Wno-missing-field-initializers') + cflags += '-Wno-missing-field-initializers' +endif cflags += no_wvla_cflag sources = files('main.c') -sources += gen_c_files.process(dpdk_chkinc_headers) +sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) # some driver SDK headers depend on these two buses, which are mandatory in build # so we always include them in deps list
@@ -56,7 +59,7 @@ gen_cpp_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cpp_sources = files('main.cpp') -cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers) +cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) executable('chkincs-cpp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags],
config/meson.build +1 -2
@@ -456,8 +456,7 @@ endif # set the install path for the drivers dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path) -install_headers(['rte_config.h'], - subdir: get_option('include_subdir_arch')) +dpdk_arch_headers += files('rte_config.h') # enable VFIO only if it is linux OS dpdk_conf.set('RTE_EAL_VFIO', is_linux)
devtools/checkpatches.sh +8 -0
@@ -87,6 +87,14 @@ check_forbidden_additions() { # <patch> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # don't call directly install_headers() + awk -v FOLDERS="lib drivers" \ + -v EXPRESSIONS="\\\<install_headers\\\>" \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using install_headers()' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # refrain from using compiler attribute without defining a common macro awk -v FOLDERS="lib drivers app examples" \ -v SKIP_FILES='lib/eal/include/rte_common.h' \
drivers/meson.build +2 -5
@@ -241,11 +241,8 @@ foreach subpath:subdirs dpdk_extra_ldflags += pkgconfig_extra_libs - install_headers(headers) - if get_option('enable_driver_sdk') - install_headers(driver_sdk_headers) - endif - dpdk_chkinc_headers += driver_sdk_headers + dpdk_headers += headers + dpdk_drivers_headers += driver_sdk_headers if headers.length() > 0 dpdk_includes += include_directories(drv_path)
drivers/net/txgbe/meson.build +1 -1
@@ -31,4 +31,4 @@ elif arch_subdir == 'arm' sources += files('txgbe_rxtx_vec_neon.c') endif -install_headers('rte_pmd_txgbe.h') +headers = files('rte_pmd_txgbe.h')
lib/eal/arm/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation. -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic_32.h', 'rte_atomic_64.h', 'rte_atomic.h',
@@ -28,4 +28,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/include/meson.build +1 -2
@@ -64,7 +64,7 @@ driver_sdk_headers = files( ) # special case install the generic headers, since they go in a subdir -generic_headers = files( +dpdk_generic_headers += files( 'generic/rte_atomic.h', 'generic/rte_byteorder.h', 'generic/rte_cpuflags.h',
@@ -78,4 +78,3 @@ generic_headers = files( 'generic/rte_spinlock.h', 'generic/rte_vect.h', ) -install_headers(generic_headers, subdir: 'generic')
lib/eal/loongarch/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2022 Loongson Technology Corporation Limited -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -15,4 +15,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/ppc/include/meson.build +1 -2
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi <[email protected]> -arch_headers = files( +dpdk_arch_headers += files( 'rte_altivec.h', 'rte_atomic.h', 'rte_byteorder.h',
@@ -16,4 +16,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/riscv/include/meson.build +1 -2
@@ -3,7 +3,7 @@ # Copyright(c) 2022 SiFive # Copyright(c) 2022 Semihalf -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -17,4 +17,3 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
lib/eal/x86/include/meson.build +2 -4
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -arch_headers = files( +dpdk_arch_headers += files( 'rte_atomic.h', 'rte_byteorder.h', 'rte_cpuflags.h',
@@ -16,11 +16,9 @@ arch_headers = files( 'rte_spinlock.h', 'rte_vect.h', ) -arch_indirect_headers = files( +dpdk_arch_indirect_headers += files( 'rte_atomic_32.h', 'rte_atomic_64.h', 'rte_byteorder_32.h', 'rte_byteorder_64.h', ) -install_headers(arch_headers + arch_indirect_headers, subdir: get_option('include_subdir_arch')) -dpdk_chkinc_headers += arch_headers
lib/meson.build +3 -7
@@ -208,13 +208,9 @@ foreach l:libraries dpdk_libs_enabled += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) - install_headers(headers) - install_headers(indirect_headers) - if get_option('enable_driver_sdk') - install_headers(driver_sdk_headers) - endif - dpdk_chkinc_headers += headers - dpdk_chkinc_headers += driver_sdk_headers + dpdk_headers += headers + dpdk_indirect_headers += indirect_headers + dpdk_drivers_headers += driver_sdk_headers libname = 'rte_' + name includes += include_directories(l)
meson.build +14 -1
@@ -37,7 +37,12 @@ dpdk_libraries = [] dpdk_static_libraries = [] dpdk_shared_lib_deps = [] dpdk_static_lib_deps = [] -dpdk_chkinc_headers = [] +dpdk_arch_headers = [] +dpdk_arch_indirect_headers = [] +dpdk_generic_headers = [] +dpdk_headers = [] +dpdk_indirect_headers = [] +dpdk_drivers_headers = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = []
@@ -106,6 +111,14 @@ if get_option('check_includes') subdir('buildtools/chkincs') endif +install_headers(dpdk_arch_headers + dpdk_arch_indirect_headers, + subdir: get_option('include_subdir_arch')) +install_headers(dpdk_headers + dpdk_indirect_headers) +install_headers(dpdk_generic_headers, subdir: 'generic') +if get_option('enable_driver_sdk') + install_headers(dpdk_drivers_headers) +endif + # write the build config build_cfg = 'rte_build_config.h' configure_file(output: build_cfg,
Signature · 1 line
2.51.0
PATCH v7 8/9 buildtools/chkincs: use a staging directory for headers
In reply to David MarchandA problem with the current headers check is that it relies on meson dependencies objects that come with their include_directories directives, and all of those point at the library / driver sources.
This means that we won't detect a public header including a private (as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header is copied to it.
Drivers and library headers are staged to two different directories and the check is updated accordingly.
---
Changes since v6:
- fixed driver headers include path,
- added some documentation in stage-headers.py,
Changes since v5:
- flushed staging directory before copying again in case of a change in the list of headers,
Changes since v4:
- split global_inc (isolating config include path from EAL headers),
- moved all changes under buildtools/chkincs,
Changes since v3:
- removed update of global_inc (which was unneeded, and probably was what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),
--- buildtools/chkincs/meson.build | 65 +++++++++++++++---- .../chkincs/staging/drivers/meson.build | 13 ++++ buildtools/chkincs/staging/meson.build | 43 ++++++++++++ buildtools/chkincs/staging/stage-headers.py | 50 ++++++++++++++ meson.build | 6 +- 5 files changed, 161 insertions(+), 16 deletions(-) create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build create mode 100755 buildtools/chkincs/staging/stage-headers.py
buildtools/chkincs/meson.build +52 -13
@@ -6,6 +6,13 @@ if not get_option('check_includes') subdir_done() endif +includes = [config_inc] +deps = [] +includes_drivers = [] +deps_drivers = [] + +subdir('staging') + gen_c_file_for_header = find_program('gen_c_file_for_header.py') gen_c_files = generator(gen_c_file_for_header, output: '@[email protected]',
@@ -18,18 +25,7 @@ endif cflags += no_wvla_cflag sources = files('main.c') -sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) - -# some driver SDK headers depend on these two buses, which are mandatory in build -# so we always include them in deps list -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')] -if dpdk_conf.has('RTE_BUS_VMBUS') - deps += get_variable('shared_rte_bus_vmbus') -endif -# add the rest of the libs to the dependencies -foreach l:dpdk_libs_enabled - deps += get_variable('shared_rte_' + l) -endforeach +sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers) executable('chkincs', sources, c_args: cflags,
@@ -49,6 +45,27 @@ executable('chkincs-all', sources, dependencies: deps, install: false) +sources_drivers = files('main.c') +sources_drivers += gen_c_files.process(dpdk_drivers_headers) + +executable('chkincs-drv', sources_drivers, + c_args: cflags, + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-exp', sources_drivers, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-all', sources_drivers, + c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + # run tests for c++ builds also if not add_languages('cpp', required: false) subdir_done()
@@ -59,7 +76,7 @@ gen_cpp_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cpp_sources = files('main.cpp') -cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers) +cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers) executable('chkincs-cpp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags],
@@ -79,3 +96,25 @@ executable('chkincs-cpp-all', cpp_sources, include_directories: includes, dependencies: deps, install: false) + +cpp_sources_drivers = files('main.cpp') +cpp_sources_drivers += gen_cpp_files.process(dpdk_drivers_headers) + +executable('chkincs-drv-cpp', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-cpp-exp', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false) + +executable('chkincs-drv-cpp-all', cpp_sources_drivers, + cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API', + '-DALLOW_INTERNAL_API'], + include_directories: includes + includes_drivers, + dependencies: deps + deps_drivers, + install: false)
buildtools/chkincs/staging/drivers/meson.build new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2025 Red Hat, Inc. + +includes_drivers += include_directories('.') +deps_drivers += declare_dependency(sources: + custom_target('drivers_headers_staging', + output: 'drivers_headers_staging.stamp', + depends: cleanup_target, + command: [stage_headers_cmd, meson.current_build_dir(), '@OUTPUT@', + dpdk_drivers_headers], + install: false, + ) +)
buildtools/chkincs/staging/meson.build new file +43 -0
43 lines not on this page · raw message
buildtools/chkincs/staging/stage-headers.py new file +50 -0
50 lines not on this page · raw message
meson.build +3 -3
@@ -69,9 +69,9 @@ elif host_machine.cpu_family().startswith('riscv') endif # configure the build, and make sure configs here and in config folder are -# able to be included in any file. We also store a global array of include dirs -# for passing to pmdinfogen scripts -global_inc = [include_directories('.', 'config', +# able to be included in any file +config_inc = [include_directories('.', 'config')] +global_inc = [config_inc, include_directories( 'lib/eal/include', 'lib/eal/@0@/include'.format(host_machine.system()), 'lib/eal/@0@/include'.format(arch_subdir),
Signature · 1 line
2.51.0
PATCH v7 9/9 power: separate public and driver headers
In reply to David Marchandpower_cpufreq.h, power_common.h and power_uncore_ops.h look like driver only headers, but were included from public headers.
Move them to the driver_sdk_headers list.
There is one complication though for power_cpufreq.h as it was included from a public header rte_power_cpufreq.h.
Move the rte_power_core_capabilities struct definition to the public header, since a (stable) public symbol relies on it.
--- lib/power/meson.build | 7 +++++-- lib/power/power_cpufreq.h | 14 +------------- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++++++++++++-- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 ++- 7 files changed, 24 insertions(+), 20 deletions(-)
lib/power/meson.build +5 -2
@@ -22,12 +22,15 @@ sources = files( 'rte_power_uncore.c', ) headers = files( - 'power_cpufreq.h', - 'power_uncore_ops.h', 'rte_power_cpufreq.h', 'rte_power_pmd_mgmt.h', 'rte_power_qos.h', 'rte_power_uncore.h', ) +driver_sdk_headers = files( + 'power_common.h', + 'power_cpufreq.h', + 'power_uncore_ops.h', +) deps += ['timer', 'ethdev']
lib/power/power_cpufreq.h +1 -13
@@ -14,6 +14,7 @@#include <rte_common.h> #include <rte_log.h> #include <rte_compat.h> +#include <rte_power_cpufreq.h> #define RTE_POWER_DRIVER_NAMESZ 24
@@ -131,19 +132,6 @@ typedef int (*rte_power_freq_change_t)(unsigned int lcore_id);* - Negative on error. */ -/** -* Power capabilities summary. -*/ -struct rte_power_core_capabilities { -union { -uint64_t capabilities; -struct { -uint64_t turbo:1 ;/**< Turbo can be enabled. */ -uint64_t priority:1 ;/**< SST-BF high freq core */ - }; - }; -}; -typedef int (*rte_power_get_capabilities_t )(unsigned int lcore_id,struct rte_power_core_capabilities *caps);
lib/power/power_uncore_ops.h +1 -0
@@ -13,6 +13,7 @@#include <rte_compat.h> #include <rte_common.h> +#include <rte_power_uncore.h> #define RTE_POWER_UNCORE_DRIVER_NAMESZ 24
lib/power/rte_power_cpufreq.c +1 -1
@@ -6,8 +6,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_cpufreq.h" #include "power_common.h" +#include "power_cpufreq.h" static enum power_management_env global_default_env =PM_ENV_NOT_SET ;static struct rte_power_cpufreq_ops *global_cpufreq_ops;
lib/power/rte_power_cpufreq.h +13 -2
@@ -14,8 +14,6 @@#include <rte_common.h> #include <rte_log.h> -#include "power_cpufreq.h" -#ifdef __cplusplusextern "C" {#endif
@@ -248,6 +246,19 @@ int rte_power_freq_enable_turbo(unsigned int lcore_id);*/ int rte_power_freq_disable_turbo (unsigned int lcore_id); +/** +* Power capabilities summary. +*/ +struct rte_power_core_capabilities { +union { +uint64_t capabilities; +struct { +uint64_t turbo:1 ;/**< Turbo can be enabled. */ +uint64_t priority:1 ;/**< SST-BF high freq core */ + }; + }; +}; +/** * Returns power capabilities for a specific lcore. * Function pointer definition. Review each environments
lib/power/rte_power_uncore.c +1 -1
@@ -7,8 +7,8 @@#include <rte_spinlock.h> #include <rte_debug.h> -#include "rte_power_uncore.h" #include "power_common.h" +#include "power_uncore_ops.h" static enum rte_uncore_power_mgmt_env global_uncore_env =RTE_UNCORE_PM_ENV_NOT_SET ;static struct rte_power_uncore_ops *global_uncore_ops;
lib/power/rte_power_uncore.h +2 -1
@@ -11,7 +11,8 @@* Uncore Frequency Management */ -#include "power_uncore_ops.h" +#include <rte_compat.h> +#include <rte_common.h> #ifdef __cplusplusextern "C" {
Signature · 1 line
2.51.0
Quoted 83 lines · David Marchand
As explained in patch 8, the current headers check can not catch issues when a public header includes an internal header.
Patch 1-5 fixes have not been marked as backport material as those bugs seems minor/easy to fix externally (by either including missing headers, or enabling
enable_driver_sdkoption).--
David MarchandChanges since v6:
- a rabbit told me I should fix driver headers include path:
https://github.com/david-marchand/dpdk/pull/2#discussion_r2390690589,Changes since v5:
- added headers staging cleanup,Changes since v4:
- reworked headers install,
- fixed issue in ARM memcpy header,
- further simplified the header check modifications,Changes since v3:
- narrowed down the changes under a check on check_includes= option,
- moved the staging directories under buildtools/chkincs,Changes since v2:
- major rework, dropping the makefile approach, and instead copying headers to a staging directory used by the check,
- rebased,
- dropped changes on raw cnxk drivers and disabled the associated build warning in the headers check,David Marchand (9):
baseband/acc: fix exported header
drivers: drop export of driver headers
eventdev: do not include driver header in DMA adapter
gpudev: fix driver header for Windows
drivers: fix some exported headers
eal/arm: fix C++ build for 32-bit memcpy
build: factorize headers installation buildtools/chkincs: use a staging directory for headers
power: separate public and driver headersbuildtools/chkincs/meson.build | 68 +++++++++++++++---- .../chkincs/staging/drivers/meson.build | 13 ++++ buildtools/chkincs/staging/meson.build | 43 ++++++++++++ buildtools/chkincs/staging/stage-headers.py | 50 ++++++++++++++ config/meson.build | 3 +- devtools/checkpatches.sh | 8 +++ drivers/baseband/acc/meson.build | 2 +- drivers/bus/vmbus/rte_vmbus_reg.h | 6 ++ drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h | 2 + drivers/meson.build | 7 +- drivers/net/dpaa/rte_pmd_dpaa.h | 2 + drivers/net/intel/iavf/rte_pmd_iavf.h | 6 ++ drivers/net/mlx5/rte_pmd_mlx5.h | 3 + drivers/net/txgbe/meson.build | 2 +- drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h | 2 + drivers/raw/ntb/rte_pmd_ntb.h | 2 + lib/bbdev/meson.build | 14 ++-- lib/eal/arm/include/meson.build | 3 +- lib/eal/arm/include/rte_memcpy_32.h | 6 +- lib/eal/include/meson.build | 3 +- lib/eal/loongarch/include/meson.build | 3 +- lib/eal/ppc/include/meson.build | 3 +- lib/eal/riscv/include/meson.build | 3 +- lib/eal/x86/include/meson.build | 6 +- lib/ethdev/meson.build | 6 +- lib/eventdev/rte_event_dma_adapter.h | 2 +- lib/gpudev/gpudev.c | 1 + lib/gpudev/gpudev_driver.h | 4 +- lib/meson.build | 10 +-- lib/mldev/meson.build | 5 +- lib/power/meson.build | 7 +- lib/power/power_cpufreq.h | 14 +--- lib/power/power_uncore_ops.h | 1 + lib/power/rte_power_cpufreq.c | 2 +- lib/power/rte_power_cpufreq.h | 15 +++- lib/power/rte_power_uncore.c | 2 +- lib/power/rte_power_uncore.h | 3 +-
Quoted 8 lines
lib/rawdev/meson.build | 3 +- lib/regexdev/meson.build | 3 +- lib/security/meson.build | 3 +- meson.build | 21 ++++-- 41 files changed, 276 insertions(+), 86 deletions(-) create mode 100644 buildtools/chkincs/staging/drivers/meson.build create mode 100644 buildtools/chkincs/staging/meson.build create mode 100755 buildtools/chkincs/staging/stage-headers.py
Series applied, thanks for the reviews.
Signature · 1 line
David Marchand