Microchip-Ethernet / EVB-KSZ9477

Repository for using Microchip EVB-KSZ9477 board. Product Supported: KSZ9477, KSZ9567, KSZ9897, KSZ9896, KSZ8567, KSZ8565, KSZ9893, KSZ9563, KSZ8563, LAN9646, Phys(KSZ9031/9131, LAN8770
76 stars 78 forks source link

KSZ9477 Disable PTP Message Forwarding #51

Open miazan opened 3 years ago

miazan commented 3 years ago

Hi,

I want to use the KSZ9477 board as a PTP boundary clock, but I am trying to figure out how to stop KSZ9477 board from automatically forwarding PTP Sync and Announce messages it receives.

Specifying specific ports (i.e. eth0.101) using the '-i' option for ptp4l only limits the ports on which the KSZ9477 sends its own PTP messages; Sync and Announce messages received from other devices are still forwarded on every port on the board. I have also tried setting the 'transparent' option in the ptp4l configuration file to 0, but foreign messages are still forwarded on every port. I've also tried setting 'multi_dev=1' in the U-Boot and assigned a limited number of ports to eth0, but even then, Sync and Announce messages get forwarded on every port regardless of whether the ports in question were grouped into the same network device or not.

I will also note that I did not see this kind of forwarding behavior when I was working off of the firmware that was preloaded on the board.

I know this mostly likely comes from a configuration error, but I'm not sure where else I should begin looking.

triha2work commented 3 years ago

The register 0x514 controls how PTP messages are handled in the hardware. Bit 6 enables PTP message processing. If turned off they are treated as regular multicast frames. Bits 5, 4, and 3 enable L2, UDPv4, and UDPv6 PTP message detection. They are typically turned on. Bit 0 enables 1-step clock operation by default, which forwards all PTP messages. Disabling it enables the 2-step clock operation, which does not forward PTP timing messages in addition to other operation. This is the mode that is typically used for 2-step operation. However, other PTP messages like Announce, Management, and Signaling are still forwarded, which may not be wanted. Bit 7 does not forward anything and everything goes to the host port. Software needs to do the forwarding. This is the mode used for 802.1AS, and so the bit is named. Bit 2 enables the P2P mode. Implementing Boundary Clock requires enabling bits 7 and 2 to run in P2P mode, but E2E mode can still be supported. However, there are hardware bugs when 2-step clock mode is used, so it is no longer recommended to use the chip to run AVB application. There is workaround of using 1-step clock mode to do 2-step operation, but if 2-step Pdelay_Resp is needed then it does not work. 2-step Pdelay_Resp is typically needed to calculate the peer ratio. Typical implementation of synchronizing the clock will result in that ratio of always being 1.0, so the actual ratio is only important at the very beginning, and when the clock frequency difference is too big. The ptp_cli utility can be used to configure the chip. The command to enable 802.1AS bit is "has 1."