nxp-archive / openil

OpenIL is an open source project based on Buildroot and designed for embedded industrial solution.
Other
136 stars 55 forks source link

how to get hardware timestamp when cpu get the packet? #110

Open HAIYAA opened 2 years ago

HAIYAA commented 2 years ago

hello, i have one LS1021A switch, i've used qci command to get the interested packet from cpu, but i also want to get the hardware timestamps of arrived time from these packets, i noticed that linux kernel can get hardware timestamp through set SOL_TIMESTAMPING from socket and i can code it with gcc, but i only find python2 in the openil of LS1021A, is there any other methods can help me to get the hardware timestamp of packets?

vladimiroltean commented 2 years ago

sja1105 can only retrieve hardware timestamps for packets which match one of two link-local MAC DA filters, which are currently hardcoded in the driver to 01-80-c2-xx-xx-xx and 01-1b-19-xx-xx-xx. Furthermore, DSA restricts hardware timestamping to only PTP packets. And even furthermore, DSA restricts hardware timestamps from being taken on the DSA master (gianfar eth2) if PTP is available on the switch ports.

HAIYAA commented 2 years ago

sja1105 can only retrieve hardware timestamps for packets which match one of two link-local MAC DA filters, which are currently hardcoded in the driver to 01-80-c2-xx-xx-xx and 01-1b-19-xx-xx-xx. Furthermore, DSA restricts hardware timestamping to only PTP packets. And even furthermore, DSA restricts hardware timestamps from being taken on the DSA master (gianfar eth2) if PTP is available on the switch ports.

Thank you very much for your answer, it helped me a lot~