Skip to content

Commit

Permalink
Merge branch 'upstream' of git://lost.foo-projects.org/~ahkok/git/net…
Browse files Browse the repository at this point in the history
…dev-2.6 into tmp
  • Loading branch information
Jeff Garzik committed Sep 27, 2006
2 parents d4b0a4c + 76ddb3f commit 022e7a1
Show file tree
Hide file tree
Showing 21 changed files with 1,104 additions and 1,484 deletions.
82 changes: 36 additions & 46 deletions drivers/net/e100.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
/*******************************************************************************
Copyright(c) 1999 - 2006 Intel Corporation. All rights reserved.
Intel PRO/100 Linux driver
Copyright(c) 1999 - 2006 Intel Corporation.
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.
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 that it will be useful, but WITHOUT
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.
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 LICENSE.
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>
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
Expand Down Expand Up @@ -159,7 +159,7 @@

#define DRV_NAME "e100"
#define DRV_EXT "-NAPI"
#define DRV_VERSION "3.5.16-k2"DRV_EXT
#define DRV_VERSION "3.5.17-k2"DRV_EXT
#define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver"
#define DRV_COPYRIGHT "Copyright(c) 1999-2006 Intel Corporation"
#define PFX DRV_NAME ": "
Expand Down Expand Up @@ -1657,13 +1657,14 @@ static int e100_tx_clean(struct nic *nic)

spin_lock(&nic->cb_lock);

DPRINTK(TX_DONE, DEBUG, "cb->status = 0x%04X\n",
nic->cb_to_clean->status);

/* Clean CBs marked complete */
for(cb = nic->cb_to_clean;
cb->status & cpu_to_le16(cb_complete);
cb = nic->cb_to_clean = cb->next) {
DPRINTK(TX_DONE, DEBUG, "cb[%d]->status = 0x%04X\n",
(int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)),
cb->status);

if(likely(cb->skb != NULL)) {
nic->net_stats.tx_packets++;
nic->net_stats.tx_bytes += cb->skb->len;
Expand Down Expand Up @@ -2572,7 +2573,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
#ifdef CONFIG_NET_POLL_CONTROLLER
netdev->poll_controller = e100_netpoll;
#endif
strcpy(netdev->name, pci_name(pdev));
strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);

nic = netdev_priv(netdev);
nic->netdev = netdev;
Expand Down Expand Up @@ -2714,68 +2715,56 @@ static void __devexit e100_remove(struct pci_dev *pdev)
}
}

#ifdef CONFIG_PM
static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct nic *nic = netdev_priv(netdev);
int retval;

if(netif_running(netdev))
if (netif_running(netdev))
e100_down(nic);
e100_hw_reset(nic);
netif_device_detach(netdev);

#ifdef CONFIG_PM
pci_save_state(pdev);
retval = pci_enable_wake(pdev, pci_choose_state(pdev, state),
nic->flags & (wol_magic | e100_asf(nic)));
if (retval)
DPRINTK(PROBE,ERR, "Error enabling wake\n");
if (nic->flags & (wol_magic | e100_asf(nic)))
#else
if (nic->flags & (wol_magic))
#endif
pci_enable_wake(pdev, pci_choose_state(pdev, state), 1);
else
/* disable PME */
pci_enable_wake(pdev, 0, 0);

pci_disable_device(pdev);
retval = pci_set_power_state(pdev, pci_choose_state(pdev, state));
if (retval)
DPRINTK(PROBE,ERR, "Error %d setting power state\n", retval);
pci_set_power_state(pdev, pci_choose_state(pdev, state));

return 0;
}

#ifdef CONFIG_PM
static int e100_resume(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct nic *nic = netdev_priv(netdev);
int retval;

retval = pci_set_power_state(pdev, PCI_D0);
if (retval)
DPRINTK(PROBE,ERR, "Error waking adapter\n");
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
/* ack any pending wake events, disable PME */
retval = pci_enable_wake(pdev, 0, 0);
if (retval)
DPRINTK(PROBE,ERR, "Error clearing wake events\n");
pci_enable_wake(pdev, 0, 0);

netif_device_attach(netdev);
if(netif_running(netdev))
if (netif_running(netdev))
e100_up(nic);

return 0;
}
#endif
#endif /* CONFIG_PM */


static void e100_shutdown(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct nic *nic = netdev_priv(netdev);
int retval;

#ifdef CONFIG_PM
retval = pci_enable_wake(pdev, 0, nic->flags & (wol_magic | e100_asf(nic)));
#else
retval = pci_enable_wake(pdev, 0, nic->flags & (wol_magic));
#endif
if (retval)
DPRINTK(PROBE,ERR, "Error enabling wake\n");
e100_suspend(pdev, PMSG_SUSPEND);
}

/* ------------------ PCI Error Recovery infrastructure -------------- */
Expand Down Expand Up @@ -2859,8 +2848,9 @@ static struct pci_driver e100_driver = {
.id_table = e100_id_table,
.probe = e100_probe,
.remove = __devexit_p(e100_remove),
#ifdef CONFIG_PM
/* Power Management hooks */
.suspend = e100_suspend,
#ifdef CONFIG_PM
.resume = e100_resume,
#endif
.shutdown = e100_shutdown,
Expand Down
Loading

0 comments on commit 022e7a1

Please sign in to comment.