]> Pileus Git - ~andy/linux/blobdiff - drivers/net/e1000/e1000_main.c
Merge branch 'e1000-upstream' of git://198.78.49.142/linux-2.6
[~andy/linux] / drivers / net / e1000 / e1000_main.c
index b572a1218c819ac7508738fa173bc93e7a5f4872..34d77ed6acaade56c0c69409220c80e8d24651f1 100644 (file)
 #include "e1000.h"
 
 /* Change Log
+ * 7.0.33      3-Feb-2006
+ *   o Added another fix for the pass false carrier bit
+ * 7.0.32      24-Jan-2006
+ *   o Need to rebuild with noew version number for the pass false carrier 
+ *     fix in e1000_hw.c
+ * 7.0.30      18-Jan-2006
+ *   o fixup for tso workaround to disable it for pci-x
+ *   o fix mem leak on 82542
+ *   o fixes for 10 Mb/s connections and incorrect stats
+ * 7.0.28      01/06/2006
+ *   o hardware workaround to only set "speed mode" bit for 1G link.
+ * 7.0.26      12/23/2005
+ *   o wake on lan support modified for device ID 10B5
+ *   o fix dhcp + vlan issue not making it to the iAMT firmware
+ * 7.0.24      12/9/2005
+ *   o New hardware support for the Gigabit NIC embedded in the south bridge
+ *   o Fixes to the recycling logic (skb->tail) from IBM LTC
  * 6.3.9       12/16/2005
  *   o incorporate fix for recycled skbs from IBM LTC
  * 6.3.7       11/18/2005
  *     rx_buffer_len
  * 6.3.1       9/19/05
  *   o Use adapter->tx_timeout_factor in Tx Hung Detect logic 
-       (e1000_clean_tx_irq)
*      (e1000_clean_tx_irq)
  *   o Support for 8086:10B5 device (Quad Port)
- * 6.2.14      9/15/05
- *   o In AMT enabled configurations, set/reset DRV_LOAD bit on interface 
- *     open/close 
- * 6.2.13       9/14/05
- *   o Invoke e1000_check_mng_mode only for 8257x controllers since it 
- *     accesses the FWSM that is not supported in other controllers
- * 6.2.12       9/9/05
- *   o Add support for device id E1000_DEV_ID_82546GB_QUAD_COPPER
- *   o set RCTL:SECRC only for controllers newer than 82543. 
- *   o When the n/w interface comes down reset DRV_LOAD bit to notify f/w.
- *     This code was moved from e1000_remove to e1000_close
- * 6.2.10       9/6/05
- *   o Fix error in updating RDT in el1000_alloc_rx_buffers[_ps] -- one off.
- *   o Enable fc by default on 82573 controllers (do not read eeprom)
- *   o Fix rx_errors statistic not to include missed_packet_count
- *   o Fix rx_dropped statistic not to include missed_packet_count 
-       (Padraig Brady)
- * 6.2.9        8/30/05
- *   o Remove call to update statistics from the controller ib e1000_get_stats
- * 6.2.8        8/30/05
- *   o Improved algorithm for rx buffer allocation/rdt update
- *   o Flow control watermarks relative to rx PBA size
- *   o Simplified 'Tx Hung' detect logic
- * 6.2.7       8/17/05
- *   o Report rx buffer allocation failures and tx timeout counts in stats
- * 6.2.6       8/16/05
- *   o Implement workaround for controller erratum -- linear non-tso packet
- *     following a TSO gets written back prematurely
- * 6.2.5       8/15/05
- *   o Set netdev->tx_queue_len based on link speed/duplex settings.
- *   o Fix net_stats.rx_fifo_errors <p@draigBrady.com>
- *   o Do not power off PHY if SoL/IDER session is active
- * 6.2.4       8/10/05
- *   o Fix loopback test setup/cleanup for 82571/3 controllers
- *   o Fix parsing of outgoing packets (e1000_transfer_dhcp_info) to treat
- *     all packets as raw
- *   o Prevent operations that will cause the PHY to be reset if SoL/IDER
- *     sessions are active and log a message
- * 6.2.2       7/21/05
- *   o used fixed size descriptors for all MTU sizes, reduces memory load
- * 6.1.2       4/13/05
- *   o Fixed ethtool diagnostics
- *   o Enabled flow control to take default eeprom settings
- *   o Added stats_lock around e1000_read_phy_reg commands to avoid concurrent
- *     calls, one from mii_ioctl and other from within update_stats while 
- *     processing MIIREG ioctl.
  */
 
 char e1000_driver_name[] = "e1000";
@@ -178,13 +149,13 @@ int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
 void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
 void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
 static int e1000_setup_tx_resources(struct e1000_adapter *adapter,
-                                   struct e1000_tx_ring *txdr);
+                                    struct e1000_tx_ring *txdr);
 static int e1000_setup_rx_resources(struct e1000_adapter *adapter,
-                                   struct e1000_rx_ring *rxdr);
+                                    struct e1000_rx_ring *rxdr);
 static void e1000_free_tx_resources(struct e1000_adapter *adapter,
-                                   struct e1000_tx_ring *tx_ring);
+                                    struct e1000_tx_ring *tx_ring);
 static void e1000_free_rx_resources(struct e1000_adapter *adapter,
-                                   struct e1000_rx_ring *rx_ring);
+                                    struct e1000_rx_ring *rx_ring);
 void e1000_update_stats(struct e1000_adapter *adapter);
 
 /* Local Function Prototypes */
@@ -1727,6 +1698,7 @@ e1000_configure_rx(struct e1000_adapter *adapter)
        uint32_t rdlen, rctl, rxcsum, ctrl_ext;
 
        if (adapter->rx_ps_pages) {
+               /* this is a 32 byte descriptor */
                rdlen = adapter->rx_ring[0].count *
                        sizeof(union e1000_rx_desc_packet_split);
                adapter->clean_rx = e1000_clean_rx_irq_ps;
@@ -2576,9 +2548,9 @@ e1000_tx_map(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
                /* Workaround for Controller erratum --
                 * descriptor for non-tso packet in a linear SKB that follows a
                 * tso gets written back prematurely before the data is fully
-                * DMAd to the controller */
+                * DMA'd to the controller */
                if (!skb->data_len && tx_ring->last_tx_tso &&
-                               !skb_shinfo(skb)->tso_size) {
+                   !skb_shinfo(skb)->tso_size) {
                        tx_ring->last_tx_tso = 0;
                        size -= 4;
                }
@@ -2843,7 +2815,7 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                                        printk(KERN_ERR 
                                                "__pskb_pull_tail failed.\n");
                                        dev_kfree_skb_any(skb);
-                                       return -EFAULT;
+                                       return NETDEV_TX_OK;
                                }
                                len = skb->len - skb->data_len;
                                break;
@@ -2866,7 +2838,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)->tso_size)
                count++;
 #endif
 
@@ -2889,7 +2861,9 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        if (adapter->pcix_82544)
                count += nr_frags;
 
-       if (adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == e1000_82573) )
+
+       if (adapter->hw.tx_pkt_filtering &&
+           (adapter->hw.mac_type == e1000_82573))
                e1000_transfer_dhcp_info(adapter, skb);
 
        local_irq_save(flags);
@@ -3892,7 +3866,6 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
                        goto map_skb;
                }
 
-
                if (unlikely(!skb)) {
                        /* Better luck next round */
                        adapter->alloc_rx_buff_failed++;
@@ -4198,7 +4171,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
                        spin_unlock_irqrestore(&adapter->stats_lock, flags);
                        return -EIO;
                }
-               if (adapter->hw.phy_type == e1000_phy_m88) {
+               if (adapter->hw.phy_type == e1000_media_type_copper) {
                        switch (data->reg_num) {
                        case PHY_CTRL:
                                if (mii_reg & MII_CR_POWER_DOWN)
@@ -4214,8 +4187,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
                                        else
                                                spddplx = SPEED_10;
                                        spddplx += (mii_reg & 0x100)
-                                                  ? FULL_DUPLEX :
-                                                  HALF_DUPLEX;
+                                                  ? DUPLEX_FULL :
+                                                  DUPLEX_HALF;
                                        retval = e1000_set_spd_dplx(adapter,
                                                                    spddplx);
                                        if (retval) {
@@ -4445,8 +4418,8 @@ e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
 }
 
 #ifdef CONFIG_PM
-/* these functions save and restore 16 or 64 dwords (64-256 bytes) of config
- * space versus the 64 bytes that pci_[save|restore]_state handle
+/* Save/restore 16 or 64 dwords of PCI config space depending on which
+ * bus we're on (PCI(X) vs. PCI-E)
  */
 #define PCIE_CONFIG_SPACE_LEN 256
 #define PCI_CONFIG_SPACE_LEN 64
@@ -4456,6 +4429,7 @@ e1000_pci_save_state(struct e1000_adapter *adapter)
        struct pci_dev *dev = adapter->pdev;
        int size;
        int i;
+
        if (adapter->hw.mac_type >= e1000_82571)
                size = PCIE_CONFIG_SPACE_LEN;
        else
@@ -4479,8 +4453,10 @@ e1000_pci_restore_state(struct e1000_adapter *adapter)
        struct pci_dev *dev = adapter->pdev;
        int size;
        int i;
+
        if (adapter->config_space == NULL)
                return;
+
        if (adapter->hw.mac_type >= e1000_82571)
                size = PCIE_CONFIG_SPACE_LEN;
        else
@@ -4508,8 +4484,8 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
                e1000_down(adapter);
 
 #ifdef CONFIG_PM
-       /* implement our own version of pci_save_state(pdev) because pci 
-        * express adapters have larger 256 byte config spaces */
+       /* Implement our own version of pci_save_state(pdev) because pci-
+        * express adapters have 256-byte config spaces. */
        retval = e1000_pci_save_state(adapter);
        if (retval)
                return retval;
@@ -4566,7 +4542,7 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
                retval = pci_enable_wake(pdev, PCI_D3hot, 0);
                if (retval)
                        DPRINTK(PROBE, ERR, "Error enabling D3 wake\n");
-               retval = pci_enable_wake(pdev, PCI_D3cold, 0); /* 4 == D3 cold */
+               retval = pci_enable_wake(pdev, PCI_D3cold, 0);
                if (retval)
                        DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n");
        }
@@ -4582,7 +4558,8 @@ e1000_suspend(struct pci_dev *pdev, pm_message_t state)
                                DPRINTK(PROBE, ERR, "Error enabling D3 wake\n");
                        retval = pci_enable_wake(pdev, PCI_D3cold, 1);
                        if (retval)
-                               DPRINTK(PROBE, ERR, "Error enabling D3 cold wake\n");
+                               DPRINTK(PROBE, ERR,
+                                       "Error enabling D3 cold wake\n");
                }
        }