Skip to contentSkip to conversation

net/ixgbe: avoid private driver include in testpmd

PATCH In review Thomas Monjalon 6 participants 23 messages Oct 14 – Oct 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ixgbe: avoid private driver include in testpmd

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

---
 drivers/net/intel/ixgbe/ixgbe_testpmd.c | 55 ++++++++++---------------
 1 file changed, 21 insertions(+), 34 deletions(-)
drivers/net/intel/ixgbe/ixgbe_testpmd.c +21 -34
index e0d161eafe..e209093477 100644
@@ -2,11 +2,12 @@
  * Copyright(c) 2010-2016 Intel Corporation.
  */
 
-/* Required for ixgbe internal structures to be aligned with the driver */
-#define RTE_LIBRTE_IXGBE_BYPASS
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
-#include <ethdev_driver.h>
-#include "ixgbe_ethdev.h"
+#include <rte_string_fns.h>
 #include "rte_pmd_ixgbe.h"
 
 #include <cmdline_parse_etheraddr.h>
@@ -621,20 +622,6 @@ static cmdline_parse_inst_t cmd_tc_min_bw = {
 /* The NIC bypass watchdog timeout. */
 uint32_t bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_OFF;
 
-static inline bool
-check_bypass_enabled(portid_t port_id)
-{
-	struct ixgbe_adapter *adapter;
-
-	adapter = rte_eth_devices[port_id].data->dev_private;
-	if (adapter->bps.ops.bypass_rw == NULL) {
-		fprintf(stderr, "Bypass is not enabled on this port.\n");
-		return false;
-	}
-
-	return true;
-}
-
 /* Enable bypass mode */
 struct cmd_config_bypass_result {
 	cmdline_fixed_string_t port;
@@ -704,9 +691,6 @@ cmd_set_bypass_mode_parsed(void *parsed_result,
 	portid_t port_id = res->port_id;
 	int32_t rc = -EINVAL;
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
 	if (!strcmp(res->value, "bypass"))
 		bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_BYPASS;
 	else if (!strcmp(res->value, "isolate"))
@@ -716,7 +700,9 @@ cmd_set_bypass_mode_parsed(void *parsed_result,
 
 	/* Set the bypass mode for the relevant port. */
 	rc = rte_pmd_ixgbe_bypass_state_set(port_id, &bypass_mode);
-	if (rc != 0)
+	if (rc == -ENOTSUP)
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+	else if (rc != 0)
 		fprintf(stderr, "\t Failed to set bypass mode for port = %d.\n",
 			port_id);
 }
@@ -773,9 +759,6 @@ cmd_set_bypass_event_parsed(void *parsed_result,
 	uint32_t bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_NONE;
 	uint32_t bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_NORMAL;
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
 	if (!strcmp(res->event_value, "timeout"))
 		bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT;
 	else if (!strcmp(res->event_value, "os_on"))
@@ -803,6 +786,10 @@ cmd_set_bypass_event_parsed(void *parsed_result,
 			rc = rte_pmd_ixgbe_bypass_wd_timeout_store(port_id,
 				bypass_timeout);
 		}
+		if (rc == -ENOTSUP) {
+			fprintf(stderr, "Bypass is not enabled on this port.\n");
+			return;
+		}
 		if (rc != 0) {
 			fprintf(stderr,
 				"Failed to set timeout value %u for port %d, errto code: %d.\n",
@@ -813,7 +800,9 @@ cmd_set_bypass_event_parsed(void *parsed_result,
 	/* Set the bypass event to transition to bypass mode. */
 	rc = rte_pmd_ixgbe_bypass_event_store(port_id, bypass_event,
 		bypass_mode);
-	if (rc != 0)
+	if (rc == -ENOTSUP)
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+	else if (rc != 0)
 		fprintf(stderr, "\t Failed to set bypass event for port = %d.\n",
 			port_id);
 }
@@ -952,11 +941,13 @@ cmd_show_bypass_config_parsed(void *parsed_result,
 		"power supply off",
 		"timeout"};
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
 	/* Display the bypass mode.*/
-	if (rte_pmd_ixgbe_bypass_state_show(port_id, &bypass_mode) != 0) {
+	rc = rte_pmd_ixgbe_bypass_state_show(port_id, &bypass_mode);
+	if (rc == -ENOTSUP) {
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+		return;
+	}
+	if (rc != 0) {
 		fprintf(stderr, "\tFailed to get bypass mode for port = %d\n",
 			port_id);
 		return;
@@ -985,10 +976,6 @@ cmd_show_bypass_config_parsed(void *parsed_result,
 				modes[event_mode]);
 		}
 	}
-	if (rc != 0)
-		fprintf(stderr,
-			"\tFailed to get bypass configuration for port = %d\n",
-			port_id);
 }
 
 static cmdline_parse_token_string_t cmd_showbypass_config_show =
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Thomas Monjalon

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Quoted 7 lines

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

---

Signature · 2 lines
Thanks,
Anatoly
#2 lore raw

15/10/2026 10:53, Burakov, Anatoly:

Quoted 13 lines · Thomas Monjalon
Quoted 12 lines

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

Quoted 4 lines
Quoted 2 lines

---

I forgot to say it is mostly written by AI.
I didn't review it myself.
Please double check.

#3 lore raw
Quoted 14 lines · Thomas Monjalon

15/10/2026 10:53, Burakov, Anatoly:

Quoted 13 lines · Thomas Monjalon
Quoted 12 lines

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

---

I forgot to say it is mostly written by AI.
I didn't review it myself.
Please double check.

It doesn't look wrong to me, testpmd code should not be using driver-internal things anyway except through pmd-specific API, which is what this patch does.

Signature · 2 lines
Thanks,
Anatoly
#4 lore raw
Quoted 21 lines · Anatoly
Quoted 19 lines · Thomas Monjalon

15/10/2026 10:53, Burakov, Anatoly:

Quoted 17 lines · Thomas Monjalon
Quoted 7 lines

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Quoted 7 lines

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

---

Quoted 7 lines
Quoted 3 lines

I forgot to say it is mostly written by AI.
I didn't review it myself.
Please double check.

It doesn't look wrong to me, testpmd code should not be using driver-internal things anyway except through pmd-specific API, which is what this patch does.

On the principle, this looks good indeed.

My fault for just moving the code around, without considering the used APIs. And there are probably similar issues in some other drivers _testpmd.c files (at least net/ice seems to include ice_ethdev.h).

Signature · 1 line
David Marchand
#5 lore raw
Quoted 31 lines · David Marchand
Quoted 21 lines · Anatoly
Quoted 19 lines · Thomas Monjalon

15/10/2026 10:53, Burakov, Anatoly:

Quoted 17 lines · Thomas Monjalon
Quoted 7 lines

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Quoted 7 lines

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

---

Quoted 7 lines
Quoted 3 lines

I forgot to say it is mostly written by AI.
I didn't review it myself.
Please double check.

It doesn't look wrong to me, testpmd code should not be using driver-internal things anyway except through pmd-specific API, which is what this patch does.

Quoted 7 lines

On the principle, this looks good indeed.

My fault for just moving the code around, without considering the used APIs. And there are probably similar issues in some other drivers _testpmd.c files (at least net/ice seems to include ice_ethdev.h).

My guess is this doesn't blow up on ice because it is not using the graph helper yet. I'll see about fixing our other drivers.

Signature · 2 lines
Thanks,
Anatoly
#6 lore raw

15/10/2026 13:21, Burakov, Anatoly:

Quoted 32 lines · David Marchand
Quoted 31 lines
Quoted 28 lines · Anatoly
Quoted 14 lines · Thomas Monjalon

15/10/2026 10:53, Burakov, Anatoly:

Quoted 13 lines · Thomas Monjalon
Quoted 12 lines

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

---

I forgot to say it is mostly written by AI.
I didn't review it myself.
Please double check.

It doesn't look wrong to me, testpmd code should not be using driver-internal things anyway except through pmd-specific API, which is what this patch does.

Quoted 8 lines
Quoted 5 lines

On the principle, this looks good indeed.

My fault for just moving the code around, without considering the used APIs. And there are probably similar issues in some other drivers _testpmd.c files (at least net/ice seems to include ice_ethdev.h).

My guess is this doesn't blow up on ice because it is not using the graph helper yet. I'll see about fixing our other drivers.

Please could you make it as a v2 of this series?

#7 lore raw
Quoted 35 lines · Thomas Monjalon

15/10/2026 13:21, Burakov, Anatoly:

Quoted 34 lines · David Marchand
Quoted 33 lines
Quoted 21 lines · Anatoly
Quoted 19 lines · Thomas Monjalon

15/10/2026 10:53, Burakov, Anatoly:

Quoted 17 lines · Thomas Monjalon
Quoted 7 lines

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Quoted 7 lines

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

---

Quoted 7 lines
Quoted 3 lines

I forgot to say it is mostly written by AI.
I didn't review it myself.
Please double check.

It doesn't look wrong to me, testpmd code should not be using driver-internal things anyway except through pmd-specific API, which is what this patch does.

On the principle, this looks good indeed.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

My fault for just moving the code around, without considering the used APIs. And there are probably similar issues in some other drivers _testpmd.c files (at least net/ice seems to include ice_ethdev.h).

My guess is this doesn't blow up on ice because it is not using the graph helper yet. I'll see about fixing our other drivers.

Please could you make it as a v2 of this series?

Sure. patches already submitted but I'll respin with this one included.

(I also took the liberty of checking if other drivers have this problem, and no, only ours do)

Signature · 2 lines
Thanks,
Anatoly
#8 lore raw

PATCH v2 1/3 net/ixgbe: avoid private driver include in testpmd

In reply to Thomas Monjalon

From: Thomas Monjalon <[email protected]>

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

---
 drivers/net/intel/ixgbe/ixgbe_testpmd.c | 55 ++++++++++---------------
 1 file changed, 21 insertions(+), 34 deletions(-)
drivers/net/intel/ixgbe/ixgbe_testpmd.c +21 -34
index e0d161eafe..e209093477 100644
@@ -2,11 +2,12 @@
  * Copyright(c) 2010-2016 Intel Corporation.
  */
 
-/* Required for ixgbe internal structures to be aligned with the driver */
-#define RTE_LIBRTE_IXGBE_BYPASS
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
-#include <ethdev_driver.h>
-#include "ixgbe_ethdev.h"
+#include <rte_string_fns.h>
 #include "rte_pmd_ixgbe.h"
 
 #include <cmdline_parse_etheraddr.h>
@@ -621,20 +622,6 @@ static cmdline_parse_inst_t cmd_tc_min_bw = {
 /* The NIC bypass watchdog timeout. */
 uint32_t bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_OFF;
 
-static inline bool
-check_bypass_enabled(portid_t port_id)
-{
-	struct ixgbe_adapter *adapter;
-
-	adapter = rte_eth_devices[port_id].data->dev_private;
-	if (adapter->bps.ops.bypass_rw == NULL) {
-		fprintf(stderr, "Bypass is not enabled on this port.\n");
-		return false;
-	}
-
-	return true;
-}
-
 /* Enable bypass mode */
 struct cmd_config_bypass_result {
 	cmdline_fixed_string_t port;
@@ -704,9 +691,6 @@ cmd_set_bypass_mode_parsed(void *parsed_result,
 	portid_t port_id = res->port_id;
 	int32_t rc = -EINVAL;
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
 	if (!strcmp(res->value, "bypass"))
 		bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_BYPASS;
 	else if (!strcmp(res->value, "isolate"))
@@ -716,7 +700,9 @@ cmd_set_bypass_mode_parsed(void *parsed_result,
 
 	/* Set the bypass mode for the relevant port. */
 	rc = rte_pmd_ixgbe_bypass_state_set(port_id, &bypass_mode);
-	if (rc != 0)
+	if (rc == -ENOTSUP)
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+	else if (rc != 0)
 		fprintf(stderr, "\t Failed to set bypass mode for port = %d.\n",
 			port_id);
 }
@@ -773,9 +759,6 @@ cmd_set_bypass_event_parsed(void *parsed_result,
 	uint32_t bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_NONE;
 	uint32_t bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_NORMAL;
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
 	if (!strcmp(res->event_value, "timeout"))
 		bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT;
 	else if (!strcmp(res->event_value, "os_on"))
@@ -803,6 +786,10 @@ cmd_set_bypass_event_parsed(void *parsed_result,
 			rc = rte_pmd_ixgbe_bypass_wd_timeout_store(port_id,
 				bypass_timeout);
 		}
+		if (rc == -ENOTSUP) {
+			fprintf(stderr, "Bypass is not enabled on this port.\n");
+			return;
+		}
 		if (rc != 0) {
 			fprintf(stderr,
 				"Failed to set timeout value %u for port %d, errto code: %d.\n",
@@ -813,7 +800,9 @@ cmd_set_bypass_event_parsed(void *parsed_result,
 	/* Set the bypass event to transition to bypass mode. */
 	rc = rte_pmd_ixgbe_bypass_event_store(port_id, bypass_event,
 		bypass_mode);
-	if (rc != 0)
+	if (rc == -ENOTSUP)
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+	else if (rc != 0)
 		fprintf(stderr, "\t Failed to set bypass event for port = %d.\n",
 			port_id);
 }
@@ -952,11 +941,13 @@ cmd_show_bypass_config_parsed(void *parsed_result,
 		"power supply off",
 		"timeout"};
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
 	/* Display the bypass mode.*/
-	if (rte_pmd_ixgbe_bypass_state_show(port_id, &bypass_mode) != 0) {
+	rc = rte_pmd_ixgbe_bypass_state_show(port_id, &bypass_mode);
+	if (rc == -ENOTSUP) {
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+		return;
+	}
+	if (rc != 0) {
 		fprintf(stderr, "\tFailed to get bypass mode for port = %d\n",
 			port_id);
 		return;
@@ -985,10 +976,6 @@ cmd_show_bypass_config_parsed(void *parsed_result,
 				modes[event_mode]);
 		}
 	}
-	if (rc != 0)
-		fprintf(stderr,
-			"\tFailed to get bypass configuration for port = %d\n",
-			port_id);
 }
 
 static cmdline_parse_token_string_t cmd_showbypass_config_show =
Signature · 1 line
2.52.0
#9 lore raw

PATCH v2 2/3 net/iavf: do not include private headers in testpmd

Currently, the iavf_testpmd.c file includes headers that are only available to driver itself, but should not be available to applications, including testpmd.

Fix the testpmd file to not include private headers (they are unused).

Fixes c702044ed909 ("net/iavf: remove Tx LLDP dynfield method")
---
 drivers/net/intel/iavf/iavf_testpmd.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/intel/iavf/iavf_testpmd.c +0 -2
index f3b932da04..1146f534e3 100644
@@ -9,9 +9,7 @@
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
 
-#include "iavf.h"
 #include "testpmd.h"
-#include "iavf_rxtx.h"
 
 struct cmd_reinit_result {
 	cmdline_fixed_string_t port;
Signature · 1 line
2.52.0
Acked-by on v2 2/3
#10 lore raw

Re: [PATCH v2 2/3] net/iavf: do not include private headers in testpmd

Quoted 11 lines · Anatoly Burakov

Currently, the iavf_testpmd.c file includes headers that are only available to driver itself, but should not be available to applications, including testpmd.

Fix the testpmd file to not include private headers (they are unused).

Fixes c702044ed909 ("net/iavf: remove Tx LLDP dynfield method")

---

Quoted 20 lines
 drivers/net/intel/iavf/iavf_testpmd.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/intel/iavf/iavf_testpmd.c +0 -2
index f3b932da04..1146f534e3 100644
@@ -9,9 +9,7 @@
 #include <cmdline_parse_num.h>
 #include <cmdline_parse_string.h>
 
-#include "iavf.h"
 #include "testpmd.h"
-#include "iavf_rxtx.h"
 
 struct cmd_reinit_result {
 	cmdline_fixed_string_t port;
Signature · 1 line
2.52.0
Acked-by on v2 2/3
#11 lore raw

Re: [PATCH v2 2/3] net/iavf: do not include private headers in testpmd

In reply to Anatoly Burakov
Quoted 28 lines · Anatoly Burakov

Currently, the iavf_testpmd.c file includes headers that are only available to driver itself, but should not be available to applications, including testpmd.

Fix the testpmd file to not include private headers (they are unused).

Fixes c702044ed909 ("net/iavf: remove Tx LLDP dynfield method")
---
  drivers/net/intel/iavf/iavf_testpmd.c | 2 --
  1 file changed, 2 deletions(-)
drivers/net/intel/iavf/iavf_testpmd.c +0 -2
index f3b932da04..1146f534e3 100644
@@ -9,9 +9,7 @@
  #include <cmdline_parse_num.h>
  #include <cmdline_parse_string.h>
 
-#include "iavf.h"
  #include "testpmd.h"
-#include "iavf_rxtx.h"
 
  struct cmd_reinit_result {
  	cmdline_fixed_string_t port;
Signature · 2 lines
Regards,
Vladimir
#12 lore raw

PATCH v2 3/3 net/ice: do not include private headers in testpmd

In reply to Anatoly Burakov

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")
---
 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
doc/guides/nics/ice.rst +3 -0
index ba598742c5..e4dd87649b 100644
@@ -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
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_26_11.rst +2 -0
index a4f44e5ebd..f3c820a72a 100644
@@ -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.**
 
drivers/net/intel/ice/ice_diagnose.c +1 -0
index 4946ace7ae..ecfcdf5559 100644
@@ -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
drivers/net/intel/ice/ice_ethdev.h +0 -9
index 8d5e17e2df..08c2b61519 100644
@@ -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);
 
drivers/net/intel/ice/ice_testpmd.c +5 -2
index 98c02d68c6..0c135d79a3 100644
@@ -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
drivers/net/intel/ice/meson.build +1 -0
index 322d9597d2..00077be30a 100644
@@ -19,6 +19,7 @@ sources = files(
 )
 
 testpmd_sources = files('ice_testpmd.c')
+headers = files('rte_pmd_ice.h')
 
 deps += ['hash', 'net']
 
drivers/net/intel/ice/rte_pmd_ice.h new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
2.52.0
Acked-by on v2 3/3
#13 lore raw

Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd

Quoted 13 lines · Anatoly Burakov

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")
Quoted 11 lines
---
 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

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?

Quoted 180 lines
doc/guides/nics/ice.rst +3 -0
index ba598742c5..e4dd87649b 100644
@@ -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
 ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_26_11.rst +2 -0
index a4f44e5ebd..f3c820a72a 100644
@@ -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.**
 
drivers/net/intel/ice/ice_diagnose.c +1 -0
index 4946ace7ae..ecfcdf5559 100644
@@ -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
drivers/net/intel/ice/ice_ethdev.h +0 -9
index 8d5e17e2df..08c2b61519 100644
@@ -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);
 
drivers/net/intel/ice/ice_testpmd.c +5 -2
index 98c02d68c6..0c135d79a3 100644
@@ -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
drivers/net/intel/ice/meson.build +1 -0
index 322d9597d2..00077be30a 100644
@@ -19,6 +19,7 @@ sources = files(
 )
 
 testpmd_sources = files('ice_testpmd.c')
+headers = files('rte_pmd_ice.h')
 
 deps += ['hash', 'net']
 
drivers/net/intel/ice/rte_pmd_ice.h new file +76 -0
new file mode 100644
index 0000000000..dccfdcd5f4
@@ -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_ */
Signature · 1 line
2.52.0
#14 lore raw

Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd

Quoted 26 lines · Bruce Richardson
Quoted 13 lines · Anatoly Burakov

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")
Quoted 11 lines
---
 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
Quoted 8 lines

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?

+techboard and others for more input and thoughts for the future.

#15 lore raw

Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd

Quoted 30 lines · Bruce Richardson
Quoted 28 lines · Bruce Richardson
Quoted 13 lines · Anatoly Burakov

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")
Quoted 11 lines
---
 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
Quoted 7 lines
Quoted 6 lines

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?

+techboard and others for more input and thoughts for the future.

Accessing some symbols from the internal ABI is probably ok but it is a slippery topic.
Like the ethdev ops changes between 25.11/26.07 that triggered crashes in app/test.

Signature · 1 line
David Marchand
#16 lore raw

RE: [PATCH v2 3/3] net/ice: do not include private headers in testpmd

Quoted 10 lines
Quoted 3 lines
Quoted 3 lines

Given where we are, this is probably a reasonable solution.

However, I'm

Quoted 1 line
Quoted 1 line

also thinking that maybe we should have a discussion as to whether

testpmd

Quoted 1 line
Quoted 1 line

- which is, after all, for testing PMDs - should be limited to the

public

Quoted 1 line
Quoted 1 line

APIs. Is there not a case to be made for allowing the per-driver

testpmd

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

files to access the internals of the driver for testing purposes?

+techboard and others for more input and thoughts for the future.

Accessing some symbols from the internal ABI is probably ok but it is a slippery topic.
Like the ethdev ops changes between 25.11/26.07 that triggered crashes in app/test.

I tend to agree with Bruce's statement about the purpose of testpmd:
The purpose of testpmd is testing PMDs.

When used for PMD development purposes, this means:
1. Testpmd should be allowed to go deep inside PMDs.
2. Testpmd should not be limited by ABI/API stability.

This also means that the testpmd released with DPDK 27.03 is not expected to be compatible with the DPDK 26.11 LTS runtime. If a new release of testpmd offers new features, they will not be available until you upgrade your DPDK runtime.

"Nice to have":
When used for non-PMD development purposes,
perhaps testpmd could emit a warning if not running on the same build as the DPDK runtime.

-Morten

Acked-by on v2 3/3
#17 lore raw

Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd

In reply to Anatoly Burakov

Hi Anatoly,

One nit: the buffer must be allocated with malloc, could you please reflect this information in doxygen comments?

Apart from this,

Quoted 201 lines · Anatoly Burakov

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")
---
  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

doc/guides/nics/ice.rst +3 -0
index ba598742c5..e4dd87649b 100644
@@ -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
  ~~~~~~~~~~~~~~~~
 
doc/guides/rel_notes/release_26_11.rst +2 -0
index a4f44e5ebd..f3c820a72a 100644
@@ -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.**
 
drivers/net/intel/ice/ice_diagnose.c +1 -0
index 4946ace7ae..ecfcdf5559 100644
@@ -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
drivers/net/intel/ice/ice_ethdev.h +0 -9
index 8d5e17e2df..08c2b61519 100644
@@ -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);
 
drivers/net/intel/ice/ice_testpmd.c +5 -2
index 98c02d68c6..0c135d79a3 100644
@@ -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
drivers/net/intel/ice/meson.build +1 -0
index 322d9597d2..00077be30a 100644
@@ -19,6 +19,7 @@ sources = files(
  )
 
  testpmd_sources = files('ice_testpmd.c')
+headers = files('rte_pmd_ice.h')
 
  deps += ['hash', 'net']
 
drivers/net/intel/ice/rte_pmd_ice.h new file +76 -0
new file mode 100644
index 0000000000..dccfdcd5f4
@@ -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_ */
Signature · 2 lines
Regards,
Vladimir
#18 lore raw

Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd

Quoted 3 lines · Vladimir

Hi Anatoly,

One nit: the buffer must be allocated with malloc, could you please reflect this information in doxygen comments?

@Bruce

Perhaps this can be fixed on apply?

drivers/net/intel/ice/rte_pmd_ice.h +3 -2
index dccfdcd5f4..881dc4cc56 100644
@@ -27,8 +27,9 @@ extern "C" {
  * @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.
+ *   Pointer to a `malloc()`-allocated buffer. On success, it will be freed by
+ *   `free()` and replaced by a newly `malloc()`-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
Quoted 202 lines

Apart from this,

Quoted 195 lines · Anatoly Burakov

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")

---
  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

doc/guides/nics/ice.rst +0 -0
index ba598742c5..e4dd87649b 100644
@@ -1021,6 +1021,9 @@ To start ``testpmd``, and add vlan 10 to port 0:

  Diagnostic Utilities
  --------------------

doc/guides/nics/ice.rst +3 -0
+The diagnostic dump functions are also available to applications through
+the public ``rte_pmd_ice.h`` header.
+

  Dump DDP Package
  ~~~~~~~~~~~~~~~~

doc/guides/rel_notes/release_26_11.rst +0 -0
index a4f44e5ebd..f3c820a72a 100644
@@ -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.**

drivers/net/intel/ice/ice_diagnose.c +1 -0
index 4946ace7ae..ecfcdf5559 100644
@@ -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
drivers/net/intel/ice/ice_ethdev.h +0 -9
index 8d5e17e2df..08c2b61519 100644
@@ -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);

drivers/net/intel/ice/ice_testpmd.c +5 -2
index 98c02d68c6..0c135d79a3 100644
@@ -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
drivers/net/intel/ice/meson.build +1 -0
index 322d9597d2..00077be30a 100644
@@ -19,6 +19,7 @@ sources = files(
   )
   testpmd_sources = files('ice_testpmd.c')
+headers = files('rte_pmd_ice.h')

  deps += ['hash', 'net']

drivers/net/intel/ice/rte_pmd_ice.h new file +33 -0
new file mode 100644
index 0000000000..dccfdcd5f4
@@ -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.
+ */

drivers/net/intel/ice/rte_pmd_ice.h new file +2 -0
+__rte_experimental
+int rte_pmd_ice_dump_package(uint16_t port, uint8_t **buff, uint32_t 

*size);

drivers/net/intel/ice/rte_pmd_ice.h new file +10 -0
+
+/**
+ * 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.
+ */

drivers/net/intel/ice/rte_pmd_ice.h new file +2 -0
+__rte_experimental
+int rte_pmd_ice_dump_switch(uint16_t port, uint8_t **buff, uint32_t 

*size);

drivers/net/intel/ice/rte_pmd_ice.h new file +12 -0
+
+/**
+ * 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.
+ */

drivers/net/intel/ice/rte_pmd_ice.h new file +8 -0
+__rte_experimental
+int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_ICE_H_ */
Signature · 2 lines
Thanks,
Anatoly
#19 lore raw

Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd

Quoted 22 lines · Anatoly
Quoted 4 lines · Vladimir

Hi Anatoly,

One nit: the buffer must be allocated with malloc, could you please reflect this information in doxygen comments?

@Bruce

Perhaps this can be fixed on apply?

drivers/net/intel/ice/rte_pmd_ice.h +1 -2
index dccfdcd5f4..881dc4cc56 100644
@@ -27,8 +27,9 @@ extern "C" {
  * @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.
+ *   Pointer to a `malloc()`-allocated buffer. On success, it will be freed
Quoted 4 lines

by
+ * free() and replaced by a newly malloc()-allocated buffer; the
caller
+ * must free the resulting buffer.

That is very strange behaviour! That looks like something a future patch should fix, but ok to change the documentation on apply here.

/Bruce

#20 lore raw

Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd

Quoted 31 lines · Bruce Richardson
Quoted 22 lines · Anatoly
Quoted 4 lines · Vladimir

Hi Anatoly,

One nit: the buffer must be allocated with malloc, could you please reflect this information in doxygen comments?

@Bruce

Perhaps this can be fixed on apply?

drivers/net/intel/ice/rte_pmd_ice.h +1 -2
index dccfdcd5f4..881dc4cc56 100644
@@ -27,8 +27,9 @@ extern "C" {
   * @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.
+ *   Pointer to a `malloc()`-allocated buffer. On success, it will be freed
Quoted 4 lines

by
+ * free() and replaced by a newly malloc()-allocated buffer; the
caller
+ * must free the resulting buffer.

That is very strange behaviour! That looks like something a future patch should fix, but ok to change the documentation on apply here.

Quoted 1 line

/Bruce

Agreed. My best guess is that the intention was to return success even if the buffer was too small, by passing pointer-to-pointer so that we can reallocate buffer of an appropriate size (as opposed to introducing a "size" API...). We will address this later.

Signature · 2 lines
Thanks,
Anatoly
Acked-by on v2 1/3
#21 lore raw
In reply to Anatoly Burakov
Quoted 144 lines · Anatoly Burakov

From: Thomas Monjalon <[email protected]>

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

---
  drivers/net/intel/ixgbe/ixgbe_testpmd.c | 55 ++++++++++---------------
  1 file changed, 21 insertions(+), 34 deletions(-)
drivers/net/intel/ixgbe/ixgbe_testpmd.c +21 -34
index e0d161eafe..e209093477 100644
@@ -2,11 +2,12 @@
   * Copyright(c) 2010-2016 Intel Corporation.
   */
 
-/* Required for ixgbe internal structures to be aligned with the driver */
-#define RTE_LIBRTE_IXGBE_BYPASS
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
-#include <ethdev_driver.h>
-#include "ixgbe_ethdev.h"
+#include <rte_string_fns.h>
  #include "rte_pmd_ixgbe.h"
 
  #include <cmdline_parse_etheraddr.h>
@@ -621,20 +622,6 @@ static cmdline_parse_inst_t cmd_tc_min_bw = {
  /* The NIC bypass watchdog timeout. */
  uint32_t bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_OFF;
 
-static inline bool
-check_bypass_enabled(portid_t port_id)
-{
-	struct ixgbe_adapter *adapter;
-
-	adapter = rte_eth_devices[port_id].data->dev_private;
-	if (adapter->bps.ops.bypass_rw == NULL) {
-		fprintf(stderr, "Bypass is not enabled on this port.\n");
-		return false;
-	}
-
-	return true;
-}
-
  /* Enable bypass mode */
  struct cmd_config_bypass_result {
  	cmdline_fixed_string_t port;
@@ -704,9 +691,6 @@ cmd_set_bypass_mode_parsed(void *parsed_result,
  	portid_t port_id = res->port_id;
  	int32_t rc = -EINVAL;
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
  	if (!strcmp(res->value, "bypass"))
  		bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_BYPASS;
  	else if (!strcmp(res->value, "isolate"))
@@ -716,7 +700,9 @@ cmd_set_bypass_mode_parsed(void *parsed_result,
 
  	/* Set the bypass mode for the relevant port. */
  	rc = rte_pmd_ixgbe_bypass_state_set(port_id, &bypass_mode);
-	if (rc != 0)
+	if (rc == -ENOTSUP)
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+	else if (rc != 0)
  		fprintf(stderr, "\t Failed to set bypass mode for port = %d.\n",
  			port_id);
  }
@@ -773,9 +759,6 @@ cmd_set_bypass_event_parsed(void *parsed_result,
  	uint32_t bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_NONE;
  	uint32_t bypass_mode = RTE_PMD_IXGBE_BYPASS_MODE_NORMAL;
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
  	if (!strcmp(res->event_value, "timeout"))
  		bypass_event = RTE_PMD_IXGBE_BYPASS_EVENT_TIMEOUT;
  	else if (!strcmp(res->event_value, "os_on"))
@@ -803,6 +786,10 @@ cmd_set_bypass_event_parsed(void *parsed_result,
  			rc = rte_pmd_ixgbe_bypass_wd_timeout_store(port_id,
  				bypass_timeout);
  		}
+		if (rc == -ENOTSUP) {
+			fprintf(stderr, "Bypass is not enabled on this port.\n");
+			return;
+		}
  		if (rc != 0) {
  			fprintf(stderr,
  				"Failed to set timeout value %u for port %d, errto code: %d.\n",
@@ -813,7 +800,9 @@ cmd_set_bypass_event_parsed(void *parsed_result,
  	/* Set the bypass event to transition to bypass mode. */
  	rc = rte_pmd_ixgbe_bypass_event_store(port_id, bypass_event,
  		bypass_mode);
-	if (rc != 0)
+	if (rc == -ENOTSUP)
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+	else if (rc != 0)
  		fprintf(stderr, "\t Failed to set bypass event for port = %d.\n",
  			port_id);
  }
@@ -952,11 +941,13 @@ cmd_show_bypass_config_parsed(void *parsed_result,
  		"power supply off",
  		"timeout"};
 
-	if (!check_bypass_enabled(port_id))
-		return;
-
  	/* Display the bypass mode.*/
-	if (rte_pmd_ixgbe_bypass_state_show(port_id, &bypass_mode) != 0) {
+	rc = rte_pmd_ixgbe_bypass_state_show(port_id, &bypass_mode);
+	if (rc == -ENOTSUP) {
+		fprintf(stderr, "Bypass is not enabled on this port.\n");
+		return;
+	}
+	if (rc != 0) {
  		fprintf(stderr, "\tFailed to get bypass mode for port = %d\n",
  			port_id);
  		return;
@@ -985,10 +976,6 @@ cmd_show_bypass_config_parsed(void *parsed_result,
  				modes[event_mode]);
  		}
  	}
-	if (rc != 0)
-		fprintf(stderr,
-			"\tFailed to get bypass configuration for port = %d\n",
-			port_id);
  }
 
  static cmdline_parse_token_string_t cmd_showbypass_config_show =
Signature · 2 lines
Regards,
Vladimir
#22 lore raw
Quoted 23 lines · Vladimir
Quoted 20 lines · Anatoly Burakov

From: Thomas Monjalon <[email protected]>

Testpmd commands should use the driver's public API rather than access its private structures directly.
Note: ixgbe_testpmd.c should be considered as part of testpmd.

ixgbe_testpmd.c includes ixgbe_ethdev.h only to check whether bypass operations are available through the private adapter structure.

Rely on the public bypass API to check availability and handle -ENOTSUP in the commands.
Remove ixgbe_ethdev.h, ethdev_driver.h
and the now unnecessary RTE_LIBRTE_IXGBE_BYPASS definition.

---
  drivers/net/intel/ixgbe/ixgbe_testpmd.c | 55 ++++++++++---------------
  1 file changed, 21 insertions(+), 34 deletions(-)

Patchset applied to dpdk-next-net-intel, ahead of the flow graph set.

/Bruce