Merge branch 'upstream' of git://lost.foo-projects.org/~ahkok/git/netdev-2.6 into...
[pandora-kernel.git] / drivers / net / e1000 / e1000_main.c
index 76e36a4..f06b281 100644 (file)
@@ -36,7 +36,7 @@ static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
 #else
 #define DRIVERNAPI "-NAPI"
 #endif
-#define DRV_VERSION "7.0.38-k4"DRIVERNAPI
+#define DRV_VERSION "7.1.9-k2"DRIVERNAPI
 char e1000_driver_version[] = DRV_VERSION;
 static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
 
@@ -73,6 +73,11 @@ static struct pci_device_id e1000_pci_tbl[] = {
        INTEL_E1000_ETHERNET_DEVICE(0x1026),
        INTEL_E1000_ETHERNET_DEVICE(0x1027),
        INTEL_E1000_ETHERNET_DEVICE(0x1028),
+       INTEL_E1000_ETHERNET_DEVICE(0x1049),
+       INTEL_E1000_ETHERNET_DEVICE(0x104A),
+       INTEL_E1000_ETHERNET_DEVICE(0x104B),
+       INTEL_E1000_ETHERNET_DEVICE(0x104C),
+       INTEL_E1000_ETHERNET_DEVICE(0x104D),
        INTEL_E1000_ETHERNET_DEVICE(0x105E),
        INTEL_E1000_ETHERNET_DEVICE(0x105F),
        INTEL_E1000_ETHERNET_DEVICE(0x1060),
@@ -96,6 +101,8 @@ static struct pci_device_id e1000_pci_tbl[] = {
        INTEL_E1000_ETHERNET_DEVICE(0x109A),
        INTEL_E1000_ETHERNET_DEVICE(0x10B5),
        INTEL_E1000_ETHERNET_DEVICE(0x10B9),
+       INTEL_E1000_ETHERNET_DEVICE(0x10BA),
+       INTEL_E1000_ETHERNET_DEVICE(0x10BB),
        /* required last entry */
        {0,}
 };
@@ -265,7 +272,7 @@ static int e1000_request_irq(struct e1000_adapter *adapter)
        struct net_device *netdev = adapter->netdev;
        int flags, err = 0;
 
-       flags = SA_SHIRQ | SA_SAMPLE_RANDOM;
+       flags = IRQF_SHARED;
 #ifdef CONFIG_PCI_MSI
        if (adapter->hw.mac_type > e1000_82547_rev_2) {
                adapter->have_msi = TRUE;
@@ -366,6 +373,7 @@ e1000_release_hw_control(struct e1000_adapter *adapter)
 {
        uint32_t ctrl_ext;
        uint32_t swsm;
+       uint32_t extcnf;
 
        /* Let firmware taken over control of h/w */
        switch (adapter->hw.mac_type) {
@@ -380,6 +388,11 @@ e1000_release_hw_control(struct e1000_adapter *adapter)
                swsm = E1000_READ_REG(&adapter->hw, SWSM);
                E1000_WRITE_REG(&adapter->hw, SWSM,
                                swsm & ~E1000_SWSM_DRV_LOAD);
+       case e1000_ich8lan:
+               extcnf = E1000_READ_REG(&adapter->hw, CTRL_EXT);
+               E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
+                               extcnf & ~E1000_CTRL_EXT_DRV_LOAD);
+               break;
        default:
                break;
        }
@@ -401,6 +414,7 @@ e1000_get_hw_control(struct e1000_adapter *adapter)
 {
        uint32_t ctrl_ext;
        uint32_t swsm;
+       uint32_t extcnf;
        /* Let firmware know the driver has taken over */
        switch (adapter->hw.mac_type) {
        case e1000_82571:
@@ -415,6 +429,11 @@ e1000_get_hw_control(struct e1000_adapter *adapter)
                E1000_WRITE_REG(&adapter->hw, SWSM,
                                swsm | E1000_SWSM_DRV_LOAD);
                break;
+       case e1000_ich8lan:
+               extcnf = E1000_READ_REG(&adapter->hw, EXTCNF_CTRL);
+               E1000_WRITE_REG(&adapter->hw, EXTCNF_CTRL,
+                               extcnf | E1000_EXTCNF_CTRL_SWFLAG);
+               break;
        default:
                break;
        }
@@ -490,6 +509,7 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)
         * (b) AMT is active
         * (c) SoL/IDER session is active */
        if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 &&
+           adapter->hw.mac_type != e1000_ich8lan &&
            adapter->hw.media_type == e1000_media_type_copper &&
            !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) &&
            !mng_mode_enabled &&
@@ -561,6 +581,9 @@ e1000_reset(struct e1000_adapter *adapter)
        case e1000_82573:
                pba = E1000_PBA_12K;
                break;
+       case e1000_ich8lan:
+               pba = E1000_PBA_8K;
+               break;
        default:
                pba = E1000_PBA_48K;
                break;
@@ -585,6 +608,12 @@ e1000_reset(struct e1000_adapter *adapter)
        /* Set the FC high water mark to 90% of the FIFO size.
         * Required to clear last 3 LSB */
        fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8;
+       /* We can't use 90% on small FIFOs because the remainder
+        * would be less than 1 full frame.  In this case, we size
+        * it to allow at least a full frame above the high water
+        *  mark. */
+       if (pba < E1000_PBA_16K)
+               fc_high_water_mark = (pba * 1024) - 1600;
 
        adapter->hw.fc_high_water = fc_high_water_mark;
        adapter->hw.fc_low_water = fc_high_water_mark - 8;
@@ -607,6 +636,23 @@ e1000_reset(struct e1000_adapter *adapter)
 
        e1000_reset_adaptive(&adapter->hw);
        e1000_phy_get_info(&adapter->hw, &adapter->phy_info);
+
+       if (!adapter->smart_power_down &&
+           (adapter->hw.mac_type == e1000_82571 ||
+            adapter->hw.mac_type == e1000_82572)) {
+               uint16_t phy_data = 0;
+               /* speed up time to link by disabling smart power down, ignore
+                * the return value of this function because there is nothing
+                * different we would do if it failed */
+               e1000_read_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT,
+                                  &phy_data);
+               phy_data &= ~IGP02E1000_PM_SPD;
+               e1000_write_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT,
+                                   phy_data);
+       }
+
+       if (adapter->hw.mac_type < e1000_ich8lan)
+       /* FIXME: this code is duplicate and wrong for PCI Express */
        if (adapter->en_mng_pt) {
                manc = E1000_READ_REG(&adapter->hw, MANC);
                manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
@@ -633,6 +679,7 @@ e1000_probe(struct pci_dev *pdev,
        struct net_device *netdev;
        struct e1000_adapter *adapter;
        unsigned long mmio_start, mmio_len;
+       unsigned long flash_start, flash_len;
 
        static int cards_found = 0;
        static int e1000_ksp3_port_a = 0; /* global ksp3 port a indication */
@@ -642,10 +689,12 @@ e1000_probe(struct pci_dev *pdev,
        if ((err = pci_enable_device(pdev)))
                return err;
 
-       if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
+       if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK)) &&
+           !(err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))) {
                pci_using_dac = 1;
        } else {
-               if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
+               if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) &&
+                   (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) {
                        E1000_ERR("No usable DMA configuration, aborting\n");
                        return err;
                }
@@ -725,6 +774,19 @@ e1000_probe(struct pci_dev *pdev,
        if ((err = e1000_sw_init(adapter)))
                goto err_sw_init;
 
+       /* Flash BAR mapping must happen after e1000_sw_init
+        * because it depends on mac_type */
+       if ((adapter->hw.mac_type == e1000_ich8lan) &&
+          (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
+               flash_start = pci_resource_start(pdev, 1);
+               flash_len = pci_resource_len(pdev, 1);
+               adapter->hw.flash_address = ioremap(flash_start, flash_len);
+               if (!adapter->hw.flash_address) {
+                       err = -EIO;
+                       goto err_flashmap;
+               }
+       }
+
        if ((err = e1000_check_phy_reset_block(&adapter->hw)))
                DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
 
@@ -743,6 +805,8 @@ e1000_probe(struct pci_dev *pdev,
                                   NETIF_F_HW_VLAN_TX |
                                   NETIF_F_HW_VLAN_RX |
                                   NETIF_F_HW_VLAN_FILTER;
+               if (adapter->hw.mac_type == e1000_ich8lan)
+                       netdev->features &= ~NETIF_F_HW_VLAN_FILTER;
        }
 
 #ifdef NETIF_F_TSO
@@ -758,11 +822,17 @@ e1000_probe(struct pci_dev *pdev,
        if (pci_using_dac)
                netdev->features |= NETIF_F_HIGHDMA;
 
-       /* hard_start_xmit is safe against parallel locking */
        netdev->features |= NETIF_F_LLTX;
 
        adapter->en_mng_pt = e1000_enable_mng_pass_thru(&adapter->hw);
 
+       /* initialize eeprom parameters */
+
+       if (e1000_init_eeprom_params(&adapter->hw)) {
+               E1000_ERR("EEPROM initialization failed\n");
+               return -EIO;
+       }
+
        /* before reading the EEPROM, reset the controller to
         * put the device in a known good starting state */
 
@@ -830,6 +900,11 @@ e1000_probe(struct pci_dev *pdev,
                        EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data);
                eeprom_apme_mask = E1000_EEPROM_82544_APM;
                break;
+       case e1000_ich8lan:
+               e1000_read_eeprom(&adapter->hw,
+                       EEPROM_INIT_CONTROL1_REG, 1, &eeprom_data);
+               eeprom_apme_mask = E1000_EEPROM_ICH8_APME;
+               break;
        case e1000_82546:
        case e1000_82546_rev_3:
        case e1000_82571:
@@ -889,6 +964,9 @@ e1000_probe(struct pci_dev *pdev,
        return 0;
 
 err_register:
+       if (adapter->hw.flash_address)
+               iounmap(adapter->hw.flash_address);
+err_flashmap:
 err_sw_init:
 err_eeprom:
        iounmap(adapter->hw.hw_addr);
@@ -922,6 +1000,7 @@ e1000_remove(struct pci_dev *pdev)
        flush_scheduled_work();
 
        if (adapter->hw.mac_type >= e1000_82540 &&
+          adapter->hw.mac_type != e1000_ich8lan &&
           adapter->hw.media_type == e1000_media_type_copper) {
                manc = E1000_READ_REG(&adapter->hw, MANC);
                if (manc & E1000_MANC_SMBUS_EN) {
@@ -950,6 +1029,8 @@ e1000_remove(struct pci_dev *pdev)
 #endif
 
        iounmap(adapter->hw.hw_addr);
+       if (adapter->hw.flash_address)
+               iounmap(adapter->hw.flash_address);
        pci_release_regions(pdev);
 
        free_netdev(netdev);
@@ -1000,13 +1081,6 @@ e1000_sw_init(struct e1000_adapter *adapter)
                return -EIO;
        }
 
-       /* initialize eeprom parameters */
-
-       if (e1000_init_eeprom_params(hw)) {
-               E1000_ERR("EEPROM initialization failed\n");
-               return -EIO;
-       }
-
        switch (hw->mac_type) {
        default:
                break;
@@ -1242,8 +1316,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter,
        int size;
 
        size = sizeof(struct e1000_buffer) * txdr->count;
-
-       txdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus));
+       txdr->buffer_info = vmalloc(size);
        if (!txdr->buffer_info) {
                DPRINTK(PROBE, ERR,
                "Unable to allocate memory for the transmit descriptor ring\n");
@@ -1355,11 +1428,11 @@ e1000_configure_tx(struct e1000_adapter *adapter)
                tdba = adapter->tx_ring[0].dma;
                tdlen = adapter->tx_ring[0].count *
                        sizeof(struct e1000_tx_desc);
-               E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
-               E1000_WRITE_REG(hw, TDBAH, (tdba >> 32));
                E1000_WRITE_REG(hw, TDLEN, tdlen);
-               E1000_WRITE_REG(hw, TDH, 0);
+               E1000_WRITE_REG(hw, TDBAH, (tdba >> 32));
+               E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
                E1000_WRITE_REG(hw, TDT, 0);
+               E1000_WRITE_REG(hw, TDH, 0);
                adapter->tx_ring[0].tdh = E1000_TDH;
                adapter->tx_ring[0].tdt = E1000_TDT;
                break;
@@ -1471,7 +1544,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter,
        int size, desc_len;
 
        size = sizeof(struct e1000_buffer) * rxdr->count;
-       rxdr->buffer_info = vmalloc_node(size, pcibus_to_node(pdev->bus));
+       rxdr->buffer_info = vmalloc(size);
        if (!rxdr->buffer_info) {
                DPRINTK(PROBE, ERR,
                "Unable to allocate memory for the receive descriptor ring\n");
@@ -1613,9 +1686,6 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
                E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
                (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT);
 
-       if (adapter->hw.mac_type > e1000_82543)
-               rctl |= E1000_RCTL_SECRC;
-
        if (adapter->hw.tbi_compatibility_on == 1)
                rctl |= E1000_RCTL_SBP;
        else
@@ -1681,7 +1751,7 @@ e1000_setup_rctl(struct e1000_adapter *adapter)
                rfctl |= E1000_RFCTL_IPV6_DIS;
                E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl);
 
-               rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC;
+               rctl |= E1000_RCTL_DTYP_PS;
 
                psrctl |= adapter->rx_ps_bsize0 >>
                        E1000_PSRCTL_BSIZE0_SHIFT;
@@ -1765,11 +1835,11 @@ e1000_configure_rx(struct e1000_adapter *adapter)
        case 1:
        default:
                rdba = adapter->rx_ring[0].dma;
-               E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL));
-               E1000_WRITE_REG(hw, RDBAH, (rdba >> 32));
                E1000_WRITE_REG(hw, RDLEN, rdlen);
-               E1000_WRITE_REG(hw, RDH, 0);
+               E1000_WRITE_REG(hw, RDBAH, (rdba >> 32));
+               E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL));
                E1000_WRITE_REG(hw, RDT, 0);
+               E1000_WRITE_REG(hw, RDH, 0);
                adapter->rx_ring[0].rdh = E1000_RDH;
                adapter->rx_ring[0].rdt = E1000_RDT;
                break;
@@ -1794,9 +1864,6 @@ e1000_configure_rx(struct e1000_adapter *adapter)
                E1000_WRITE_REG(hw, RXCSUM, rxcsum);
        }
 
-       if (hw->mac_type == e1000_82573)
-               E1000_WRITE_REG(hw, ERT, 0x0100);
-
        /* Enable Receives */
        E1000_WRITE_REG(hw, RCTL, rctl);
 }
@@ -2136,6 +2203,12 @@ e1000_set_multi(struct net_device *netdev)
        uint32_t rctl;
        uint32_t hash_value;
        int i, rar_entries = E1000_RAR_ENTRIES;
+       int mta_reg_count = (hw->mac_type == e1000_ich8lan) ?
+                               E1000_NUM_MTA_REGISTERS_ICH8LAN :
+                               E1000_NUM_MTA_REGISTERS;
+
+       if (adapter->hw.mac_type == e1000_ich8lan)
+               rar_entries = E1000_RAR_ENTRIES_ICH8LAN;
 
        /* reserve RAR[14] for LAA over-write work-around */
        if (adapter->hw.mac_type == e1000_82571)
@@ -2174,14 +2247,18 @@ e1000_set_multi(struct net_device *netdev)
                        mc_ptr = mc_ptr->next;
                } else {
                        E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0);
+                       E1000_WRITE_FLUSH(hw);
                        E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0);
+                       E1000_WRITE_FLUSH(hw);
                }
        }
 
        /* clear the old settings from the multicast hash table */
 
-       for (i = 0; i < E1000_NUM_MTA_REGISTERS; i++)
+       for (i = 0; i < mta_reg_count; i++) {
                E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
+               E1000_WRITE_FLUSH(hw);
+       }
 
        /* load any remaining addresses into the hash table */
 
@@ -2257,8 +2334,16 @@ e1000_watchdog(unsigned long data)
        struct net_device *netdev = adapter->netdev;
        struct e1000_tx_ring *txdr = adapter->tx_ring;
        uint32_t link, tctl;
-
-       e1000_check_for_link(&adapter->hw);
+       int32_t ret_val;
+
+       ret_val = e1000_check_for_link(&adapter->hw);
+       if ((ret_val == E1000_ERR_PHY) &&
+           (adapter->hw.phy_type == e1000_phy_igp_3) &&
+           (E1000_READ_REG(&adapter->hw, CTRL) & E1000_PHY_CTRL_GBE_DISABLE)) {
+               /* See e1000_kumeran_lock_loss_workaround() */
+               DPRINTK(LINK, INFO,
+                       "Gigabit has been disabled, downgrading speed\n");
+       }
        if (adapter->hw.mac_type == e1000_82573) {
                e1000_enable_tx_pkt_filtering(&adapter->hw);
                if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)
@@ -2439,7 +2524,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
        uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
        int err;
 
-       if (skb_shinfo(skb)->tso_size) {
+       if (skb_shinfo(skb)->gso_size) {
                if (skb_header_cloned(skb)) {
                        err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
                        if (err)
@@ -2447,7 +2532,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
                }
 
                hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
-               mss = skb_shinfo(skb)->tso_size;
+               mss = skb_shinfo(skb)->gso_size;
                if (skb->protocol == htons(ETH_P_IP)) {
                        skb->nh.iph->tot_len = 0;
                        skb->nh.iph->check = 0;
@@ -2564,7 +2649,7 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
                 * tso gets written back prematurely before the data is fully
                 * DMA'd to the controller */
                if (!skb->data_len && tx_ring->last_tx_tso &&
-                   !skb_shinfo(skb)->tso_size) {
+                   !skb_shinfo(skb)->gso_size) {
                        tx_ring->last_tx_tso = 0;
                        size -= 4;
                }
@@ -2802,7 +2887,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        }
 
 #ifdef NETIF_F_TSO
-       mss = skb_shinfo(skb)->tso_size;
+       mss = skb_shinfo(skb)->gso_size;
        /* The controller does a simple calculation to
         * make sure there is enough room in the FIFO before
         * initiating the DMA for each buffer.  The calc is:
@@ -2824,9 +2909,10 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                        case e1000_82571:
                        case e1000_82572:
                        case e1000_82573:
+                       case e1000_ich8lan:
                                pull_size = min((unsigned int)4, skb->data_len);
                                if (!__pskb_pull_tail(skb, pull_size)) {
-                                       printk(KERN_ERR
+                                       DPRINTK(DRV, ERR,
                                                "__pskb_pull_tail failed.\n");
                                        dev_kfree_skb_any(skb);
                                        return NETDEV_TX_OK;
@@ -2852,7 +2938,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
 #ifdef NETIF_F_TSO
        /* Controller Erratum workaround */
        if (!skb->data_len && tx_ring->last_tx_tso &&
-           !skb_shinfo(skb)->tso_size)
+           !skb_shinfo(skb)->gso_size)
                count++;
 #endif
 
@@ -3008,6 +3094,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
        /* Adapter-specific max frame size limits. */
        switch (adapter->hw.mac_type) {
        case e1000_undefined ... e1000_82542_rev2_1:
+       case e1000_ich8lan:
                if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) {
                        DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n");
                        return -EINVAL;
@@ -3116,12 +3203,15 @@ e1000_update_stats(struct e1000_adapter *adapter)
        adapter->stats.bprc += E1000_READ_REG(hw, BPRC);
        adapter->stats.mprc += E1000_READ_REG(hw, MPRC);
        adapter->stats.roc += E1000_READ_REG(hw, ROC);
+
+       if (adapter->hw.mac_type != e1000_ich8lan) {
        adapter->stats.prc64 += E1000_READ_REG(hw, PRC64);
        adapter->stats.prc127 += E1000_READ_REG(hw, PRC127);
        adapter->stats.prc255 += E1000_READ_REG(hw, PRC255);
        adapter->stats.prc511 += E1000_READ_REG(hw, PRC511);
        adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023);
        adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522);
+       }
 
        adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS);
        adapter->stats.mpc += E1000_READ_REG(hw, MPC);
@@ -3149,12 +3239,16 @@ e1000_update_stats(struct e1000_adapter *adapter)
        adapter->stats.totl += E1000_READ_REG(hw, TOTL);
        adapter->stats.toth += E1000_READ_REG(hw, TOTH);
        adapter->stats.tpr += E1000_READ_REG(hw, TPR);
+
+       if (adapter->hw.mac_type != e1000_ich8lan) {
        adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64);
        adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127);
        adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255);
        adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511);
        adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023);
        adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522);
+       }
+
        adapter->stats.mptc += E1000_READ_REG(hw, MPTC);
        adapter->stats.bptc += E1000_READ_REG(hw, BPTC);
 
@@ -3176,6 +3270,8 @@ e1000_update_stats(struct e1000_adapter *adapter)
        if (hw->mac_type > e1000_82547_rev_2) {
                adapter->stats.iac += E1000_READ_REG(hw, IAC);
                adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC);
+
+               if (adapter->hw.mac_type != e1000_ich8lan) {
                adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC);
                adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC);
                adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC);
@@ -3183,6 +3279,7 @@ e1000_update_stats(struct e1000_adapter *adapter)
                adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC);
                adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC);
                adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC);
+               }
        }
 
        /* Fill out the OS statistics structure */
@@ -3589,7 +3686,8 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
                        /* All receives must fit into a single buffer */
                        E1000_DBG("%s: Receive packet consumed multiple"
                                  " buffers\n", netdev->name);
-                       dev_kfree_skb_irq(skb);
+                       /* recycle */
+                       buffer_info-> skb = skb;
                        goto next_desc;
                }
 
@@ -4316,18 +4414,21 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
                ctrl |= E1000_CTRL_VME;
                E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
 
+               if (adapter->hw.mac_type != e1000_ich8lan) {
                /* enable VLAN receive filtering */
                rctl = E1000_READ_REG(&adapter->hw, RCTL);
                rctl |= E1000_RCTL_VFE;
                rctl &= ~E1000_RCTL_CFIEN;
                E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
                e1000_update_mng_vlan(adapter);
+               }
        } else {
                /* disable VLAN tag insert/strip */
                ctrl = E1000_READ_REG(&adapter->hw, CTRL);
                ctrl &= ~E1000_CTRL_VME;
                E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
 
+               if (adapter->hw.mac_type != e1000_ich8lan) {
                /* disable VLAN filtering */
                rctl = E1000_READ_REG(&adapter->hw, RCTL);
                rctl &= ~E1000_RCTL_VFE;
@@ -4336,6 +4437,7 @@ e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
                        e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
                        adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
                }
+               }
        }
 
        e1000_irq_enable(adapter);
@@ -4564,7 +4666,9 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
                pci_enable_wake(pdev, PCI_D3cold, 0);
        }
 
+       /* FIXME: this code is incorrect for PCI Express */
        if (adapter->hw.mac_type >= e1000_82540 &&
+          adapter->hw.mac_type != e1000_ich8lan &&
           adapter->hw.media_type == e1000_media_type_copper) {
                manc = E1000_READ_REG(&adapter->hw, MANC);
                if (manc & E1000_MANC_SMBUS_EN) {
@@ -4575,6 +4679,9 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
                }
        }
 
+       if (adapter->hw.phy_type == e1000_phy_igp_3)
+               e1000_phy_powerdown_workaround(&adapter->hw);
+
        /* Release control of h/w to f/w.  If f/w is AMT enabled, this
         * would have already happened in close and is redundant. */
        e1000_release_hw_control(adapter);
@@ -4610,7 +4717,9 @@ e1000_resume(struct pci_dev *pdev)
 
        netif_device_attach(netdev);
 
+       /* FIXME: this code is incorrect for PCI Express */
        if (adapter->hw.mac_type >= e1000_82540 &&
+          adapter->hw.mac_type != e1000_ich8lan &&
           adapter->hw.media_type == e1000_media_type_copper) {
                manc = E1000_READ_REG(&adapter->hw, MANC);
                manc &= ~(E1000_MANC_ARP_EN);