sfc: Use correct macro to set event bitfield
[safe/jmp/linux-2.6] / drivers / net / 3c59x.c
index 274b013..c566984 100644 (file)
        410 Severn Ave., Suite 210
        Annapolis MD 21403
 
-       Linux Kernel Additions:
-       
-       0.99H+lk0.9 - David S. Miller - softnet, PCI DMA updates
-       0.99H+lk1.0 - Jeff Garzik <jgarzik@pobox.com>
-               Remove compatibility defines for kernel versions < 2.2.x.
-               Update for new 2.3.x module interface
-       LK1.1.2 (March 19, 2000)
-       * New PCI interface (jgarzik)
-
-    LK1.1.3 25 April 2000, Andrew Morton <andrewm@uow.edu.au>
-    - Merged with 3c575_cb.c
-    - Don't set RxComplete in boomerang interrupt enable reg
-    - spinlock in vortex_timer to protect mdio functions
-    - disable local interrupts around call to vortex_interrupt in
-      vortex_tx_timeout() (So vortex_interrupt can use spin_lock())
-    - Select window 3 in vortex_timer()'s write to Wn3_MAC_Ctrl
-    - In vortex_start_xmit(), move the lock to _after_ we've altered
-      vp->cur_tx and vp->tx_full.  This defeats the race between
-      vortex_start_xmit() and vortex_interrupt which was identified
-      by Bogdan Costescu.
-    - Merged back support for six new cards from various sources
-    - Set vortex_have_pci if pci_module_init returns zero (fixes cardbus
-      insertion oops)
-    - Tell it that 3c905C has NWAY for 100bT autoneg
-    - Fix handling of SetStatusEnd in 'Too much work..' code, as
-      per 2.3.99's 3c575_cb (Dave Hinds).
-    - Split ISR into two for vortex & boomerang
-    - Fix MOD_INC/DEC races
-    - Handle resource allocation failures.
-    - Fix 3CCFE575CT LED polarity
-    - Make tx_interrupt_mitigation the default
-
-    LK1.1.4 25 April 2000, Andrew Morton <andrewm@uow.edu.au>    
-    - Add extra TxReset to vortex_up() to fix 575_cb hotplug initialisation probs.
-    - Put vortex_info_tbl into __devinitdata
-    - In the vortex_error StatsFull HACK, disable stats in vp->intr_enable as well
-      as in the hardware.
-    - Increased the loop counter in issue_and_wait from 2,000 to 4,000.
-
-    LK1.1.5 28 April 2000, andrewm
-    - Added powerpc defines (John Daniel <jdaniel@etresoft.com> said these work...)
-    - Some extra diagnostics
-    - In vortex_error(), reset the Tx on maxCollisions.  Otherwise most
-      chips usually get a Tx timeout.
-    - Added extra_reset module parm
-    - Replaced some inline timer manip with mod_timer
-      (Franois romieu <Francois.Romieu@nic.fr>)
-    - In vortex_up(), don't make Wn3_config initialisation dependent upon has_nway
-      (this came across from 3c575_cb).
-
-    LK1.1.6 06 Jun 2000, andrewm
-    - Backed out the PPC defines.
-    - Use del_timer_sync(), mod_timer().
-    - Fix wrapped ulong comparison in boomerang_rx()
-    - Add IS_TORNADO, use it to suppress 3c905C checksum error msg
-      (Donald Becker, I Lee Hetherington <ilh@sls.lcs.mit.edu>)
-    - Replace union wn3_config with BFINS/BFEXT manipulation for
-      sparc64 (Pete Zaitcev, Peter Jones)
-    - In vortex_error, do_tx_reset and vortex_tx_timeout(Vortex):
-      do a netif_wake_queue() to better recover from errors. (Anders Pedersen,
-      Donald Becker)
-    - Print a warning on out-of-memory (rate limited to 1 per 10 secs)
-    - Added two more Cardbus 575 NICs: 5b57 and 6564 (Paul Wagland)
-
-    LK1.1.7 2 Jul 2000 andrewm
-    - Better handling of shared IRQs
-    - Reset the transmitter on a Tx reclaim error
-    - Fixed crash under OOM during vortex_open() (Mark Hemment)
-    - Fix Rx cessation problem during OOM (help from Mark Hemment)
-    - The spinlocks around the mdio access were blocking interrupts for 300uS.
-      Fix all this to use spin_lock_bh() within mdio_read/write
-    - Only write to TxFreeThreshold if it's a boomerang - other NICs don't
-      have one.
-    - Added 802.3x MAC-layer flow control support
-
-   LK1.1.8 13 Aug 2000 andrewm
-    - Ignore request_region() return value - already reserved if Cardbus.
-    - Merged some additional Cardbus flags from Don's 0.99Qk
-    - Some fixes for 3c556 (Fred Maciel)
-    - Fix for EISA initialisation (Jan Rekorajski)
-    - Renamed MII_XCVR_PWR and EEPROM_230 to align with 3c575_cb and D. Becker's drivers
-    - Fixed MII_XCVR_PWR for 3CCFE575CT
-    - Added INVERT_LED_PWR, used it.
-    - Backed out the extra_reset stuff
-
-   LK1.1.9 12 Sep 2000 andrewm
-    - Backed out the tx_reset_resume flags.  It was a no-op.
-    - In vortex_error, don't reset the Tx on txReclaim errors
-    - In vortex_error, don't reset the Tx on maxCollisions errors.
-      Hence backed out all the DownListPtr logic here.
-    - In vortex_error, give Tornado cards a partial TxReset on
-      maxCollisions (David Hinds).  Defined MAX_COLLISION_RESET for this.
-    - Redid some driver flags and device names based on pcmcia_cs-3.1.20.
-    - Fixed a bug where, if vp->tx_full is set when the interface
-      is downed, it remains set when the interface is upped.  Bad
-      things happen.
-
-   LK1.1.10 17 Sep 2000 andrewm
-    - Added EEPROM_8BIT for 3c555 (Fred Maciel)
-    - Added experimental support for the 3c556B Laptop Hurricane (Louis Gerbarg)
-    - Add HAS_NWAY to "3c900 Cyclone 10Mbps TPO"
-
-   LK1.1.11 13 Nov 2000 andrewm
-    - Dump MOD_INC/DEC_USE_COUNT, use SET_MODULE_OWNER
-
-   LK1.1.12 1 Jan 2001 andrewm (2.4.0-pre1)
-    - Call pci_enable_device before we request our IRQ (Tobias Ringstrom)
-    - Add 3c590 PCI latency timer hack to vortex_probe1 (from 0.99Ra)
-    - Added extended issue_and_wait for the 3c905CX.
-    - Look for an MII on PHY index 24 first (3c905CX oddity).
-    - Add HAS_NWAY to 3cSOHO100-TX (Brett Frankenberger)
-    - Don't free skbs we don't own on oom path in vortex_open().
-
-   LK1.1.13 27 Jan 2001
-    - Added explicit `medialock' flag so we can truly
-      lock the media type down with `options'.
-    - "check ioremap return and some tidbits" (Arnaldo Carvalho de Melo <acme@conectiva.com.br>)
-    - Added and used EEPROM_NORESET for 3c556B PM resumes.
-    - Fixed leakage of vp->rx_ring.
-    - Break out separate HAS_HWCKSM device capability flag.
-    - Kill vp->tx_full (ANK)
-    - Merge zerocopy fragment handling (ANK?)
-
-   LK1.1.14 15 Feb 2001
-    - Enable WOL.  Can be turned on with `enable_wol' module option.
-    - EISA and PCI initialisation fixes (jgarzik, Manfred Spraul)
-    - If a device's internalconfig register reports it has NWAY,
-      use it, even if autoselect is enabled.
-
-   LK1.1.15 6 June 2001 akpm
-    - Prevent double counting of received bytes (Lars Christensen)
-    - Add ethtool support (jgarzik)
-    - Add module parm descriptions (Andrzej M. Krzysztofowicz)
-    - Implemented alloc_etherdev() API
-    - Special-case the 'Tx error 82' message.
-
-   LK1.1.16 18 July 2001 akpm
-    - Make NETIF_F_SG dependent upon nr_free_highpages(), not on CONFIG_HIGHMEM
-    - Lessen verbosity of bootup messages
-    - Fix WOL - use new PM API functions.
-    - Use netif_running() instead of vp->open in suspend/resume.
-    - Don't reset the interface logic on open/close/rmmod.  It upsets
-      autonegotiation, and hence DHCP (from 0.99T).
-    - Back out EEPROM_NORESET flag because of the above (we do it for all
-      NICs).
-    - Correct 3c982 identification string
-    - Rename wait_for_completion() to issue_and_wait() to avoid completion.h
-      clash.
-
-   LK1.1.17 18Dec01 akpm
-    - PCI ID 9805 is a Python-T, not a dual-port Cyclone.  Apparently.
-      And it has NWAY.
-    - Mask our advertised modes (vp->advertising) with our capabilities
-         (MII reg5) when deciding which duplex mode to use.
-    - Add `global_options' as default for options[].  Ditto global_enable_wol,
-      global_full_duplex.
-
-   LK1.1.18 01Jul02 akpm
-    - Fix for undocumented transceiver power-up bit on some 3c566B's
-      (Donald Becker, Rahul Karnik)
-
-    - See http://www.zip.com.au/~akpm/linux/#3c59x-2.3 for more details.
-    - Also see Documentation/networking/vortex.txt
-
-   LK1.1.19 10Nov02 Marc Zyngier <maz@wild-wind.fr.eu.org>
-    - EISA sysfs integration.
 */
 
 /*
@@ -236,7 +70,6 @@ static int vortex_debug = VORTEX_DEBUG;
 static int vortex_debug = 1;
 #endif
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -257,7 +90,7 @@ static int vortex_debug = 1;
 #include <linux/eisa.h>
 #include <linux/bitops.h>
 #include <linux/jiffies.h>
-#include <asm/irq.h>                   /* For NR_IRQS only. */
+#include <asm/irq.h>                   /* For nr_irqs only. */
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
@@ -269,8 +102,8 @@ static int vortex_debug = 1;
 #include <linux/delay.h>
 
 
-static char version[] __devinitdata =
-DRV_NAME ": Donald Becker and others. www.scyld.com/network/vortex.html\n";
+static const char version[] __devinitconst =
+       DRV_NAME ": Donald Becker and others.\n";
 
 MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
 MODULE_DESCRIPTION("3Com 3c59x/3c9xx ethernet driver ");
@@ -375,8 +208,7 @@ limit of 4K.
    of the drivers, and will likely be provided by some future kernel.
 */
 enum pci_flags_bit {
-       PCI_USES_IO=1, PCI_USES_MEM=2, PCI_USES_MASTER=4,
-       PCI_ADDR0=0x10<<0, PCI_ADDR1=0x10<<1, PCI_ADDR2=0x10<<2, PCI_ADDR3=0x10<<3,
+       PCI_USES_MASTER=4,
 };
 
 enum { IS_VORTEX=1, IS_BOOMERANG=2, IS_CYCLONE=4, IS_TORNADO=8,
@@ -446,95 +278,95 @@ static struct vortex_chip_info {
        int io_size;
 } vortex_info_tbl[] __devinitdata = {
        {"3c590 Vortex 10Mbps",
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c592 EISA 10Mbps Demon/Vortex",                                      /* AKPM: from Don's 3c59x_cb.c 0.49H */
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c597 EISA Fast Demon/Vortex",                                        /* AKPM: from Don's 3c59x_cb.c 0.49H */
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c595 Vortex 100baseTx",
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c595 Vortex 100baseT4",
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
 
        {"3c595 Vortex 100base-MII",
-        PCI_USES_IO|PCI_USES_MASTER, IS_VORTEX, 32, },
+        PCI_USES_MASTER, IS_VORTEX, 32, },
        {"3c900 Boomerang 10baseT",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
+        PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
        {"3c900 Boomerang 10Mbps Combo",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
+        PCI_USES_MASTER, IS_BOOMERANG|EEPROM_RESET, 64, },
        {"3c900 Cyclone 10Mbps TPO",                                            /* AKPM: from Don's 0.99M */
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
        {"3c900 Cyclone 10Mbps Combo",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
 
        {"3c900 Cyclone 10Mbps TPC",                                            /* AKPM: from Don's 0.99M */
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
        {"3c900B-FL Cyclone 10base-FL",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
        {"3c905 Boomerang 100baseTx",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
+        PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
        {"3c905 Boomerang 100baseT4",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
+        PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_RESET, 64, },
        {"3c905B Cyclone 100baseTx",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
 
        {"3c905B Cyclone 10/100/BNC",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3c905B-FX Cyclone 100baseFx",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
        {"3c905C Tornado",
-       PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+       PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
        {"3c920B-EMB-WNM (ATI Radeon 9100 IGP)",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_MII|HAS_HWCKSM, 128, },
        {"3c980 Cyclone",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
 
        {"3c980C Python-T",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3cSOHO100-TX Hurricane",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
        {"3c555 Laptop Hurricane",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|EEPROM_8BIT|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|EEPROM_8BIT|HAS_HWCKSM, 128, },
        {"3c556 Laptop Tornado",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_8BIT|HAS_CB_FNS|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_8BIT|HAS_CB_FNS|INVERT_MII_PWR|
                                                                        HAS_HWCKSM, 128, },
        {"3c556B Laptop Hurricane",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_OFFSET|HAS_CB_FNS|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|EEPROM_OFFSET|HAS_CB_FNS|INVERT_MII_PWR|
                                        WNO_XCVR_PWR|HAS_HWCKSM, 128, },
 
        {"3c575 [Megahertz] 10/100 LAN  CardBus",
-       PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
+       PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
        {"3c575 Boomerang CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
+        PCI_USES_MASTER, IS_BOOMERANG|HAS_MII|EEPROM_8BIT, 128, },
        {"3CCFE575BT Cyclone CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|
                                                                        INVERT_LED_PWR|HAS_HWCKSM, 128, },
        {"3CCFE575CT Tornado CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
                                                                        MAX_COLLISION_RESET|HAS_HWCKSM, 128, },
        {"3CCFE656 Cyclone CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
                                                                        INVERT_LED_PWR|HAS_HWCKSM, 128, },
 
        {"3CCFEM656B Cyclone+Winmodem CardBus",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
                                                                        INVERT_LED_PWR|HAS_HWCKSM, 128, },
        {"3CXFEM656C Tornado+Winmodem CardBus",                 /* From pcmcia-cs-3.1.5 */
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_CB_FNS|EEPROM_8BIT|INVERT_MII_PWR|
                                                                        MAX_COLLISION_RESET|HAS_HWCKSM, 128, },
        {"3c450 HomePNA Tornado",                                               /* AKPM: from Don's 0.99Q */
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3c920 Tornado",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
        {"3c982 Hydra Dual Port A",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
 
        {"3c982 Hydra Dual Port B",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_HWCKSM|HAS_NWAY, 128, },
        {"3c905B-T4",
-        PCI_USES_IO|PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
+        PCI_USES_MASTER, IS_CYCLONE|HAS_NWAY|HAS_HWCKSM|EXTRA_PREAMBLE, 128, },
        {"3c920B-EMB-WNM Tornado",
-        PCI_USES_IO|PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
+        PCI_USES_MASTER, IS_TORNADO|HAS_NWAY|HAS_HWCKSM, 128, },
 
        {NULL,}, /* NULL terminated list. */
 };
@@ -706,10 +538,10 @@ enum MasterCtrl {
 #define LAST_FRAG      0x80000000                      /* Last Addr/Len pair in descriptor. */
 #define DN_COMPLETE    0x00010000                      /* This packet has been downloaded */
 struct boom_rx_desc {
-       u32 next;                                       /* Last entry points to 0.   */
-       s32 status;
-       u32 addr;                                       /* Up to 63 addr/len pairs possible. */
-       s32 length;                                     /* Set LAST_FRAG to indicate last pair. */
+       __le32 next;                                    /* Last entry points to 0.   */
+       __le32 status;
+       __le32 addr;                                    /* Up to 63 addr/len pairs possible. */
+       __le32 length;                                  /* Set LAST_FRAG to indicate last pair. */
 };
 /* Values for the Rx status entry. */
 enum rx_desc_status {
@@ -726,16 +558,16 @@ enum rx_desc_status {
 #endif
 
 struct boom_tx_desc {
-       u32 next;                                       /* Last entry points to 0.   */
-       s32 status;                                     /* bits 0:12 length, others see below.  */
+       __le32 next;                                    /* Last entry points to 0.   */
+       __le32 status;                                  /* bits 0:12 length, others see below.  */
 #if DO_ZEROCOPY
        struct {
-               u32 addr;
-               s32 length;
+               __le32 addr;
+               __le32 length;
        } frag[1+MAX_SKB_FRAGS];
 #else
-               u32 addr;
-               s32 length;
+               __le32 addr;
+               __le32 length;
 #endif
 };
 
@@ -768,7 +600,6 @@ struct vortex_private {
        struct sk_buff* tx_skbuff[TX_RING_SIZE];
        unsigned int cur_rx, cur_tx;            /* The next free ring entry */
        unsigned int dirty_rx, dirty_tx;        /* The ring entries to be free()ed. */
-       struct net_device_stats stats;          /* Generic stats */
        struct vortex_extra_stats xstats;       /* NIC-specific extra stats */
        struct sk_buff *tx_skb;                         /* Packet being eaten by bus master ctrl.  */
        dma_addr_t tx_skb_dma;                          /* Allocated DMA address for bus master ctrl DMA.   */
@@ -873,7 +704,7 @@ static struct {
 
 static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,
                                   int chip_idx, int card_idx);
-static void vortex_up(struct net_device *dev);
+static int vortex_up(struct net_device *dev);
 static void vortex_down(struct net_device *dev, int final);
 static int vortex_open(struct net_device *dev);
 static void mdio_sync(void __iomem *ioaddr, int bits);
@@ -885,8 +716,8 @@ static int vortex_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int vortex_rx(struct net_device *dev);
 static int boomerang_rx(struct net_device *dev);
-static irqreturn_t vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-static irqreturn_t boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t vortex_interrupt(int irq, void *dev_id);
+static irqreturn_t boomerang_interrupt(int irq, void *dev_id);
 static int vortex_close(struct net_device *dev);
 static void dump_tx_ring(struct net_device *dev);
 static void update_stats(void __iomem *ioaddr, struct net_device *dev);
@@ -897,7 +728,7 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 #endif
 static void vortex_tx_timeout(struct net_device *dev);
 static void acpi_set_WOL(struct net_device *dev);
-static struct ethtool_ops vortex_ethtool_ops;
+static const struct ethtool_ops vortex_ethtool_ops;
 static void set_8021q_mode(struct net_device *dev, int enable);
 
 /* This driver uses 'options' to pass the media type, full-duplex flag, etc. */
@@ -960,11 +791,10 @@ static void poll_vortex(struct net_device *dev)
 {
        struct vortex_private *vp = netdev_priv(dev);
        unsigned long flags;
-       local_save_flags(flags);
-       local_irq_disable();
-       (vp->full_bus_master_rx ? boomerang_interrupt:vortex_interrupt)(dev->irq,dev,NULL);
+       local_irq_save(flags);
+       (vp->full_bus_master_rx ? boomerang_interrupt:vortex_interrupt)(dev->irq,dev);
        local_irq_restore(flags);
-} 
+}
 #endif
 
 #ifdef CONFIG_PM
@@ -973,7 +803,7 @@ static int vortex_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
 
-       if (dev && dev->priv) {
+       if (dev && netdev_priv(dev)) {
                if (netif_running(dev)) {
                        netif_device_detach(dev);
                        vortex_down(dev, 1);
@@ -991,21 +821,30 @@ static int vortex_resume(struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
        struct vortex_private *vp = netdev_priv(dev);
+       int err;
 
        if (dev && vp) {
                pci_set_power_state(pdev, PCI_D0);
                pci_restore_state(pdev);
-               pci_enable_device(pdev);
+               err = pci_enable_device(pdev);
+               if (err) {
+                       printk(KERN_WARNING "%s: Could not enable device \n",
+                               dev->name);
+                       return err;
+               }
                pci_set_master(pdev);
                if (request_irq(dev->irq, vp->full_bus_master_rx ?
-                               &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev)) {
+                               &boomerang_interrupt : &vortex_interrupt, IRQF_SHARED, dev->name, dev)) {
                        printk(KERN_WARNING "%s: Could not reserve IRQ %d\n", dev->name, dev->irq);
                        pci_disable_device(pdev);
                        return -EBUSY;
                }
                if (netif_running(dev)) {
-                       vortex_up(dev);
-                       netif_device_attach(dev);
+                       err = vortex_up(dev);
+                       if (err)
+                               return err;
+                       else
+                               netif_device_attach(dev);
                }
        }
        return 0;
@@ -1019,20 +858,9 @@ static struct eisa_device_id vortex_eisa_ids[] = {
        { "TCM5970", CH_3C597 },
        { "" }
 };
+MODULE_DEVICE_TABLE(eisa, vortex_eisa_ids);
 
-static int vortex_eisa_probe(struct device *device);
-static int vortex_eisa_remove(struct device *device);
-
-static struct eisa_driver vortex_eisa_driver = {
-       .id_table = vortex_eisa_ids,
-       .driver   = {
-               .name    = "3c59x",
-               .probe   = vortex_eisa_probe,
-               .remove  = vortex_eisa_remove
-       }
-};
-
-static int vortex_eisa_probe(struct device *device)
+static int __init vortex_eisa_probe(struct device *device)
 {
        void __iomem *ioaddr;
        struct eisa_device *edev;
@@ -1055,7 +883,7 @@ static int vortex_eisa_probe(struct device *device)
        return 0;
 }
 
-static int vortex_eisa_remove(struct device *device)
+static int __devexit vortex_eisa_remove(struct device *device)
 {
        struct eisa_device *edev;
        struct net_device *dev;
@@ -1072,7 +900,7 @@ static int vortex_eisa_remove(struct device *device)
 
        vp = netdev_priv(dev);
        ioaddr = vp->ioaddr;
-       
+
        unregister_netdev(dev);
        iowrite16(TotalReset|0x14, ioaddr + EL3_CMD);
        release_region(dev->base_addr, VORTEX_TOTAL_SIZE);
@@ -1080,7 +908,17 @@ static int vortex_eisa_remove(struct device *device)
        free_netdev(dev);
        return 0;
 }
-#endif
+
+static struct eisa_driver vortex_eisa_driver = {
+       .id_table = vortex_eisa_ids,
+       .driver   = {
+               .name    = "3c59x",
+               .probe   = vortex_eisa_probe,
+               .remove  = __devexit_p(vortex_eisa_remove)
+       }
+};
+
+#endif /* CONFIG_EISA */
 
 /* returns count found (>= 0), or negative on error */
 static int __init vortex_eisa_init(void)
@@ -1103,7 +941,7 @@ static int __init vortex_eisa_init(void)
                eisa_found = 1;
        }
 #endif
-       
+
        /* Special code to work-around the Compaq PCI BIOS32 problem. */
        if (compaq_ioaddr) {
                vortex_probe1(NULL, ioport_map(compaq_ioaddr, VORTEX_TOTAL_SIZE),
@@ -1121,7 +959,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,
        struct vortex_chip_info *vci;
        void __iomem *ioaddr;
 
-       /* wake up and enable device */         
+       /* wake up and enable device */
        rc = pci_enable_device(pdev);
        if (rc < 0)
                goto out;
@@ -1154,6 +992,42 @@ out:
        return rc;
 }
 
+static const struct net_device_ops boomrang_netdev_ops = {
+       .ndo_open               = vortex_open,
+       .ndo_stop               = vortex_close,
+       .ndo_start_xmit         = boomerang_start_xmit,
+       .ndo_tx_timeout         = vortex_tx_timeout,
+       .ndo_get_stats          = vortex_get_stats,
+#ifdef CONFIG_PCI
+       .ndo_do_ioctl           = vortex_ioctl,
+#endif
+       .ndo_set_multicast_list = set_rx_mode,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = poll_vortex,
+#endif
+};
+
+static const struct net_device_ops vortex_netdev_ops = {
+       .ndo_open               = vortex_open,
+       .ndo_stop               = vortex_close,
+       .ndo_start_xmit         = vortex_start_xmit,
+       .ndo_tx_timeout         = vortex_tx_timeout,
+       .ndo_get_stats          = vortex_get_stats,
+#ifdef CONFIG_PCI
+       .ndo_do_ioctl           = vortex_ioctl,
+#endif
+       .ndo_set_multicast_list = set_rx_mode,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = poll_vortex,
+#endif
+};
+
 /*
  * Start up the PCI/EISA device which is described by *gendev.
  * Return 0 on success.
@@ -1172,7 +1046,7 @@ static int __devinit vortex_probe1(struct device *gendev,
        static int printed_version;
        int retval, print_info;
        struct vortex_chip_info * const vci = &vortex_info_tbl[chip_idx];
-       char *print_name = "3c59x";
+       const char *print_name = "3c59x";
        struct pci_dev *pdev = NULL;
        struct eisa_device *edev = NULL;
 
@@ -1187,7 +1061,7 @@ static int __devinit vortex_probe1(struct device *gendev,
                }
 
                if ((edev = DEVICE_EISA(gendev))) {
-                       print_name = edev->dev.bus_id;
+                       print_name = dev_name(&edev->dev);
                }
        }
 
@@ -1197,7 +1071,6 @@ static int __devinit vortex_probe1(struct device *gendev,
                printk (KERN_ERR PFX "unable to allocate etherdev, aborting\n");
                goto out;
        }
-       SET_MODULE_OWNER(dev);
        SET_NETDEV_DEV(dev, gendev);
        vp = netdev_priv(dev);
 
@@ -1257,7 +1130,7 @@ static int __devinit vortex_probe1(struct device *gendev,
                if (request_region(dev->base_addr, vci->io_size, print_name) != NULL)
                        vp->must_free_region = 1;
 
-               /* enable bus-mastering if necessary */         
+               /* enable bus-mastering if necessary */
                if (vci->flags & PCI_USES_MASTER)
                        pci_set_master(pdev);
 
@@ -1292,14 +1165,14 @@ static int __devinit vortex_probe1(struct device *gendev,
                                           + sizeof(struct boom_tx_desc) * TX_RING_SIZE,
                                           &vp->rx_ring_dma);
        retval = -ENOMEM;
-       if (vp->rx_ring == 0)
+       if (!vp->rx_ring)
                goto free_region;
 
        vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring + RX_RING_SIZE);
        vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE;
 
        /* if we are a PCI driver, we store info in pdev->driver_data
-        * instead of a module list */  
+        * instead of a module list */
        if (pdev)
                pci_set_drvdata(pdev, dev);
        if (edev)
@@ -1365,12 +1238,10 @@ static int __devinit vortex_probe1(struct device *gendev,
        if ((checksum != 0x00) && !(vci->drv_flags & IS_TORNADO))
                printk(" ***INVALID CHECKSUM %4.4x*** ", checksum);
        for (i = 0; i < 3; i++)
-               ((u16 *)dev->dev_addr)[i] = htons(eeprom[i + 10]);
+               ((__be16 *)dev->dev_addr)[i] = htons(eeprom[i + 10]);
        memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
-       if (print_info) {
-               for (i = 0; i < 6; i++)
-                       printk("%c%2.2x", i ? ':' : ' ', dev->dev_addr[i]);
-       }
+       if (print_info)
+               printk(" %pM", dev->dev_addr);
        /* Unfortunately an all zero eeprom passes the checksum and this
           gets found in the wild in failure cases. Crypto is hard 8) */
        if (!is_valid_ether_addr(dev->dev_addr)) {
@@ -1382,17 +1253,12 @@ static int __devinit vortex_probe1(struct device *gendev,
        for (i = 0; i < 6; i++)
                iowrite8(dev->dev_addr[i], ioaddr + i);
 
-#ifdef __sparc__
-       if (print_info)
-               printk(", IRQ %s\n", __irq_itoa(dev->irq));
-#else
        if (print_info)
                printk(", IRQ %d\n", dev->irq);
        /* Tell them about an invalid IRQ. */
-       if (dev->irq <= 0 || dev->irq >= NR_IRQS)
+       if (dev->irq <= 0 || dev->irq >= nr_irqs)
                printk(KERN_WARNING " *** Warning: IRQ %d is unlikely to work! ***\n",
                           dev->irq);
-#endif
 
        EL3WINDOW(4);
        step = (ioread8(ioaddr + Wn4_NetDiag) & 0x1e) >> 1;
@@ -1413,8 +1279,10 @@ static int __devinit vortex_probe1(struct device *gendev,
                }
 
                if (print_info) {
-                       printk(KERN_INFO "%s: CardBus functions mapped %8.8lx->%p\n",
-                               print_name, pci_resource_start(pdev, 2),
+                       printk(KERN_INFO "%s: CardBus functions mapped "
+                               "%16.16llx->%p\n",
+                               print_name,
+                               (unsigned long long)pci_resource_start(pdev, 2),
                                vp->cb_fn_base);
                }
                EL3WINDOW(2);
@@ -1534,18 +1402,16 @@ static int __devinit vortex_probe1(struct device *gendev,
        }
 
        /* The 3c59x-specific entries in the device structure. */
-       dev->open = vortex_open;
        if (vp->full_bus_master_tx) {
-               dev->hard_start_xmit = boomerang_start_xmit;
+               dev->netdev_ops = &boomrang_netdev_ops;
                /* Actually, it still should work with iommu. */
                if (card_idx < MAX_UNITS &&
                    ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) ||
                                hw_checksums[card_idx] == 1)) {
                        dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
                }
-       } else {
-               dev->hard_start_xmit = vortex_start_xmit;
-       }
+       } else
+               dev->netdev_ops =  &vortex_netdev_ops;
 
        if (print_info) {
                printk(KERN_INFO "%s: scatter/gather %sabled. h/w checksums %sabled\n",
@@ -1554,18 +1420,9 @@ static int __devinit vortex_probe1(struct device *gendev,
                                (dev->features & NETIF_F_IP_CSUM) ? "en":"dis");
        }
 
-       dev->stop = vortex_close;
-       dev->get_stats = vortex_get_stats;
-#ifdef CONFIG_PCI
-       dev->do_ioctl = vortex_ioctl;
-#endif
        dev->ethtool_ops = &vortex_ethtool_ops;
-       dev->set_multicast_list = set_rx_mode;
-       dev->tx_timeout = vortex_tx_timeout;
        dev->watchdog_timeo = (watchdog * HZ) / 1000;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = poll_vortex; 
-#endif
+
        if (pdev) {
                vp->pm_state_valid = 1;
                pci_save_state(VORTEX_PCI(vp));
@@ -1651,19 +1508,24 @@ static void vortex_check_media(struct net_device *dev, unsigned int init)
        }
 }
 
-static void
+static int
 vortex_up(struct net_device *dev)
 {
        struct vortex_private *vp = netdev_priv(dev);
        void __iomem *ioaddr = vp->ioaddr;
        unsigned int config;
-       int i, mii_reg1, mii_reg5;
+       int i, mii_reg1, mii_reg5, err = 0;
 
        if (VORTEX_PCI(vp)) {
                pci_set_power_state(VORTEX_PCI(vp), PCI_D0);    /* Go active */
                if (vp->pm_state_valid)
                        pci_restore_state(VORTEX_PCI(vp));
-               pci_enable_device(VORTEX_PCI(vp));
+               err = pci_enable_device(VORTEX_PCI(vp));
+               if (err) {
+                       printk(KERN_WARNING "%s: Could not enable device \n",
+                               dev->name);
+                       goto err_out;
+               }
        }
 
        /* Before initializing select the active media port. */
@@ -1722,6 +1584,7 @@ vortex_up(struct net_device *dev)
                mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
                mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
                vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);
+               vp->mii.full_duplex = vp->full_duplex;
 
                vortex_check_media(dev, 1);
        }
@@ -1827,6 +1690,8 @@ vortex_up(struct net_device *dev)
        if (vp->cb_fn_base)                     /* The PCMCIA people are idiots.  */
                iowrite32(0x8000, vp->cb_fn_base + 4);
        netif_start_queue (dev);
+err_out:
+       return err;
 }
 
 static int
@@ -1838,9 +1703,9 @@ vortex_open(struct net_device *dev)
 
        /* Use the now-standard shared IRQ implementation. */
        if ((retval = request_irq(dev->irq, vp->full_bus_master_rx ?
-                               &boomerang_interrupt : &vortex_interrupt, SA_SHIRQ, dev->name, dev))) {
+                               &boomerang_interrupt : &vortex_interrupt, IRQF_SHARED, dev->name, dev))) {
                printk(KERN_ERR "%s: Could not reserve IRQ %d\n", dev->name, dev->irq);
-               goto out;
+               goto err;
        }
 
        if (vp->full_bus_master_rx) { /* Boomerang bus master. */
@@ -1851,12 +1716,14 @@ vortex_open(struct net_device *dev)
                        vp->rx_ring[i].next = cpu_to_le32(vp->rx_ring_dma + sizeof(struct boom_rx_desc) * (i+1));
                        vp->rx_ring[i].status = 0;      /* Clear complete bit. */
                        vp->rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ | LAST_FRAG);
-                       skb = dev_alloc_skb(PKT_BUF_SZ);
+
+                       skb = __netdev_alloc_skb(dev, PKT_BUF_SZ + NET_IP_ALIGN,
+                                                GFP_KERNEL);
                        vp->rx_skbuff[i] = skb;
                        if (skb == NULL)
                                break;                  /* Bad news!  */
-                       skb->dev = dev;                 /* Mark as being used by this device. */
-                       skb_reserve(skb, 2);    /* Align IP on 16 byte boundaries */
+
+                       skb_reserve(skb, NET_IP_ALIGN); /* Align IP on 16 byte boundaries */
                        vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));
                }
                if (i != RX_RING_SIZE) {
@@ -1869,20 +1736,22 @@ vortex_open(struct net_device *dev)
                                }
                        }
                        retval = -ENOMEM;
-                       goto out_free_irq;
+                       goto err_free_irq;
                }
                /* Wrap the ring. */
                vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma);
        }
 
-       vortex_up(dev);
-       return 0;
+       retval = vortex_up(dev);
+       if (!retval)
+               goto out;
 
-out_free_irq:
+err_free_irq:
        free_irq(dev->irq, dev);
-out:
+err:
        if (vortex_debug > 1)
                printk(KERN_ERR "%s: vortex_open() fails: returning %d\n", dev->name, retval);
+out:
        return retval;
 }
 
@@ -1902,7 +1771,7 @@ vortex_timer(unsigned long data)
                printk(KERN_DEBUG "dev->watchdog_timeo=%d\n", dev->watchdog_timeo);
        }
 
-       disable_irq(dev->irq);
+       disable_irq_lockdep(dev->irq);
        old_window = ioread16(ioaddr + EL3_CMD) >> 13;
        EL3WINDOW(4);
        media_status = ioread16(ioaddr + Wn4_Media);
@@ -1925,9 +1794,10 @@ vortex_timer(unsigned long data)
        case XCVR_MII: case XCVR_NWAY:
                {
                        ok = 1;
-                       spin_lock_bh(&vp->lock);
+                       /* Interrupts are already disabled */
+                       spin_lock(&vp->lock);
                        vortex_check_media(dev, 0);
-                       spin_unlock_bh(&vp->lock);
+                       spin_unlock(&vp->lock);
                }
                break;
          default:                                      /* Other media types handled by Tx timeouts. */
@@ -1983,7 +1853,7 @@ leave_media_alone:
                         dev->name, media_tbl[dev->if_port].name);
 
        EL3WINDOW(old_window);
-       enable_irq(dev->irq);
+       enable_irq_lockdep(dev->irq);
        mod_timer(&vp->timer, RUN_AT(next_tick));
        if (vp->deferred)
                iowrite16(FakeIntr, ioaddr + EL3_CMD);
@@ -2019,9 +1889,9 @@ static void vortex_tx_timeout(struct net_device *dev)
                        unsigned long flags;
                        local_irq_save(flags);
                        if (vp->full_bus_master_tx)
-                               boomerang_interrupt(dev->irq, dev, NULL);
+                               boomerang_interrupt(dev->irq, dev);
                        else
-                               vortex_interrupt(dev->irq, dev, NULL);
+                               vortex_interrupt(dev->irq, dev);
                        local_irq_restore(flags);
                }
        }
@@ -2031,7 +1901,7 @@ static void vortex_tx_timeout(struct net_device *dev)
 
        issue_and_wait(dev, TxReset);
 
-       vp->stats.tx_errors++;
+       dev->stats.tx_errors++;
        if (vp->full_bus_master_tx) {
                printk(KERN_DEBUG "%s: Resetting the Tx ring pointer.\n", dev->name);
                if (vp->cur_tx - vp->dirty_tx > 0  &&  ioread32(ioaddr + DownListPtr) == 0)
@@ -2043,14 +1913,14 @@ static void vortex_tx_timeout(struct net_device *dev)
                        iowrite8(PKT_BUF_SZ>>8, ioaddr + TxFreeThreshold);
                iowrite16(DownUnstall, ioaddr + EL3_CMD);
        } else {
-               vp->stats.tx_dropped++;
+               dev->stats.tx_dropped++;
                netif_wake_queue(dev);
        }
-       
+
        /* Issue Tx Enable */
        iowrite16(TxEnable, ioaddr + EL3_CMD);
        dev->trans_start = jiffies;
-       
+
        /* Switch to register set 7 for normal use. */
        EL3WINDOW(7);
 }
@@ -2084,8 +1954,8 @@ vortex_error(struct net_device *dev, int status)
                        }
                        dump_tx_ring(dev);
                }
-               if (tx_status & 0x14)  vp->stats.tx_fifo_errors++;
-               if (tx_status & 0x38)  vp->stats.tx_aborted_errors++;
+               if (tx_status & 0x14)  dev->stats.tx_fifo_errors++;
+               if (tx_status & 0x38)  dev->stats.tx_aborted_errors++;
                if (tx_status & 0x08)  vp->xstats.tx_max_collisions++;
                iowrite8(0, ioaddr + TxStatus);
                if (tx_status & 0x30) {                 /* txJabber or txUnderrun */
@@ -2207,8 +2077,8 @@ vortex_start_xmit(struct sk_buff *skb, struct net_device *dev)
                                if (vortex_debug > 2)
                                  printk(KERN_DEBUG "%s: Tx error, status %2.2x.\n",
                                                 dev->name, tx_status);
-                               if (tx_status & 0x04) vp->stats.tx_fifo_errors++;
-                               if (tx_status & 0x38) vp->stats.tx_aborted_errors++;
+                               if (tx_status & 0x04) dev->stats.tx_fifo_errors++;
+                               if (tx_status & 0x38) dev->stats.tx_aborted_errors++;
                                if (tx_status & 0x30) {
                                        issue_and_wait(dev, TxReset);
                                }
@@ -2248,7 +2118,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        vp->tx_ring[entry].next = 0;
 #if DO_ZEROCOPY
-       if (skb->ip_summed != CHECKSUM_HW)
+       if (skb->ip_summed != CHECKSUM_PARTIAL)
                        vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded);
        else
                        vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum);
@@ -2319,7 +2189,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
  */
 
 static irqreturn_t
-vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+vortex_interrupt(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct vortex_private *vp = netdev_priv(dev);
@@ -2424,7 +2294,7 @@ handler_exit:
  */
 
 static irqreturn_t
-boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+boomerang_interrupt(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct vortex_private *vp = netdev_priv(dev);
@@ -2487,10 +2357,10 @@ boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                if ((vp->tx_ring[entry].status & DN_COMPLETE) == 0)
                                        break;                  /* It still hasn't been processed. */
 #endif
-                                       
+
                                if (vp->tx_skbuff[entry]) {
                                        struct sk_buff *skb = vp->tx_skbuff[entry];
-#if DO_ZEROCOPY                                        
+#if DO_ZEROCOPY
                                        int i;
                                        for (i=0; i<=skb_shinfo(skb)->nr_frags; i++)
                                                        pci_unmap_single(VORTEX_PCI(vp),
@@ -2506,7 +2376,7 @@ boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                } else {
                                        printk(KERN_DEBUG "boomerang_interrupt: no skb!\n");
                                }
-                               /* vp->stats.tx_packets++;  Counted below. */
+                               /* dev->stats.tx_packets++;  Counted below. */
                                dirty_tx++;
                        }
                        vp->dirty_tx = dirty_tx;
@@ -2565,12 +2435,12 @@ static int vortex_rx(struct net_device *dev)
                        unsigned char rx_error = ioread8(ioaddr + RxErrors);
                        if (vortex_debug > 2)
                                printk(KERN_DEBUG " Rx error: status %2.2x.\n", rx_error);
-                       vp->stats.rx_errors++;
-                       if (rx_error & 0x01)  vp->stats.rx_over_errors++;
-                       if (rx_error & 0x02)  vp->stats.rx_length_errors++;
-                       if (rx_error & 0x04)  vp->stats.rx_frame_errors++;
-                       if (rx_error & 0x08)  vp->stats.rx_crc_errors++;
-                       if (rx_error & 0x10)  vp->stats.rx_length_errors++;
+                       dev->stats.rx_errors++;
+                       if (rx_error & 0x01)  dev->stats.rx_over_errors++;
+                       if (rx_error & 0x02)  dev->stats.rx_length_errors++;
+                       if (rx_error & 0x04)  dev->stats.rx_frame_errors++;
+                       if (rx_error & 0x08)  dev->stats.rx_crc_errors++;
+                       if (rx_error & 0x10)  dev->stats.rx_length_errors++;
                } else {
                        /* The packet length: up to 4.5K!. */
                        int pkt_len = rx_status & 0x1fff;
@@ -2581,7 +2451,6 @@ static int vortex_rx(struct net_device *dev)
                                printk(KERN_DEBUG "Receiving packet size %d status %4.4x.\n",
                                           pkt_len, rx_status);
                        if (skb != NULL) {
-                               skb->dev = dev;
                                skb_reserve(skb, 2);    /* Align IP on 16 byte boundaries */
                                /* 'skb_put()' points to the start of sk_buff data area. */
                                if (vp->bus_master &&
@@ -2602,8 +2471,7 @@ static int vortex_rx(struct net_device *dev)
                                iowrite16(RxDiscard, ioaddr + EL3_CMD); /* Pop top Rx packet. */
                                skb->protocol = eth_type_trans(skb, dev);
                                netif_rx(skb);
-                               dev->last_rx = jiffies;
-                               vp->stats.rx_packets++;
+                               dev->stats.rx_packets++;
                                /* Wait a limited time to go to next packet. */
                                for (i = 200; i >= 0; i--)
                                        if ( ! (ioread16(ioaddr + EL3_STATUS) & CmdInProgress))
@@ -2612,7 +2480,7 @@ static int vortex_rx(struct net_device *dev)
                        } else if (vortex_debug > 0)
                                printk(KERN_NOTICE "%s: No memory to allocate a sk_buff of "
                                           "size %d.\n", dev->name, pkt_len);
-                       vp->stats.rx_dropped++;
+                       dev->stats.rx_dropped++;
                }
                issue_and_wait(dev, RxDiscard);
        }
@@ -2639,12 +2507,12 @@ boomerang_rx(struct net_device *dev)
                        unsigned char rx_error = rx_status >> 16;
                        if (vortex_debug > 2)
                                printk(KERN_DEBUG " Rx error: status %2.2x.\n", rx_error);
-                       vp->stats.rx_errors++;
-                       if (rx_error & 0x01)  vp->stats.rx_over_errors++;
-                       if (rx_error & 0x02)  vp->stats.rx_length_errors++;
-                       if (rx_error & 0x04)  vp->stats.rx_frame_errors++;
-                       if (rx_error & 0x08)  vp->stats.rx_crc_errors++;
-                       if (rx_error & 0x10)  vp->stats.rx_length_errors++;
+                       dev->stats.rx_errors++;
+                       if (rx_error & 0x01)  dev->stats.rx_over_errors++;
+                       if (rx_error & 0x02)  dev->stats.rx_length_errors++;
+                       if (rx_error & 0x04)  dev->stats.rx_frame_errors++;
+                       if (rx_error & 0x08)  dev->stats.rx_crc_errors++;
+                       if (rx_error & 0x10)  dev->stats.rx_length_errors++;
                } else {
                        /* The packet length: up to 4.5K!. */
                        int pkt_len = rx_status & 0x1fff;
@@ -2657,8 +2525,7 @@ boomerang_rx(struct net_device *dev)
 
                        /* Check if the packet is long enough to just accept without
                           copying to a properly sized skbuff. */
-                       if (pkt_len < rx_copybreak && (skb = dev_alloc_skb(pkt_len + 2)) != 0) {
-                               skb->dev = dev;
+                       if (pkt_len < rx_copybreak && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
                                skb_reserve(skb, 2);    /* Align IP on 16 byte boundaries */
                                pci_dma_sync_single_for_cpu(VORTEX_PCI(vp), dma, PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
                                /* 'skb_put()' points to the start of sk_buff data area. */
@@ -2686,8 +2553,7 @@ boomerang_rx(struct net_device *dev)
                                }
                        }
                        netif_rx(skb);
-                       dev->last_rx = jiffies;
-                       vp->stats.rx_packets++;
+                       dev->stats.rx_packets++;
                }
                entry = (++vp->cur_rx) % RX_RING_SIZE;
        }
@@ -2696,7 +2562,7 @@ boomerang_rx(struct net_device *dev)
                struct sk_buff *skb;
                entry = vp->dirty_rx % RX_RING_SIZE;
                if (vp->rx_skbuff[entry] == NULL) {
-                       skb = dev_alloc_skb(PKT_BUF_SZ);
+                       skb = netdev_alloc_skb(dev, PKT_BUF_SZ + NET_IP_ALIGN);
                        if (skb == NULL) {
                                static unsigned long last_jif;
                                if (time_after(jiffies, last_jif + 10 * HZ)) {
@@ -2707,8 +2573,8 @@ boomerang_rx(struct net_device *dev)
                                        mod_timer(&vp->rx_oom_timer, RUN_AT(HZ * 1));
                                break;                  /* Bad news!  */
                        }
-                       skb->dev = dev;                 /* Mark as being used by this device. */
-                       skb_reserve(skb, 2);    /* Align IP on 16 byte boundaries */
+
+                       skb_reserve(skb, NET_IP_ALIGN);
                        vp->rx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE));
                        vp->rx_skbuff[entry] = skb;
                }
@@ -2749,7 +2615,7 @@ vortex_down(struct net_device *dev, int final_down)
        del_timer_sync(&vp->rx_oom_timer);
        del_timer_sync(&vp->timer);
 
-       /* Turn off statistics ASAP.  We update vp->stats below. */
+       /* Turn off statistics ASAP.  We update dev->stats below. */
        iowrite16(StatsDisable, ioaddr + EL3_CMD);
 
        /* Disable the receiver and transmitter. */
@@ -2804,7 +2670,7 @@ vortex_close(struct net_device *dev)
                                                "not using them!\n", dev->name);
        }
 #endif
-               
+
        free_irq(dev->irq, dev);
 
        if (vp->full_bus_master_rx) { /* Free Boomerang bus master Rx buffers. */
@@ -2846,7 +2712,7 @@ dump_tx_ring(struct net_device *dev)
        if (vortex_debug > 0) {
        struct vortex_private *vp = netdev_priv(dev);
                void __iomem *ioaddr = vp->ioaddr;
-               
+
                if (vp->full_bus_master_tx) {
                        int i;
                        int stalled = ioread32(ioaddr + PktStatus) & 0x04;      /* Possible racy. But it's only debug stuff */
@@ -2886,7 +2752,7 @@ static struct net_device_stats *vortex_get_stats(struct net_device *dev)
                update_stats(ioaddr, dev);
                spin_unlock_irqrestore (&vp->lock, flags);
        }
-       return &vp->stats;
+       return &dev->stats;
 }
 
 /*  Update statistics.
@@ -2906,18 +2772,18 @@ static void update_stats(void __iomem *ioaddr, struct net_device *dev)
        /* Unlike the 3c5x9 we need not turn off stats updates while reading. */
        /* Switch to the stats window, and read everything. */
        EL3WINDOW(6);
-       vp->stats.tx_carrier_errors             += ioread8(ioaddr + 0);
-       vp->stats.tx_heartbeat_errors           += ioread8(ioaddr + 1);
-       vp->stats.tx_window_errors              += ioread8(ioaddr + 4);
-       vp->stats.rx_fifo_errors                += ioread8(ioaddr + 5);
-       vp->stats.tx_packets                    += ioread8(ioaddr + 6);
-       vp->stats.tx_packets                    += (ioread8(ioaddr + 9)&0x30) << 4;
+       dev->stats.tx_carrier_errors            += ioread8(ioaddr + 0);
+       dev->stats.tx_heartbeat_errors          += ioread8(ioaddr + 1);
+       dev->stats.tx_window_errors             += ioread8(ioaddr + 4);
+       dev->stats.rx_fifo_errors               += ioread8(ioaddr + 5);
+       dev->stats.tx_packets                   += ioread8(ioaddr + 6);
+       dev->stats.tx_packets                   += (ioread8(ioaddr + 9)&0x30) << 4;
        /* Rx packets   */                      ioread8(ioaddr + 7);   /* Must read to clear */
        /* Don't bother with register 9, an extension of registers 6&7.
           If we do use the 6&7 values the atomic update assumption above
           is invalid. */
-       vp->stats.rx_bytes                      += ioread16(ioaddr + 10);
-       vp->stats.tx_bytes                      += ioread16(ioaddr + 12);
+       dev->stats.rx_bytes                     += ioread16(ioaddr + 10);
+       dev->stats.tx_bytes                     += ioread16(ioaddr + 12);
        /* Extra stats for get_ethtool_stats() */
        vp->xstats.tx_multiple_collisions       += ioread8(ioaddr + 2);
        vp->xstats.tx_single_collisions         += ioread8(ioaddr + 3);
@@ -2925,14 +2791,14 @@ static void update_stats(void __iomem *ioaddr, struct net_device *dev)
        EL3WINDOW(4);
        vp->xstats.rx_bad_ssd                   += ioread8(ioaddr + 12);
 
-       vp->stats.collisions = vp->xstats.tx_multiple_collisions
+       dev->stats.collisions = vp->xstats.tx_multiple_collisions
                + vp->xstats.tx_single_collisions
                + vp->xstats.tx_max_collisions;
 
        {
                u8 up = ioread8(ioaddr + 13);
-               vp->stats.rx_bytes += (up & 0x0f) << 16;
-               vp->stats.tx_bytes += (up & 0xf0) << 12;
+               dev->stats.rx_bytes += (up & 0x0f) << 16;
+               dev->stats.tx_bytes += (up & 0xf0) << 12;
        }
 
        EL3WINDOW(old_window >> 13);
@@ -2991,9 +2857,14 @@ static void vortex_set_msglevel(struct net_device *dev, u32 dbg)
        vortex_debug = dbg;
 }
 
-static int vortex_get_stats_count(struct net_device *dev)
+static int vortex_get_sset_count(struct net_device *dev, int sset)
 {
-       return VORTEX_NUM_STATS;
+       switch (sset) {
+       case ETH_SS_STATS:
+               return VORTEX_NUM_STATS;
+       default:
+               return -EOPNOTSUPP;
+       }
 }
 
 static void vortex_get_ethtool_stats(struct net_device *dev,
@@ -3037,25 +2908,24 @@ static void vortex_get_drvinfo(struct net_device *dev,
                strcpy(info->bus_info, pci_name(VORTEX_PCI(vp)));
        } else {
                if (VORTEX_EISA(vp))
-                       sprintf(info->bus_info, vp->gendev->bus_id);
+                       strcpy(info->bus_info, dev_name(vp->gendev));
                else
                        sprintf(info->bus_info, "EISA 0x%lx %d",
                                        dev->base_addr, dev->irq);
        }
 }
 
-static struct ethtool_ops vortex_ethtool_ops = {
+static const struct ethtool_ops vortex_ethtool_ops = {
        .get_drvinfo            = vortex_get_drvinfo,
        .get_strings            = vortex_get_strings,
        .get_msglevel           = vortex_get_msglevel,
        .set_msglevel           = vortex_set_msglevel,
        .get_ethtool_stats      = vortex_get_ethtool_stats,
-       .get_stats_count        = vortex_get_stats_count,
+       .get_sset_count         = vortex_get_sset_count,
        .get_settings           = vortex_get_settings,
        .set_settings           = vortex_set_settings,
        .get_link               = ethtool_op_get_link,
        .nway_reset             = vortex_nway_reset,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 #ifdef CONFIG_PCI
@@ -3068,7 +2938,7 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        struct vortex_private *vp = netdev_priv(dev);
        void __iomem *ioaddr = vp->ioaddr;
        unsigned long flags;
-       int state = 0;
+       pci_power_t state = 0;
 
        if(VORTEX_PCI(vp))
                state = VORTEX_PCI(vp)->current_state;
@@ -3099,7 +2969,7 @@ static void set_rx_mode(struct net_device *dev)
        int new_mode;
 
        if (dev->flags & IFF_PROMISC) {
-               if (vortex_debug > 0)
+               if (vortex_debug > 3)
                        printk(KERN_NOTICE "%s: Setting promiscuous mode.\n", dev->name);
                new_mode = SetRxFilter|RxStation|RxMulticast|RxBroadcast|RxProm;
        } else  if ((dev->mc_list)  ||  (dev->flags & IFF_ALLMULTI)) {
@@ -3264,6 +3134,8 @@ static void acpi_set_WOL(struct net_device *dev)
        struct vortex_private *vp = netdev_priv(dev);
        void __iomem *ioaddr = vp->ioaddr;
 
+       device_set_wakeup_enable(vp->gendev, vp->enable_wol);
+
        if (vp->enable_wol) {
                /* Power up on: 1==Downloaded Filter, 2==Magic Packets, 4==Link Status. */
                EL3WINDOW(7);
@@ -3272,7 +3144,13 @@ static void acpi_set_WOL(struct net_device *dev)
                iowrite16(SetRxFilter|RxStation|RxMulticast|RxBroadcast, ioaddr + EL3_CMD);
                iowrite16(RxEnable, ioaddr + EL3_CMD);
 
-               pci_enable_wake(VORTEX_PCI(vp), 0, 1);
+               if (pci_enable_wake(VORTEX_PCI(vp), PCI_D3hot, 1)) {
+                       printk(KERN_INFO "%s: WOL not supported.\n",
+                                       pci_name(VORTEX_PCI(vp)));
+
+                       vp->enable_wol = 0;
+                       return;
+               }
 
                /* Change the power state to D3; RxEnable doesn't take effect. */
                pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot);
@@ -3340,7 +3218,7 @@ static int __init vortex_init(void)
 {
        int pci_rc, eisa_rc;
 
-       pci_rc = pci_module_init(&vortex_driver);
+       pci_rc = pci_register_driver(&vortex_driver);
        eisa_rc = vortex_eisa_init();
 
        if (pci_rc == 0)
@@ -3361,9 +3239,9 @@ static void __exit vortex_eisa_cleanup(void)
        /* Take care of the EISA devices */
        eisa_driver_unregister(&vortex_eisa_driver);
 #endif
-       
+
        if (compaq_net_device) {
-               vp = compaq_net_device->priv;
+               vp = netdev_priv(compaq_net_device);
                ioaddr = ioport_map(compaq_net_device->base_addr,
                                    VORTEX_TOTAL_SIZE);