Skip to content

PTP support for the SJA1105 DSA driver

Vladimir Oltean lkml netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest17 patches 1 replyIn review
  2. v317 patches 22 repliesSuperseded
  3. v210 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v15 patches37 repliesSuperseded

Changes in v4 from the cover letter

- Made it compile with the SJA1105 DSA driver and PTP driver as modules.

- Reworked/simplified/fixed some issues in 03/17 (dsa_8021q_remove_header) and added an ASCII image that illustrates the transformation that is taking place.

- Removed a useless check for sja1105_is_link_local from 16/17 (RX timestamping) which also made previous 08/17 patch ("Move sja1105_is_link_local to include/linux") useless and therefore dropped.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/17net: dsa: Keep a pointer to the skb clone for TX timestampingnet/dsa/slave.c+3 -00 replies
2/17net: dsa: Add teardown callback for driversinclude/net/dsa.h net/dsa/dsa2.c+4 -00 replies
3/17net: dsa: tag_8021q: Create helper function for removing VLAN headerinclude/linux/dsa/8021q.h net/dsa/tag_8021q.c net/dsa/tag_sja1105.c+53 -390 replies
4/17net: dsa: sja1105: Move sja1105_change_tpid into sja1105_vlan_filteringdrivers/net/dsa/sja1105/sja1105_main.c+21 -210 replies
5/17net: dsa: sja1105: Reverse TPID and TPID2drivers/net/dsa/sja1105/sja1105_main.c+4 -20 replies
6/17net: dsa: sja1105: Limit use of incl_srcpt to bridge+vlan modedrivers/net/dsa/sja1105/sja1105_main.c net/dsa/tag_sja1105.c+18 -90 replies
7/17net: dsa: sja1105: Export symbols for upcoming PTP driverdrivers/net/dsa/sja1105/sja1105_spi.c drivers/net/dsa/sja1105/sja1105_static_config.c+5 -00 replies
8/17net: dsa: sja1105: Add support for the PTP clockdrivers/net/dsa/sja1105/Kconfig drivers/net/dsa/sja1105/Makefile drivers/net/dsa/sja1105/sja1105.h +4 more+395 -00 replies
9/17net: dsa: sja1105: Add logic for TX timestampingdrivers/net/dsa/sja1105/sja1105.h drivers/net/dsa/sja1105/sja1105_main.c drivers/net/dsa/sja1105/sja1105_ptp.c +3 more+201 -20 replies
10/17net: dsa: sja1105: Build a minimal understanding of meta framesinclude/linux/dsa/sja1105.h net/dsa/tag_sja1105.c+26 -00 replies
11/17net: dsa: sja1105: Add support for the AVB Parameters Tabledrivers/net/dsa/sja1105/sja1105_dynamic_config.c drivers/net/dsa/sja1105/sja1105_main.c drivers/net/dsa/sja1105/sja1105_static_config.c +1 more+107 -00 replies
12/17net: dsa: sja1105: Make sja1105_is_link_local not match meta framesnet/dsa/tag_sja1105.c+2 -00 replies
13/17net: dsa: sja1105: Receive and decode meta framesnet/dsa/tag_sja1105.c+41 -30 replies
14/17net: dsa: sja1105: Add a global sja1105_tagger_data structuredrivers/net/dsa/sja1105/sja1105.h drivers/net/dsa/sja1105/sja1105_main.c include/linux/dsa/sja1105.h+21 -00 replies
15/17net: dsa: sja1105: Increase priority of CPU-trapped framesdrivers/net/dsa/sja1105/sja1105_main.c+1 -10 replies
16/17net: dsa: sja1105: Add a state machine for RX timestampingdrivers/net/dsa/sja1105/sja1105_main.c include/linux/dsa/sja1105.h net/dsa/tag_sja1105.c+189 -10 replies
17/17net: dsa: sja1105: Expose PTP timestamping ioctls to userspacedrivers/net/dsa/sja1105/sja1105_main.c drivers/net/dsa/sja1105/sja1105_ptp.c+100 -20 replies

Reviews trailers per patch

6 of 17 patches have a Reviewed-by or Acked-by.

PatchFlorian FainelliAndrew Lunn
1/17R-b
2/17R-b R-b
3/17
4/17R-b
5/17R-b
6/17R-b
7/17
8/17
9/17
10/17R-b
11/17
12/17
13/17
14/17
15/17
16/17
17/17

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

Read the v4 thread

Cover letter [PATCH v4 net-next 00/17] PTP support for the SJA1105 DSA driver

This patchset adds the following:

- A timecounter/cyclecounter based PHC for the free-running timestamping clock of this switch.

- A state machine implemented in the DSA tagger for SJA1105, which keeps track of metadata follow-up Ethernet frames (the switch's way of transmitting RX timestamps).

Clock manipulations on the actual hardware PTP clock will have to be implemented anyway, for the TTEthernet block and the time-based ingress policer.

v3 patchset can be found at:
https://lkml.org/lkml/2019/6/4/954

Changes from v3:

- Made it compile with the SJA1105 DSA driver and PTP driver as modules.

- Reworked/simplified/fixed some issues in 03/17 (dsa_8021q_remove_header) and added an ASCII image that illustrates the transformation that is taking place.

- Removed a useless check for sja1105_is_link_local from 16/17 (RX timestamping) which also made previous 08/17 patch ("Move sja1105_is_link_local to include/linux") useless and therefore dropped.

v2 patchset can be found at:
https://lkml.org/lkml/2019/6/2/146

Changes from v2:

- Broke previous 09/10 patch (timestamping) into multiple smaller patches.

- Every patch in the series compiles.

v1 patchset can be found at:
https://lkml.org/lkml/2019/5/28/1093

Changes from v1:

- Removed the addition of the DSA .can_timestamp callback.

- Waiting for meta frames is done completely inside the tagger, and all frames emitted on RX are already partially timestamped.

- Added a global data structure for the tagger common to all ports.

- Made PTP work with ports in standalone mode, by limiting use of the DMAC-mangling "incl_srcpt" mode only when ports are bridged, aka when the DSA master is already promiscuous and can receive anything. Also changed meta frames to be sent at the 01-80-C2-00-00-0E DMAC.

- Made some progress w.r.t. observed negative path delay. Apparently it only appears when the delay mechanism is the delay request-response (end-to-end) one. If peer delay is used (-P), the path delay is positive and appears reasonable for an 1000Base-T link (485 ns in steady state).

SJA1105 as PTP slave (OC) with E2E path delay:

ptp4l[55.600]: master offset          8 s2 freq  +83677 path delay     -2390
ptp4l[56.600]: master offset         17 s2 freq  +83688 path delay     -2391
ptp4l[57.601]: master offset          6 s2 freq  +83682 path delay     -2391
ptp4l[58.601]: master offset         -1 s2 freq  +83677 path delay     -2391

SJA1105 as PTP slave (OC) with P2P path delay:

ptp4l[48.343]: master offset          5 s2 freq  +83715 path delay       484
ptp4l[48.468]: master offset         -3 s2 freq  +83705 path delay       485
ptp4l[48.593]: master offset          0 s2 freq  +83708 path delay       485
ptp4l[48.718]: master offset          1 s2 freq  +83710 path delay       485
ptp4l[48.844]: master offset          1 s2 freq  +83710 path delay       485
ptp4l[48.969]: master offset         -5 s2 freq  +83702 path delay       485
ptp4l[49.094]: master offset          3 s2 freq  +83712 path delay       485
ptp4l[49.219]: master offset          4 s2 freq  +83714 path delay       485
ptp4l[49.344]: master offset         -5 s2 freq  +83702 path delay       485
ptp4l[49.469]: master offset          3 s2 freq  +83713 path delay       487

Vladimir Oltean (17):
net: dsa: Keep a pointer to the skb clone for TX timestamping
net: dsa: Add teardown callback for drivers
net: dsa: tag_8021q: Create helper function for removing VLAN header
net: dsa: sja1105: Move sja1105_change_tpid into

    sja1105_vlan_filtering

net: dsa: sja1105: Reverse TPID and TPID2
net: dsa: sja1105: Limit use of incl_srcpt to bridge+vlan mode
net: dsa: sja1105: Export symbols for upcoming PTP driver
net: dsa: sja1105: Add support for the PTP clock
net: dsa: sja1105: Add logic for TX timestamping
net: dsa: sja1105: Build a minimal understanding of meta frames
net: dsa: sja1105: Add support for the AVB Parameters Table
net: dsa: sja1105: Make sja1105_is_link_local not match meta frames
net: dsa: sja1105: Receive and decode meta frames
net: dsa: sja1105: Add a global sja1105_tagger_data structure
net: dsa: sja1105: Increase priority of CPU-trapped frames
net: dsa: sja1105: Add a state machine for RX timestamping
net: dsa: sja1105: Expose PTP timestamping ioctls to userspace

 drivers/net/dsa/sja1105/Kconfig               |   7 +
 drivers/net/dsa/sja1105/Makefile              |   1 +
 drivers/net/dsa/sja1105/sja1105.h             |  29 ++
 .../net/dsa/sja1105/sja1105_dynamic_config.c  |   2 +
 drivers/net/dsa/sja1105/sja1105_main.c        | 316 ++++++++++++--
 drivers/net/dsa/sja1105/sja1105_ptp.c         | 404 ++++++++++++++++++
 drivers/net/dsa/sja1105/sja1105_ptp.h         |  64 +++
 drivers/net/dsa/sja1105/sja1105_spi.c         |  35 ++
 .../net/dsa/sja1105/sja1105_static_config.c   |  62 +++
 .../net/dsa/sja1105/sja1105_static_config.h   |  10 +
 include/linux/dsa/8021q.h                     |  16 +-
 include/linux/dsa/sja1105.h                   |  34 ++
 include/net/dsa.h                             |   1 +
 net/dsa/dsa2.c                                |   3 +
 net/dsa/slave.c                               |   3 +
 net/dsa/tag_8021q.c                           |  57 ++-
 net/dsa/tag_sja1105.c                         | 213 ++++++++-
 17 files changed, 1184 insertions(+), 73 deletions(-)
 create mode 100644 drivers/net/dsa/sja1105/sja1105_ptp.c
 create mode 100644 drivers/net/dsa/sja1105/sja1105_ptp.h
Signature · 1 line
2.17.1