sky2: fix VLAN receive processing (resend)
[powerpc.git] / drivers / net / sky2.c
index e6d937e..8b15654 100644 (file)
@@ -149,6 +149,8 @@ static const char *yukon2_name[] = {
        "FE",           /* 0xb7 */
 };
 
+static void sky2_set_multicast(struct net_device *dev);
+
 /* Access to external PHY */
 static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val)
 {
@@ -2101,6 +2103,13 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
        struct sky2_port *sky2 = netdev_priv(dev);
        struct rx_ring_info *re = sky2->rx_ring + sky2->rx_next;
        struct sk_buff *skb = NULL;
+       u16 count = (status & GMR_FS_LEN) >> 16;
+
+#ifdef SKY2_VLAN_TAG_USED
+       /* Account for vlan tag */
+       if (sky2->vlgrp && (status & GMR_FS_VLAN))
+               count -= VLAN_HLEN;
+#endif
 
        if (unlikely(netif_msg_rx_status(sky2)))
                printk(KERN_DEBUG PFX "%s: rx slot %u status 0x%x len %d\n",
@@ -2115,7 +2124,8 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
        if (!(status & GMR_FS_RX_OK))
                goto resubmit;
 
-       if (status >> 16 != length)
+       /* if length reported by DMA does not match PHY, packet was truncated */
+       if (length != count)
                goto len_mismatch;
 
        if (length < copybreak)
@@ -2131,6 +2141,10 @@ len_mismatch:
        /* Truncation of overlength packets
           causes PHY length to not match MAC length */
        ++sky2->net_stats.rx_length_errors;
+       if (netif_msg_rx_err(sky2) && net_ratelimit())
+               pr_info(PFX "%s: rx length mismatch: length %d status %#x\n",
+                       dev->name, length, status);
+       goto resubmit;
 
 error:
        ++sky2->net_stats.rx_errors;
@@ -2900,8 +2914,10 @@ static int sky2_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
        sky2->autoneg = ecmd->autoneg;
        sky2->advertising = ecmd->advertising;
 
-       if (netif_running(dev))
+       if (netif_running(dev)) {
                sky2_phy_reinit(sky2);
+               sky2_set_multicast(dev);
+       }
 
        return 0;
 }
@@ -2994,6 +3010,7 @@ static int sky2_nway_reset(struct net_device *dev)
                return -EINVAL;
 
        sky2_phy_reinit(sky2);
+       sky2_set_multicast(dev);
 
        return 0;
 }
@@ -4171,6 +4188,8 @@ static int sky2_resume(struct pci_dev *pdev)
                                dev_close(dev);
                                goto out;
                        }
+
+                       sky2_set_multicast(dev);
                }
        }