[PATCH net v1 0/3] af_packet/tcp: fix late hardware timestamp handling

Kohei Enju
2026-04-29T09:16:43Z

Since commit 97dc7cd92ac6 ("ptp: Support late timestamp determination"),
skb_shared_hwtstamps may carry netdev_data instead of a resolved
hwtstamp. AF_PACKET and TCP could still read that storage as a ktime_t
and report bogus hardware timestamps to userspace.

This series factors the late timestamp resolution logic into a common
helper, then switches AF_PACKET and TCP to use it.

Notes on SOF_TIMESTAMPING_BIND_PHC:
The generic socket receive timestamping path honors it, but the
AF_PACKET and TCP receive paths touched here haven't implemented that
behavior.
This series doesn't change that; those paths always resolve timestamps
with cycles == false and preserve their timestamp-domain semantics.

Kohei Enju (3):
net: introduce helper to resolve hardware timestamps from skb
af_packet: use skb_get_hwtstamp() for hardware timestamps
tcp: use skb_get_hwtstamp() for hardware timestamps

include/linux/skbuff.h | 11 +++++++++++
include/net/tcp.h | 2 +-
net/core/skbuff.c | 27 +++++++++++++++++++++++++++
net/ipv4/tcp_input.c | 3 ++-
net/ipv4/tcp_ipv4.c | 6 ++++--
net/ipv6/tcp_ipv6.c | 3 ++-
net/packet/af_packet.c | 2 +-
net/socket.c | 27 +++------------------------
8 files changed, 51 insertions(+), 30 deletions(-)

--
2.53.0