All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Luca Vizzarro <luca.vizzarro@arm.com>,
	Patrick Robb <patrickrobb1997@gmail.com>
Subject: [PATCH v9 09/10] dts: use specific types for Rx/Tx offloads
Date: Sat,  6 Jun 2026 01:33:49 +0200	[thread overview]
Message-ID: <20260605233456.3017423-10-thomas@monjalon.net> (raw)
In-Reply-To: <20260605233456.3017423-1-thomas@monjalon.net>

Testpmd Rx and Tx offload parameters only accepted integer masks.
This forced tests to pass enum values through .value
when using RxOffloadCapability or TxOffloadCapability.

Allow these parameters to take either typed offload flags
or raw integer masks,
and convert both forms to the hexadecimal mask
expected by the testpmd command line.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 dts/api/testpmd/config.py        | 11 +++++++++--
 dts/framework/params/__init__.py | 14 ++++++++++++++
 dts/framework/params/types.py    |  5 +++--
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/dts/api/testpmd/config.py b/dts/api/testpmd/config.py
index 1e59bccd08..f0581843ca 100644
--- a/dts/api/testpmd/config.py
+++ b/dts/api/testpmd/config.py
@@ -19,6 +19,7 @@
     YesNoSwitch,
     bracketed,
     comma_separated,
+    hex_from_flag_or_int,
     hex_from_flag_value,
     modify_str,
     str_from_flag_value,
@@ -26,6 +27,8 @@
 from framework.params.eal import EalParams
 from framework.utils import StrEnum
 
+from .types import RxOffloadCapability, TxOffloadCapability
+
 
 class PortTopology(StrEnum):
     """Enum representing the port topology."""
@@ -577,12 +580,16 @@ class TestPmdParams(EalParams):
     )
     multi_rx_mempool: Switch = None
     rx_shared_queue: Switch | int = field(default=None, metadata=Params.long("rxq-share"))
-    rx_offloads: int | None = field(default=None, metadata=Params.convert_value(hex))
+    rx_offloads: RxOffloadCapability | int | None = field(
+        default=None, metadata=Params.convert_value(hex_from_flag_or_int)
+    )
     rx_mq_mode: RXMultiQueueMode | None = None
 
     tx_queues: int | None = field(default=None, metadata=Params.long("txq"))
     tx_ring: TXRingParams | None = None
-    tx_offloads: int | None = field(default=None, metadata=Params.convert_value(hex))
+    tx_offloads: TxOffloadCapability | int | None = field(
+        default=None, metadata=Params.convert_value(hex_from_flag_or_int)
+    )
 
     eth_link_speed: int | None = None
     disable_link_check: Switch = None
diff --git a/dts/framework/params/__init__.py b/dts/framework/params/__init__.py
index e6a2d3c903..b5bae9dad9 100644
--- a/dts/framework/params/__init__.py
+++ b/dts/framework/params/__init__.py
@@ -130,6 +130,20 @@ def hex_from_flag_value(flag: Flag) -> str:
     return hex(flag.value)
 
 
+def hex_from_flag_or_int(value: Flag | int) -> str:
+    """Returns a :class:`enum.Flag` or integer value converted to hexadecimal.
+
+    Args:
+        value: An instance of :class:`Flag` or an integer.
+
+    Returns:
+        The value in hexadecimal representation.
+    """
+    if isinstance(value, Flag):
+        return hex_from_flag_value(value)
+    return hex(value)
+
+
 class ParamsModifier(TypedDict, total=False):
     """Params modifiers dict compatible with the :func:`dataclasses.field` metadata parameter."""
 
diff --git a/dts/framework/params/types.py b/dts/framework/params/types.py
index 3c7650474c..a9f3749083 100644
--- a/dts/framework/params/types.py
+++ b/dts/framework/params/types.py
@@ -53,6 +53,7 @@ def create_testpmd(**kwargs: Unpack[TestPmdParamsDict]):
     TXRingParams,
     TxUDPPortPair,
 )
+from api.testpmd.types import RxOffloadCapability, TxOffloadCapability
 from framework.params import Switch, YesNoSwitch
 from framework.testbed_model.cpu import LogicalCoreList
 from framework.testbed_model.port import Port
@@ -175,11 +176,11 @@ class TestPmdParamsDict(EalParamsDict, total=False):
     rx_segments_length: list[int] | None
     multi_rx_mempool: Switch
     rx_shared_queue: Switch | int
-    rx_offloads: int | None
+    rx_offloads: RxOffloadCapability | int | None
     rx_mq_mode: RXMultiQueueMode | None
     tx_queues: int | None
     tx_ring: TXRingParams | None
-    tx_offloads: int | None
+    tx_offloads: TxOffloadCapability | int | None
     eth_link_speed: int | None
     disable_link_check: Switch
     disable_device_start: Switch
-- 
2.54.0


  parent reply	other threads:[~2026-06-05 23:36 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02 16:09 [PATCH 1/2] ethdev: support selective Rx data Gregory Etelson
2026-02-02 16:09 ` [PATCH 2/2] app/testpmd: " Gregory Etelson
2026-02-02 17:37   ` Stephen Hemminger
2026-02-02 18:17 ` [PATCH 1/2] ethdev: " Stephen Hemminger
2026-05-09 21:56 ` [PATCH v2 00/10] selective Rx Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 03/10] app/testpmd: support " Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-05-09 21:57   ` [PATCH v2 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-05-09 21:57   ` [PATCH v2 10/10] dts: add selective Rx tests Thomas Monjalon
2026-05-10 16:19   ` [PATCH v2 00/10] selective Rx Stephen Hemminger
2026-05-28 12:46 ` [PATCH v3 " Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 03/10] app/testpmd: support " Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 10/10] dts: add selective Rx tests Thomas Monjalon
2026-05-29 13:33 ` [PATCH v4 00/10] selective Rx Thomas Monjalon
2026-05-29 13:33   ` [PATCH v4 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-05-29 13:33   ` [PATCH v4 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-01  8:07     ` Andrew Rybchenko
2026-05-29 13:33   ` [PATCH v4 03/10] app/testpmd: support " Thomas Monjalon
2026-05-29 13:33   ` [PATCH v4 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-05-29 13:33   ` [PATCH v4 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-02 13:53     ` Stephen Hemminger
2026-06-02 21:37       ` Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-02 21:38 ` [PATCH v5 00/10] selective Rx Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 03/10] app/testpmd: support " Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-02 21:49 ` [PATCH v6 00/10] selective Rx Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 03/10] app/testpmd: support " Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-03 17:31   ` [PATCH v6 00/10] selective Rx Stephen Hemminger
2026-06-03 18:23 ` [PATCH v7 " Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 03/10] app/testpmd: support " Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-04 19:30 ` [PATCH v8 0/9] selective Rx Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 1/9] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 2/9] ethdev: introduce selective Rx Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 3/9] app/testpmd: support " Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 4/9] common/mlx5: add null MR functions Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 5/9] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 6/9] net/mlx5: support selective Rx Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 7/9] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-04 19:31   ` [PATCH v8 8/9] dts: fix topology capability comparison Thomas Monjalon
2026-06-04 19:31   ` [PATCH v8 9/9] dts: add selective Rx tests Thomas Monjalon
2026-06-05 21:28     ` Stephen Hemminger
2026-06-05 23:31       ` Thomas Monjalon
2026-06-05 23:33 ` [PATCH v9 00/10] selective Rx Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 03/10] app/testpmd: support " Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 07/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 08/10] dts: fix topology capability comparison Thomas Monjalon
2026-06-05 23:33   ` Thomas Monjalon [this message]
2026-06-05 23:33   ` [PATCH v9 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-07 18:15   ` [PATCH v9 00/10] selective Rx Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260605233456.3017423-10-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=luca.vizzarro@arm.com \
    --cc=patrickrobb1997@gmail.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.