Loading drivers/net/starfire.c +39 −50 Original line number Diff line number Diff line Loading @@ -561,7 +561,7 @@ struct netdev_private { struct net_device *dev; struct pci_dev *pci_dev; #ifdef VLAN_SUPPORT struct vlan_group *vlgrp; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; #endif void *queue_mem; dma_addr_t queue_mem_dma; Loading Loading @@ -607,18 +607,6 @@ static const struct ethtool_ops ethtool_ops; #ifdef VLAN_SUPPORT static void netdev_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) { struct netdev_private *np = netdev_priv(dev); spin_lock(&np->lock); if (debug > 2) printk("%s: Setting vlgrp to %p\n", dev->name, grp); np->vlgrp = grp; set_rx_mode(dev); spin_unlock(&np->lock); } static void netdev_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) { struct netdev_private *np = netdev_priv(dev); Loading @@ -626,6 +614,7 @@ static void netdev_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) spin_lock(&np->lock); if (debug > 1) printk("%s: Adding vlanid %d to vlan filter\n", dev->name, vid); set_bit(vid, np->active_vlans); set_rx_mode(dev); spin_unlock(&np->lock); } Loading @@ -637,7 +626,7 @@ static void netdev_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) spin_lock(&np->lock); if (debug > 1) printk("%s: removing vlanid %d from vlan filter\n", dev->name, vid); vlan_group_set_device(np->vlgrp, vid, NULL); clear_bit(vid, np->active_vlans); set_rx_mode(dev); spin_unlock(&np->lock); } Loading @@ -656,7 +645,6 @@ static const struct net_device_ops netdev_ops = { .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, #ifdef VLAN_SUPPORT .ndo_vlan_rx_register = netdev_vlan_rx_register, .ndo_vlan_rx_add_vid = netdev_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = netdev_vlan_rx_kill_vid, #endif Loading Loading @@ -1528,19 +1516,15 @@ static int __netdev_rx(struct net_device *dev, int *quota) printk(KERN_DEBUG "%s: checksum_hw, status2 = %#x\n", dev->name, le16_to_cpu(desc->status2)); } #ifdef VLAN_SUPPORT if (np->vlgrp && le16_to_cpu(desc->status2) & 0x0200) { if (le16_to_cpu(desc->status2) & 0x0200) { u16 vlid = le16_to_cpu(desc->vlanid); if (debug > 4) { printk(KERN_DEBUG " netdev_rx() vlanid = %d\n", vlid); } /* * vlan_hwaccel_rx expects a packet with the VLAN tag * stripped out. */ vlan_hwaccel_rx(skb, np->vlgrp, vlid); } else __vlan_hwaccel_put_tag(skb, vlid); } #endif /* VLAN_SUPPORT */ netif_receive_skb(skb); dev->stats.rx_packets++; Loading Loading @@ -1752,40 +1736,45 @@ static struct net_device_stats *get_stats(struct net_device *dev) return &dev->stats; } static void set_rx_mode(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); void __iomem *ioaddr = np->base; u32 rx_mode = MinVLANPrio; struct netdev_hw_addr *ha; int i; #ifdef VLAN_SUPPORT rx_mode |= VlanMode; if (np->vlgrp) { static u32 set_vlan_mode(struct netdev_private *np) { u32 ret = VlanMode; u16 vid; void __iomem *filter_addr = np->base + HashTable + 8; int vlan_count = 0; void __iomem *filter_addr = ioaddr + HashTable + 8; for (i = 0; i < VLAN_VID_MASK; i++) { if (vlan_group_get_device(np->vlgrp, i)) { if (vlan_count >= 32) for_each_set_bit(vid, np->active_vlans, VLAN_N_VID) { if (vlan_count == 32) break; writew(i, filter_addr); writew(vid, filter_addr); filter_addr += 16; vlan_count++; } } if (i == VLAN_VID_MASK) { rx_mode |= PerfectFilterVlan; if (vlan_count == 32) { ret |= PerfectFilterVlan; while (vlan_count < 32) { writew(0, filter_addr); filter_addr += 16; vlan_count++; } } return ret; } #endif /* VLAN_SUPPORT */ static void set_rx_mode(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); void __iomem *ioaddr = np->base; u32 rx_mode = MinVLANPrio; struct netdev_hw_addr *ha; int i; #ifdef VLAN_SUPPORT rx_mode |= set_vlan_mode(np); #endif /* VLAN_SUPPORT */ if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ rx_mode |= AcceptAll; } else if ((netdev_mc_count(dev) > multicast_filter_limit) || Loading Loading
drivers/net/starfire.c +39 −50 Original line number Diff line number Diff line Loading @@ -561,7 +561,7 @@ struct netdev_private { struct net_device *dev; struct pci_dev *pci_dev; #ifdef VLAN_SUPPORT struct vlan_group *vlgrp; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; #endif void *queue_mem; dma_addr_t queue_mem_dma; Loading Loading @@ -607,18 +607,6 @@ static const struct ethtool_ops ethtool_ops; #ifdef VLAN_SUPPORT static void netdev_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) { struct netdev_private *np = netdev_priv(dev); spin_lock(&np->lock); if (debug > 2) printk("%s: Setting vlgrp to %p\n", dev->name, grp); np->vlgrp = grp; set_rx_mode(dev); spin_unlock(&np->lock); } static void netdev_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) { struct netdev_private *np = netdev_priv(dev); Loading @@ -626,6 +614,7 @@ static void netdev_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) spin_lock(&np->lock); if (debug > 1) printk("%s: Adding vlanid %d to vlan filter\n", dev->name, vid); set_bit(vid, np->active_vlans); set_rx_mode(dev); spin_unlock(&np->lock); } Loading @@ -637,7 +626,7 @@ static void netdev_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) spin_lock(&np->lock); if (debug > 1) printk("%s: removing vlanid %d from vlan filter\n", dev->name, vid); vlan_group_set_device(np->vlgrp, vid, NULL); clear_bit(vid, np->active_vlans); set_rx_mode(dev); spin_unlock(&np->lock); } Loading @@ -656,7 +645,6 @@ static const struct net_device_ops netdev_ops = { .ndo_set_mac_address = eth_mac_addr, .ndo_validate_addr = eth_validate_addr, #ifdef VLAN_SUPPORT .ndo_vlan_rx_register = netdev_vlan_rx_register, .ndo_vlan_rx_add_vid = netdev_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = netdev_vlan_rx_kill_vid, #endif Loading Loading @@ -1528,19 +1516,15 @@ static int __netdev_rx(struct net_device *dev, int *quota) printk(KERN_DEBUG "%s: checksum_hw, status2 = %#x\n", dev->name, le16_to_cpu(desc->status2)); } #ifdef VLAN_SUPPORT if (np->vlgrp && le16_to_cpu(desc->status2) & 0x0200) { if (le16_to_cpu(desc->status2) & 0x0200) { u16 vlid = le16_to_cpu(desc->vlanid); if (debug > 4) { printk(KERN_DEBUG " netdev_rx() vlanid = %d\n", vlid); } /* * vlan_hwaccel_rx expects a packet with the VLAN tag * stripped out. */ vlan_hwaccel_rx(skb, np->vlgrp, vlid); } else __vlan_hwaccel_put_tag(skb, vlid); } #endif /* VLAN_SUPPORT */ netif_receive_skb(skb); dev->stats.rx_packets++; Loading Loading @@ -1752,40 +1736,45 @@ static struct net_device_stats *get_stats(struct net_device *dev) return &dev->stats; } static void set_rx_mode(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); void __iomem *ioaddr = np->base; u32 rx_mode = MinVLANPrio; struct netdev_hw_addr *ha; int i; #ifdef VLAN_SUPPORT rx_mode |= VlanMode; if (np->vlgrp) { static u32 set_vlan_mode(struct netdev_private *np) { u32 ret = VlanMode; u16 vid; void __iomem *filter_addr = np->base + HashTable + 8; int vlan_count = 0; void __iomem *filter_addr = ioaddr + HashTable + 8; for (i = 0; i < VLAN_VID_MASK; i++) { if (vlan_group_get_device(np->vlgrp, i)) { if (vlan_count >= 32) for_each_set_bit(vid, np->active_vlans, VLAN_N_VID) { if (vlan_count == 32) break; writew(i, filter_addr); writew(vid, filter_addr); filter_addr += 16; vlan_count++; } } if (i == VLAN_VID_MASK) { rx_mode |= PerfectFilterVlan; if (vlan_count == 32) { ret |= PerfectFilterVlan; while (vlan_count < 32) { writew(0, filter_addr); filter_addr += 16; vlan_count++; } } return ret; } #endif /* VLAN_SUPPORT */ static void set_rx_mode(struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); void __iomem *ioaddr = np->base; u32 rx_mode = MinVLANPrio; struct netdev_hw_addr *ha; int i; #ifdef VLAN_SUPPORT rx_mode |= set_vlan_mode(np); #endif /* VLAN_SUPPORT */ if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */ rx_mode |= AcceptAll; } else if ((netdev_mc_count(dev) > multicast_filter_limit) || Loading