From: Stephen Hemminger <stephen@networkplumber.org>
To: Rajesh Kumar <rajesh3.kumar@intel.com>
Cc: dev@dpdk.org, thomas@monjalon.net, bruce.richardson@intel.com,
andrew.rybchenko@oktetlabs.ru, aman.deep.singh@intel.com
Subject: Re: [RFC PATCH v3 1/1] ethdev: add Tx timestamp slot management APIs
Date: Thu, 27 Aug 2026 14:45:12 -0700 [thread overview]
Message-ID: <20260827144512.10cf0616@phoenix.local> (raw)
In-Reply-To: <20260827122200.339388-2-rajesh3.kumar@intel.com>
On Thu, 27 Aug 2026 17:51:59 +0530
Rajesh Kumar <rajesh3.kumar@intel.com> wrote:
> Extend ethdev timesync with a capability model for selecting between
> shared-register and per-packet Tx timestamping.
>
> Add public and PMD interfaces to query timestamp capabilities, allocate
> timestamp slots, retrieve timestamps asynchronously, and release slots.
> Slots have port-global scope and can be used across Tx queues.
>
> Add a dual-domain timestamp structure for reporting adjusted PHC time
> and raw hardware time independently through validity flags.
>
> Add APIs to register and unregister the mbuf dynamic field and dynflag
> used to pass slot handles to the Tx datapath. Add helpers to associate
> a slot handle with an mbuf before transmission.
>
> Keep the legacy Tx timestamp API for shared-register hardware and provide
> a compatibility alias for the mbuf stamping helper.
>
> Document the timestamp capability model, slot lifecycle, and application
> workflow.
>
> Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com>
> ---
Lots of feedback for AI review that needs addressing (Claude Fable).
Also a feature like this needs some form of test coverage. Perhaps
mocking up something in null PMD or related.
Review of [RFC PATCH v3 1/1] ethdev: add Tx timestamp slot management APIs
Applied cleanly to current main and read post-apply. No build
performed (meson not available here); nothing in the diff looks like
it would fail to compile.
Errors:
1. Documentation and Doxygen claim rte_eth_timesync_enable() registers
the dynfield/dynflag automatically. It does not. The patch does not
touch rte_eth_timesync_enable(); post-apply it still just calls the
PMD op. So the .. note:: in timesync.rst ("registers the dynamic
field automatically ... Call ... explicitly only if creating
mempools before enabling timesync") and the same statement in the
header Doxygen for rte_eth_timesync_tx_slot_dynfield_register() are
false. An application that follows the doc and relies on
timesync_enable will get -ENOTSUP from stamp_mbuf (or worse, a late
registration that fails after pools are created). Either add the
call in rte_eth_timesync_enable() or drop the claim; given the
"must register before pool create" constraint, dropping the claim
and making the explicit call mandatory is the safer contract.
2. Commit message says "provide a compatibility alias for the mbuf
stamping helper". No such alias exists in the diff. Either the
alias was dropped between v2 and v3 and the message is stale, or
it is missing. Fix one or the other.
3. Dead macros referencing a nonexistent structure:
RTE_ETH_TIMESYNC_TX_TIMESTAMP_SLOT_INFO_MAX_VALID
RTE_ETH_TIMESYNC_TX_TIMESTAMP_SLOT_INFO_FREE_VALID
Doxygen says they are valid bits for
rte_eth_timesync_tx_timestamp_slot_info.max_slots / .free_slots,
but that struct is not defined anywhere. Leftover from an earlier
revision; remove them.
4. The PMD contract is incomplete: the datapath needs the dynfield
offset and dynflag bit, but they are file-static in rte_ethdev.c
with no accessor in ethdev_driver.h. A PMD is forced to do its own
rte_mbuf_dynfield_lookup()/dynflag_lookup() by name, which then
cannot observe rte_eth_timesync_tx_slot_dynfield_unregister()
resetting the library-side cache. So the documented behaviour that
after unregister "PMD Tx datapaths fall back to port-level legacy
mode" cannot actually happen: the PMD keeps testing the dynflag it
looked up, and mbufs stamped before unregister still carry it.
Either export an internal accessor (offset + flag) in
ethdev_driver.h that PMDs must use, or drop the unregister API and
its fallback claim. As written, the unregister function only
changes library-local state and cannot deliver what its Doxygen
promises.
Warnings:
5. rte_ethdev.h Doxygen for rte_eth_timesync_tx_slot_dynfield_unregister
refers to "the port-level ptp_tx_index". That is an Intel driver
internal, not an ethdev concept; a generic header should not
reference it.
6. rte_eth_timesync_tx_timestamp_stamp_mbuf() calls
rte_eth_timesync_tx_slot_dynfield_register() on every invocation.
Post-registration this is just an int compare, but it also means
the first stamp_mbuf call can silently register the dynfield after
pools exist, which the register() Doxygen says may fail. It is also
inconsistent with the "-ENOTSUP after unregister" contract: after
unregister, stamp_mbuf will simply re-register (lookup succeeds)
and go on working. Do the offset check inline and return -ENOTSUP
if the offset is < 0 rather than re-registering.
7. Slot handles are uint32_t, but rte_eth_timesync_tx_ts_caps has no
way to express the free-slot count, and slot_release() has no
documented behaviour for double-release or release of a slot whose
timestamp was never read. For an RFC that is acceptable, but the
PMD contract section in timesync.rst should say what a PMD must do
for an invalid or already-free slot_id (-EINVAL is the obvious
answer, and the ethdev wrapper could enforce slot_id < max_slots
if caps are cached).
8. Release notes and header call these experimental, but the new
eth_dev_ops members are inserted in the middle of struct
eth_dev_ops rather than at the end. eth_dev_ops is internal so
this is not an ABI issue, but the ordering in the struct
(alloc, get_capabilities, read_slot, release) does not match the
typedef order or the order in features.rst
(get_capabilities, alloc, read_slot, release). Make them consistent.
9. features.rst adds the ops and API names, but there is no PMD
implementing them in this series and no testpmd hook or unit test
exercising the new API. Per contributing guidelines a new ethdev
API needs at least one driver implementation and a testpmd hook
before it can be merged out of RFC.
Info:
10. timesync.rst: the "Clock Management & Control", "Rx Timestamp
Extraction Workflow" and "PMD Implementation Requirements"
sections use bullet lists with bold term + description; RST
definition lists would render better. Several lines in the .rst
are well over 100 columns; wrap at sentence boundaries.
11. In rte_eth_timesync_tx_slot_dynfield_register(), the inner
braced block for flag_bit is unusual style in DPDK; declare
flag_bit at function top or at point of use without the block.
12. Blank line separating the slot_release function from the
"Internal process-local cache" comment is missing; there is a
double blank line before stamp_mbuf.
next prev parent reply other threads:[~2026-08-27 21:45 UTC|newest]
Thread overview: 14+ 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 [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
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=20260827144512.10cf0616@phoenix.local \
--to=stephen@networkplumber.org \
--cc=aman.deep.singh@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=rajesh3.kumar@intel.com \
--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 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.