From: Rajesh Kumar <rajesh3.kumar@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
andrew.rybchenko@oktetlabs.ru, stephen@networkplumber.org,
aman.deep.singh@intel.com, Rajesh Kumar <rajesh3.kumar@intel.com>
Subject: [RFC PATCH v4 3/3] app/testpmd: add Tx timestamp capabilities command
Date: Wed, 2 Sep 2026 11:21:24 +0530 [thread overview]
Message-ID: <20260902055125.836268-4-rajesh3.kumar@intel.com> (raw)
In-Reply-To: <20260902055125.836268-1-rajesh3.kumar@intel.com>
Add "show port <port_id> tx_timestamp_caps" to report the Tx timestamp
slot capabilities of a port: the slot type reported by the driver and the
number of available slots.
When the port supports per-packet slots, the command also performs an
allocate and release round-trip so the slot management API can be
exercised from the command line.
Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com>
---
app/test-pmd/cmdline.c | 79 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 10ee7c5179..66276cee58 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -14213,6 +14213,84 @@ static cmdline_parse_inst_t cmd_set_dev_led = {
},
};
+/* *** show port tx_timestamp capabilities *** */
+struct cmd_show_port_tx_ts_caps_result {
+ cmdline_fixed_string_t show;
+ cmdline_fixed_string_t port;
+ portid_t port_id;
+ cmdline_fixed_string_t tx_timestamp_caps;
+};
+
+static void cmd_show_port_tx_ts_caps_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_show_port_tx_ts_caps_result *res = parsed_result;
+ struct rte_eth_timesync_tx_ts_caps caps;
+ uint32_t slot_id;
+ int ret;
+
+ ret = rte_eth_timesync_tx_timestamp_slot_get_capabilities(
+ res->port_id, &caps);
+ if (ret == -ENOTSUP) {
+ printf("Port %u: TX timestamp slot API not supported\n",
+ res->port_id);
+ return;
+ }
+ if (ret < 0) {
+ printf("Port %u: get capabilities failed (%d)\n",
+ res->port_id, ret);
+ return;
+ }
+
+ printf("Port %u TX timestamp capabilities:\n", res->port_id);
+ printf(" Type : %s\n",
+ caps.type == RTE_ETH_TIMESYNC_TX_TS_PER_PACKET ? "per-packet" :
+ caps.type == RTE_ETH_TIMESYNC_TX_TS_SINGLE_REG ? "single-reg" :
+ "none");
+ printf(" Max slots : %u\n", caps.max_slots);
+
+ if (caps.type != RTE_ETH_TIMESYNC_TX_TS_PER_PACKET)
+ return;
+
+ /* Quick alloc/release round-trip to prove the API works */
+ ret = rte_eth_timesync_tx_timestamp_slot_alloc(res->port_id, &slot_id);
+ if (ret == 0) {
+ printf(" Alloc test: slot_id=%u OK\n", slot_id);
+ ret = rte_eth_timesync_tx_timestamp_slot_release(
+ res->port_id, slot_id);
+ printf(" Release : %s\n", ret == 0 ? "OK" : "FAILED");
+ } else {
+ printf(" Alloc test: failed (%d)\n", ret);
+ }
+}
+
+static cmdline_parse_token_string_t cmd_show_port_tx_ts_caps_show =
+ TOKEN_STRING_INITIALIZER(struct cmd_show_port_tx_ts_caps_result,
+ show, "show");
+static cmdline_parse_token_string_t cmd_show_port_tx_ts_caps_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_show_port_tx_ts_caps_result,
+ port, "port");
+static cmdline_parse_token_num_t cmd_show_port_tx_ts_caps_port_id =
+ TOKEN_NUM_INITIALIZER(struct cmd_show_port_tx_ts_caps_result,
+ port_id, RTE_UINT16);
+static cmdline_parse_token_string_t cmd_show_port_tx_ts_caps_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_show_port_tx_ts_caps_result,
+ tx_timestamp_caps, "tx_timestamp_caps");
+
+static cmdline_parse_inst_t cmd_show_port_tx_ts_caps = {
+ .f = cmd_show_port_tx_ts_caps_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> tx_timestamp_caps",
+ .tokens = {
+ (void *)&cmd_show_port_tx_ts_caps_show,
+ (void *)&cmd_show_port_tx_ts_caps_port,
+ (void *)&cmd_show_port_tx_ts_caps_port_id,
+ (void *)&cmd_show_port_tx_ts_caps_keyword,
+ NULL,
+ },
+};
+
/* ******************************************************************************** */
/* list of instructions */
@@ -14469,6 +14547,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
&cmd_set_port_cman_config,
&cmd_config_tx_affinity_map,
&cmd_set_dev_led,
+ &cmd_show_port_tx_ts_caps,
NULL,
};
--
2.55.0
next prev parent reply other threads:[~2026-09-02 5:52 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 19:24 [RFC 0/1] ethdev: per-packet Tx timestamp slot management Rajesh Kumar
2026-08-17 19:24 ` [RFC 1/1] ethdev: add per-packet Tx timestamp slot APIs Rajesh Kumar
2026-08-20 4:51 ` Naga Harish K, S V
2026-08-18 2:23 ` [RFC 0/1] ethdev: per-packet Tx timestamp slot management Stephen Hemminger
2026-08-20 4:41 ` Naga Harish K, S V
2026-08-27 11:09 ` Kumar, Rajesh
2026-08-27 12:13 ` [RFC PATCH v2 0/1] ethdev: add Tx timestamp slot APIs Rajesh Kumar
2026-08-27 12:13 ` [RFC PATCH v3 1/1] ethdev: add Tx timestamp slot management APIs Rajesh Kumar
2026-08-27 12:18 ` [RFC PATCH v3 0/1] ethdev: add Tx timestamp slot APIs Rajesh Kumar
2026-08-27 12:21 ` Rajesh Kumar
2026-08-27 12:21 ` [RFC PATCH v3 1/1] ethdev: add Tx timestamp slot management APIs Rajesh Kumar
2026-08-27 21:45 ` Stephen Hemminger
2026-09-02 5:51 ` [RFC PATCH v4 0/3] ethdev: add Tx timestamp slot APIs Rajesh Kumar
2026-09-02 5:51 ` [RFC PATCH v4 1/3] ethdev: add Tx timestamp slot management APIs Rajesh Kumar
2026-09-02 14:13 ` Stephen Hemminger
2026-09-02 5:51 ` [RFC PATCH v4 2/3] net/ice: support per-packet Tx timestamp slots Rajesh Kumar
2026-09-02 5:51 ` Rajesh Kumar [this message]
2026-08-27 12:34 ` [RFC PATCH v2 0/1] ethdev: add Tx timestamp slot APIs Rajesh Kumar
2026-08-27 12:34 ` [RFC PATCH v2 1/1] ethdev: add Tx timestamp slot management APIs Rajesh Kumar
2026-09-02 14:16 ` [RFC PATCH v2 0/1] ethdev: add Tx timestamp slot APIs 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=20260902055125.836268-4-rajesh3.kumar@intel.com \
--to=rajesh3.kumar@intel.com \
--cc=aman.deep.singh@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox