DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/ixgbe: avoid private driver include in testpmd
@ 2026-10-14 20:34 Thomas Monjalon
  2026-10-15  8:53 ` Burakov, Anatoly
  2026-10-15 14:21 ` [PATCH v2 1/3] " Anatoly Burakov
  0 siblings, 2 replies; 21+ messages in thread
From: Thomas Monjalon @ 2026-10-14 20:34 UTC (permalink / raw)
  To: dev; +Cc: Anatoly Burakov, Vladimir Medvedkin

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.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/net/intel/ixgbe/ixgbe_testpmd.c | 55 ++++++++++---------------
 1 file changed, 21 insertions(+), 34 deletions(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_testpmd.c b/drivers/net/intel/ixgbe/ixgbe_testpmd.c
index e0d161eafe..e209093477 100644
--- a/drivers/net/intel/ixgbe/ixgbe_testpmd.c
+++ b/drivers/net/intel/ixgbe/ixgbe_testpmd.c
@@ -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 =
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH] net/ixgbe: avoid private driver include in testpmd
  2026-10-14 20:34 [PATCH] net/ixgbe: avoid private driver include in testpmd Thomas Monjalon
@ 2026-10-15  8:53 ` Burakov, Anatoly
  2026-10-15  9:13   ` Thomas Monjalon
  2026-10-15 14:21 ` [PATCH v2 1/3] " Anatoly Burakov
  1 sibling, 1 reply; 21+ messages in thread
From: Burakov, Anatoly @ 2026-10-15  8:53 UTC (permalink / raw)
  To: Thomas Monjalon, dev; +Cc: Vladimir Medvedkin

On 10/14/2026 10:34 PM, Thomas Monjalon wrote:
> 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.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] net/ixgbe: avoid private driver include in testpmd
  2026-10-15  8:53 ` Burakov, Anatoly
@ 2026-10-15  9:13   ` Thomas Monjalon
  2026-10-15 10:41     ` Burakov, Anatoly
  0 siblings, 1 reply; 21+ messages in thread
From: Thomas Monjalon @ 2026-10-15  9:13 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: dev, Vladimir Medvedkin, Bruce Richardson

15/10/2026 10:53, Burakov, Anatoly:
> On 10/14/2026 10:34 PM, Thomas Monjalon wrote:
> > 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.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
> 
> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>

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



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] net/ixgbe: avoid private driver include in testpmd
  2026-10-15  9:13   ` Thomas Monjalon
@ 2026-10-15 10:41     ` Burakov, Anatoly
  2026-10-15 11:18       ` David Marchand
  0 siblings, 1 reply; 21+ messages in thread
From: Burakov, Anatoly @ 2026-10-15 10:41 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Vladimir Medvedkin, Bruce Richardson

On 10/15/2026 11:13 AM, Thomas Monjalon wrote:
> 15/10/2026 10:53, Burakov, Anatoly:
>> On 10/14/2026 10:34 PM, Thomas Monjalon wrote:
>>> 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.
>>>
>>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>>> ---
>>
>> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> 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.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] net/ixgbe: avoid private driver include in testpmd
  2026-10-15 10:41     ` Burakov, Anatoly
@ 2026-10-15 11:18       ` David Marchand
  2026-10-15 11:21         ` Burakov, Anatoly
  0 siblings, 1 reply; 21+ messages in thread
From: David Marchand @ 2026-10-15 11:18 UTC (permalink / raw)
  To: Thomas Monjalon, Burakov, Anatoly
  Cc: dev, Vladimir Medvedkin, Bruce Richardson

On Thu, 15 Oct 2026 at 12:41, Burakov, Anatoly
<anatoly.burakov@intel.com> wrote:
>
> On 10/15/2026 11:13 AM, Thomas Monjalon wrote:
> > 15/10/2026 10:53, Burakov, Anatoly:
> >> On 10/14/2026 10:34 PM, Thomas Monjalon wrote:
> >>> 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.
> >>>
> >>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> >>> ---
> >>
> >> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >
> > 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).


-- 
David Marchand


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] net/ixgbe: avoid private driver include in testpmd
  2026-10-15 11:18       ` David Marchand
@ 2026-10-15 11:21         ` Burakov, Anatoly
  2026-10-15 11:50           ` Thomas Monjalon
  0 siblings, 1 reply; 21+ messages in thread
From: Burakov, Anatoly @ 2026-10-15 11:21 UTC (permalink / raw)
  To: David Marchand, Thomas Monjalon; +Cc: dev, Vladimir Medvedkin, Bruce Richardson

On 10/15/2026 1:18 PM, David Marchand wrote:
> On Thu, 15 Oct 2026 at 12:41, Burakov, Anatoly
> <anatoly.burakov@intel.com> wrote:
>>
>> On 10/15/2026 11:13 AM, Thomas Monjalon wrote:
>>> 15/10/2026 10:53, Burakov, Anatoly:
>>>> On 10/14/2026 10:34 PM, Thomas Monjalon wrote:
>>>>> 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.
>>>>>
>>>>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>>>>> ---
>>>>
>>>> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>>
>>> 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).
> 
> 

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.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] net/ixgbe: avoid private driver include in testpmd
  2026-10-15 11:21         ` Burakov, Anatoly
@ 2026-10-15 11:50           ` Thomas Monjalon
  2026-10-15 14:01             ` Burakov, Anatoly
  0 siblings, 1 reply; 21+ messages in thread
From: Thomas Monjalon @ 2026-10-15 11:50 UTC (permalink / raw)
  To: David Marchand, Burakov, Anatoly
  Cc: dev, Vladimir Medvedkin, Bruce Richardson

15/10/2026 13:21, Burakov, Anatoly:
> On 10/15/2026 1:18 PM, David Marchand wrote:
> > On Thu, 15 Oct 2026 at 12:41, Burakov, Anatoly
> > <anatoly.burakov@intel.com> wrote:
> >>
> >> On 10/15/2026 11:13 AM, Thomas Monjalon wrote:
> >>> 15/10/2026 10:53, Burakov, Anatoly:
> >>>> On 10/14/2026 10:34 PM, Thomas Monjalon wrote:
> >>>>> 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.
> >>>>>
> >>>>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> >>>>> ---
> >>>>
> >>>> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >>>
> >>> 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).
> 
> 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?



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] net/ixgbe: avoid private driver include in testpmd
  2026-10-15 11:50           ` Thomas Monjalon
@ 2026-10-15 14:01             ` Burakov, Anatoly
  0 siblings, 0 replies; 21+ messages in thread
From: Burakov, Anatoly @ 2026-10-15 14:01 UTC (permalink / raw)
  To: Thomas Monjalon, David Marchand; +Cc: dev, Vladimir Medvedkin, Bruce Richardson

On 10/15/2026 1:50 PM, Thomas Monjalon wrote:
> 15/10/2026 13:21, Burakov, Anatoly:
>> On 10/15/2026 1:18 PM, David Marchand wrote:
>>> On Thu, 15 Oct 2026 at 12:41, Burakov, Anatoly
>>> <anatoly.burakov@intel.com> wrote:
>>>>
>>>> On 10/15/2026 11:13 AM, Thomas Monjalon wrote:
>>>>> 15/10/2026 10:53, Burakov, Anatoly:
>>>>>> On 10/14/2026 10:34 PM, Thomas Monjalon wrote:
>>>>>>> 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.
>>>>>>>
>>>>>>> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>>>>>>> ---
>>>>>>
>>>>>> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>>>>
>>>>> 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).
>>
>> 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)

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/3] net/ixgbe: avoid private driver include in testpmd
  2026-10-14 20:34 [PATCH] net/ixgbe: avoid private driver include in testpmd Thomas Monjalon
  2026-10-15  8:53 ` Burakov, Anatoly
@ 2026-10-15 14:21 ` Anatoly Burakov
  2026-10-15 14:21   ` [PATCH v2 2/3] net/iavf: do not include private headers " Anatoly Burakov
                     ` (2 more replies)
  1 sibling, 3 replies; 21+ messages in thread
From: Anatoly Burakov @ 2026-10-15 14:21 UTC (permalink / raw)
  To: dev, Vladimir Medvedkin

From: Thomas Monjalon <thomas@monjalon.net>

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.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/ixgbe/ixgbe_testpmd.c | 55 ++++++++++---------------
 1 file changed, 21 insertions(+), 34 deletions(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_testpmd.c b/drivers/net/intel/ixgbe/ixgbe_testpmd.c
index e0d161eafe..e209093477 100644
--- a/drivers/net/intel/ixgbe/ixgbe_testpmd.c
+++ b/drivers/net/intel/ixgbe/ixgbe_testpmd.c
@@ -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 =
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/3] net/iavf: do not include private headers in testpmd
  2026-10-15 14:21 ` [PATCH v2 1/3] " Anatoly Burakov
@ 2026-10-15 14:21   ` Anatoly Burakov
  2026-10-15 14:33     ` Bruce Richardson
  2026-10-15 14:45     ` Medvedkin, Vladimir
  2026-10-15 14:21   ` [PATCH v2 3/3] net/ice: " Anatoly Burakov
  2026-10-15 14:44   ` [PATCH v2 1/3] net/ixgbe: avoid private driver include " Medvedkin, Vladimir
  2 siblings, 2 replies; 21+ messages in thread
From: Anatoly Burakov @ 2026-10-15 14:21 UTC (permalink / raw)
  To: dev, Vladimir Medvedkin, Ciara Loftus, Bruce Richardson

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")
Cc: ciara.loftus@intel.com

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 drivers/net/intel/iavf/iavf_testpmd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_testpmd.c b/drivers/net/intel/iavf/iavf_testpmd.c
index f3b932da04..1146f534e3 100644
--- a/drivers/net/intel/iavf/iavf_testpmd.c
+++ b/drivers/net/intel/iavf/iavf_testpmd.c
@@ -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;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/3] net/ice: do not include private headers in testpmd
  2026-10-15 14:21 ` [PATCH v2 1/3] " Anatoly Burakov
  2026-10-15 14:21   ` [PATCH v2 2/3] net/iavf: do not include private headers " Anatoly Burakov
@ 2026-10-15 14:21   ` Anatoly Burakov
  2026-10-15 14:36     ` Bruce Richardson
  2026-10-15 14:52     ` Medvedkin, Vladimir
  2026-10-15 14:44   ` [PATCH v2 1/3] net/ixgbe: avoid private driver include " Medvedkin, Vladimir
  2 siblings, 2 replies; 21+ messages in thread
From: Anatoly Burakov @ 2026-10-15 14:21 UTC (permalink / raw)
  To: dev, Bruce Richardson, Kevin Liu, Qi Zhang

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@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@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

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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/3] net/iavf: do not include private headers in testpmd
  2026-10-15 14:21   ` [PATCH v2 2/3] net/iavf: do not include private headers " Anatoly Burakov
@ 2026-10-15 14:33     ` Bruce Richardson
  2026-10-15 14:45     ` Medvedkin, Vladimir
  1 sibling, 0 replies; 21+ messages in thread
From: Bruce Richardson @ 2026-10-15 14:33 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, Vladimir Medvedkin, Ciara Loftus

On Thu, Oct 15, 2026 at 03:21:03PM +0100, Anatoly Burakov wrote:
> 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")
> Cc: ciara.loftus@intel.com
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>  drivers/net/intel/iavf/iavf_testpmd.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/net/intel/iavf/iavf_testpmd.c b/drivers/net/intel/iavf/iavf_testpmd.c
> index f3b932da04..1146f534e3 100644
> --- a/drivers/net/intel/iavf/iavf_testpmd.c
> +++ b/drivers/net/intel/iavf/iavf_testpmd.c
> @@ -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;
> -- 
> 2.52.0
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd
  2026-10-15 14:21   ` [PATCH v2 3/3] net/ice: " Anatoly Burakov
@ 2026-10-15 14:36     ` Bruce Richardson
  2026-10-15 14:39       ` Bruce Richardson
  2026-10-15 14:52     ` Medvedkin, Vladimir
  1 sibling, 1 reply; 21+ messages in thread
From: Bruce Richardson @ 2026-10-15 14:36 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, Kevin Liu, Qi Zhang

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@dpdk.org
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@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@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
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd
  2026-10-15 14:36     ` Bruce Richardson
@ 2026-10-15 14:39       ` Bruce Richardson
  0 siblings, 0 replies; 21+ messages in thread
From: Bruce Richardson @ 2026-10-15 14:39 UTC (permalink / raw)
  To: Anatoly Burakov; +Cc: dev, techboard, david.marchand

On Thu, Oct 15, 2026 at 03:36:05PM +0100, Bruce Richardson wrote:
> 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@dpdk.org
> > 
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@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@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?
> 
+techboard and others for more input and thoughts for the future.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] net/ixgbe: avoid private driver include in testpmd
  2026-10-15 14:21 ` [PATCH v2 1/3] " Anatoly Burakov
  2026-10-15 14:21   ` [PATCH v2 2/3] net/iavf: do not include private headers " Anatoly Burakov
  2026-10-15 14:21   ` [PATCH v2 3/3] net/ice: " Anatoly Burakov
@ 2026-10-15 14:44   ` Medvedkin, Vladimir
  2026-10-15 17:09     ` Bruce Richardson
  2 siblings, 1 reply; 21+ messages in thread
From: Medvedkin, Vladimir @ 2026-10-15 14:44 UTC (permalink / raw)
  To: Anatoly Burakov, dev

Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

On 10/15/2026 3:21 PM, Anatoly Burakov wrote:
> From: Thomas Monjalon <thomas@monjalon.net>
>
> 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.
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>   drivers/net/intel/ixgbe/ixgbe_testpmd.c | 55 ++++++++++---------------
>   1 file changed, 21 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/net/intel/ixgbe/ixgbe_testpmd.c b/drivers/net/intel/ixgbe/ixgbe_testpmd.c
> index e0d161eafe..e209093477 100644
> --- a/drivers/net/intel/ixgbe/ixgbe_testpmd.c
> +++ b/drivers/net/intel/ixgbe/ixgbe_testpmd.c
> @@ -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 =

-- 
Regards,
Vladimir


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/3] net/iavf: do not include private headers in testpmd
  2026-10-15 14:21   ` [PATCH v2 2/3] net/iavf: do not include private headers " Anatoly Burakov
  2026-10-15 14:33     ` Bruce Richardson
@ 2026-10-15 14:45     ` Medvedkin, Vladimir
  1 sibling, 0 replies; 21+ messages in thread
From: Medvedkin, Vladimir @ 2026-10-15 14:45 UTC (permalink / raw)
  To: Anatoly Burakov, dev, Ciara Loftus, Bruce Richardson

Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

On 10/15/2026 3:21 PM, Anatoly Burakov wrote:
> 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")
> Cc: ciara.loftus@intel.com
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>   drivers/net/intel/iavf/iavf_testpmd.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/drivers/net/intel/iavf/iavf_testpmd.c b/drivers/net/intel/iavf/iavf_testpmd.c
> index f3b932da04..1146f534e3 100644
> --- a/drivers/net/intel/iavf/iavf_testpmd.c
> +++ b/drivers/net/intel/iavf/iavf_testpmd.c
> @@ -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;

-- 
Regards,
Vladimir


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd
  2026-10-15 14:21   ` [PATCH v2 3/3] net/ice: " Anatoly Burakov
  2026-10-15 14:36     ` Bruce Richardson
@ 2026-10-15 14:52     ` Medvedkin, Vladimir
  2026-10-15 15:00       ` Burakov, Anatoly
  1 sibling, 1 reply; 21+ messages in thread
From: Medvedkin, Vladimir @ 2026-10-15 14:52 UTC (permalink / raw)
  To: Anatoly Burakov, dev, Bruce Richardson, Kevin Liu, Qi Zhang

Hi Anatoly,

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

Apart from this,

Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

On 10/15/2026 3:21 PM, 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@dpdk.org
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@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
>
> 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_ */

-- 
Regards,
Vladimir


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd
  2026-10-15 14:52     ` Medvedkin, Vladimir
@ 2026-10-15 15:00       ` Burakov, Anatoly
  2026-10-15 15:21         ` Bruce Richardson
  0 siblings, 1 reply; 21+ messages in thread
From: Burakov, Anatoly @ 2026-10-15 15:00 UTC (permalink / raw)
  To: Medvedkin, Vladimir, dev, Bruce Richardson, Kevin Liu, Qi Zhang

On 10/15/2026 4:52 PM, Medvedkin, Vladimir wrote:
> 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?

diff --git a/drivers/net/intel/ice/rte_pmd_ice.h 
b/drivers/net/intel/ice/rte_pmd_ice.h
index dccfdcd5f4..881dc4cc56 100644
--- a/drivers/net/intel/ice/rte_pmd_ice.h
+++ b/drivers/net/intel/ice/rte_pmd_ice.h
@@ -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


> 
> Apart from this,
> 
> Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> 
> On 10/15/2026 3:21 PM, 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@dpdk.org
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@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
>>
>> 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_ */
> 


-- 
Thanks,
Anatoly

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd
  2026-10-15 15:00       ` Burakov, Anatoly
@ 2026-10-15 15:21         ` Bruce Richardson
  2026-10-15 15:29           ` Burakov, Anatoly
  0 siblings, 1 reply; 21+ messages in thread
From: Bruce Richardson @ 2026-10-15 15:21 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: Medvedkin, Vladimir, dev, Kevin Liu, Qi Zhang

On Thu, Oct 15, 2026 at 05:00:38PM +0200, Burakov, Anatoly wrote:
> On 10/15/2026 4:52 PM, Medvedkin, Vladimir wrote:
> > 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?
> 
> diff --git a/drivers/net/intel/ice/rte_pmd_ice.h
> b/drivers/net/intel/ice/rte_pmd_ice.h
> index dccfdcd5f4..881dc4cc56 100644
> --- a/drivers/net/intel/ice/rte_pmd_ice.h
> +++ b/drivers/net/intel/ice/rte_pmd_ice.h
> @@ -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.

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

/Bruce

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 3/3] net/ice: do not include private headers in testpmd
  2026-10-15 15:21         ` Bruce Richardson
@ 2026-10-15 15:29           ` Burakov, Anatoly
  0 siblings, 0 replies; 21+ messages in thread
From: Burakov, Anatoly @ 2026-10-15 15:29 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: Medvedkin, Vladimir, dev, Kevin Liu, Qi Zhang

On 10/15/2026 5:21 PM, Bruce Richardson wrote:
> On Thu, Oct 15, 2026 at 05:00:38PM +0200, Burakov, Anatoly wrote:
>> On 10/15/2026 4:52 PM, Medvedkin, Vladimir wrote:
>>> 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?
>>
>> diff --git a/drivers/net/intel/ice/rte_pmd_ice.h
>> b/drivers/net/intel/ice/rte_pmd_ice.h
>> index dccfdcd5f4..881dc4cc56 100644
>> --- a/drivers/net/intel/ice/rte_pmd_ice.h
>> +++ b/drivers/net/intel/ice/rte_pmd_ice.h
>> @@ -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.
> 
> That is very strange behaviour! That looks like something a future patch
> should fix, but ok to change the documentation on apply here.
> 
> /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.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/3] net/ixgbe: avoid private driver include in testpmd
  2026-10-15 14:44   ` [PATCH v2 1/3] net/ixgbe: avoid private driver include " Medvedkin, Vladimir
@ 2026-10-15 17:09     ` Bruce Richardson
  0 siblings, 0 replies; 21+ messages in thread
From: Bruce Richardson @ 2026-10-15 17:09 UTC (permalink / raw)
  To: Medvedkin, Vladimir; +Cc: Anatoly Burakov, dev

On Thu, Oct 15, 2026 at 03:44:33PM +0100, Medvedkin, Vladimir wrote:
> Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> 
> On 10/15/2026 3:21 PM, Anatoly Burakov wrote:
> > From: Thomas Monjalon <thomas@monjalon.net>
> > 
> > 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.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
> > ---
> >   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

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-10-15 17:09 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14 20:34 [PATCH] net/ixgbe: avoid private driver include in testpmd Thomas Monjalon
2026-10-15  8:53 ` Burakov, Anatoly
2026-10-15  9:13   ` Thomas Monjalon
2026-10-15 10:41     ` Burakov, Anatoly
2026-10-15 11:18       ` David Marchand
2026-10-15 11:21         ` Burakov, Anatoly
2026-10-15 11:50           ` Thomas Monjalon
2026-10-15 14:01             ` Burakov, Anatoly
2026-10-15 14:21 ` [PATCH v2 1/3] " Anatoly Burakov
2026-10-15 14:21   ` [PATCH v2 2/3] net/iavf: do not include private headers " Anatoly Burakov
2026-10-15 14:33     ` Bruce Richardson
2026-10-15 14:45     ` Medvedkin, Vladimir
2026-10-15 14:21   ` [PATCH v2 3/3] net/ice: " Anatoly Burakov
2026-10-15 14:36     ` Bruce Richardson
2026-10-15 14:39       ` Bruce Richardson
2026-10-15 14:52     ` Medvedkin, Vladimir
2026-10-15 15:00       ` Burakov, Anatoly
2026-10-15 15:21         ` Bruce Richardson
2026-10-15 15:29           ` Burakov, Anatoly
2026-10-15 14:44   ` [PATCH v2 1/3] net/ixgbe: avoid private driver include " Medvedkin, Vladimir
2026-10-15 17:09     ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox