net: dsa: sja1105: Add a state machine for RX timestamping

Meta frame reception relies on the hardware keeping its promise that it
will send no other traffic towards the CPU port between a link-local
frame and a meta frame.  Otherwise there is no other way to associate
the meta frame with the link-local frame it's holding a timestamp of.
The receive function is made stateful, and buffers a timestampable frame
until its meta frame arrives, then merges the two, drops the meta and
releases the link-local frame up the stack.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vladimir Oltean
2019-06-08 15:04:42 +03:00
committed by David S. Miller
parent 08fde09a0d
commit f3097be21b
3 changed files with 189 additions and 1 deletions

View File

@@ -45,6 +45,13 @@ struct sja1105_tagger_data {
bool hwts_rx_en;
};
struct sja1105_skb_cb {
u32 meta_tstamp;
};
#define SJA1105_SKB_CB(skb) \
((struct sja1105_skb_cb *)DSA_SKB_CB_PRIV(skb))
struct sja1105_port {
struct sja1105_tagger_data *data;
struct dsa_port *dp;