Skip to content

Commit 5fd8220

Browse files
laurent5791davem330
authored andcommitted
net: mscc: ocelot: fix hardware timestamp dequeue logic
The next hw timestamp should be snapshoot to the read registers only once the current timestamp has been read. If none of the pending skbs matches the current HW timestamp just gracefully flush the available timestamp by reading it. Signed-off-by: laurent brando <[email protected]> Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Yangbo Lu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 367fe04 commit 5fd8220

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -748,21 +748,21 @@ void ocelot_get_txtstamp(struct ocelot *ocelot)
748748

749749
spin_unlock_irqrestore(&port->tx_skbs.lock, flags);
750750

751-
/* Next ts */
752-
ocelot_write(ocelot, SYS_PTP_NXT_PTP_NXT, SYS_PTP_NXT);
751+
/* Get the h/w timestamp */
752+
ocelot_get_hwtimestamp(ocelot, &ts);
753753

754754
if (unlikely(!skb_match))
755755
continue;
756756

757-
/* Get the h/w timestamp */
758-
ocelot_get_hwtimestamp(ocelot, &ts);
759-
760757
/* Set the timestamp into the skb */
761758
memset(&shhwtstamps, 0, sizeof(shhwtstamps));
762759
shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec);
763760
skb_tstamp_tx(skb_match, &shhwtstamps);
764761

765762
dev_kfree_skb_any(skb_match);
763+
764+
/* Next ts */
765+
ocelot_write(ocelot, SYS_PTP_NXT_PTP_NXT, SYS_PTP_NXT);
766766
}
767767
}
768768
EXPORT_SYMBOL(ocelot_get_txtstamp);

0 commit comments

Comments
 (0)