mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
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>
This commit is contained in:
committed by
David S. Miller
parent
90188fff65
commit
ab32f56a41
@@ -23,11 +23,19 @@ static inline ktime_t ksz_decode_tstamp(u32 tstamp)
|
||||
return ns_to_ktime(ns);
|
||||
}
|
||||
|
||||
struct ksz_deferred_xmit_work {
|
||||
struct dsa_port *dp;
|
||||
struct sk_buff *skb;
|
||||
struct kthread_work work;
|
||||
};
|
||||
|
||||
struct ksz_tagger_data {
|
||||
void (*xmit_work_fn)(struct kthread_work *work);
|
||||
void (*hwtstamp_set_state)(struct dsa_switch *ds, bool on);
|
||||
};
|
||||
|
||||
struct ksz_skb_cb {
|
||||
struct sk_buff *clone;
|
||||
u32 tstamp;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user