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