bcmdhd: use the wiphy from private data structure (i.e., wl_priv)
[linux-2.6.git] / drivers / net / ixgb / ixgb_main.c
index 666207a..6a130eb 100644 (file)
@@ -28,6 +28,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/prefetch.h>
 #include "ixgb.h"
 
 char ixgb_driver_name[] = "ixgb";
@@ -98,8 +99,8 @@ static void ixgb_alloc_rx_buffers(struct ixgb_adapter *, int);
 static void ixgb_tx_timeout(struct net_device *dev);
 static void ixgb_tx_timeout_task(struct work_struct *work);
 
-static void ixgb_vlan_rx_register(struct net_device *netdev,
-                                  struct vlan_group *grp);
+static void ixgb_vlan_strip_enable(struct ixgb_adapter *adapter);
+static void ixgb_vlan_strip_disable(struct ixgb_adapter *adapter);
 static void ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
 static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
 static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
@@ -334,7 +335,6 @@ static const struct net_device_ops ixgb_netdev_ops = {
        .ndo_set_mac_address    = ixgb_set_mac,
        .ndo_change_mtu         = ixgb_change_mtu,
        .ndo_tx_timeout         = ixgb_tx_timeout,
-       .ndo_vlan_rx_register   = ixgb_vlan_rx_register,
        .ndo_vlan_rx_add_vid    = ixgb_vlan_rx_add_vid,
        .ndo_vlan_rx_kill_vid   = ixgb_vlan_rx_kill_vid,
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -525,7 +525,7 @@ ixgb_remove(struct pci_dev *pdev)
        struct net_device *netdev = pci_get_drvdata(pdev);
        struct ixgb_adapter *adapter = netdev_priv(netdev);
 
-       flush_scheduled_work();
+       cancel_work_sync(&adapter->tx_timeout_task);
 
        unregister_netdev(netdev);
 
@@ -533,6 +533,7 @@ ixgb_remove(struct pci_dev *pdev)
        pci_release_regions(pdev);
 
        free_netdev(netdev);
+       pci_disable_device(pdev);
 }
 
 /**
@@ -668,13 +669,12 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
        int size;
 
        size = sizeof(struct ixgb_buffer) * txdr->count;
-       txdr->buffer_info = vmalloc(size);
+       txdr->buffer_info = vzalloc(size);
        if (!txdr->buffer_info) {
                netif_err(adapter, probe, adapter->netdev,
                          "Unable to allocate transmit descriptor ring memory\n");
                return -ENOMEM;
        }
-       memset(txdr->buffer_info, 0, size);
 
        /* round up to nearest 4K */
 
@@ -758,13 +758,12 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
        int size;
 
        size = sizeof(struct ixgb_buffer) * rxdr->count;
-       rxdr->buffer_info = vmalloc(size);
+       rxdr->buffer_info = vzalloc(size);
        if (!rxdr->buffer_info) {
                netif_err(adapter, probe, adapter->netdev,
                          "Unable to allocate receive descriptor ring\n");
                return -ENOMEM;
        }
-       memset(rxdr->buffer_info, 0, size);
 
        /* Round up to nearest 4K */
 
@@ -1077,6 +1076,8 @@ ixgb_set_multi(struct net_device *netdev)
 
        if (netdev->flags & IFF_PROMISC) {
                rctl |= (IXGB_RCTL_UPE | IXGB_RCTL_MPE);
+               /* disable VLAN filtering */
+               rctl &= ~IXGB_RCTL_CFIEN;
                rctl &= ~IXGB_RCTL_VFE;
        } else {
                if (netdev->flags & IFF_ALLMULTI) {
@@ -1085,7 +1086,9 @@ ixgb_set_multi(struct net_device *netdev)
                } else {
                        rctl &= ~(IXGB_RCTL_UPE | IXGB_RCTL_MPE);
                }
+               /* enable VLAN filtering */
                rctl |= IXGB_RCTL_VFE;
+               rctl &= ~IXGB_RCTL_CFIEN;
        }
 
        if (netdev_mc_count(netdev) > IXGB_MAX_NUM_MULTICAST_ADDRESSES) {
@@ -1104,6 +1107,12 @@ ixgb_set_multi(struct net_device *netdev)
 
                ixgb_mc_addr_list_update(hw, mta, netdev_mc_count(netdev), 0);
        }
+
+       if (netdev->features & NETIF_F_HW_VLAN_RX)
+               ixgb_vlan_strip_enable(adapter);
+       else
+               ixgb_vlan_strip_disable(adapter);
+
 }
 
 /**
@@ -1251,7 +1260,7 @@ ixgb_tx_csum(struct ixgb_adapter *adapter, struct sk_buff *skb)
 
        if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
                struct ixgb_buffer *buffer_info;
-               css = skb_transport_offset(skb);
+               css = skb_checksum_start_offset(skb);
                cso = css + skb->csum_offset;
 
                i = adapter->tx_ring.next_to_use;
@@ -1497,7 +1506,7 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                      DESC_NEEDED)))
                return NETDEV_TX_BUSY;
 
-       if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
+       if (vlan_tx_tag_present(skb)) {
                tx_flags |= IXGB_TX_FLAGS_VLAN;
                vlan_id = vlan_tx_tag_get(skb);
        }
@@ -2038,12 +2047,11 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
                ixgb_rx_checksum(adapter, rx_desc, skb);
 
                skb->protocol = eth_type_trans(skb, netdev);
-               if (adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) {
-                       vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
-                                               le16_to_cpu(rx_desc->special));
-               } else {
-                       netif_receive_skb(skb);
-               }
+               if (status & IXGB_RX_DESC_STATUS_VP)
+                       __vlan_hwaccel_put_tag(skb,
+                                              le16_to_cpu(rx_desc->special));
+
+               netif_receive_skb(skb);
 
 rxdesc_done:
                /* clean up descriptor, might be written over by hw */
@@ -2141,43 +2149,26 @@ map_skb:
        }
 }
 
-/**
- * ixgb_vlan_rx_register - enables or disables vlan tagging/stripping.
- *
- * @param netdev network interface device structure
- * @param grp indicates to enable or disable tagging/stripping
- **/
 static void
-ixgb_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
+ixgb_vlan_strip_enable(struct ixgb_adapter *adapter)
 {
-       struct ixgb_adapter *adapter = netdev_priv(netdev);
-       u32 ctrl, rctl;
-
-       ixgb_irq_disable(adapter);
-       adapter->vlgrp = grp;
-
-       if (grp) {
-               /* enable VLAN tag insert/strip */
-               ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
-               ctrl |= IXGB_CTRL0_VME;
-               IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
+       u32 ctrl;
 
-               /* enable VLAN receive filtering */
-
-               rctl = IXGB_READ_REG(&adapter->hw, RCTL);
-               rctl &= ~IXGB_RCTL_CFIEN;
-               IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
-       } else {
-               /* disable VLAN tag insert/strip */
+       /* enable VLAN tag insert/strip */
+       ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
+       ctrl |= IXGB_CTRL0_VME;
+       IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
+}
 
-               ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
-               ctrl &= ~IXGB_CTRL0_VME;
-               IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
-       }
+static void
+ixgb_vlan_strip_disable(struct ixgb_adapter *adapter)
+{
+       u32 ctrl;
 
-       /* don't enable interrupts unless we are UP */
-       if (adapter->netdev->flags & IFF_UP)
-               ixgb_irq_enable(adapter);
+       /* disable VLAN tag insert/strip */
+       ctrl = IXGB_READ_REG(&adapter->hw, CTRL0);
+       ctrl &= ~IXGB_CTRL0_VME;
+       IXGB_WRITE_REG(&adapter->hw, CTRL0, ctrl);
 }
 
 static void
@@ -2192,6 +2183,7 @@ ixgb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
        vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index);
        vfta |= (1 << (vid & 0x1F));
        ixgb_write_vfta(&adapter->hw, index, vfta);
+       set_bit(vid, adapter->active_vlans);
 }
 
 static void
@@ -2200,35 +2192,22 @@ ixgb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
        struct ixgb_adapter *adapter = netdev_priv(netdev);
        u32 vfta, index;
 
-       ixgb_irq_disable(adapter);
-
-       vlan_group_set_device(adapter->vlgrp, vid, NULL);
-
-       /* don't enable interrupts unless we are UP */
-       if (adapter->netdev->flags & IFF_UP)
-               ixgb_irq_enable(adapter);
-
        /* remove VID from filter table */
 
        index = (vid >> 5) & 0x7F;
        vfta = IXGB_READ_REG_ARRAY(&adapter->hw, VFTA, index);
        vfta &= ~(1 << (vid & 0x1F));
        ixgb_write_vfta(&adapter->hw, index, vfta);
+       clear_bit(vid, adapter->active_vlans);
 }
 
 static void
 ixgb_restore_vlan(struct ixgb_adapter *adapter)
 {
-       ixgb_vlan_rx_register(adapter->netdev, adapter->vlgrp);
-
-       if (adapter->vlgrp) {
-               u16 vid;
-               for (vid = 0; vid < VLAN_N_VID; vid++) {
-                       if (!vlan_group_get_device(adapter->vlgrp, vid))
-                               continue;
-                       ixgb_vlan_rx_add_vid(adapter->netdev, vid);
-               }
-       }
+       u16 vid;
+
+       for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
+               ixgb_vlan_rx_add_vid(adapter->netdev, vid);
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER