gianfar: prevent buggy hw rx vlan tagging
authorJiri Pirko <jpirko@redhat.com>
Wed, 10 Aug 2011 01:19:48 +0000 (01:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 14 Aug 2011 01:00:33 +0000 (18:00 -0700)
On some buggy chips, "vlan tag present" flag is set which causes packet
loss. Fix this by checking if rx vlan accel is enabled in features.

Reported-by: Michael Guntsche <mguntsche@gmail.com>
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/gianfar.c

index 2659daad783ddb857f5e9597bbb2a2ea95c05f04..31d5c574e5a9aaf923d23c124186dbdfc7defa70 100644 (file)
@@ -2710,8 +2710,13 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
        /* Tell the skb what kind of packet this is */
        skb->protocol = eth_type_trans(skb, dev);
 
-       /* Set vlan tag */
-       if (fcb->flags & RXFCB_VLN)
+       /*
+        * There's need to check for NETIF_F_HW_VLAN_RX here.
+        * Even if vlan rx accel is disabled, on some chips
+        * RXFCB_VLN is pseudo randomly set.
+        */
+       if (dev->features & NETIF_F_HW_VLAN_RX &&
+           fcb->flags & RXFCB_VLN)
                __vlan_hwaccel_put_tag(skb, fcb->vlctl);
 
        /* Send the packet up the stack */