Implement PTP support in netdevsim
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v12 Latest3 patches 7 repliesIn review
- v113 patches 5 repliesSuperseded
- v103 patches 6 repliesSuperseded
Earlier versions · 9
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v9 | 3 patches | 0 replies | Superseded | |
| v8 | 3 patches | 2 replies | Superseded | |
| v7 | 3 patches | 3 replies | Superseded | |
| v6 | 3 patches | 4 replies | Superseded | |
| v5 | 3 patches | 12 replies | Superseded | |
| v4 | 3 patches | 1 reply | Superseded | |
| v3 | 3 patches | 10 replies | Superseded | |
| v2 | 3 patches | 3 replies | Superseded | |
| v1 | 2 patches | 5 replies | Superseded |
Changes in v12 from the cover letter
- Unclone the skb before writing hwtstamp to not corrupt the TX errqueue clone
- Clear the TX hwtstamp when peer RX timestamping is off
- Set SKBTX_IN_PROGRESS before skb_tx_timestamp() to avoid SW+HW duplicates
- Use skb_unclone() instead of skb_unclone_full()
- Return -EOPNOTSUPP from nsim_get_ts_config() when there is no PHC
- Use isolated ptp4l UDS paths in the selftest
- Explicitly kill the remote ptp4l leader in the selftest
- Tolerate the deferred pkill finding no ptp4l process in the selftest
Patches in v12 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | ptp_mock: Expose ptp_clock_info to external driversdrivers/ include/ | +25 | 0 replies | |
| 2/3 | netdevsim: Implement basic ptp supportdrivers/ drivers/ drivers/ | +140 | 4 replies | |
| 3/3 | selftests: drivers/net: Implement ptp4l sync test using netdevsimtools/ tools/ tools/ | +114 | 3 replies |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Vadim Fedorenko | Mina Almasry | Hangbin Liu |
|---|---|---|---|
| 1/3 | R-b | R-b | |
| 2/3 | R-b | R-b | |
| 3/3 | R-b | R-b | T-b R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v12 net-next 0/3] Implement PTP support in netdevsim
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.
v12:
- Unclone the skb before writing hwtstamp to not corrupt the TX errqueue clone
- Clear the TX hwtstamp when peer RX timestamping is off
- Set SKBTX_IN_PROGRESS before skb_tx_timestamp() to avoid SW+HW duplicates
- Use skb_unclone() instead of skb_unclone_full()
- Return -EOPNOTSUPP from nsim_get_ts_config() when there is no PHC
- Use isolated ptp4l UDS paths in the selftest
- Explicitly kill the remote ptp4l leader in the selftest
- Tolerate the deferred pkill finding no ptp4l process in the selftest
v11:
- Avoid aliasing the RX hwtstamp write with AF_XDP completion metadata (skb_shared_info's hwtstamps/xsk_meta union) by orphaning the skb first, addressing the Critical finding from Simon Horman's review.
- Only unshare the skb when an RX timestamp is written into it
- Reject non-zero hwtstamp flags and accept the PTP V2 L2 RX filters
- Use READ_ONCE() in ndo_hwtstamp_get and stop overwriting the whole config struct
- Skip the selftest if either the local or the remote device lacks hardware timestamping support
- Forward declare struct ptp_clock_info in ptp_mock.h
- Fix the ptp_mock commit message wording
v10:
- Drop the local_irq_save()/local_irq_restore() around the PHC reads.
v9:
- Unshare the skb instead of copying it
- Move the PTP timestamping off the xmit fast path
- Sample the TX and RX PHCs with IRQs disabled to keep the reads adjacent
- Validate the hwtstamp config before touching device state
- Report a -1 PHC index from ethtool for ports without a PHC (VFs)
- Clamp the ptp4l poll timeout in the selftest to a non-negative value
v8:
- Fix the lockless tstamp_config access in netdevsim with READ_ONCE()/WRITE_ONCE()
- Clarify the TX/RX timestamp handling in netdevsim comments
v7:
- Moved the test script to tools/testing/selftest/drivers/net
- Optimized implementation to avoid potential edge cases reported
v6:
- Enable PTP Mock in the tools/testing/selftests/net/config
v5:
- Rebase
v4:
- Check if Rx timestamps are enabled before generating a timestamp
- Replace bash selftest script with a python one
- Optimized Tx timestamp generation
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_bh
v2:
- Added selftest/net/ptp.sh
- Modified ptp_mock to use spin_lock_bh
- Populate ethtool defaults using ethtool_op_get_ts_info
Maciek Machnikowski (3):
ptp_mock: Expose ptp_clock_info to external drivers
netdevsim: Implement basic ptp support
selftests: drivers/net: Implement ptp4l sync test using netdevsim
drivers/net/netdevsim/ethtool.c | 15 +++ drivers/net/netdevsim/netdev.c | 124 +++++++++++++++++++ drivers/net/netdevsim/netdevsim.h | 1 + drivers/ptp/ptp_mock.c | 26 ++-- include/linux/ptp_mock.h | 7 ++ tools/testing/selftests/drivers/net/Makefile | 1 + tools/testing/selftests/drivers/net/config | 1 + tools/testing/selftests/drivers/net/ptp.py | 112 +++++++++++++++++ 8 files changed, 279 insertions(+), 8 deletions(-) create mode 100755 tools/testing/selftests/drivers/net/ptp.py
Signature · 1 line
2.56.0