[PATCH v2 3/3] net/ice: do not include private headers in testpmd
Bruce Richardson
bruce.richardson at intel.com
Thu Oct 15 16:36:05 CEST 2026
On Thu, Oct 15, 2026 at 03:21:04PM +0100, Anatoly Burakov wrote:
> Currently, the `ice_testpmd.c` file includes headers that are only
> available to driver itself, but should not be available to applications,
> including testpmd. Instead, testpmd should access them through public PMD
> specific API.
>
> The ice driver does not have one (even though it offers a testpmd file), so
> add the public PMD-specific API header, move all function definitions
> into that file, and get rid of driver-private includes in testpmd file.
>
> Fixes: df539aaf35cb ("net/ice: refactor flex descriptor protocol field extraction")
> Cc: stable at dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
> ---
> doc/guides/nics/ice.rst | 3 +
> doc/guides/rel_notes/release_26_11.rst | 2 +
> drivers/net/intel/ice/ice_diagnose.c | 1 +
> drivers/net/intel/ice/ice_ethdev.h | 9 ---
> drivers/net/intel/ice/ice_testpmd.c | 7 ++-
> drivers/net/intel/ice/meson.build | 1 +
> drivers/net/intel/ice/rte_pmd_ice.h | 76 ++++++++++++++++++++++++++
> 7 files changed, 88 insertions(+), 11 deletions(-)
> create mode 100644 drivers/net/intel/ice/rte_pmd_ice.h
>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
Given where we are, this is probably a reasonable solution. However, I'm
also thinking that maybe we should have a discussion as to whether testpmd
- which is, after all, for testing PMDs - should be limited to the public
APIs. Is there not a case to be made for allowing the per-driver testpmd
files to access the internals of the driver for testing purposes?
> diff --git a/doc/guides/nics/ice.rst b/doc/guides/nics/ice.rst
> index ba598742c5..e4dd87649b 100644
> --- a/doc/guides/nics/ice.rst
> +++ b/doc/guides/nics/ice.rst
> @@ -1021,6 +1021,9 @@ To start ``testpmd``, and add vlan 10 to port 0:
> Diagnostic Utilities
> --------------------
>
> +The diagnostic dump functions are also available to applications through
> +the public ``rte_pmd_ice.h`` header.
> +
> Dump DDP Package
> ~~~~~~~~~~~~~~~~
>
> diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst
> index a4f44e5ebd..f3c820a72a 100644
> --- a/doc/guides/rel_notes/release_26_11.rst
> +++ b/doc/guides/rel_notes/release_26_11.rst
> @@ -118,6 +118,8 @@ New Features
> enabling QinQ tag insertion and outer IPv4/UDP checksum offloads on those paths.
> * Added support for getting and setting link (802.3x) flow control.
> * Added support for Tx rate limiting per queue.
> + * Made the existing diagnostic dump functions available through
> + the public ``rte_pmd_ice.h`` header.
>
> * **Updated Intel ixgbe driver.**
>
> diff --git a/drivers/net/intel/ice/ice_diagnose.c b/drivers/net/intel/ice/ice_diagnose.c
> index 4946ace7ae..ecfcdf5559 100644
> --- a/drivers/net/intel/ice/ice_diagnose.c
> +++ b/drivers/net/intel/ice/ice_diagnose.c
> @@ -13,6 +13,7 @@
>
> #include "ice_ethdev.h"
> #include "ice_rxtx.h"
> +#include "rte_pmd_ice.h"
>
> #define ICE_BLK_MAX_COUNT 512
> #define ICE_BUFF_SEG_HEADER_FLAG 0x1
> diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h
> index 8d5e17e2df..08c2b61519 100644
> --- a/drivers/net/intel/ice/ice_ethdev.h
> +++ b/drivers/net/intel/ice/ice_ethdev.h
> @@ -821,15 +821,6 @@ ice_align_floor(int n)
> ((phy_type) & ICE_PHY_TYPE_HIGH_200G_AUI8_AOC_ACC) || \
> ((phy_type) & ICE_PHY_TYPE_HIGH_200G_AUI8))
>
> -__rte_experimental
> -int rte_pmd_ice_dump_package(uint16_t port, uint8_t **buff, uint32_t *size);
> -
> -__rte_experimental
> -int rte_pmd_ice_dump_switch(uint16_t port, uint8_t **buff, uint32_t *size);
> -
> -__rte_experimental
> -int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream);
> -
> int
> ice_tm_setup_txq_node(struct ice_pf *pf, struct ice_hw *hw, uint16_t qid, uint32_t node_teid);
>
> diff --git a/drivers/net/intel/ice/ice_testpmd.c b/drivers/net/intel/ice/ice_testpmd.c
> index 98c02d68c6..0c135d79a3 100644
> --- a/drivers/net/intel/ice/ice_testpmd.c
> +++ b/drivers/net/intel/ice/ice_testpmd.c
> @@ -2,14 +2,17 @@
> * Copyright(c) 2022 Intel Corporation.
> */
>
> -#include <stdlib.h>
> +#include <errno.h>
> #include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +
> +#include <rte_pmd_ice.h>
>
> #include <cmdline_parse_num.h>
> #include <cmdline_parse_string.h>
>
> #include "testpmd.h"
> -#include "ice_ethdev.h"
>
> /* Fixed size for ICE ddp runtime configure */
> #define ICE_BUFF_SIZE 0x000c9000
> diff --git a/drivers/net/intel/ice/meson.build b/drivers/net/intel/ice/meson.build
> index 322d9597d2..00077be30a 100644
> --- a/drivers/net/intel/ice/meson.build
> +++ b/drivers/net/intel/ice/meson.build
> @@ -19,6 +19,7 @@ sources = files(
> )
>
> testpmd_sources = files('ice_testpmd.c')
> +headers = files('rte_pmd_ice.h')
>
> deps += ['hash', 'net']
>
> diff --git a/drivers/net/intel/ice/rte_pmd_ice.h b/drivers/net/intel/ice/rte_pmd_ice.h
> new file mode 100644
> index 0000000000..dccfdcd5f4
> --- /dev/null
> +++ b/drivers/net/intel/ice/rte_pmd_ice.h
> @@ -0,0 +1,76 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2026 Intel Corporation
> + */
> +
> +#ifndef _RTE_PMD_ICE_H_
> +#define _RTE_PMD_ICE_H_
> +
> +/**
> + * @file rte_pmd_ice.h
> + *
> + * ICE PMD specific diagnostic functions.
> + */
> +
> +#include <stdbool.h>
> +#include <stdint.h>
> +#include <stdio.h>
> +
> +#include <rte_compat.h>
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * Dump the runtime DDP package configuration.
> + *
> + * @param port
> + * The port identifier of the Ethernet device.
> + * @param buff
> + * Pointer to an allocated buffer. On success, it may be replaced by a
> + * newly allocated buffer; the caller must free the resulting buffer.
> + * @param size
> + * Input buffer size in bytes; receives the size of the dump on success.
> + * @return
> + * 0 on success, -ENODEV for an invalid port, -ENOTSUP for a non-ICE port,
> + * or a negative error code on failure.
> + */
> +__rte_experimental
> +int rte_pmd_ice_dump_package(uint16_t port, uint8_t **buff, uint32_t *size);
> +
> +/**
> + * Dump the runtime switch configuration.
> + *
> + * @param port
> + * The port identifier of the Ethernet device.
> + * @param buff
> + * Pointer to a caller-allocated output buffer.
> + * @param size
> + * Input buffer size in bytes; receives the size of the dump on success.
> + * @return
> + * 0 on success, -ENODEV for an invalid port, -ENOTSUP for a non-ICE port,
> + * or a negative error code on failure.
> + */
> +__rte_experimental
> +int rte_pmd_ice_dump_switch(uint16_t port, uint8_t **buff, uint32_t *size);
> +
> +/**
> + * Dump the Tx scheduling tree to a stream in DOT format.
> + *
> + * @param port
> + * The port identifier of the Ethernet device.
> + * @param detail
> + * Include node configuration parameters when true.
> + * @param stream
> + * Output stream opened by the caller.
> + * @return
> + * 0 on success, -ENODEV for an invalid port, or -ENOTSUP for a non-ICE port.
> + */
> +__rte_experimental
> +int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif /* _RTE_PMD_ICE_H_ */
> --
> 2.52.0
>
More information about the dev
mailing list