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>
This commit is contained in:

committed by
David S. Miller

parent
47ed985e97
commit
d3f9b90bf1
@@ -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.
|
||||
|
Reference in New Issue
Block a user