summaryrefslogtreecommitdiffstats
path: root/net/dsa/tag_rtl4_a.c
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2021-08-10 16:13:55 +0300
committerDavid S. Miller <davem@davemloft.net>2021-08-11 14:44:58 +0100
commit5d928ff4865641309e39e9ec8eec1022f8a0c0ac (patch)
tree7d0e8c2a82f105cfb32f73f0167456abfe1ec443 /net/dsa/tag_rtl4_a.c
parent6bef794da6d3bd347c18e93ad33483bd8903d9fd (diff)
downloadlinux-5d928ff4865641309e39e9ec8eec1022f8a0c0ac.tar.gz
linux-5d928ff4865641309e39e9ec8eec1022f8a0c0ac.tar.bz2
linux-5d928ff4865641309e39e9ec8eec1022f8a0c0ac.zip
net: dsa: create a helper for locating EtherType DSA headers on RX
It seems that protocol tagging driver writers are always surprised about the formula they use to reach their EtherType header on RX, which becomes apparent from the fact that there are comments in multiple drivers that mention the same information. Create a helper that returns a void pointer to skb->data - 2, as well as centralize the explanation why that is the case. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/tag_rtl4_a.c')
-rw-r--r--net/dsa/tag_rtl4_a.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c
index 06e901eda298..947247d2124e 100644
--- a/net/dsa/tag_rtl4_a.c
+++ b/net/dsa/tag_rtl4_a.c
@@ -76,12 +76,7 @@ static struct sk_buff *rtl4a_tag_rcv(struct sk_buff *skb,
if (unlikely(!pskb_may_pull(skb, RTL4_A_HDR_LEN)))
return NULL;
- /* The RTL4 header has its own custom Ethertype 0x8899 and that
- * starts right at the beginning of the packet, after the src
- * ethernet addr. Apparently skb->data always points 2 bytes in,
- * behind the Ethertype.
- */
- tag = skb->data - 2;
+ tag = dsa_etype_header_pos_rx(skb);
p = (__be16 *)tag;
etype = ntohs(*p);
if (etype != RTL4_A_ETHERTYPE) {