diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2021-08-10 16:13:54 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-08-11 14:44:58 +0100 |
commit | 6bef794da6d3bd347c18e93ad33483bd8903d9fd (patch) | |
tree | 1ce71a803cc78ef91d743a51ced9be8606b429aa /net/dsa/tag_dsa.c | |
parent | f1dacd7aea34333620bd5177a8808a3296a63184 (diff) |
net: dsa: create a helper which allocates space for EtherType DSA headers
Hide away the memmove used by DSA EtherType header taggers to shift the
MAC SA and DA to the left to make room for the header, after they've
called skb_push(). The call to skb_push() is still left explicit in
drivers, to be symmetric with dsa_strip_etype_header, and because not
all callers can be refactored to do it (for example, brcm_tag_xmit_ll
has common code for a pre-Ethernet DSA tag and an EtherType DSA 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.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index ad9c841c998f..ab2c63859d12 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c @@ -166,7 +166,7 @@ static struct sk_buff *dsa_xmit_ll(struct sk_buff *skb, struct net_device *dev, if (skb->protocol == htons(ETH_P_8021Q)) { if (extra) { skb_push(skb, extra); - memmove(skb->data, skb->data + extra, 2 * ETH_ALEN); + dsa_alloc_etype_header(skb, extra); } /* Construct tagged DSA tag from 802.1Q tag. */ @@ -181,7 +181,7 @@ static struct sk_buff *dsa_xmit_ll(struct sk_buff *skb, struct net_device *dev, } } else { skb_push(skb, DSA_HLEN + extra); - memmove(skb->data, skb->data + DSA_HLEN + extra, 2 * ETH_ALEN); + dsa_alloc_etype_header(skb, DSA_HLEN + extra); /* Construct untagged DSA tag. */ dsa_header = skb->data + 2 * ETH_ALEN + extra; |