Merge tag 'net-next-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev...
[linux-2.6-microblaze.git] / net / dsa / tag_rtl4_a.c
index 57c46b4..40811ba 100644 (file)
@@ -47,8 +47,8 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb,
                   dp->index);
        skb_push(skb, RTL4_A_HDR_LEN);
 
-       memmove(skb->data, skb->data + RTL4_A_HDR_LEN, 2 * ETH_ALEN);
-       tag = skb->data + 2 * ETH_ALEN;
+       dsa_alloc_etype_header(skb, RTL4_A_HDR_LEN);
+       tag = dsa_etype_header_pos_tx(skb);
 
        /* Set Ethertype */
        p = (__be16 *)tag;
@@ -64,8 +64,7 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb,
 }
 
 static struct sk_buff *rtl4a_tag_rcv(struct sk_buff *skb,
-                                    struct net_device *dev,
-                                    struct packet_type *pt)
+                                    struct net_device *dev)
 {
        u16 protport;
        __be16 *p;
@@ -77,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) {
@@ -109,12 +103,9 @@ static struct sk_buff *rtl4a_tag_rcv(struct sk_buff *skb,
        /* Remove RTL4 tag and recalculate checksum */
        skb_pull_rcsum(skb, RTL4_A_HDR_LEN);
 
-       /* Move ethernet DA and SA in front of the data */
-       memmove(skb->data - ETH_HLEN,
-               skb->data - ETH_HLEN - RTL4_A_HDR_LEN,
-               2 * ETH_ALEN);
+       dsa_strip_etype_header(skb, RTL4_A_HDR_LEN);
 
-       skb->offload_fwd_mark = 1;
+       dsa_default_offload_fwd_mark(skb);
 
        return skb;
 }