aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e100.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r--drivers/net/e100.c82
1 files changed, 36 insertions, 46 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index dc5e38aefca6..26073c345213 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1,27 +1,27 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 3 Intel PRO/100 Linux driver
4 Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved. 4 Copyright(c) 1999 - 2006 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the Free 7 under the terms and conditions of the GNU General Public License,
8 Software Foundation; either version 2 of the License, or (at your option) 8 version 2, as published by the Free Software Foundation.
9 any later version.
10 9
11 This program is distributed in the hope that it will be useful, but WITHOUT 10 This program is distributed in the hope it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details. 13 more details.
15 14
16 You should have received a copy of the GNU General Public License along with 15 You should have received a copy of the GNU General Public License along with
17 this program; if not, write to the Free Software Foundation, Inc., 59 16 this program; if not, write to the Free Software Foundation, Inc.,
18 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 18
20 The full GNU General Public License is included in this distribution in the 19 The full GNU General Public License is included in this distribution in
21 file called LICENSE. 20 the file called "COPYING".
22 21
23 Contact Information: 22 Contact Information:
24 Linux NICS <linux.nics@intel.com> 23 Linux NICS <linux.nics@intel.com>
24 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 26
27*******************************************************************************/ 27*******************************************************************************/
@@ -159,7 +159,7 @@
159 159
160#define DRV_NAME "e100" 160#define DRV_NAME "e100"
161#define DRV_EXT "-NAPI" 161#define DRV_EXT "-NAPI"
162#define DRV_VERSION "3.5.16-k2"DRV_EXT 162#define DRV_VERSION "3.5.17-k2"DRV_EXT
163#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" 163#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver"
164#define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation" 164#define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation"
165#define PFX DRV_NAME ": " 165#define PFX DRV_NAME ": "
@@ -1657,13 +1657,14 @@ static int e100_tx_clean(struct nic *nic)
1657 1657
1658 spin_lock(&nic->cb_lock); 1658 spin_lock(&nic->cb_lock);
1659 1659
1660 DPRINTK(TX_DONE, DEBUG, "cb->status = 0x%04X\n",
1661 nic->cb_to_clean->status);
1662
1663 /* Clean CBs marked complete */ 1660 /* Clean CBs marked complete */
1664 for(cb = nic->cb_to_clean; 1661 for(cb = nic->cb_to_clean;
1665 cb->status & cpu_to_le16(cb_complete); 1662 cb->status & cpu_to_le16(cb_complete);
1666 cb = nic->cb_to_clean = cb->next) { 1663 cb = nic->cb_to_clean = cb->next) {
1664 DPRINTK(TX_DONE, DEBUG, "cb[%d]->status = 0x%04X\n",
1665 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)),
1666 cb->status);
1667
1667 if(likely(cb->skb != NULL)) { 1668 if(likely(cb->skb != NULL)) {
1668 nic->net_stats.tx_packets++; 1669 nic->net_stats.tx_packets++;
1669 nic->net_stats.tx_bytes += cb->skb->len; 1670 nic->net_stats.tx_bytes += cb->skb->len;
@@ -2572,7 +2573,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2572#ifdef CONFIG_NET_POLL_CONTROLLER 2573#ifdef CONFIG_NET_POLL_CONTROLLER
2573 netdev->poll_controller = e100_netpoll; 2574 netdev->poll_controller = e100_netpoll;
2574#endif 2575#endif
2575 strcpy(netdev->name, pci_name(pdev)); 2576 strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
2576 2577
2577 nic = netdev_priv(netdev); 2578 nic = netdev_priv(netdev);
2578 nic->netdev = netdev; 2579 nic->netdev = netdev;
@@ -2714,68 +2715,56 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2714 } 2715 }
2715} 2716}
2716 2717
2717#ifdef CONFIG_PM
2718static int e100_suspend(struct pci_dev *pdev, pm_message_t state) 2718static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2719{ 2719{
2720 struct net_device *netdev = pci_get_drvdata(pdev); 2720 struct net_device *netdev = pci_get_drvdata(pdev);
2721 struct nic *nic = netdev_priv(netdev); 2721 struct nic *nic = netdev_priv(netdev);
2722 int retval;
2723 2722
2724 if(netif_running(netdev)) 2723 if (netif_running(netdev))
2725 e100_down(nic); 2724 e100_down(nic);
2726 e100_hw_reset(nic); 2725 e100_hw_reset(nic);
2727 netif_device_detach(netdev); 2726 netif_device_detach(netdev);
2728 2727
2728#ifdef CONFIG_PM
2729 pci_save_state(pdev); 2729 pci_save_state(pdev);
2730 retval = pci_enable_wake(pdev, pci_choose_state(pdev, state), 2730 if (nic->flags & (wol_magic | e100_asf(nic)))
2731 nic->flags & (wol_magic | e100_asf(nic))); 2731#else
2732 if (retval) 2732 if (nic->flags & (wol_magic))
2733 DPRINTK(PROBE,ERR, "Error enabling wake\n"); 2733#endif
2734 pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
2735 else
2736 /* disable PME */
2737 pci_enable_wake(pdev, 0, 0);
2738
2734 pci_disable_device(pdev); 2739 pci_disable_device(pdev);
2735 retval = pci_set_power_state(pdev, pci_choose_state(pdev, state)); 2740 pci_set_power_state(pdev, pci_choose_state(pdev, state));
2736 if (retval)
2737 DPRINTK(PROBE,ERR, "Error %d setting power state\n", retval);
2738 2741
2739 return 0; 2742 return 0;
2740} 2743}
2741 2744
2745#ifdef CONFIG_PM
2742static int e100_resume(struct pci_dev *pdev) 2746static int e100_resume(struct pci_dev *pdev)
2743{ 2747{
2744 struct net_device *netdev = pci_get_drvdata(pdev); 2748 struct net_device *netdev = pci_get_drvdata(pdev);
2745 struct nic *nic = netdev_priv(netdev); 2749 struct nic *nic = netdev_priv(netdev);
2746 int retval;
2747 2750
2748 retval = pci_set_power_state(pdev, PCI_D0); 2751 pci_set_power_state(pdev, PCI_D0);
2749 if (retval)
2750 DPRINTK(PROBE,ERR, "Error waking adapter\n");
2751 pci_restore_state(pdev); 2752 pci_restore_state(pdev);
2752 /* ack any pending wake events, disable PME */ 2753 /* ack any pending wake events, disable PME */
2753 retval = pci_enable_wake(pdev, 0, 0); 2754 pci_enable_wake(pdev, 0, 0);
2754 if (retval)
2755 DPRINTK(PROBE,ERR, "Error clearing wake events\n");
2756 2755
2757 netif_device_attach(netdev); 2756 netif_device_attach(netdev);
2758 if(netif_running(netdev)) 2757 if (netif_running(netdev))
2759 e100_up(nic); 2758 e100_up(nic);
2760 2759
2761 return 0; 2760 return 0;
2762} 2761}
2763#endif 2762#endif /* CONFIG_PM */
2764 2763
2765 2764
2766static void e100_shutdown(struct pci_dev *pdev) 2765static void e100_shutdown(struct pci_dev *pdev)
2767{ 2766{
2768 struct net_device *netdev = pci_get_drvdata(pdev); 2767 e100_suspend(pdev, PMSG_SUSPEND);
2769 struct nic *nic = netdev_priv(netdev);
2770 int retval;
2771
2772#ifdef CONFIG_PM
2773 retval = pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
2774#else
2775 retval = pci_enable_wake(pdev, 0, nic->flags & (wol_magic));
2776#endif
2777 if (retval)
2778 DPRINTK(PROBE,ERR, "Error enabling wake\n");
2779} 2768}
2780 2769
2781/* ------------------ PCI Error Recovery infrastructure -------------- */ 2770/* ------------------ PCI Error Recovery infrastructure -------------- */
@@ -2859,8 +2848,9 @@ static struct pci_driver e100_driver = {
2859 .id_table = e100_id_table, 2848 .id_table = e100_id_table,
2860 .probe = e100_probe, 2849 .probe = e100_probe,
2861 .remove = __devexit_p(e100_remove), 2850 .remove = __devexit_p(e100_remove),
2862#ifdef CONFIG_PM 2851 /* Power Management hooks */
2863 .suspend = e100_suspend, 2852 .suspend = e100_suspend,
2853#ifdef CONFIG_PM
2864 .resume = e100_resume, 2854 .resume = e100_resume,
2865#endif 2855#endif
2866 .shutdown = e100_shutdown, 2856 .shutdown = e100_shutdown,