* [RFC 2/6] drivers: drop export of driver headers
2024-11-27 11:26 [RFC 0/6] Add a stricter headers check David Marchand
2024-11-27 11:26 ` [RFC 1/6] baseband/acc: fix exported header David Marchand
@ 2024-11-27 11:26 ` David Marchand
2024-11-27 11:26 ` [RFC 3/6] eventdev: do not include driver header in DMA adapter David Marchand
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: David Marchand @ 2024-11-27 11:26 UTC (permalink / raw)
To: dev
Cc: thomas, bruce.richardson, Nicolas Chautru, Ferruh Yigit,
Andrew Rybchenko, Srikanth Yalavarthi, Sachin Saxena,
Hemant Agrawal, Ori Kam, Akhil Goyal, Anoob Joseph
Many classes are exposing driver only headers as public headers.
Move them to the driver_sdk_headers list.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
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(-)
diff --git a/lib/bbdev/meson.build b/lib/bbdev/meson.build
index 07685e7578..7d035065f1 100644
--- a/lib/bbdev/meson.build
+++ b/lib/bbdev/meson.build
@@ -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']
diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build
index f1d2586591..8ba6c708a2 100644
--- a/lib/ethdev/meson.build
+++ b/lib/ethdev/meson.build
@@ -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
diff --git a/lib/mldev/meson.build b/lib/mldev/meson.build
index 2c933baad6..efc3edd288 100644
--- a/lib/mldev/meson.build
+++ b/lib/mldev/meson.build
@@ -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',
)
diff --git a/lib/rawdev/meson.build b/lib/rawdev/meson.build
index 7dfc3d5cf9..ccfd922fda 100644
--- a/lib/rawdev/meson.build
+++ b/lib/rawdev/meson.build
@@ -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']
diff --git a/lib/regexdev/meson.build b/lib/regexdev/meson.build
index 426e764ece..05040051c5 100644
--- a/lib/regexdev/meson.build
+++ b/lib/regexdev/meson.build
@@ -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']
diff --git a/lib/security/meson.build b/lib/security/meson.build
index 1034a7a299..d5431d472c 100644
--- a/lib/security/meson.build
+++ b/lib/security/meson.build
@@ -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']
--
2.47.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [RFC 4/6] drivers: fix exported headers
2024-11-27 11:26 [RFC 0/6] Add a stricter headers check David Marchand
` (2 preceding siblings ...)
2024-11-27 11:26 ` [RFC 3/6] eventdev: do not include driver header in DMA adapter David Marchand
@ 2024-11-27 11:26 ` David Marchand
2024-11-27 11:26 ` [RFC 5/6] build: install indirect headers to a dedicated directory David Marchand
2024-11-27 11:26 ` [RFC 6/6] buildtools: externally check exported headers David Marchand
5 siblings, 0 replies; 9+ messages in thread
From: David Marchand @ 2024-11-27 11:26 UTC (permalink / raw)
To: dev
Cc: thomas, bruce.richardson, Long Li, Wei Hu, Ankur Dwivedi,
Anoob Joseph, Tejasree Kondoj, Hemant Agrawal, Sachin Saxena,
Vladimir Medvedkin, Ian Stokes, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad, Jakub Palider, Tomasz Duszynski, Gagandeep Singh,
Jingjing Wu, Stephen Hemminger, Akhil Goyal, Haiyue Wang,
Jeff Guo, Michael Baum, Jerin Jacob, Nipun Gupta, Shreyansh Jain,
Xiaoyun Li
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")
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
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(+)
diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h b/drivers/bus/vmbus/rte_vmbus_reg.h
index e3299aa871..95c8eb29b4 100644
--- a/drivers/bus/vmbus/rte_vmbus_reg.h
+++ b/drivers/bus/vmbus/rte_vmbus_reg.h
@@ -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.
*/
diff --git a/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h b/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h
index 02278605a2..2bb0ff9e95 100644
--- a/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h
+++ b/drivers/crypto/cnxk/rte_pmd_cnxk_crypto.h
@@ -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 */
/**
diff --git a/drivers/net/dpaa/rte_pmd_dpaa.h b/drivers/net/dpaa/rte_pmd_dpaa.h
index ec45633ba2..0a57e2097a 100644
--- a/drivers/net/dpaa/rte_pmd_dpaa.h
+++ b/drivers/net/dpaa/rte_pmd_dpaa.h
@@ -5,6 +5,8 @@
#ifndef _PMD_DPAA_H_
#define _PMD_DPAA_H_
+#include <stdint.h>
+
/**
* @file rte_pmd_dpaa.h
*
diff --git a/drivers/net/iavf/rte_pmd_iavf.h b/drivers/net/iavf/rte_pmd_iavf.h
index 56d453fc4c..04b86a5dd7 100644
--- a/drivers/net/iavf/rte_pmd_iavf.h
+++ b/drivers/net/iavf/rte_pmd_iavf.h
@@ -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_experimental
static 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
diff --git a/drivers/net/mlx5/rte_pmd_mlx5.h b/drivers/net/mlx5/rte_pmd_mlx5.h
index fdd2f65888..f2c6aebe0b 100644
--- a/drivers/net/mlx5/rte_pmd_mlx5.h
+++ b/drivers/net/mlx5/rte_pmd_mlx5.h
@@ -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>
/**
diff --git a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
index f668e6ea82..c200c935ff 100644
--- a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
+++ b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h
@@ -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));
diff --git a/drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h b/drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h
index 80a37be9c7..72d138ab1d 100644
--- a/drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h
+++ b/drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h
@@ -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));
diff --git a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h
index 483b66eaae..7731fc6363 100644
--- a/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h
+++ b/drivers/raw/dpaa2_cmdif/rte_pmd_dpaa2_cmdif.h
@@ -12,6 +12,8 @@
*
*/
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/drivers/raw/ntb/rte_pmd_ntb.h b/drivers/raw/ntb/rte_pmd_ntb.h
index 6591ce7931..76da3be026 100644
--- a/drivers/raw/ntb/rte_pmd_ntb.h
+++ b/drivers/raw/ntb/rte_pmd_ntb.h
@@ -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"
--
2.47.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [RFC 6/6] buildtools: externally check exported headers
2024-11-27 11:26 [RFC 0/6] Add a stricter headers check David Marchand
` (4 preceding siblings ...)
2024-11-27 11:26 ` [RFC 5/6] build: install indirect headers to a dedicated directory David Marchand
@ 2024-11-27 11:26 ` David Marchand
5 siblings, 0 replies; 9+ messages in thread
From: David Marchand @ 2024-11-27 11:26 UTC (permalink / raw)
To: dev; +Cc: thomas, bruce.richardson, Aaron Conole, Michael Santana
At 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.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
.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
diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index fdb5787621..3146d9ccd8 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -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%%:*}
diff --git a/buildtools/chkincs/Makefile b/buildtools/chkincs/Makefile
new file mode 100644
index 0000000000..838819c617
--- /dev/null
+++ b/buildtools/chkincs/Makefile
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2024 Red Hat, Inc.
+
+ifeq ($(V),)
+Q ?= @
+else
+Q =
+endif
+
+O ?= build
+
+PKGCONF ?= pkg-config
+
+ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0)
+$(error "no installation of DPDK found")
+endif
+
+ifeq ($(I),)
+
+.PHONY: headers_list
+.ONESHELL:
+headers_list:
+ $(Q)for dir in $$($(PKGCONF) --cflags-only-I libdpdk); do
+ dir=$${dir##-I}
+ [ -e $$dir/rte_build_config.h ] || continue
+ $(MAKE) I="$$dir" O="$(O)"
+ break
+ done
+else
+
+HEADERS := $(shell find $(I) -name "*.h" | grep -vE $(I)'/(generic|internal)/')
+SRCS := $(patsubst $(I)/%.h, $(O)/%.c, $(HEADERS))
+.PRECIOUS: $(SRCS)
+
+PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
+CFLAGS = $(shell $(PKGCONF) --cflags libdpdk) -Wall -Wextra -Werror
+LDFLAGS = $(shell $(PKGCONF) --libs libdpdk)
+
+OBJS := $(patsubst $(I)/%.h, $(O)/%.o, $(HEADERS))
+OBJS_EXP := $(patsubst $(I)/%.h, $(O)/%+exp.o, $(HEADERS))
+OBJS_ALL := $(patsubst $(I)/%.h, $(O)/%+all.o, $(HEADERS))
+
+all: $(OBJS) $(OBJS_EXP) $(OBJS_ALL)
+
+$(O):
+ $(Q)mkdir -p $@
+
+$(O)/%.c: $(I)/%.h $(O) gen_c_file_for_header.py Makefile
+ $(Q)python3 gen_c_file_for_header.py $< $@
+
+$(O)/%.o: $(O)/%.c Makefile $(PC_FILE)
+ $(Q)$(CC) $(CFLAGS) -o $@ -c $<
+
+$(O)/%+exp.o: $(O)/%.c Makefile $(PC_FILE)
+ $(Q)$(CC) $(CFLAGS) -DALLOW_EXPERIMENTAL_API -o $@ -c $<
+
+$(O)/%+all.o: $(O)/%.c Makefile $(PC_FILE)
+ $(Q)$(CC) $(CFLAGS) -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -o $@ -c $<
+
+CXXFLAGS = $(shell $(PKGCONF) --cflags libdpdk) -Wall -Wextra -Werror
+
+OBJS_CPP := $(patsubst $(I)/%.h, $(O)/%.cpp.o, $(HEADERS))
+OBJS_CPP_EXP := $(patsubst $(I)/%.h, $(O)/%.cpp+exp.o, $(HEADERS))
+OBJS_CPP_ALL := $(patsubst $(I)/%.h, $(O)/%.cpp+all.o, $(HEADERS))
+
+all: $(OBJS_CPP) $(OBJS_CPP_EXP) $(OBJS_CPP_ALL)
+
+$(O)/%.cpp.o: $(O)/%.c Makefile $(PC_FILE)
+ $(Q)$(CXX) $(CXXFLAGS) -o $@ -c $<
+
+$(O)/%.cpp+exp.o: $(O)/%.c Makefile $(PC_FILE)
+ $(Q)$(CXX) $(CXXFLAGS) -DALLOW_EXPERIMENTAL_API -o $@ -c $<
+
+$(O)/%.cpp+all.o: $(O)/%.c Makefile $(PC_FILE)
+ $(Q)$(CXX) $(CXXFLAGS) -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -o $@ -c $<
+
+endif
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 4fff1f7177..c3cebead70 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -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
--
2.47.0
^ permalink raw reply [flat|nested] 9+ messages in thread