realtek: update the tree to the latest refactored version
[openwrt/staging/jow.git] / target / linux / realtek / patches-5.4 / 701-net-dsa-add-rtl838x-support-for-tag-trailer.patch
1 Index: linux-5.4.77/net/dsa/tag_trailer.c
2 ===================================================================
3 --- linux-5.4.77.orig/net/dsa/tag_trailer.c
4 +++ linux-5.4.77/net/dsa/tag_trailer.c
5 @@ -44,7 +44,12 @@ static struct sk_buff *trailer_xmit(stru
6
7 trailer = skb_put(nskb, 4);
8 trailer[0] = 0x80;
9 +
10 +#ifdef CONFIG_NET_DSA_RTL83XX
11 + trailer[1] = dp->index;
12 +#else
13 trailer[1] = 1 << dp->index;
14 +#endif /* CONFIG_NET_DSA_RTL83XX */
15 trailer[2] = 0x10;
16 trailer[3] = 0x00;
17
18 @@ -61,12 +66,20 @@ static struct sk_buff *trailer_rcv(struc
19 return NULL;
20
21 trailer = skb_tail_pointer(skb) - 4;
22 +
23 +#ifdef CONFIG_NET_DSA_RTL83XX
24 + if (trailer[0] != 0x80 || (trailer[1] & 0xe0) != 0x00 ||
25 + (trailer[2] & 0xef) != 0x00 || trailer[3] != 0x00)
26 + return NULL;
27 +
28 + source_port = trailer[1] & 0x1f;
29 +#else
30 if (trailer[0] != 0x80 || (trailer[1] & 0xf8) != 0x00 ||
31 (trailer[2] & 0xef) != 0x00 || trailer[3] != 0x00)
32 return NULL;
33
34 source_port = trailer[1] & 7;
35 -
36 +#endif
37 skb->dev = dsa_master_find_slave(dev, 0, source_port);
38 if (!skb->dev)
39 return NULL;