summaryrefslogtreecommitdiff
path: root/net/dsa/tag_dsa.c
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2021-08-10 16:13:53 +0300
committerDavid S. Miller <davem@davemloft.net>2021-08-11 16:44:58 +0300
commitf1dacd7aea34333620bd5177a8808a3296a63184 (patch)
tree273cc438c8f33fc92fc42757b8b10eff1c82bd74 /net/dsa/tag_dsa.c
parent1a8e628c8a3e38af1392197adf086de7ce51d24f (diff)
downloadlinux-f1dacd7aea34333620bd5177a8808a3296a63184.tar.xz
net: dsa: create a helper that strips EtherType DSA headers on RX
All header taggers open-code a memmove that is fairly not all that obvious, and we can hide the details behind a helper function, since the only thing specific to the driver is the length of the header tag. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/tag_dsa.c')
-rw-r--r--net/dsa/tag_dsa.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index e32f8160e895..ad9c841c998f 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -312,14 +312,10 @@ static struct sk_buff *dsa_rcv_ll(struct sk_buff *skb, struct net_device *dev,
memcpy(dsa_header, new_header, DSA_HLEN);
if (extra)
- memmove(skb->data - ETH_HLEN,
- skb->data - ETH_HLEN - extra,
- 2 * ETH_ALEN);
+ dsa_strip_etype_header(skb, extra);
} else {
skb_pull_rcsum(skb, DSA_HLEN);
- memmove(skb->data - ETH_HLEN,
- skb->data - ETH_HLEN - DSA_HLEN - extra,
- 2 * ETH_ALEN);
+ dsa_strip_etype_header(skb, DSA_HLEN + extra);
}
return skb;