|
|
Log in / Subscribe / Register

Implement PTP support in netdevsim

From:  Maciek Machnikowski <maciek-AT-machnikowski.net>
To:  netdev-AT-vger.kernel.org
Subject:  [PATCH v4 net-next 0/3] Implement PTP support in netdevsim
Date:  Mon, 27 Apr 2026 18:47:24 +0200
Message-ID:  <20260427164727.15418-1-maciek@machnikowski.net>
Cc:  kuba-AT-kernel.org, maciek-AT-machnikowski.net, richardcochran-AT-gmail.com, milena.olech-AT-intel.com, willemdebruijn.kernel-AT-gmail.com, andrew-AT-lunn.ch, vadim.fedorenko-AT-linux.dev, horms-AT-kernel.org
Archive-link:  Article

This patchset adds support to the PTP HW timestamping emulation in the
netdevsim. It uses existing binding between netdevsim and ptp_mock
driver to generate transmit and receive timestamps.

It also adds the selftest to verify the hw timestamping functionality
running over netdevsim.

v2:
- Added selftest/net/ptp.sh
- Modified ptp_mock to use spin_lock_bh
- Populate ethtool defaults using ethtool_op_get_ts_info

v3:
- Fixed shellcheck issues in the selftest/net/ptp.sh
- Added selftest/net/ptp.sh to the selftest/net/Makefile
- Modified ptp_mock to use spin_lock_irqsave

v4:
- Check if Rx timestamps are enabled before generating a timestamp
- Replace bash selftest script with a python one
- Optimized Tx timestamp generation

Maciek Machnikowski (3):
  ptp_mock: Expose ptp_clock_info to external drivers
  netdevsim: Implement basic ptp support
  selftests:net: Implement ptp4l sync test using netdevsim

 drivers/net/netdevsim/ethtool.c      |  11 ++
 drivers/net/netdevsim/netdev.c       |  91 ++++++++++++
 drivers/net/netdevsim/netdevsim.h    |   1 +
 drivers/ptp/ptp_mock.c               |  26 ++--
 include/linux/ptp_mock.h             |   5 +
 tools/testing/selftests/net/Makefile |   1 +
 tools/testing/selftests/net/ptp.py   | 184 +++++++++++++++++++++++++++
 7 files changed, 311 insertions(+), 8 deletions(-)
 create mode 100755 tools/testing/selftests/net/ptp.py

-- 
2.53.0




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds