Skip to content

net: dsa: netc: add PTP support for NETC switch

[email protected] imx linux-arm-kernel linuxppc-dev lkml netdev 8 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest9 patches 0 repliesNew
  2. v79 patches 5 repliesSuperseded
  3. v69 patches 2 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v59 patches3 repliesSuperseded
v48 patches6 repliesSuperseded
v38 patches10 repliesSuperseded
v27 patches4 repliesSuperseded
v17 patches5 repliesSuperseded

Changes in v8 from the cover letter

1. Rebase patch 4 due to the code base has been changed
2. Check the return value of pcie_flr() in netc_switch_pci_init()
3. Remove retry in netc_port_set_host_flood()
4. Add IPFT_FAF_L4_CODE mask to frm_attr_flags_mask
v7 link: https://lore.kernel.org/imx/[email protected]/
v6 link: https://lore.kernel.org/imx/[email protected]/
v5 link: https://lore.kernel.org/imx/[email protected]/
v4 link: https://lore.kernel.org/imx/[email protected]/
v3 link: https://lore.kernel.org/imx/[email protected]/
v2 link: https://lore.kernel.org/imx/[email protected]/
v1 link: https://lore.kernel.org/imx/[email protected]/
---

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register accessdrivers/ptp/ptp_netc.c+21 -510 replies
2/9ptp: netc: remove unnecessary pcie_flr() call in probedrivers/ptp/ptp_netc.c+0 -10 replies
3/9ptp: netc: export netc_timer_get_current_time() for cross-driver usedrivers/ptp/ptp_netc.c include/linux/fsl/netc_global.h+72 -10 replies
4/9net: dsa: netc: tie setup resources and reset to DSA setup/teardowndrivers/net/dsa/netc/netc_main.c drivers/net/dsa/netc/netc_switch.h+155 -320 replies
5/9net: dsa: netc: use entry ID instead of pointer to track host flood ruledrivers/net/dsa/netc/netc_main.c drivers/net/dsa/netc/netc_switch.h+24 -400 replies
6/9net: dsa: netc: check return value of ntmp_ipft_delete_entry()drivers/net/dsa/netc/netc_main.c+52 -310 replies
7/9net: dsa: netc: enable ingress port filtering lookup by defaultdrivers/net/dsa/netc/netc_main.c+6 -30 replies
8/9net: dsa: netc: add PTP two-step timestamping supportdrivers/net/dsa/netc/Kconfig drivers/net/dsa/netc/Makefile drivers/net/dsa/netc/netc_main.c +5 more+793 -230 replies
9/9net: dsa: netc: add PTP one-step timestamping supportdrivers/net/dsa/netc/Kconfig drivers/net/dsa/netc/netc_main.c drivers/net/dsa/netc/netc_ptp.c +4 more+507 -60 replies

Reviews trailers per patch

1 of 9 patches has a Reviewed-by or Acked-by.

PatchLinus Walleij
1/9R-b
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH v8 net-next 0/9] net: dsa: netc: add PTP support for NETC switch

From: Wei Fang <[email protected]>

This patch set adds PTP timestamping support to the NETC switch, so that the switch ports can be used for IEEE 1588 PTP synchronization.

The NETC switch has no time registers of its own and instead shares the PTP time of the NETC Timer, which is a separate PCIe function driven by its own driver. The first 3 patches prepare the Timer driver for this
role: tidy up its 64-bit register access, drop an ineffective reset, and export netc_timer_get_current_time() so the switch driver can read the current PTP time across the driver boundary in a race-free way.

The switch redirects PTP frames to the CPU through the ingress port filter table (IPFT). A few patches harden and simplify the existing IPFT and host flood handling first, then enable the ingress port filtering lookup by default so PTP filter rules take effect without extra software tracking.

On top of that groundwork, the switch driver gains RX timestamping and both flavours of TX timestamping. Timestamps are carried between the hardware and the driver through dedicated switch tags: the ingress and transmit timestamps ride in To_Host tags, and per-frame requests ride in To_Port tags. Two-step TX matches a queued skb clone against the timestamp response echoed back by the hardware. One-step TX defers the Sync frame to a per-port work, where the driver reads a fresh PTP time and writes it into the Sync frame's timestamp field, then programs the single-step register and transmits the frame so the hardware can add the residence time to the correction field on the wire.

Together these changes let standard user-space PTP stacks drive hardware timestamping on the NETC switch ports.

---
v8 changes:
1. Rebase patch 4 due to the code base has been changed
2. Check the return value of pcie_flr() in netc_switch_pci_init()
3. Remove retry in netc_port_set_host_flood()
4. Add IPFT_FAF_L4_CODE mask to frm_attr_flags_mask
v7 link: https://lore.kernel.org/imx/[email protected]/
v6 link: https://lore.kernel.org/imx/[email protected]/
v5 link: https://lore.kernel.org/imx/[email protected]/
v4 link: https://lore.kernel.org/imx/[email protected]/
v3 link: https://lore.kernel.org/imx/[email protected]/
v2 link: https://lore.kernel.org/imx/[email protected]/
v1 link: https://lore.kernel.org/imx/[email protected]/
---

Wei Fang (9):
ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register
access
ptp: netc: remove unnecessary pcie_flr() call in probe
ptp: netc: export netc_timer_get_current_time() for cross-driver use
net: dsa: netc: tie setup resources and reset to DSA setup/teardown
net: dsa: netc: use entry ID instead of pointer to track host flood
rule
net: dsa: netc: check return value of ntmp_ipft_delete_entry()
net: dsa: netc: enable ingress port filtering lookup by default
net: dsa: netc: add PTP two-step timestamping support
net: dsa: netc: add PTP one-step timestamping support

 drivers/net/dsa/netc/Kconfig          |   2 +
 drivers/net/dsa/netc/Makefile         |   3 +-
 drivers/net/dsa/netc/netc_main.c      | 398 +++++++++---
 drivers/net/dsa/netc/netc_platform.c  |   1 +
 drivers/net/dsa/netc/netc_ptp.c       | 890 ++++++++++++++++++++++++++
 drivers/net/dsa/netc/netc_switch.h    |  67 +-
 drivers/net/dsa/netc/netc_switch_hw.h |   5 +
 drivers/ptp/ptp_netc.c                | 136 ++--
 include/linux/dsa/tag_netc.h          |  38 ++
 include/linux/fsl/netc_global.h       |  10 +
 net/dsa/tag_netc.c                    | 228 ++++++-
 11 files changed, 1610 insertions(+), 168 deletions(-)
 create mode 100644 drivers/net/dsa/netc/netc_ptp.c
Signature · 1 line
2.34.1