Skip to content

Propagate DPDK mbuf RX timestamp to FreeBSD mbuf rcv_tstmp#1051

Merged
jfb8856606 merged 2 commits intoF-Stack:devfrom
tarun-t:fix/propagate-dpdk-rx-timestamp
Mar 20, 2026
Merged

Propagate DPDK mbuf RX timestamp to FreeBSD mbuf rcv_tstmp#1051
jfb8856606 merged 2 commits intoF-Stack:devfrom
tarun-t:fix/propagate-dpdk-rx-timestamp

Conversation

@tarun-t
Copy link
Contributor

@tarun-t tarun-t commented Mar 19, 2026

Summary

  • Enable RTE_ETH_RX_OFFLOAD_TIMESTAMP on ports where the NIC supports it
  • Register the timestamp dynamic field and flag via rte_mbuf_dyn_rx_timestamp_register() after rte_eth_dev_start() (DPDK 23.11 dynamic field API)
  • Copy the hardware timestamp into the FreeBSD mbuf's m_pkthdr.rcv_tstmp so that the existing SO_TIMESTAMP / SCM_TIMESTAMP path delivers it to userspace
  • Map LINUX_SO_TIMESTAMP (29) to FreeBSD SO_TIMESTAMP in ff_syscall_wrapper.c so applications using the Linux syscall wrapper can enable receive timestamps via setsockopt()

Uses the registered dynflag mask per-packet (not the legacy RTE_MBUF_F_RX_IEEE1588_TMST) and reads the timestamp via RTE_MBUF_DYNFIELD at the registered offset.

When HW timestamps are not available the offload is not enabled, the dynflag is never set, and the new code path is never entered — fully backward compatible.

Fixes: #1045

tarun-t added 2 commits March 19, 2026 17:51
Enable RTE_ETH_RX_OFFLOAD_TIMESTAMP on ports where the NIC supports it,
register the timestamp dynamic field and flag via
rte_mbuf_dyn_rx_timestamp_register() after rte_eth_dev_start() (when
the PMD has registered the dynfield), and copy it into the FreeBSD
mbuf's m_pkthdr.rcv_tstmp so that the existing SO_TIMESTAMP /
SCM_TIMESTAMP path delivers it to userspace.

Uses the DPDK 23.11 dynamic field API: checks the registered dynflag
mask per-packet (not the legacy RTE_MBUF_F_RX_IEEE1588_TMST) and reads
the timestamp via RTE_MBUF_DYNFIELD at the registered offset.

When HW timestamps are not available the offload is not enabled, the
dynflag is never set, and the new code path is never entered — fully
backward compatible.

Fixes: F-Stack#1045
Add LINUX_SO_TIMESTAMP (29) to the socket option translation table so
that applications using the Linux syscall wrapper can enable packet
receive timestamps via setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP, ...).
@jfb8856606
Copy link
Contributor

Thanks for the PR.

@jfb8856606 jfb8856606 merged commit 22608e4 into F-Stack:dev Mar 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Propagate DPDK mbuf RX timestamp to FreeBSD mbuf rcv_tstmp

2 participants