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