OSDN Git Service

net: dsa: microchip: ptp: add packet reception timestamping
authorChristian Eggers <ceggers@arri.de>
Tue, 10 Jan 2023 08:49:24 +0000 (14:19 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Jan 2023 08:40:41 +0000 (08:40 +0000)
commit90188fff655d8efad79acdf60c3012ffcbbef716
treeba4f788ba0e8de376ca8f9614880c9db4b161435
parent2955762b372b791a8f4cd862cf0b5fef9c456449
net: dsa: microchip: ptp: add packet reception timestamping

Rx Timestamping is done through 4 additional bytes in tail tag.
Whenever the ptp packet is received, the 4 byte hardware time stamped
value is added before 1 byte tail tag. Also, bit 7 in tail tag indicates
it as PTP frame. This 4 byte value is extracted from the tail tag and
reconstructed to absolute time and assigned to skb hwtstamp.
If the packet received in PDelay_Resp, then partial ingress timestamp
is subtracted from the correction field. Since user space tools expects
to be done in hardware.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Co-developed-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/microchip/ksz_ptp.c
drivers/net/dsa/microchip/ksz_ptp.h
include/linux/dsa/ksz_common.h
net/dsa/tag_ksz.c