]> err.no Git - linux-2.6/blobdiff - drivers/net/e1000/e1000_main.c
e1000: add multicast stats counters
[linux-2.6] / drivers / net / e1000 / e1000_main.c
index 1d7c99947e922cce8818193fb40418e3d5880949..5296a82c22b8cde56c32c082b4b1e144421b54d5 100644 (file)
@@ -1,25 +1,24 @@
 /*******************************************************************************
 
-  
-  Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
-  
-  This program is free software; you can redistribute it and/or modify it 
-  under the terms of the GNU General Public License as published by the Free 
-  Software Foundation; either version 2 of the License, or (at your option) 
-  any later version.
-  
-  This program is distributed in the hope that it will be useful, but WITHOUT 
-  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
-  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
+  Intel PRO/1000 Linux driver
+  Copyright(c) 1999 - 2006 Intel Corporation.
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
-  
+
   You should have received a copy of the GNU General Public License along with
-  this program; if not, write to the Free Software Foundation, Inc., 59 
-  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-  
-  The full GNU General Public License is included in this distribution in the
-  file called LICENSE.
-  
+  this program; if not, write to the Free Software Foundation, Inc.,
+  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
   Contact Information:
   Linux NICS <linux.nics@intel.com>
   e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
@@ -48,6 +47,7 @@ static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
  *   {PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
  */
 static struct pci_device_id e1000_pci_tbl[] = {
+       INTEL_E1000_ETHERNET_DEVICE(0x1000),
        INTEL_E1000_ETHERNET_DEVICE(0x1001),
        INTEL_E1000_ETHERNET_DEVICE(0x1004),
        INTEL_E1000_ETHERNET_DEVICE(0x1008),
@@ -109,16 +109,24 @@ static struct pci_device_id e1000_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, e1000_pci_tbl);
 
+int e1000_up(struct e1000_adapter *adapter);
+void e1000_down(struct e1000_adapter *adapter);
+void e1000_reinit_locked(struct e1000_adapter *adapter);
+void e1000_reset(struct e1000_adapter *adapter);
+int e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx);
+int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
+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);
-
-/* Local Function Prototypes */
+                             struct e1000_rx_ring *rx_ring);
+void e1000_update_stats(struct e1000_adapter *adapter);
 
 static int e1000_init_module(void);
 static void e1000_exit_module(void);
@@ -171,6 +179,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
 static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
 static int e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
                           int cmd);
+void e1000_set_ethtool_ops(struct net_device *netdev);
 static void e1000_enter_82542_rst(struct e1000_adapter *adapter);
 static void e1000_leave_82542_rst(struct e1000_adapter *adapter);
 static void e1000_tx_timeout(struct net_device *dev);
@@ -195,6 +204,8 @@ static void e1000_shutdown(struct pci_dev *pdev);
 static void e1000_netpoll (struct net_device *netdev);
 #endif
 
+extern void e1000_check_options(struct e1000_adapter *adapter);
+
 static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev,
                      pci_channel_state_t state);
 static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev);
@@ -211,9 +222,9 @@ static struct pci_driver e1000_driver = {
        .id_table = e1000_pci_tbl,
        .probe    = e1000_probe,
        .remove   = __devexit_p(e1000_remove),
+#ifdef CONFIG_PM
        /* Power Managment Hooks */
        .suspend  = e1000_suspend,
-#ifdef CONFIG_PM
        .resume   = e1000_resume,
 #endif
        .shutdown = e1000_shutdown,
@@ -759,7 +770,7 @@ e1000_probe(struct pci_dev *pdev,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        netdev->poll_controller = e1000_netpoll;
 #endif
-       strcpy(netdev->name, pci_name(pdev));
+       strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
 
        netdev->mem_start = mmio_start;
        netdev->mem_end = mmio_start + mmio_len;
@@ -1467,8 +1478,8 @@ e1000_configure_tx(struct e1000_adapter *adapter)
                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;
+               adapter->tx_ring[0].tdh = ((hw->mac_type >= e1000_82543) ? E1000_TDH : E1000_82542_TDH);
+               adapter->tx_ring[0].tdt = ((hw->mac_type >= e1000_82543) ? E1000_TDT : E1000_82542_TDT);
                break;
        }
 
@@ -1871,8 +1882,8 @@ e1000_configure_rx(struct e1000_adapter *adapter)
                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;
+               adapter->rx_ring[0].rdh = ((hw->mac_type >= e1000_82543) ? E1000_RDH : E1000_82542_RDH);
+               adapter->rx_ring[0].rdt = ((hw->mac_type >= e1000_82543) ? E1000_RDT : E1000_82542_RDT);
                break;
        }
 
@@ -2630,7 +2641,7 @@ e1000_tx_csum(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
        unsigned int i;
        uint8_t css;
 
-       if (likely(skb->ip_summed == CHECKSUM_HW)) {
+       if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
                css = skb->h.raw - skb->data;
 
                i = tx_ring->next_to_use;
@@ -2957,11 +2968,11 @@ e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        }
 
        /* reserve a descriptor for the offload context */
-       if ((mss) || (skb->ip_summed == CHECKSUM_HW))
+       if ((mss) || (skb->ip_summed == CHECKSUM_PARTIAL))
                count++;
        count++;
 #else
-       if (skb->ip_summed == CHECKSUM_HW)
+       if (skb->ip_summed == CHECKSUM_PARTIAL)
                count++;
 #endif
 
@@ -3327,16 +3338,15 @@ e1000_update_stats(struct e1000_adapter *adapter)
                adapter->stats.crcerrs + adapter->stats.algnerrc +
                adapter->stats.ruc + adapter->stats.roc +
                adapter->stats.cexterr;
-       adapter->net_stats.rx_length_errors = adapter->stats.ruc +
-                                             adapter->stats.roc;
+       adapter->stats.rlerrc = adapter->stats.ruc + adapter->stats.roc;
+       adapter->net_stats.rx_length_errors = adapter->stats.rlerrc;
        adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
        adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc;
        adapter->net_stats.rx_missed_errors = adapter->stats.mpc;
 
        /* Tx Errors */
-
-       adapter->net_stats.tx_errors = adapter->stats.ecol +
-                                      adapter->stats.latecol;
+       adapter->stats.txerrc = adapter->stats.ecol + adapter->stats.latecol;
+       adapter->net_stats.tx_errors = adapter->stats.txerrc;
        adapter->net_stats.tx_aborted_errors = adapter->stats.ecol;
        adapter->net_stats.tx_window_errors = adapter->stats.latecol;
        adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;
@@ -3638,7 +3648,7 @@ e1000_rx_checksum(struct e1000_adapter *adapter,
                 */
                csum = ntohl(csum ^ 0xFFFF);
                skb->csum = csum;
-               skb->ip_summed = CHECKSUM_HW;
+               skb->ip_summed = CHECKSUM_COMPLETE;
        }
        adapter->hw_csum_good++;
 }
@@ -4411,14 +4421,6 @@ e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t *value)
        pci_write_config_word(adapter->pdev, reg, *value);
 }
 
-#if 0
-uint32_t
-e1000_io_read(struct e1000_hw *hw, unsigned long port)
-{
-       return inl(port);
-}
-#endif  /*  0  */
-
 void
 e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value)
 {
@@ -4810,6 +4812,7 @@ static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, pci_channe
 
        if (netif_running(netdev))
                e1000_down(adapter);
+       pci_disable_device(pdev);
 
        /* Request a slot slot reset. */
        return PCI_ERS_RESULT_NEED_RESET;