OSDN Git Service

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

This patch adds the routines for transmission of ptp packets. When the
ptp pdelay_req packet to be transmitted, it uses the deferred xmit
worker to schedule the packets.
During irq_setup, interrupt for Sync, Pdelay_req and Pdelay_rsp are
enabled. So interrupt is triggered for all three packets. But for
p2p1step, we require only time stamp of Pdelay_req packet. Hence to
avoid posting of the completion from ISR routine for Sync and
Pdelay_resp packets, ts_en flag is introduced. This controls which
packets need to processed for timestamp.
After the packet is transmitted, ISR is triggered. The time at which
packet transmitted is recorded to separate register.
This value is reconstructed to absolute time and posted to the user
application through socket error queue.

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_common.h
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