Hi, NXP team. When using a SoC (imx8mp-evk) + Switch (SJA1105) architecture, setting the network bridge mode causes PTP L2 layer data to lose timestamps.
This is our architecture:
┌──────────────────────────────┐
│ │
│ │
│ │
│ │
│ │
│ ┌───────────┴───────────────┐
│ │ SPI │
┌─────▼─────────┐ │ │
│ SPI │ │ │
│ port0 │ │M │
│ port1 port2◄────────┤A │
│ SJA1105 │ │C │
│ │ │1 CPU │
│ port3 │ │ MIMX8ML8DVNLZAB │
│ port4 │ │ │
│ │ │ │
└─────── ───────┘ │ │
│ MAC2 │
└──────────┬────────────────┘
│
│
│
┌───────── ────────┐ │
│ RGMII │ │
│ │ │
│ PHY │ │
│ 88E1512 M│ │
│ D◄──────────────────┘
│ I│
│ O│
│ │
└───────┬──────────┘
│
│
│
│
│
│
│
│
│
└► OUT
Ports 1 through 4 are each connected to a SoC device.
Linux system configuration
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.16.2.100 netmask 255.255.255.0 broadcast 172.16.2.255
inet6 fe80::d053:57ff:feb1:df50 prefixlen 64 scopeid 0x20<link>
ether d2:53:57:b1:df:50 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12 bytes 984 (984.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
end0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.100 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::3065:76ff:feed:96cb prefixlen 64 scopeid 0x20<link>
ether 32:65:76:ed:96:cb txqueuelen 1000 (Ethernet)
RX packets 2 bytes 132 (132.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 49 bytes 2434 (2.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
end1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1504
inet6 fe80::7c32:f0ff:fefb:c940 prefixlen 64 scopeid 0x20<link>
ether 7e:32:f0:fb:c9:40 txqueuelen 1000 (Ethernet)
RX packets 58 bytes 7130 (7.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 22 bytes 1828 (1.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 210
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 130 bytes 9914 (9.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 130 bytes 9914 (9.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
swp1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 7e:32:f0:fb:c9:40 txqueuelen 1000 (Ethernet)
RX packets 58 bytes 6898 (6.8 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
swp2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 7e:32:f0:fb:c9:40 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
swp3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 7e:32:f0:fb:c9:40 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
swp4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 7e:32:f0:fb:c9:40 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12 bytes 984 (984.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root@hawaii-gen2:~# ptp4l -f linux_ptp_bc.conf -m && phc2sys -a -r -m
ptp4l[149.643]: selected /dev/ptp0 as PTP clock
ptp4l[149.645]: port 2 (swp1): just a bunch of devices
ptp4l[149.645]: port 3 (swp2): just a bunch of devices
ptp4l[149.645]: port 4 (swp3): just a bunch of devices
ptp4l[149.645]: port 5 (swp4): just a bunch of devices
ptp4l[149.680]: port 1 (end0): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[149.717]: port 2 (swp1): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[149.753]: port 3 (swp2): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[149.785]: port 4 (swp3): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[149.817]: port 5 (swp4): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[149.817]: port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[149.817]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[150.545]: port 1 (end0): new foreign master 0080ee.fffe.60f9b8-1
ptp4l[154.561]: selected best master clock 0080ee.fffe.60f9b8
ptp4l[154.561]: port 1 (end0): LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[154.561]: Switched to /dev/ptp0 as PTP clock
ptp4l[155.360]: port 1 (end0): minimum delay request interval 2^-3
ptp4l[156.258]: port 3 (swp2): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[156.292]: port 4 (swp3): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[156.452]: port 5 (swp4): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[156.569]: master offset -1766736492136248875 s0 freq -0 path delay 1150
ptp4l[156.612]: port 2 (swp1): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[157.261]: port 2 (swp1): received DELAY_REQ without timestamp
ptp4l[157.262]: port 4 (swp3): received DELAY_REQ without timestamp
ptp4l[157.262]: port 5 (swp4): received DELAY_REQ without timestamp
ptp4l[157.295]: port 2 (swp1): received DELAY_REQ without timestamp
ptp4l[157.295]: port 3 (swp2): received DELAY_REQ without timestamp
ptp4l[157.295]: port 5 (swp4): received DELAY_REQ without timestamp
ptp4l[157.455]: port 2 (swp1): received DELAY_REQ without timestamp
ptp4l[157.455]: port 3 (swp2): received DELAY_REQ without timestamp
ptp4l[157.455]: port 4 (swp3): received DELAY_REQ without timestamp
ptp4l[157.573]: master offset -1766736492136230812 s1 freq +17991 path delay -718
ptp4l[157.614]: port 3 (swp2): received DELAY_REQ without timestamp
ptp4l[157.615]: port 4 (swp3): received DELAY_REQ without timestamp
ptp4l[157.615]: port 5 (swp4): received DELAY_REQ without timestamp
ptp4l[158.262]: port 2 (swp1): received DELAY_REQ without timestamp
ptp4l[158.262]: port 4 (swp3): received DELAY_REQ without timestamp
ptp4l[158.262]: port 5 (swp4): received DELAY_REQ without timestamp
ptp4l[158.295]: port 2 (swp1): received DELAY_REQ without timestamp
ptp4l[158.296]: port 3 (swp2): received DELAY_REQ without timestamp
ptp4l[158.296]: port 5 (swp4): received DELAY_REQ without timestamp
ptp4l[158.455]: port 2 (swp1): received DELAY_REQ without timestamp
ptp4l[158.455]: port 3 (swp2): received DELAY_REQ without timestamp
ptp4l[158.455]: port 4 (swp3): received DELAY_REQ without timestamp
ptp4l[158.577]: master offset -1848 s2 freq +16143 path delay -718
ptp4l[158.577]: port 1 (end0): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED