blob: 6b105845986feddd3c494941232e468e4a8056f6 [file] [log] [blame]
developerfd40db22021-04-29 10:08:25 +08001--- linux-5.4.77.orig/net/dsa/tag_mtk.c
2+++ linux-5.4.77/net/dsa/tag_mtk.c
3@@ -73,22 +73,28 @@ static struct sk_buff *mtk_tag_rcv(struc
4 bool is_multicast_skb = is_multicast_ether_addr(dest) &&
5 !is_broadcast_ether_addr(dest);
6
7- if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
8- return NULL;
9+ if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) {
10+ hdr = ntohs(skb->vlan_proto);
11+ skb->vlan_proto = 0;
12+ skb->vlan_tci = 0;
13+ } else {
14+ if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
15+ return NULL;
16
17- /* The MTK header is added by the switch between src addr
18- * and ethertype at this point, skb->data points to 2 bytes
19- * after src addr so header should be 2 bytes right before.
20- */
21- phdr = (__be16 *)(skb->data - 2);
22- hdr = ntohs(*phdr);
23+ /* The MTK header is added by the switch between src addr
24+ * and ethertype at this point, skb->data points to 2 bytes
25+ * after src addr so header should be 2 bytes right before.
26+ */
27+ phdr = (__be16 *)(skb->data - 2);
28+ hdr = ntohs(*phdr);
29
30- /* Remove MTK tag and recalculate checksum. */
31- skb_pull_rcsum(skb, MTK_HDR_LEN);
32+ /* Remove MTK tag and recalculate checksum. */
33+ skb_pull_rcsum(skb, MTK_HDR_LEN);
34
35- memmove(skb->data - ETH_HLEN,
36- skb->data - ETH_HLEN - MTK_HDR_LEN,
37- 2 * ETH_ALEN);
38+ memmove(skb->data - ETH_HLEN,
39+ skb->data - ETH_HLEN - MTK_HDR_LEN,
40+ 2 * ETH_ALEN);
41+ }
42
43 /* Get source port information */
44 port = (hdr & MTK_HDR_RECV_SOURCE_PORT_MASK);