diff options
author | Vladimir Oltean <olteanv@gmail.com> | 2019-06-08 14:04:36 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-09 00:20:40 +0200 |
commit | d3f9b90bf19fad05889e4bead7dc1b336da56118 (patch) | |
tree | 9ad11a7f4750bda5a02b1332a825d07b716203cc /net/dsa | |
parent | net: dsa: sja1105: Add logic for TX timestamping (diff) | |
download | linux-d3f9b90bf19fad05889e4bead7dc1b336da56118.tar.xz linux-d3f9b90bf19fad05889e4bead7dc1b336da56118.zip |
net: dsa: sja1105: Build a minimal understanding of meta frames
Meta frames are sent on the CPU port by the switch if RX timestamping is
enabled. They contain a partial timestamp of the previous frame.
They are Ethernet frames with the Ethernet header constructed out of:
- SJA1105_META_DMAC
- SJA1105_META_SMAC
- ETH_P_SJA1105_META
The Ethernet payload will be decoded in a follow-up patch.
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/tag_sja1105.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c index cd8e0bfb5e75..0beb52518d56 100644 --- a/net/dsa/tag_sja1105.c +++ b/net/dsa/tag_sja1105.c @@ -22,6 +22,21 @@ static inline bool sja1105_is_link_local(const struct sk_buff *skb) return false; } +static inline bool sja1105_is_meta_frame(const struct sk_buff *skb) +{ + const struct ethhdr *hdr = eth_hdr(skb); + u64 smac = ether_addr_to_u64(hdr->h_source); + u64 dmac = ether_addr_to_u64(hdr->h_dest); + + if (smac != SJA1105_META_SMAC) + return false; + if (dmac != SJA1105_META_DMAC) + return false; + if (ntohs(hdr->h_proto) != ETH_P_SJA1105_META) + return false; + return true; +} + /* This is the first time the tagger sees the frame on RX. * Figure out if we can decode it, and if we can, annotate skb->cb with how we * plan to do that, so we don't need to check again in the rcv function. |