bk://gkernel.bkbits.net/netdev-2.6 jgarzik@redhat.com|ChangeSet|20040413213220|60023 jgarzik # This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/04/14 18:28:19-07:00 akpm@bix.(none) # Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-netdev # # include/linux/pci_ids.h # 2004/04/14 18:28:16-07:00 akpm@bix.(none) +0 -0 # Auto merged # # ChangeSet # 2004/04/13 17:39:02-07:00 akpm@bix.(none) # Merge # # drivers/net/r8169.c # 2004/04/13 17:39:01-07:00 akpm@bix.(none) +0 -0 # SCCS merged # # BitKeeper/deleted/.del-sis190.c~ba98a0b77ca71a32 # 2004/04/13 17:37:09-07:00 akpm@bix.(none) +0 -0 # Auto merged # # include/linux/pci_ids.h # 2004/04/13 17:37:09-07:00 akpm@bix.(none) +0 -0 # Auto merged # # drivers/net/Kconfig # 2004/04/13 17:37:09-07:00 akpm@bix.(none) +0 -0 # Auto merged # # MAINTAINERS # 2004/04/13 17:37:09-07:00 akpm@bix.(none) +0 -0 # Auto merged # # BitKeeper/deleted/.del-sis190.c~ba98a0b77ca71a32 # 2004/04/13 17:37:09-07:00 akpm@bix.(none) +0 -0 # Merge rename: drivers/net/sis190.c -> BitKeeper/deleted/.del-sis190.c~ba98a0b77ca71a32 # # ChangeSet # 2004/04/13 17:32:20-04:00 jgarzik@redhat.com # Merge redhat.com:/spare/repo/netdev-2.6/misc # into redhat.com:/spare/repo/netdev-2.6/ALL # # drivers/net/Kconfig # 2004/04/13 17:32:18-04:00 jgarzik@redhat.com +0 -0 # Auto merged # # ChangeSet # 2004/04/13 14:28:52-04:00 rddunlap@osdl.org # [PATCH] remove concat. with __FUNCTION__ (drivers/net/) (V2) # # Hi, # # Previous patch had a small problem. This patch replaces the # previous version. I can/will send a relative/differential diff # if you want/need it. # # # Problem: # # On Tue, 2004-04-06 at 14:45, Randy.Dunlap wrote: # > From: Tony Breeds # > # > "concatenation of string literals with __FUNCTION__ is deprecated" # > -#define TRACE_ENTER(devname) DEBUG(2, "%s: -> " __FUNCTION__ "()\n", devname); # > -#define TRACE_EXIT(devname) DEBUG(2, "%s: <- " __FUNCTION__ "()\n", devname); # > +#define TRACE_ENTER(devname) DEBUG(2, "%s: -> %s()\n", __FUNCTION__, devname); # > +#define TRACE_EXIT(devname) DEBUG(2, "%s: <- %s()\n", __FUNCTION__, devname); # # | Hi. This isn't the same. It should be: # | # | +#define TRACE_ENTER(devname) DEBUG(2, "%s: -> %s()\n", devname, __FUNCTION__); # | +#define TRACE_EXIT(devname) DEBUG(2, "%s: <- %s()\n", devname, __FUNCTION__ ); # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # # drivers/net/gt96100eth.c | 2 +- # drivers/net/irda/smsc-ircc2.c | 6 +++--- # drivers/net/irda/via-ircc.c | 2 +- # drivers/net/wireless/orinoco.h | 4 ++-- # 4 files changed, 7 insertions(+), 7 deletions(-) # # drivers/net/wireless/orinoco.h # 2004/04/05 16:31:23-04:00 rddunlap@osdl.org +2 -2 # remove concat. with __FUNCTION__ (drivers/net/) (V2) # # drivers/net/irda/via-ircc.c # 2004/04/05 16:31:23-04:00 rddunlap@osdl.org +1 -1 # remove concat. with __FUNCTION__ (drivers/net/) (V2) # # drivers/net/irda/smsc-ircc2.c # 2004/04/05 16:31:23-04:00 rddunlap@osdl.org +3 -3 # remove concat. with __FUNCTION__ (drivers/net/) (V2) # # drivers/net/gt96100eth.c # 2004/04/05 16:31:23-04:00 rddunlap@osdl.org +1 -1 # remove concat. with __FUNCTION__ (drivers/net/) (V2) # # ChangeSet # 2004/04/13 14:12:12-04:00 p_gortmaker@yahoo.com # [netdrvr 8390] Fix 8390 log spam # # It seems that PCMCIA 8390 users get spammed with a few annoying # messages upon card removal. I guess 8390 could be taught to better # detect and deal with these things, but here is a quick fix. # # drivers/net/8390.c # 2004/04/13 14:12:07-04:00 p_gortmaker@yahoo.com +1 -1 # [netdrvr 8390] Fix 8390 log spam # # It seems that PCMCIA 8390 users get spammed with a few annoying # messages upon card removal. I guess 8390 could be taught to better # detect and deal with these things, but here is a quick fix. # # ChangeSet # 2004/04/13 14:07:53-04:00 mpm@selenic.com # [PATCH] netpoll transmit busy bugfix # # Fix for handling of full transmit queue when netpoll trap is enabled. # # From Stelian Pop # # net/core/netpoll.c # 2004/04/10 16:19:31-04:00 mpm@selenic.com +3 -9 # netpoll transmit busy bugfix # # ChangeSet # 2004/04/13 14:07:45-04:00 mpm@selenic.com # [PATCH] netpoll early ARP handling # # Handle ARP requests while device is trapped before in_dev is # initialized using netpoll config. Allows early kgdboe usage. # # From Stelian Pop # # net/core/netpoll.c # 2004/04/10 16:15:25-04:00 mpm@selenic.com +6 -13 # netpoll early ARP handling # # ChangeSet # 2004/04/13 14:07:24-04:00 rmk@arm.linux.org.uk # [PATCH] etherh updates # # Update Acorn EtherH driver - convert to use mmio instead of emulated # PIO. Convert card-specific parameters to a data structure rather # than code-based selected. # # Please review and submit upstream. Thanks. # # drivers/net/arm/etherh.c # 2004/04/04 12:59:31-04:00 rmk@arm.linux.org.uk +170 -148 # etherh updates # # drivers/net/8390.h # 2004/04/04 10:59:53-04:00 rmk@arm.linux.org.uk +13 -2 # etherh updates # # ChangeSet # 2004/04/13 14:07:12-04:00 akpm@osdl.org # [PATCH] sk_mca multicast fix # # Spotted by Jean Delvare : it has its memset arguments the # wrong way round. # # drivers/net/sk_mca.c # 2004/04/10 04:57:20-04:00 akpm@osdl.org +2 -2 # sk_mca multicast fix # # ChangeSet # 2004/04/06 11:38:41-04:00 khawar.chaudhry@amd.com # Update amd8111 net driver. # # version 3.04 for 2.4 kernel: # + 1. Added set_mac_address routine for bonding driver support. # + 2. Tested the driver for bonding support # + 3. Bug fix: Fixed mismach in actual receive buffer lenth and lenth # + indicated to the h/w. # + 4. Modified amd8111e_rx() routine to receive all the received packets # + in the first interrupt. # + 5. Bug fix: Corrected rx_errors reported in get_stats() function. # # version 3.05 for 2.6 kernel: # + 1. Added NAPI support # # # drivers/net/amd8111e.h # 2004/04/06 11:38:36-04:00 khawar.chaudhry@amd.com +2 -1 # Update amd8111 net driver. # # version 3.04 for 2.4 kernel: # + 1. Added set_mac_address routine for bonding driver support. # + 2. Tested the driver for bonding support # + 3. Bug fix: Fixed mismach in actual receive buffer lenth and lenth # + indicated to the h/w. # + 4. Modified amd8111e_rx() routine to receive all the received packets # + in the first interrupt. # + 5. Bug fix: Corrected rx_errors reported in get_stats() function. # # version 3.05 for 2.6 kernel: # + 1. Added NAPI support # # # drivers/net/amd8111e.c # 2004/04/06 11:38:36-04:00 khawar.chaudhry@amd.com +212 -15 # Update amd8111 net driver. # # version 3.04 for 2.4 kernel: # + 1. Added set_mac_address routine for bonding driver support. # + 2. Tested the driver for bonding support # + 3. Bug fix: Fixed mismach in actual receive buffer lenth and lenth # + indicated to the h/w. # + 4. Modified amd8111e_rx() routine to receive all the received packets # + in the first interrupt. # + 5. Bug fix: Corrected rx_errors reported in get_stats() function. # # version 3.05 for 2.6 kernel: # + 1. Added NAPI support # # # drivers/net/Kconfig # 2004/04/06 11:38:36-04:00 khawar.chaudhry@amd.com +3 -0 # Update amd8111 net driver. # # version 3.04 for 2.4 kernel: # + 1. Added set_mac_address routine for bonding driver support. # + 2. Tested the driver for bonding support # + 3. Bug fix: Fixed mismach in actual receive buffer lenth and lenth # + indicated to the h/w. # + 4. Modified amd8111e_rx() routine to receive all the received packets # + in the first interrupt. # + 5. Bug fix: Corrected rx_errors reported in get_stats() function. # # version 3.05 for 2.6 kernel: # + 1. Added NAPI support # # # ChangeSet # 2004/04/06 11:02:38-04:00 jgarzik@redhat.com # [netdrvr r8169] add local DMA_xxBIT_MASK constants # # drivers/net/r8169.c # 2004/04/06 11:00:24-04:00 jgarzik@redhat.com +3 -0 # [netdrvr r8169] add local DMA_xxBIT_MASK constants # # ChangeSet # 2004/04/06 10:32:58-04:00 jgarzik@redhat.com # Merge redhat.com:/spare/repo/netdev-2.6/janitor # into redhat.com:/spare/repo/netdev-2.6/ALL # # include/linux/netdevice.h # 2004/04/06 10:32:55-04:00 jgarzik@redhat.com +0 -0 # Auto merged # # ChangeSet # 2004/04/06 09:36:49-04:00 jgarzik@redhat.com # Merge redhat.com:/spare/repo/netdev-2.6/s2io # into redhat.com:/spare/repo/netdev-2.6/ALL # # include/linux/pci_ids.h # 2004/04/06 09:36:47-04:00 jgarzik@redhat.com +0 -0 # Auto merged # # ChangeSet # 2004/04/06 09:23:17-04:00 akpm@osdl.org # [PATCH] com20020-isa.c warning fix # # From: "Luiz Fernando N. Capitulino" # # drivers/net/arcnet/com20020-isa.c:188: warning: unused variable `dev' # drivers/net/arcnet/com20020-isa.c:189: warning: unused variable `lp' # # drivers/net/arcnet/com20020-isa.c # 2004/04/06 05:23:12-04:00 akpm@osdl.org +0 -2 # [PATCH] com20020-isa.c warning fix # # From: "Luiz Fernando N. Capitulino" # # drivers/net/arcnet/com20020-isa.c:188: warning: unused variable `dev' # drivers/net/arcnet/com20020-isa.c:189: warning: unused variable `lp' # # ChangeSet # 2004/04/06 09:23:04-04:00 scott.feldman@intel.com # [PATCH] Update MAINTAINERS with new e100/e1000/ixgb maintainers # # Jeff, Adding John/Ganesh/Ayyappan for e100/e100/ixgb in 2.6. Keeping # myself on for e100 for a couple more 2.6.x releases. # # -scott # # MAINTAINERS # 2004/04/06 05:22:58-04:00 scott.feldman@intel.com +15 -5 # [PATCH] Update MAINTAINERS with new e100/e1000/ixgb maintainers # # Jeff, Adding John/Ganesh/Ayyappan for e100/e100/ixgb in 2.6. Keeping # myself on for e100 for a couple more 2.6.x releases. # # -scott # # ChangeSet # 2004/04/06 09:22:46-04:00 jgarzik@redhat.com # [netdrvr natsemi] correct DP83816 IntrHoldoff register offset # # Spotted by Manfred Spraul. # # drivers/net/natsemi.c # 2004/04/06 05:22:41-04:00 jgarzik@redhat.com +1 -1 # [netdrvr natsemi] correct DP83816 IntrHoldoff register offset # # Spotted by Manfred Spraul. # # ChangeSet # 2004/04/06 09:21:40-04:00 jgarzik@redhat.com # [NET] define HAVE_NETDEV_PRIV back-compat hook # # include/linux/netdevice.h # 2004/04/06 05:21:33-04:00 jgarzik@redhat.com +3 -2 # [NET] define HAVE_NETDEV_PRIV back-compat hook # # ChangeSet # 2004/04/06 09:18:52-04:00 jgarzik@redhat.com # [net/fc iph5526] s/rx_dropped/tx_dropped/ in TX routines # # Spotted by Denis Valesko(sp?). # # Maybe one day we'll either kill this driver, or someone will fix it # up for the current SCSI API. # # drivers/net/fc/iph5526.c # 2004/04/06 05:17:19-04:00 jgarzik@redhat.com +2 -2 # [net/fc iph5526] s/rx_dropped/tx_dropped/ in TX routines # # Spotted by Denis Valesko(sp?). # # Maybe one day we'll either kill this driver, or someone will fix it # up for the current SCSI API. # # ChangeSet # 2004/04/06 09:15:27-04:00 daniel.ritz@gmx.ch # [PATCH] netdev_priv for xirc2ps_cs, nmclan_cs # # s/dev->priv/netdev_priv(dev)/ for xirc2ps_cs.c and nmclan_cs.c # xircom one is tested. against 2.6.4-bk # # drivers/net/pcmcia/xirc2ps_cs.c # 2004/04/06 05:15:21-04:00 daniel.ritz@gmx.ch +16 -16 # [PATCH] netdev_priv for xirc2ps_cs, nmclan_cs # # s/dev->priv/netdev_priv(dev)/ for xirc2ps_cs.c and nmclan_cs.c # xircom one is tested. against 2.6.4-bk # # drivers/net/pcmcia/nmclan_cs.c # 2004/04/06 05:15:21-04:00 daniel.ritz@gmx.ch +16 -16 # [PATCH] netdev_priv for xirc2ps_cs, nmclan_cs # # s/dev->priv/netdev_priv(dev)/ for xirc2ps_cs.c and nmclan_cs.c # xircom one is tested. against 2.6.4-bk # # ChangeSet # 2004/04/06 09:15:10-04:00 muizelaar@rogers.com # [PATCH] tc35815 cleanup # # drivers/net/tc35815.c # 2004/04/06 05:15:03-04:00 muizelaar@rogers.com +1 -6 # [PATCH] tc35815 cleanup # # ChangeSet # 2004/04/06 08:37:52-04:00 hirofumi@mail.parknet.co.jp # [PATCH] 8139too: more useful debug info for tx_timeout # # Hi, # # I think this patch is useful for looking whether it's the real driver # bug or other bug. # # What do you think of this? If ok, please apply. # -- # OGAWA Hirofumi # # # # [PATCH] 8139too: more useful debug info for tx_timeout # # /* disable Tx ASAP, if not already */ # tmp8 = RTL_R8 (ChipCmd); # if (tmp8 & CmdTxEnb) # RTL_W8 (ChipCmd, CmdRxEnb); # # The above will clear the Tx Descs. So, this prints the debugging info # before rtl8139_tx_timeout() does it. And IntrStatus etc. also prints # anytime for the debug. # # drivers/net/8139too.c # 2004/04/05 12:35:48-04:00 hirofumi@mail.parknet.co.jp +11 -15 # 8139too: more useful debug info for tx_timeout # # ChangeSet # 2004/04/06 08:28:52-04:00 rddunlap@osdl.org # [PATCH] remove magic '31' for netdev priv. alignment # # [resend/rediff] # # // linux-2.6.5 # // remove magic number of '31' from net_device and private alignment; # # include/linux/netdevice.h # 2004/04/05 18:46:26-04:00 rddunlap@osdl.org +6 -1 # remove magic '31' for netdev priv. alignment # # drivers/net/net_init.c # 2004/04/05 18:46:26-04:00 rddunlap@osdl.org +5 -3 # remove magic '31' for netdev priv. alignment # # ChangeSet # 2004/04/06 08:18:03-04:00 rddunlap@osdl.org # [PATCH] lmc header file not needed # # From: Domen Puncer # # drivers/net/wan/lmc/lmc_proto.c # 2004/04/05 16:06:33-04:00 rddunlap@osdl.org +0 -1 # lmc header file not needed # # BitKeeper/deleted/.del-lmc_proto_raw.h~b122b868c9b495d1 # 2004/04/06 08:17:58-04:00 rddunlap@osdl.org +0 -0 # Delete: drivers/net/wan/lmc/lmc_proto_raw.h # # ChangeSet # 2004/04/06 08:15:58-04:00 rddunlap@osdl.org # [PATCH] dgrs: add missing iounmaps # # [resend] # # # Insert missing iounmap's. # # From: Leana Ogasawara # # drivers/net/dgrs.c # 2004/04/05 16:08:11-04:00 rddunlap@osdl.org +7 -1 # dgrs: add missing iounmaps # # ChangeSet # 2004/04/06 08:05:16-04:00 jgarzik@redhat.com # Remove unused compatibility-defines include wan/lmc/lmc_ver.h. # # Noticed by Adrian Bunk. # # BitKeeper/deleted/.del-lmc_ver.h~31d4d105f4ad3f # 2004/04/06 08:02:29-04:00 jgarzik@redhat.com +0 -0 # Delete: drivers/net/wan/lmc/lmc_ver.h # # ChangeSet # 2004/04/06 08:01:31-04:00 hch@lst.de # [PATCH] convert acenic to pci_driver API # # drivers/net/acenic.c # 2004/04/06 04:01:26-04:00 hch@lst.de +257 -313 # [PATCH] convert acenic to pci_driver API # # ChangeSet # 2004/04/06 08:01:18-04:00 hch@lst.de # [PATCH] kill acient compat cruft from acenic # # Kills lots of really old cruft and adds a little cruft to actually # make the driver work with recent 2.4 again. # # drivers/net/acenic.c # 2004/04/06 03:59:41-04:00 hch@lst.de +4 -225 # [PATCH] kill acient compat cruft from acenic # # Kills lots of really old cruft and adds a little cruft to actually # make the driver work with recent 2.4 again. # # ChangeSet # 2004/03/26 21:32:26-05:00 romieu@fr.zoreil.com # [netdrvr sis190] more RX path work # # - sis190_rx_interrupt converted to classical Rx skb handling; # - rx_copybreak *new. # # Some similarity with the r8169 driver can not be excluded. # # drivers/net/sis190.c # 2004/03/26 20:42:39-05:00 romieu@fr.zoreil.com +78 -38 # 2.6.5-rc2 - sis190 update # # ChangeSet # 2004/03/26 21:32:19-05:00 romieu@fr.zoreil.com # [netdrvr sis190] don't use one huge buffer for all RX skb's # # Replace the giant receive buffer with individually allocated skb. # # drivers/net/sis190.c # 2004/03/26 20:37:47-05:00 romieu@fr.zoreil.com +60 -26 # 2.6.5-rc2 - sis190 update # # ChangeSet # 2004/03/26 21:32:11-05:00 romieu@fr.zoreil.com # [netdrvr sis190] add dirty_rx to private structure # # Add dirty_rx (unused so far). # # drivers/net/sis190.c # 2004/03/26 20:37:25-05:00 romieu@fr.zoreil.com +5 -4 # 2.6.5-rc2 - sis190 update # # ChangeSet # 2004/03/26 21:32:04-05:00 romieu@fr.zoreil.com # [netdrvr sis190] separate out RX skb alloc, fill # # Still no functionnal change. See r8169 driver for details. # # drivers/net/sis190.c # 2004/03/26 20:37:12-05:00 romieu@fr.zoreil.com +38 -13 # 2.6.5-rc2 - sis190 update # # ChangeSet # 2004/03/26 21:31:57-05:00 romieu@fr.zoreil.com # [netdrvr sis190] add helpers # # New helpers (shamelessly stolen from r8169 driver): # - sis190_mark_as_last_descriptor; # - sis190_give_to_asic. # # drivers/net/sis190.c # 2004/03/26 20:36:46-05:00 romieu@fr.zoreil.com +14 -6 # 2.6.5-rc2 - sis190 update # # ChangeSet # 2004/03/26 21:31:50-05:00 romieu@fr.zoreil.com # [netdrvr sis190] sis190_open() fixes/updates # # - make sis190_open() look like r8169_open() as they do the same thing; # - ready sis190_init_ring for incoming DMA api changes; # - trade a "for" loop against a single line, idiomatic, memset(). # # drivers/net/sis190.c # 2004/03/26 17:47:11-05:00 romieu@fr.zoreil.com +29 -28 # 2.6.5-rc2 - sis190 update # # ChangeSet # 2004/03/26 21:31:42-05:00 romieu@fr.zoreil.com # [netdrvr sis190] add pci-disable-device # # Balance the call to pci_enable_device() in SiS190_init_one() with a call # to pci_disable_device() in SiS190_remove_one(). # # drivers/net/sis190.c # 2004/03/26 17:16:58-05:00 romieu@fr.zoreil.com +15 -9 # 2.6.5-rc2 - sis190 update # # ChangeSet # 2004/03/26 21:31:35-05:00 romieu@fr.zoreil.com # [netdrvr sis190] fix endianness issues # # Endianness issues. # Use of le32_to_cpu/cpu_to_le32 in the code which handles the different # components of the Rx descriptors (PSize/status/buf_addr/buf_Len). # # drivers/net/sis190.c # 2004/03/26 17:13:10-05:00 romieu@fr.zoreil.com +21 -24 # 2.6.5-rc2 - sis190 update # # ChangeSet # 2004/03/25 23:52:21-05:00 romieu@fr.zoreil.com # [netdrvr epic100] napi fixes # # Multiple invocation of __netif_rx_schedule() in epic_interrupt() while # epic_poll loops over __netif_rx_complete() leads to serious device # refcount leak. # # drivers/net/epic100.c # 2004/03/25 23:52:16-05:00 romieu@fr.zoreil.com +18 -15 # [netdrvr epic100] napi fixes # # Multiple invocation of __netif_rx_schedule() in epic_interrupt() while # epic_poll loops over __netif_rx_complete() leads to serious device # refcount leak. # # ChangeSet # 2004/03/22 19:07:18-05:00 romieu@fr.zoreil.com # [netdrvr epic100] napi 3/3 - transmit path # # drivers/net/epic100.c # 2004/03/22 18:18:40-05:00 romieu@fr.zoreil.com +9 -11 # 2.6.5-rc2 - epic100 napi # # ChangeSet # 2004/03/22 19:07:11-05:00 romieu@fr.zoreil.com # [netdrvr epic100] napi 2/3 - receive path # # drivers/net/epic100.c # 2004/03/22 18:18:33-05:00 romieu@fr.zoreil.com +116 -21 # 2.6.5-rc2 - epic100 napi # # ChangeSet # 2004/03/22 19:07:03-05:00 romieu@fr.zoreil.com # [netdrvr epic100] napi 1/3 - just shuffle some code around # # Isolate the classical TX part of epic_interrupt. Innocent code shuffling. # # drivers/net/epic100.c # 2004/03/22 16:53:18-05:00 romieu@fr.zoreil.com +76 -61 # 2.6.5-rc2 - epic100 napi # # ChangeSet # 2004/03/22 19:06:56-05:00 romieu@fr.zoreil.com # [netdrvr epic100] minor cleanups # # - extra pci_disable_device() to balance invocation of pci_enable_device() # in epic_init_one() (-> error path + epic_remove_one()); # - lazy return status in epic_init_one(), tsss...; # - memory dedicated to Rx descriptors was not freed after failure of # register_netdev() in epic_init_one(); # - use of epic_pause() in epic_close() offers a small window for a late # interruption just before the final free_irq(). Let's close the window to # avoid two epic_rx() threads racing with each other. # # drivers/net/epic100.c # 2004/03/22 16:53:16-05:00 romieu@fr.zoreil.com +40 -19 # 2.6.5-rc2 - epic100 fixup # diff -Nru a/MAINTAINERS b/MAINTAINERS --- a/MAINTAINERS Wed Apr 14 18:29:04 2004 +++ b/MAINTAINERS Wed Apr 14 18:29:04 2004 @@ -1061,23 +1061,33 @@ S: Maintained INTEL PRO/100 ETHERNET SUPPORT +P: John Ronciak +M: john.ronciak@intel.com +P: Ganesh Venkatesan +M: ganesh.venkatesan@intel.com P: Scott Feldman M: scott.feldman@intel.com +W: http://sourceforge.net/projects/e1000/ S: Supported INTEL PRO/1000 GIGABIT ETHERNET SUPPORT P: Jeb Cramer M: cramerj@intel.com -P: Scott Feldman -M: scott.feldman@intel.com +P: John Ronciak +M: john.ronciak@intel.com +P: Ganesh Venkatesan +M: ganesh.venkatesan@intel.com W: http://sourceforge.net/projects/e1000/ S: Supported INTEL PRO/10GbE SUPPORT +P: Ayyappan Veeraiyan +M: ayyappan.veeraiyan@intel.com P: Ganesh Venkatesan -M: Ganesh.Venkatesan@intel.com -P: Scott Feldman -M: scott.feldman@intel.com +M: ganesh.venkatesan@intel.com +P: John Ronciak +M: john.ronciak@intel.com +W: http://sourceforge.net/projects/e1000/ S: Supported INTERMEZZO FILE SYSTEM diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c --- a/drivers/net/8139too.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/8139too.c Wed Apr 14 18:29:04 2004 @@ -1673,11 +1673,17 @@ u8 tmp8; unsigned long flags; - DPRINTK ("%s: Transmit timeout, status %2.2x %4.4x " - "media %2.2x.\n", dev->name, - RTL_R8 (ChipCmd), - RTL_R16 (IntrStatus), - RTL_R8 (MediaStatus)); + printk (KERN_DEBUG "%s: Transmit timeout, status %2.2x %4.4x %4.4x " + "media %2.2x.\n", dev->name, RTL_R8 (ChipCmd), + RTL_R16(IntrStatus), RTL_R16(IntrMask), RTL_R8(MediaStatus)); + /* Emit info to figure out what went wrong. */ + printk (KERN_DEBUG "%s: Tx queue start entry %ld dirty entry %ld.\n", + dev->name, tp->cur_tx, tp->dirty_tx); + for (i = 0; i < NUM_TX_DESC; i++) + printk (KERN_DEBUG "%s: Tx descriptor %d is %8.8lx.%s\n", + dev->name, i, RTL_R32 (TxStatus0 + (i * 4)), + i == tp->dirty_tx % NUM_TX_DESC ? + " (queue head)" : ""); tp->xstats.tx_timeouts++; @@ -1690,15 +1696,6 @@ /* Disable interrupts by clearing the interrupt mask. */ RTL_W16 (IntrMask, 0x0000); - /* Emit info to figure out what went wrong. */ - printk (KERN_DEBUG "%s: Tx queue start entry %ld dirty entry %ld.\n", - dev->name, tp->cur_tx, tp->dirty_tx); - for (i = 0; i < NUM_TX_DESC; i++) - printk (KERN_DEBUG "%s: Tx descriptor %d is %8.8lx.%s\n", - dev->name, i, RTL_R32 (TxStatus0 + (i * 4)), - i == tp->dirty_tx % NUM_TX_DESC ? - " (queue head)" : ""); - /* Stop a shared interrupt from scavenging while we are. */ spin_lock_irqsave (&tp->lock, flags); rtl8139_tx_clear (tp); @@ -1710,7 +1707,6 @@ netif_wake_queue (dev); } spin_unlock(&tp->rx_lock); - } diff -Nru a/drivers/net/8390.c b/drivers/net/8390.c --- a/drivers/net/8390.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/8390.c Wed Apr 14 18:29:04 2004 @@ -1084,7 +1084,7 @@ for(i = 0; i < 6; i++) { outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i)); - if(inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i]) + if (ei_debug > 1 && inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i]) printk(KERN_ERR "Hw. address read/write mismap %d\n",i); } diff -Nru a/drivers/net/8390.h b/drivers/net/8390.h --- a/drivers/net/8390.h Wed Apr 14 18:29:04 2004 +++ b/drivers/net/8390.h Wed Apr 14 18:29:04 2004 @@ -131,8 +131,19 @@ #define inb_p(port) in_8(port) #define outb_p(val,port) out_8(port,val) -#elif defined(CONFIG_ARM_ETHERH) || defined(CONFIG_ARM_ETHERH_MODULE) || \ - defined(CONFIG_NET_CBUS) +#elif defined(CONFIG_ARM_ETHERH) || defined(CONFIG_ARM_ETHERH_MODULE) +#define EI_SHIFT(x) (ei_local->reg_offset[x]) +#undef inb +#undef inb_p +#undef outb +#undef outb_p + +#define inb(_p) readb(_p) +#define outb(_v,_p) writeb(_v,_p) +#define inb_p(_p) inb(_p) +#define outb_p(_v,_p) outb(_v,_p) + +#elif defined(CONFIG_NET_CBUS) #define EI_SHIFT(x) (ei_local->reg_offset[x]) #else #define EI_SHIFT(x) (x) diff -Nru a/drivers/net/Kconfig b/drivers/net/Kconfig --- a/drivers/net/Kconfig Wed Apr 14 18:29:04 2004 +++ b/drivers/net/Kconfig Wed Apr 14 18:29:04 2004 @@ -1219,6 +1219,9 @@ To compile this driver as a module, choose M here and read . The module will be called amd8111e. +config AMD8111E_NAPI + bool "Enable NAPI support" + depends on AMD8111_ETH config ADAPTEC_STARFIRE tristate "Adaptec Starfire/DuraLAN support" diff -Nru a/drivers/net/acenic.c b/drivers/net/acenic.c --- a/drivers/net/acenic.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/acenic.c Wed Apr 14 18:29:04 2004 @@ -131,7 +131,6 @@ #define PCI_DEVICE_ID_SGI_ACENIC 0x0009 #endif -#if LINUX_VERSION_CODE >= 0x20400 static struct pci_device_id acenic_pci_tbl[] = { { PCI_VENDOR_ID_ALTEON, PCI_DEVICE_ID_ALTEON_ACENIC_FIBRE, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_NETWORK_ETHERNET << 8, 0xffff00, }, @@ -156,37 +155,6 @@ { } }; MODULE_DEVICE_TABLE(pci, acenic_pci_tbl); -#endif - - -#ifndef MODULE_LICENSE -#define MODULE_LICENSE(a) -#endif - -#ifndef wmb -#define wmb() mb() -#endif - -#ifndef __exit -#define __exit -#endif - -#ifndef __devinit -#define __devinit __init -#endif - -#ifndef SMP_CACHE_BYTES -#define SMP_CACHE_BYTES L1_CACHE_BYTES -#endif - -#ifndef SET_MODULE_OWNER -#define SET_MODULE_OWNER(dev) do{} while(0) -#define ACE_MOD_INC_USE_COUNT MOD_INC_USE_COUNT -#define ACE_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT -#else -#define ACE_MOD_INC_USE_COUNT do{} while(0) -#define ACE_MOD_DEC_USE_COUNT do{} while(0) -#endif #ifndef SET_NETDEV_DEV #define SET_NETDEV_DEV(net, pdev) do{} while(0) @@ -198,151 +166,8 @@ #define ace_sync_irq(irq) synchronize_irq() #endif -#if LINUX_VERSION_CODE < 0x2051e -#define local_irq_save(flags) do{__save_flags(flags) ; \ - __cli();} while(0) -#define local_irq_restore(flags) __restore_flags(flags) -#endif - -#if (LINUX_VERSION_CODE < 0x02030d) -#define pci_resource_start(dev, bar) dev->base_address[bar] -#elif (LINUX_VERSION_CODE < 0x02032c) -#define pci_resource_start(dev, bar) dev->resource[bar].start -#endif - -#if (LINUX_VERSION_CODE < 0x02030e) -#define net_device device -#endif - - -#if (LINUX_VERSION_CODE < 0x02032a) -typedef u32 dma_addr_t; - -static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, - dma_addr_t *dma_handle) -{ - void *virt_ptr; - - virt_ptr = kmalloc(size, GFP_KERNEL); - if (!virt_ptr) - return NULL; - *dma_handle = virt_to_bus(virt_ptr); - return virt_ptr; -} - -#define pci_free_consistent(cookie, size, ptr, dma_ptr) kfree(ptr) -#define pci_map_page(cookie, page, off, size, dir) \ - virt_to_bus(page_address(page)+(off)) -#define pci_unmap_page(cookie, address, size, dir) -#define pci_set_dma_mask(dev, mask) \ - (((u64)(mask) & 0xffffffff00000000) == 0 ? 0 : -EIO) -#define pci_dma_supported(dev, mask) \ - (((u64)(mask) & 0xffffffff00000000) == 0 ? 1 : 0) - -#elif (LINUX_VERSION_CODE < 0x02040d) - -/* - * 2.4.13 introduced pci_map_page()/pci_unmap_page() - for 2.4.12 and prior, - * fall back on pci_map_single()/pci_unnmap_single(). - * - * We are guaranteed that the page is mapped at this point since - * pci_map_page() is only used upon valid struct skb's. - */ -static inline dma_addr_t -pci_map_page(struct pci_dev *cookie, struct page *page, unsigned long off, - size_t size, int dir) -{ - void *page_virt; - - page_virt = page_address(page); - if (!page_virt) - BUG(); - return pci_map_single(cookie, (page_virt + off), size, dir); -} -#define pci_unmap_page(cookie, dma_addr, size, dir) \ - pci_unmap_single(cookie, dma_addr, size, dir) -#endif - -#if (LINUX_VERSION_CODE < 0x020412) -#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) -#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) -#define pci_unmap_addr(PTR, ADDR_NAME) 0 -#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do{} while(0) -#define pci_unmap_len(PTR, LEN_NAME) 0 -#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do{} while(0) -#endif - - -#if (LINUX_VERSION_CODE < 0x02032b) -/* - * SoftNet - * - * For pre-softnet kernels we need to tell the upper layer not to - * re-enter start_xmit() while we are in there. However softnet - * guarantees not to enter while we are in there so there is no need - * to do the netif_stop_queue() dance unless the transmit queue really - * gets stuck. This should also improve performance according to tests - * done by Aman Singla. - */ -#define dev_kfree_skb_irq(a) dev_kfree_skb(a) -#define netif_wake_queue(dev) clear_bit(0, &dev->tbusy) -#define netif_stop_queue(dev) set_bit(0, &dev->tbusy) -#define late_stop_netif_stop_queue(dev) do{} while(0) -#define early_stop_netif_stop_queue(dev) test_and_set_bit(0,&dev->tbusy) -#define early_stop_netif_wake_queue(dev) netif_wake_queue(dev) - -static inline void netif_start_queue(struct net_device *dev) -{ - dev->tbusy = 0; - dev->interrupt = 0; - dev->start = 1; -} - -#define ace_mark_net_bh() mark_bh(NET_BH) -#define netif_queue_stopped(dev) dev->tbusy -#define netif_running(dev) dev->start -#define ace_if_down(dev) do{dev->start = 0;} while(0) - -#define tasklet_struct tq_struct -static inline void tasklet_schedule(struct tasklet_struct *tasklet) -{ - queue_task(tasklet, &tq_immediate); - mark_bh(IMMEDIATE_BH); -} - -static inline void tasklet_init(struct tasklet_struct *tasklet, - void (*func)(unsigned long), - unsigned long data) -{ - tasklet->next = NULL; - tasklet->sync = 0; - tasklet->routine = (void (*)(void *))func; - tasklet->data = (void *)data; -} -#define tasklet_kill(tasklet) do{} while(0) -#else -#define late_stop_netif_stop_queue(dev) netif_stop_queue(dev) -#define early_stop_netif_stop_queue(dev) 0 -#define early_stop_netif_wake_queue(dev) do{} while(0) -#define ace_mark_net_bh() do{} while(0) -#define ace_if_down(dev) do{} while(0) -#endif - -#if (LINUX_VERSION_CODE >= 0x02031b) -#define NEW_NETINIT -#define ACE_PROBE_ARG void -#else -#define ACE_PROBE_ARG struct net_device *dev -#endif - -#ifndef min_t -#define min_t(type,a,b) (((a)<(b))?(a):(b)) -#endif - -#ifndef ARCH_HAS_PREFETCHW -#ifndef prefetchw -#define prefetchw(x) do{} while(0) -#endif +#ifndef offset_in_page +#define offset_in_page(ptr) ((unsigned long)(ptr) & ~PAGE_MASK) #endif #define ACE_MAX_MOD_PARMS 8 @@ -595,407 +420,323 @@ static int tx_ratio[ACE_MAX_MOD_PARMS]; static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1}; +MODULE_AUTHOR("Jes Sorensen "); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver"); +MODULE_PARM(link, "1-" __MODULE_STRING(8) "i"); +MODULE_PARM(trace, "1-" __MODULE_STRING(8) "i"); +MODULE_PARM(tx_coal_tick, "1-" __MODULE_STRING(8) "i"); +MODULE_PARM(max_tx_desc, "1-" __MODULE_STRING(8) "i"); +MODULE_PARM(rx_coal_tick, "1-" __MODULE_STRING(8) "i"); +MODULE_PARM(max_rx_desc, "1-" __MODULE_STRING(8) "i"); +MODULE_PARM(tx_ratio, "1-" __MODULE_STRING(8) "i"); +MODULE_PARM_DESC(link, "AceNIC/3C985/NetGear link state"); +MODULE_PARM_DESC(trace, "AceNIC/3C985/NetGear firmware trace level"); +MODULE_PARM_DESC(tx_coal_tick, "AceNIC/3C985/GA620 max clock ticks to wait from first tx descriptor arrives"); +MODULE_PARM_DESC(max_tx_desc, "AceNIC/3C985/GA620 max number of transmit descriptors to wait"); +MODULE_PARM_DESC(rx_coal_tick, "AceNIC/3C985/GA620 max clock ticks to wait from first rx descriptor arrives"); +MODULE_PARM_DESC(max_rx_desc, "AceNIC/3C985/GA620 max number of receive descriptors to wait"); +MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)"); + + static char version[] __initdata = "acenic.c: v0.92 08/05/2002 Jes Sorensen, linux-acenic@SunSITE.dk\n" " http://home.cern.ch/~jes/gige/acenic.html\n"; -static struct net_device *root_dev; - -static int probed __initdata = 0; - - -int __devinit acenic_probe (ACE_PROBE_ARG) +static int __devinit acenic_probe_one(struct pci_dev *pdev, + const struct pci_device_id *id) { -#ifdef NEW_NETINIT struct net_device *dev; -#endif struct ace_private *ap; - struct pci_dev *pdev = NULL; - int boards_found = 0; - int version_disp; - - if (probed) - return -ENODEV; - probed++; - - version_disp = 0; - - while ((pdev = pci_find_class(PCI_CLASS_NETWORK_ETHERNET<<8, pdev))) { - - if (!((pdev->vendor == PCI_VENDOR_ID_ALTEON) && - ((pdev->device == PCI_DEVICE_ID_ALTEON_ACENIC_FIBRE) || - (pdev->device == PCI_DEVICE_ID_ALTEON_ACENIC_COPPER)))&& - !((pdev->vendor == PCI_VENDOR_ID_3COM) && - (pdev->device == PCI_DEVICE_ID_3COM_3C985)) && - !((pdev->vendor == PCI_VENDOR_ID_NETGEAR) && - ((pdev->device == PCI_DEVICE_ID_NETGEAR_GA620) || - (pdev->device == PCI_DEVICE_ID_NETGEAR_GA620T))) && - /* - * Farallon used the DEC vendor ID on their cards by - * mistake for a while - */ - !((pdev->vendor == PCI_VENDOR_ID_DEC) && - (pdev->device == PCI_DEVICE_ID_FARALLON_PN9000SX)) && - !((pdev->vendor == PCI_VENDOR_ID_ALTEON) && - (pdev->device == PCI_DEVICE_ID_FARALLON_PN9100T)) && - !((pdev->vendor == PCI_VENDOR_ID_SGI) && - (pdev->device == PCI_DEVICE_ID_SGI_ACENIC))) - continue; - - dev = alloc_etherdev(sizeof(struct ace_private)); - if (dev == NULL) { - printk(KERN_ERR "acenic: Unable to allocate " - "net_device structure!\n"); - break; - } + static int boards_found; - SET_MODULE_OWNER(dev); - SET_NETDEV_DEV(dev, &pdev->dev); + dev = alloc_etherdev(sizeof(struct ace_private)); + if (dev == NULL) { + printk(KERN_ERR "acenic: Unable to allocate " + "net_device structure!\n"); + return -ENOMEM; + } + + SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &pdev->dev); - ap = dev->priv; - ap->pdev = pdev; + ap = dev->priv; + ap->pdev = pdev; - dev->open = &ace_open; - dev->hard_start_xmit = &ace_start_xmit; - dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; + dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; #if ACENIC_DO_VLAN - dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; - dev->vlan_rx_register = ace_vlan_rx_register; - dev->vlan_rx_kill_vid = ace_vlan_rx_kill_vid; -#endif - if (1) { - static void ace_watchdog(struct net_device *dev); - dev->tx_timeout = &ace_watchdog; - dev->watchdog_timeo = 5*HZ; - } - dev->stop = &ace_close; - dev->get_stats = &ace_get_stats; - dev->set_multicast_list = &ace_set_multicast_list; - dev->do_ioctl = &ace_ioctl; - dev->set_mac_address = &ace_set_mac_addr; - dev->change_mtu = &ace_change_mtu; + dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; + dev->vlan_rx_register = ace_vlan_rx_register; + dev->vlan_rx_kill_vid = ace_vlan_rx_kill_vid; +#endif + if (1) { + static void ace_watchdog(struct net_device *dev); + dev->tx_timeout = &ace_watchdog; + dev->watchdog_timeo = 5*HZ; + } - /* display version info if adapter is found */ - if (!version_disp) - { - /* set display flag to TRUE so that */ - /* we only display this string ONCE */ - version_disp = 1; - printk(version); - } + dev->open = &ace_open; + dev->stop = &ace_close; + dev->hard_start_xmit = &ace_start_xmit; + dev->get_stats = &ace_get_stats; + dev->set_multicast_list = &ace_set_multicast_list; + dev->do_ioctl = &ace_ioctl; + dev->set_mac_address = &ace_set_mac_addr; + dev->change_mtu = &ace_change_mtu; - if (pci_enable_device(pdev)) { - free_netdev(dev); - continue; - } + /* we only display this string ONCE */ + if (!boards_found) + printk(version); - /* - * Enable master mode before we start playing with the - * pci_command word since pci_set_master() will modify - * it. - */ - pci_set_master(pdev); + if (pci_enable_device(pdev)) + goto fail_free_netdev; - pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command); + /* + * Enable master mode before we start playing with the + * pci_command word since pci_set_master() will modify + * it. + */ + pci_set_master(pdev); - /* OpenFirmware on Mac's does not set this - DOH.. */ - if (!(ap->pci_command & PCI_COMMAND_MEMORY)) { - printk(KERN_INFO "%s: Enabling PCI Memory Mapped " - "access - was not enabled by BIOS/Firmware\n", - dev->name); - ap->pci_command = ap->pci_command | PCI_COMMAND_MEMORY; - pci_write_config_word(ap->pdev, PCI_COMMAND, - ap->pci_command); - wmb(); - } + pci_read_config_word(pdev, PCI_COMMAND, &ap->pci_command); - pci_read_config_byte(pdev, PCI_LATENCY_TIMER, - &ap->pci_latency); - if (ap->pci_latency <= 0x40) { - ap->pci_latency = 0x40; - pci_write_config_byte(pdev, PCI_LATENCY_TIMER, - ap->pci_latency); - } + /* OpenFirmware on Mac's does not set this - DOH.. */ + if (!(ap->pci_command & PCI_COMMAND_MEMORY)) { + printk(KERN_INFO "%s: Enabling PCI Memory Mapped " + "access - was not enabled by BIOS/Firmware\n", + dev->name); + ap->pci_command = ap->pci_command | PCI_COMMAND_MEMORY; + pci_write_config_word(ap->pdev, PCI_COMMAND, + ap->pci_command); + wmb(); + } - /* - * Remap the regs into kernel space - this is abuse of - * dev->base_addr since it was means for I/O port - * addresses but who gives a damn. - */ - dev->base_addr = pci_resource_start(pdev, 0); - ap->regs = (struct ace_regs *)ioremap(dev->base_addr, 0x4000); - if (!ap->regs) { - printk(KERN_ERR "%s: Unable to map I/O register, " - "AceNIC %i will be disabled.\n", - dev->name, boards_found); - break; - } + pci_read_config_byte(pdev, PCI_LATENCY_TIMER, &ap->pci_latency); + if (ap->pci_latency <= 0x40) { + ap->pci_latency = 0x40; + pci_write_config_byte(pdev, PCI_LATENCY_TIMER, ap->pci_latency); + } - switch(pdev->vendor) { - case PCI_VENDOR_ID_ALTEON: - if (pdev->device == PCI_DEVICE_ID_FARALLON_PN9100T) { - strncpy(ap->name, "Farallon PN9100-T " - "Gigabit Ethernet", sizeof (ap->name)); - printk(KERN_INFO "%s: Farallon PN9100-T ", - dev->name); - } else { - strncpy(ap->name, "AceNIC Gigabit Ethernet", - sizeof (ap->name)); - printk(KERN_INFO "%s: Alteon AceNIC ", - dev->name); - } - break; - case PCI_VENDOR_ID_3COM: - strncpy(ap->name, "3Com 3C985 Gigabit Ethernet", - sizeof (ap->name)); - printk(KERN_INFO "%s: 3Com 3C985 ", dev->name); - break; - case PCI_VENDOR_ID_NETGEAR: - strncpy(ap->name, "NetGear GA620 Gigabit Ethernet", - sizeof (ap->name)); - printk(KERN_INFO "%s: NetGear GA620 ", dev->name); - break; - case PCI_VENDOR_ID_DEC: - if (pdev->device == PCI_DEVICE_ID_FARALLON_PN9000SX) { - strncpy(ap->name, "Farallon PN9000-SX " - "Gigabit Ethernet", sizeof (ap->name)); - printk(KERN_INFO "%s: Farallon PN9000-SX ", - dev->name); - break; - } - case PCI_VENDOR_ID_SGI: - strncpy(ap->name, "SGI AceNIC Gigabit Ethernet", + /* + * Remap the regs into kernel space - this is abuse of + * dev->base_addr since it was means for I/O port + * addresses but who gives a damn. + */ + dev->base_addr = pci_resource_start(pdev, 0); + ap->regs = (struct ace_regs *)ioremap(dev->base_addr, 0x4000); + if (!ap->regs) { + printk(KERN_ERR "%s: Unable to map I/O register, " + "AceNIC %i will be disabled.\n", + dev->name, boards_found); + goto fail_free_netdev; + } + + switch(pdev->vendor) { + case PCI_VENDOR_ID_ALTEON: + if (pdev->device == PCI_DEVICE_ID_FARALLON_PN9100T) { + strncpy(ap->name, "Farallon PN9100-T " + "Gigabit Ethernet", sizeof (ap->name)); + printk(KERN_INFO "%s: Farallon PN9100-T ", + dev->name); + } else { + strncpy(ap->name, "AceNIC Gigabit Ethernet", sizeof (ap->name)); - printk(KERN_INFO "%s: SGI AceNIC ", dev->name); - break; - default: - strncpy(ap->name, "Unknown AceNIC based Gigabit " - "Ethernet", sizeof (ap->name)); - printk(KERN_INFO "%s: Unknown AceNIC ", dev->name); + printk(KERN_INFO "%s: Alteon AceNIC ", + dev->name); + } + break; + case PCI_VENDOR_ID_3COM: + strncpy(ap->name, "3Com 3C985 Gigabit Ethernet", + sizeof (ap->name)); + printk(KERN_INFO "%s: 3Com 3C985 ", dev->name); + break; + case PCI_VENDOR_ID_NETGEAR: + strncpy(ap->name, "NetGear GA620 Gigabit Ethernet", + sizeof (ap->name)); + printk(KERN_INFO "%s: NetGear GA620 ", dev->name); + break; + case PCI_VENDOR_ID_DEC: + if (pdev->device == PCI_DEVICE_ID_FARALLON_PN9000SX) { + strncpy(ap->name, "Farallon PN9000-SX " + "Gigabit Ethernet", sizeof (ap->name)); + printk(KERN_INFO "%s: Farallon PN9000-SX ", + dev->name); break; } - ap->name [sizeof (ap->name) - 1] = '\0'; - printk("Gigabit Ethernet at 0x%08lx, ", dev->base_addr); + case PCI_VENDOR_ID_SGI: + strncpy(ap->name, "SGI AceNIC Gigabit Ethernet", + sizeof (ap->name)); + printk(KERN_INFO "%s: SGI AceNIC ", dev->name); + break; + default: + strncpy(ap->name, "Unknown AceNIC based Gigabit " + "Ethernet", sizeof (ap->name)); + printk(KERN_INFO "%s: Unknown AceNIC ", dev->name); + break; + } + + ap->name [sizeof (ap->name) - 1] = '\0'; + printk("Gigabit Ethernet at 0x%08lx, ", dev->base_addr); #ifdef __sparc__ - printk("irq %s\n", __irq_itoa(pdev->irq)); + printk("irq %s\n", __irq_itoa(pdev->irq)); #else - printk("irq %i\n", pdev->irq); + printk("irq %i\n", pdev->irq); #endif #ifdef CONFIG_ACENIC_OMIT_TIGON_I - if ((readl(&ap->regs->HostCtrl) >> 28) == 4) { - printk(KERN_ERR "%s: Driver compiled without Tigon I" - " support - NIC disabled\n", dev->name); - ace_init_cleanup(dev); - free_netdev(dev); - continue; - } + if ((readl(&ap->regs->HostCtrl) >> 28) == 4) { + printk(KERN_ERR "%s: Driver compiled without Tigon I" + " support - NIC disabled\n", dev->name); + goto fail_uninit; + } #endif - if (ace_allocate_descriptors(dev)) { - /* - * ace_allocate_descriptors() calls - * ace_init_cleanup() on error. - */ - free_netdev(dev); - continue; - } + if (ace_allocate_descriptors(dev)) + goto fail_free_netdev; #ifdef MODULE - if (boards_found >= ACE_MAX_MOD_PARMS) - ap->board_idx = BOARD_IDX_OVERFLOW; - else - ap->board_idx = boards_found; + if (boards_found >= ACE_MAX_MOD_PARMS) + ap->board_idx = BOARD_IDX_OVERFLOW; + else + ap->board_idx = boards_found; #else - ap->board_idx = BOARD_IDX_STATIC; + ap->board_idx = BOARD_IDX_STATIC; #endif - if (ace_init(dev)) { - /* - * ace_init() calls ace_init_cleanup() on error. - */ - free_netdev(dev); - continue; - } + if (ace_init(dev)) + goto fail_free_netdev; - if (register_netdev(dev)) { - printk(KERN_ERR "acenic: device registration failed\n"); - ace_init_cleanup(dev); - free_netdev(dev); - continue; - } - - if (ap->pci_using_dac) - dev->features |= NETIF_F_HIGHDMA; - - boards_found++; + if (register_netdev(dev)) { + printk(KERN_ERR "acenic: device registration failed\n"); + goto fail_uninit; } - /* - * If we're at this point we're going through ace_probe() for - * the first time. Return success (0) if we've initialized 1 - * or more boards. Otherwise, return failure (-ENODEV). - */ - - if (boards_found > 0) - return 0; - else - return -ENODEV; -} + if (ap->pci_using_dac) + dev->features |= NETIF_F_HIGHDMA; + pci_set_drvdata(pdev, dev); -#ifdef MODULE -MODULE_AUTHOR("Jes Sorensen "); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver"); -MODULE_PARM(link, "1-" __MODULE_STRING(8) "i"); -MODULE_PARM(trace, "1-" __MODULE_STRING(8) "i"); -MODULE_PARM(tx_coal_tick, "1-" __MODULE_STRING(8) "i"); -MODULE_PARM(max_tx_desc, "1-" __MODULE_STRING(8) "i"); -MODULE_PARM(rx_coal_tick, "1-" __MODULE_STRING(8) "i"); -MODULE_PARM(max_rx_desc, "1-" __MODULE_STRING(8) "i"); -MODULE_PARM(tx_ratio, "1-" __MODULE_STRING(8) "i"); -MODULE_PARM_DESC(link, "AceNIC/3C985/NetGear link state"); -MODULE_PARM_DESC(trace, "AceNIC/3C985/NetGear firmware trace level"); -MODULE_PARM_DESC(tx_coal_tick, "AceNIC/3C985/GA620 max clock ticks to wait from first tx descriptor arrives"); -MODULE_PARM_DESC(max_tx_desc, "AceNIC/3C985/GA620 max number of transmit descriptors to wait"); -MODULE_PARM_DESC(rx_coal_tick, "AceNIC/3C985/GA620 max clock ticks to wait from first rx descriptor arrives"); -MODULE_PARM_DESC(max_rx_desc, "AceNIC/3C985/GA620 max number of receive descriptors to wait"); -MODULE_PARM_DESC(tx_ratio, "AceNIC/3C985/GA620 ratio of NIC memory used for TX/RX descriptors (range 0-63)"); -#endif + boards_found++; + return 0; + fail_uninit: + ace_init_cleanup(dev); + fail_free_netdev: + free_netdev(dev); + return -ENODEV; +} -static void __exit ace_module_cleanup(void) +static void __devexit acenic_remove_one(struct pci_dev *pdev) { - struct ace_private *ap; - struct ace_regs *regs; - struct net_device *next; + struct net_device *dev = pci_get_drvdata(pdev); + struct ace_private *ap = dev->priv; + struct ace_regs *regs = ap->regs; short i; - while (root_dev) { - ap = root_dev->priv; - next = ap->next; - unregister_netdev(root_dev); - - regs = ap->regs; + unregister_netdev(dev); - writel(readl(®s->CpuCtrl) | CPU_HALT, ®s->CpuCtrl); - if (ap->version >= 2) - writel(readl(®s->CpuBCtrl) | CPU_HALT, - ®s->CpuBCtrl); - /* - * This clears any pending interrupts - */ - writel(1, ®s->Mb0Lo); - readl(®s->CpuCtrl); /* flush */ + writel(readl(®s->CpuCtrl) | CPU_HALT, ®s->CpuCtrl); + if (ap->version >= 2) + writel(readl(®s->CpuBCtrl) | CPU_HALT, ®s->CpuBCtrl); + + /* + * This clears any pending interrupts + */ + writel(1, ®s->Mb0Lo); + readl(®s->CpuCtrl); /* flush */ - /* - * Make sure no other CPUs are processing interrupts - * on the card before the buffers are being released. - * Otherwise one might experience some `interesting' - * effects. - * - * Then release the RX buffers - jumbo buffers were - * already released in ace_close(). - */ - ace_sync_irq(root_dev->irq); + /* + * Make sure no other CPUs are processing interrupts + * on the card before the buffers are being released. + * Otherwise one might experience some `interesting' + * effects. + * + * Then release the RX buffers - jumbo buffers were + * already released in ace_close(). + */ + ace_sync_irq(dev->irq); - for (i = 0; i < RX_STD_RING_ENTRIES; i++) { - struct sk_buff *skb = ap->skb->rx_std_skbuff[i].skb; + for (i = 0; i < RX_STD_RING_ENTRIES; i++) { + struct sk_buff *skb = ap->skb->rx_std_skbuff[i].skb; - if (skb) { - struct ring_info *ringp; - dma_addr_t mapping; + if (skb) { + struct ring_info *ringp; + dma_addr_t mapping; - ringp = &ap->skb->rx_std_skbuff[i]; - mapping = pci_unmap_addr(ringp, mapping); - pci_unmap_page(ap->pdev, mapping, - ACE_STD_BUFSIZE - (2 + 16), - PCI_DMA_FROMDEVICE); + ringp = &ap->skb->rx_std_skbuff[i]; + mapping = pci_unmap_addr(ringp, mapping); + pci_unmap_page(ap->pdev, mapping, + ACE_STD_BUFSIZE - (2 + 16), + PCI_DMA_FROMDEVICE); - ap->rx_std_ring[i].size = 0; - ap->skb->rx_std_skbuff[i].skb = NULL; - dev_kfree_skb(skb); - } - } - if (ap->version >= 2) { - for (i = 0; i < RX_MINI_RING_ENTRIES; i++) { - struct sk_buff *skb = ap->skb->rx_mini_skbuff[i].skb; - - if (skb) { - struct ring_info *ringp; - dma_addr_t mapping; - - ringp = &ap->skb->rx_mini_skbuff[i]; - mapping = pci_unmap_addr(ringp,mapping); - pci_unmap_page(ap->pdev, mapping, - ACE_MINI_BUFSIZE - (2 + 16), - PCI_DMA_FROMDEVICE); - - ap->rx_mini_ring[i].size = 0; - ap->skb->rx_mini_skbuff[i].skb = NULL; - dev_kfree_skb(skb); - } - } + ap->rx_std_ring[i].size = 0; + ap->skb->rx_std_skbuff[i].skb = NULL; + dev_kfree_skb(skb); } - for (i = 0; i < RX_JUMBO_RING_ENTRIES; i++) { - struct sk_buff *skb = ap->skb->rx_jumbo_skbuff[i].skb; + } + + if (ap->version >= 2) { + for (i = 0; i < RX_MINI_RING_ENTRIES; i++) { + struct sk_buff *skb = ap->skb->rx_mini_skbuff[i].skb; + if (skb) { struct ring_info *ringp; dma_addr_t mapping; - ringp = &ap->skb->rx_jumbo_skbuff[i]; - mapping = pci_unmap_addr(ringp, mapping); + ringp = &ap->skb->rx_mini_skbuff[i]; + mapping = pci_unmap_addr(ringp,mapping); pci_unmap_page(ap->pdev, mapping, - ACE_JUMBO_BUFSIZE - (2 + 16), + ACE_MINI_BUFSIZE - (2 + 16), PCI_DMA_FROMDEVICE); - ap->rx_jumbo_ring[i].size = 0; - ap->skb->rx_jumbo_skbuff[i].skb = NULL; + ap->rx_mini_ring[i].size = 0; + ap->skb->rx_mini_skbuff[i].skb = NULL; dev_kfree_skb(skb); } } - - ace_init_cleanup(root_dev); - free_netdev(root_dev); - root_dev = next; } -} + for (i = 0; i < RX_JUMBO_RING_ENTRIES; i++) { + struct sk_buff *skb = ap->skb->rx_jumbo_skbuff[i].skb; + if (skb) { + struct ring_info *ringp; + dma_addr_t mapping; -int __init ace_module_init(void) -{ - int status; + ringp = &ap->skb->rx_jumbo_skbuff[i]; + mapping = pci_unmap_addr(ringp, mapping); + pci_unmap_page(ap->pdev, mapping, + ACE_JUMBO_BUFSIZE - (2 + 16), + PCI_DMA_FROMDEVICE); - root_dev = NULL; + ap->rx_jumbo_ring[i].size = 0; + ap->skb->rx_jumbo_skbuff[i].skb = NULL; + dev_kfree_skb(skb); + } + } -#ifdef NEW_NETINIT - status = acenic_probe(); -#else - status = acenic_probe(NULL); -#endif - return status; + ace_init_cleanup(dev); + free_netdev(dev); } +static struct pci_driver acenic_pci_driver = { + .name = "acenic", + .id_table = acenic_pci_tbl, + .probe = acenic_probe_one, + .remove = __devexit_p(acenic_remove_one), +}; -#if (LINUX_VERSION_CODE < 0x02032a) -#ifdef MODULE -int init_module(void) +static int __init acenic_init(void) { - return ace_module_init(); + return pci_module_init(&acenic_pci_driver); } - -void cleanup_module(void) +static void __exit acenic_exit(void) { - ace_module_cleanup(); + pci_unregister_driver(&acenic_pci_driver); } -#endif -#else -module_init(ace_module_init); -module_exit(ace_module_cleanup); -#endif +module_init(acenic_init); +module_exit(acenic_exit); static void ace_free_descriptors(struct net_device *dev) { @@ -1462,13 +1203,6 @@ } else dev->irq = pdev->irq; - /* - * Register the device here to be able to catch allocated - * interrupt handlers in case the firmware doesn't come up. - */ - ap->next = root_dev; - root_dev = dev; - #ifdef INDEX_DEBUG spin_lock_init(&ap->debug_lock); ap->last_tx = ACE_TX_RING_ENTRIES(ap) - 1; @@ -2642,8 +2376,6 @@ netif_start_queue(dev); - ACE_MOD_INC_USE_COUNT; - /* * Setup the bottom half rx ring refill handler */ @@ -2660,8 +2392,6 @@ unsigned long flags; short i; - ace_if_down(dev); - /* * Without (or before) releasing irq and stopping hardware, this * is an absolute non-sense, by the way. It will be reset instantly @@ -2733,7 +2463,6 @@ ace_unmask_irq(dev); local_irq_restore(flags); - ACE_MOD_DEC_USE_COUNT; return 0; } @@ -2789,12 +2518,6 @@ struct ace_regs *regs = ap->regs; struct tx_desc *desc; u32 idx, flagsize; - - /* - * This only happens with pre-softnet, ie. 2.2.x kernels. - */ - if (early_stop_netif_stop_queue(dev)) - return 1; restart: idx = ap->tx_prd; diff -Nru a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c --- a/drivers/net/amd8111e.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/amd8111e.c Wed Apr 14 18:29:04 2004 @@ -1,6 +1,6 @@ /* Advanced Micro Devices Inc. AMD8111E Linux Network Driver - * Copyright (C) 2003 Advanced Micro Devices + * Copyright (C) 2004 Advanced Micro Devices * * * Copyright 2001,2002 Jeff Garzik [ 8139cp.c,tg3.c ] @@ -55,6 +55,16 @@ 4. Dynamic IPG support is disabled by default. 3.0.3 06/05/2003 1. Bug fix: Fixed failure to close the interface if SMP is enabled. + 3.0.4 12/09/2003 + 1. Added set_mac_address routine for bonding driver support. + 2. Tested the driver for bonding support + 3. Bug fix: Fixed mismach in actual receive buffer lenth and lenth + indicated to the h/w. + 4. Modified amd8111e_rx() routine to receive all the received packets + in the first interrupt. + 5. Bug fix: Corrected rx_errors reported in get_stats() function. + 3.0.5 03/22/2004 + 1. Added NAPI support */ @@ -91,7 +101,7 @@ #include "amd8111e.h" #define MODULE_NAME "amd8111e" -#define MODULE_VERS "3.0.3" +#define MODULE_VERS "3.0.5" MODULE_AUTHOR("Advanced Micro Devices, Inc."); MODULE_DESCRIPTION ("AMD8111 based 10/100 Ethernet Controller. Driver Version 3.0.3"); MODULE_LICENSE("GPL"); @@ -276,8 +286,10 @@ unsigned int mtu = dev->mtu; if (mtu > ETH_DATA_LEN){ - /* MTU + ethernet header + FCS + optional VLAN tag */ - lp->rx_buff_len = mtu + ETH_HLEN + 8; + /* MTU + ethernet header + FCS + + optional VLAN tag + skb reserve space 2 */ + + lp->rx_buff_len = mtu + ETH_HLEN + 10; lp->options |= OPTION_JUMBO_ENABLE; } else{ lp->rx_buff_len = PKT_BUFF_SZ; @@ -337,7 +349,7 @@ lp->rx_skbuff[i]->data,lp->rx_buff_len-2, PCI_DMA_FROMDEVICE); lp->rx_ring[i].buff_phy_addr = cpu_to_le32(lp->rx_dma_addr[i]); - lp->rx_ring[i].buff_count = cpu_to_le16(lp->rx_buff_len); + lp->rx_ring[i].buff_count = cpu_to_le16(lp->rx_buff_len-2); lp->rx_ring[i].rx_flags = cpu_to_le16(OWN_BIT); } @@ -513,6 +525,9 @@ void * mmio = lp->mmio; + /* stop the chip */ + writel(RUN, mmio + CMD0); + /* AUTOPOLL0 Register *//*TBD default value is 8100 in FPS */ writew( 0x8101, mmio + AUTOPOLL0); @@ -654,7 +669,11 @@ */ static int amd8111e_vlan_rx(struct amd8111e_priv *lp, struct sk_buff *skb, u16 vlan_tag) { +#ifdef CONFIG_AMD8111E_NAPI + vlan_hwaccel_receive_skb(skb, lp->vlgrp,vlan_tag); +#else return vlan_hwaccel_rx(skb, lp->vlgrp, vlan_tag); +#endif /* CONFIG_AMD8111E_NAPI */ } #endif @@ -700,6 +719,142 @@ return 0; } +#if CONFIG_AMD8111E_NAPI +/* This function handles the driver receive operation in polling mode */ +static int amd8111e_rx_poll(struct net_device *dev, int * budget) +{ + struct amd8111e_priv *lp = dev->priv; + int rx_index = lp->rx_idx & RX_RING_DR_MOD_MASK; + void * mmio = lp->mmio; + struct sk_buff *skb,*new_skb; + int min_pkt_len, status; + unsigned int intr0; + int num_rx_pkt = 0; + /*int max_rx_pkt = NUM_RX_BUFFERS;*/ + short pkt_len; +#if AMD8111E_VLAN_TAG_USED + short vtag; +#endif + int rx_pkt_limit = dev->quota; + + do{ + /* process receive packets until we use the quota*/ + /* If we own the next entry, it's a new packet. Send it up. */ + while(!(lp->rx_ring[rx_index].rx_flags & OWN_BIT)){ + + /* check if err summary bit is set */ + if(le16_to_cpu(lp->rx_ring[rx_index].rx_flags) + & ERR_BIT){ + /* + * There is a tricky error noted by John Murphy, + * to Russ Nelson: Even with + * full-sized * buffers it's possible for a + * jabber packet to use two buffers, with only + * the last correctly noting the error. + */ + + /* reseting flags */ + lp->rx_ring[rx_index].rx_flags &=RESET_RX_FLAGS; + goto err_next_pkt; + + } + /* check for STP and ENP */ + status = le16_to_cpu(lp->rx_ring[rx_index].rx_flags); + if(!((status & STP_BIT) && (status & ENP_BIT))){ + /* reseting flags */ + lp->rx_ring[rx_index].rx_flags &=RESET_RX_FLAGS; + goto err_next_pkt; + } + pkt_len = le16_to_cpu(lp->rx_ring[rx_index].msg_count) - 4; + +#if AMD8111E_VLAN_TAG_USED + vtag = le16_to_cpu(lp->rx_ring[rx_index].rx_flags) & TT_MASK; + /*MAC will strip vlan tag*/ + if(lp->vlgrp != NULL && vtag !=0) + min_pkt_len =MIN_PKT_LEN - 4; + else +#endif + min_pkt_len =MIN_PKT_LEN; + + if (pkt_len < min_pkt_len) { + lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS; + lp->drv_rx_errors++; + goto err_next_pkt; + } + if(--rx_pkt_limit < 0) + goto rx_not_empty; + if(!(new_skb = dev_alloc_skb(lp->rx_buff_len))){ + /* if allocation fail, + ignore that pkt and go to next one */ + lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS; + lp->drv_rx_errors++; + goto err_next_pkt; + } + + skb_reserve(new_skb, 2); + skb = lp->rx_skbuff[rx_index]; + pci_unmap_single(lp->pci_dev,lp->rx_dma_addr[rx_index], + lp->rx_buff_len-2, PCI_DMA_FROMDEVICE); + skb_put(skb, pkt_len); + skb->dev = dev; + lp->rx_skbuff[rx_index] = new_skb; + new_skb->dev = dev; + lp->rx_dma_addr[rx_index] = pci_map_single(lp->pci_dev, + new_skb->data, lp->rx_buff_len-2,PCI_DMA_FROMDEVICE); + + skb->protocol = eth_type_trans(skb, dev); + +#if AMD8111E_VLAN_TAG_USED + + vtag = lp->rx_ring[rx_index].rx_flags & TT_MASK; + if(lp->vlgrp != NULL && (vtag == TT_VLAN_TAGGED)){ + amd8111e_vlan_rx(lp, skb, + lp->rx_ring[rx_index].tag_ctrl_info); + } else +#endif + + netif_receive_skb(skb); + /*COAL update rx coalescing parameters*/ + lp->coal_conf.rx_packets++; + lp->coal_conf.rx_bytes += pkt_len; + num_rx_pkt++; + dev->last_rx = jiffies; + +err_next_pkt: + lp->rx_ring[rx_index].buff_phy_addr + = cpu_to_le32(lp->rx_dma_addr[rx_index]); + lp->rx_ring[rx_index].buff_count = + cpu_to_le16(lp->rx_buff_len-2); + lp->rx_ring[rx_index].rx_flags |= cpu_to_le16(OWN_BIT); + rx_index = (++lp->rx_idx) & RX_RING_DR_MOD_MASK; + } + /* Check the interrupt status register for more packets in the + mean time. Process them since we have not used up our quota.*/ + + intr0 = readl(mmio + INT0); + /*Ack receive packets */ + writel(intr0 & RINT0,mmio + INT0); + + }while(intr0 & RINT0); + + /* Receive descriptor is empty now */ + dev->quota -= num_rx_pkt; + *budget -= num_rx_pkt; + netif_rx_complete(dev); + /* enable receive interrupt */ + writel(VAL0|RINTEN0, mmio + INTEN0); + writel(VAL2 | RDMD0, mmio + CMD0); + return 0; +rx_not_empty: + /* Do not call a netif_rx_complete */ + dev->quota -= num_rx_pkt; + *budget -= num_rx_pkt; + return 1; + + +} + +#else /* This function will check the ownership of receive buffers and descriptors. It will indicate to kernel up to half the number of maximum receive buffers in the descriptor ring, in a single receive interrupt. It will also replenish the descriptors with new skbs. */ @@ -710,7 +865,7 @@ int rx_index = lp->rx_idx & RX_RING_DR_MOD_MASK; int min_pkt_len, status; int num_rx_pkt = 0; - int max_rx_pkt = NUM_RX_BUFFERS/2; + int max_rx_pkt = NUM_RX_BUFFERS; short pkt_len; #if AMD8111E_VLAN_TAG_USED short vtag; @@ -752,14 +907,14 @@ if (pkt_len < min_pkt_len) { lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS; - lp->stats.rx_errors++; + lp->drv_rx_errors++; goto err_next_pkt; } if(!(new_skb = dev_alloc_skb(lp->rx_buff_len))){ /* if allocation fail, ignore that pkt and go to next one */ lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS; - lp->stats.rx_errors++; + lp->drv_rx_errors++; goto err_next_pkt; } @@ -803,7 +958,7 @@ return 0; } - +#endif /* CONFIG_AMD8111E_NAPI */ /* This function will indicate the link status to the kernel. */ @@ -896,12 +1051,14 @@ new_stats->tx_bytes = amd8111e_read_mib(mmio, xmt_octets); /* stats.rx_errors */ + /* hw errors + errors driver reported */ new_stats->rx_errors = amd8111e_read_mib(mmio, rcv_undersize_pkts)+ amd8111e_read_mib(mmio, rcv_fragments)+ amd8111e_read_mib(mmio, rcv_jabbers)+ amd8111e_read_mib(mmio, rcv_alignment_errors)+ amd8111e_read_mib(mmio, rcv_fcs_errors)+ - amd8111e_read_mib(mmio, rcv_miss_pkts); + amd8111e_read_mib(mmio, rcv_miss_pkts)+ + lp->drv_rx_errors; /* stats.tx_errors */ new_stats->tx_errors = amd8111e_read_mib(mmio, xmt_underrun_pkts); @@ -1119,20 +1276,36 @@ /* Process all the INT event until INTR bit is clear. */ - if (!(intr0 & INTR)) { + if (!(intr0 & INTR)){ handled = 0; goto err_no_interrupt; } - /* Current driver processes 3 interrupts : RINT,TINT,LCINT */ + /* Current driver processes 4 interrupts : RINT,TINT,LCINT,STINT */ writel(intr0, mmio + INT0); /* Check if Receive Interrupt has occurred. */ +#if CONFIG_AMD8111E_NAPI + if(intr0 & RINT0){ + if(netif_rx_schedule_prep(dev)){ + /* Disable receive interupts */ + writel(RINTEN0, mmio + INTEN0); + /* Schedule a polling routine */ + __netif_rx_schedule(dev); + } + else { + printk("************Driver bug! \ + interrupt while in poll\n"); + /* Fix by disabling interrupts */ + writel(RINT0, mmio + INT0); + } + } +#else if(intr0 & RINT0){ amd8111e_rx(dev); writel(VAL2 | RDMD0, mmio + CMD0); } - +#endif /* CONFIG_AMD8111E_NAPI */ /* Check if Transmit Interrupt has occurred. */ if(intr0 & TINT0) amd8111e_tx(dev); @@ -1164,6 +1337,7 @@ } #endif + /* This function closes the network interface and updates the statistics so that most recent statistics will be available after the interface is down. */ @@ -1186,7 +1360,7 @@ spin_unlock_irq(&lp->lock); free_irq(dev->irq, dev); - + /* Update the statistics before closing */ amd8111e_get_stats(dev); lp->opened = 0; @@ -1560,6 +1734,23 @@ } return -EOPNOTSUPP; } +static int amd8111e_set_mac_address(struct net_device *dev, void *p) +{ + struct amd8111e_priv *lp = dev->priv; + int i; + struct sockaddr *addr = p; + + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); + spin_lock_irq(&lp->lock); + /* Setting the MAC address to the device */ + for(i = 0; i < ETH_ADDR_LEN; i++) + writeb( dev->dev_addr[i], lp->mmio + PADR + i ); + + spin_unlock_irq(&lp->lock); + + return 0; +} + /* This function changes the mtu of the device. It restarts the device to initialize the descriptor with new receive buffers. */ @@ -1890,11 +2081,16 @@ dev->stop = amd8111e_close; dev->get_stats = amd8111e_get_stats; dev->set_multicast_list = amd8111e_set_multicast_list; + dev->set_mac_address = amd8111e_set_mac_address; dev->do_ioctl = amd8111e_ioctl; dev->change_mtu = amd8111e_change_mtu; dev->irq =pdev->irq; dev->tx_timeout = amd8111e_tx_timeout; dev->watchdog_timeo = AMD8111E_TX_TIMEOUT; +#ifdef CONFIG_AMD8111E_NAPI + dev->poll = amd8111e_rx_poll; + dev->weight = 32; +#endif #ifdef CONFIG_NET_POLL_CONTROLLER dev->poll_controller = amd8111e_poll; #endif @@ -1908,6 +2104,7 @@ /* Set receive buffer length and set jumbo option*/ amd8111e_set_rx_buff_len(dev); + err = register_netdev(dev); if (err) { printk(KERN_ERR "amd8111e: Cannot register net device, " @@ -1954,7 +2151,7 @@ } static struct pci_driver amd8111e_driver = { - .name = MODULE_NAME, + .name = MODULE_NAME, .id_table = amd8111e_pci_tbl, .probe = amd8111e_probe_one, .remove = __devexit_p(amd8111e_remove_one), diff -Nru a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h --- a/drivers/net/amd8111e.h Wed Apr 14 18:29:04 2004 +++ b/drivers/net/amd8111e.h Wed Apr 14 18:29:04 2004 @@ -606,7 +606,7 @@ /* ipg parameters */ #define DEFAULT_IPG 0x60 #define IFS1_DELTA 36 -#define IPG_CONVERGE_JIFFIES (HZ / 2) +#define IPG_CONVERGE_JIFFIES (HZ/2) #define IPG_STABLE_TIME 5 #define MIN_IPG 96 #define MAX_IPG 255 @@ -790,6 +790,7 @@ #endif char opened; struct net_device_stats stats; + unsigned int drv_rx_errors; struct dev_mc_list* mc_list; struct amd8111e_coalesce_conf coal_conf; diff -Nru a/drivers/net/arcnet/com20020-isa.c b/drivers/net/arcnet/com20020-isa.c --- a/drivers/net/arcnet/com20020-isa.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/arcnet/com20020-isa.c Wed Apr 14 18:29:04 2004 @@ -185,8 +185,6 @@ #ifndef MODULE static int __init com20020isa_setup(char *s) { - struct net_device *dev; - struct arcnet_local *lp; int ints[8]; s = get_options(s, 8, ints); diff -Nru a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c --- a/drivers/net/arm/etherh.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/arm/etherh.c Wed Apr 14 18:29:04 2004 @@ -60,11 +60,28 @@ struct etherh_priv { struct ei_device eidev; + void *ioc_fast; + void *memc; unsigned int id; - unsigned int ctrl_port; + void *ctrl_port; unsigned int ctrl; }; +struct etherh_data { + unsigned long ns8390_offset; + unsigned long dataport_offset; + unsigned long ctrlport_offset; + int ctrl_ioc; + const char name[16]; + /* + * netdev flags and port + */ + unsigned short flags; + unsigned char if_port; + unsigned char tx_start_page; + unsigned char stop_page; +}; + MODULE_AUTHOR("Russell King"); MODULE_DESCRIPTION("EtherH/EtherM driver"); MODULE_LICENSE("GPL"); @@ -72,13 +89,13 @@ static char version[] __initdata = "EtherH/EtherM Driver (c) 2002 Russell King v1.09\n"; -#define ETHERH500_DATAPORT 0x200 /* MEMC */ +#define ETHERH500_DATAPORT 0x800 /* MEMC */ #define ETHERH500_NS8390 0x000 /* MEMC */ -#define ETHERH500_CTRLPORT 0x200 /* IOC */ +#define ETHERH500_CTRLPORT 0x800 /* IOC */ -#define ETHERH600_DATAPORT 16 /* MEMC */ -#define ETHERH600_NS8390 0x200 /* MEMC */ -#define ETHERH600_CTRLPORT 0x080 /* MEMC */ +#define ETHERH600_DATAPORT 0x040 /* MEMC */ +#define ETHERH600_NS8390 0x800 /* MEMC */ +#define ETHERH600_CTRLPORT 0x200 /* MEMC */ #define ETHERH_CP_IE 1 #define ETHERH_CP_IF 2 @@ -90,9 +107,9 @@ /* * These came from CK/TEW */ -#define ETHERM_DATAPORT 0x080 /* MEMC */ -#define ETHERM_NS8390 0x200 /* MEMC */ -#define ETHERM_CTRLPORT 0x08f /* MEMC */ +#define ETHERM_DATAPORT 0x200 /* MEMC */ +#define ETHERM_NS8390 0x800 /* MEMC */ +#define ETHERM_CTRLPORT 0x23c /* MEMC */ #define ETHERM_TX_START_PAGE 64 #define ETHERM_STOP_PAGE 127 @@ -102,18 +119,18 @@ static inline void etherh_set_ctrl(struct etherh_priv *eh, unsigned int mask) { eh->ctrl |= mask; - outb(eh->ctrl, eh->ctrl_port); + writeb(eh->ctrl, eh->ctrl_port); } static inline void etherh_clr_ctrl(struct etherh_priv *eh, unsigned int mask) { eh->ctrl &= ~mask; - outb(eh->ctrl, eh->ctrl_port); + writeb(eh->ctrl, eh->ctrl_port); } static inline unsigned int etherh_get_stat(struct etherh_priv *eh) { - return inb(eh->ctrl_port); + return readb(eh->ctrl_port); } @@ -158,10 +175,10 @@ switch (dev->if_port) { case IF_PORT_10BASE2: - outb((inb(addr) & 0xf8) | 1, addr); + writeb((readb(addr) & 0xf8) | 1, addr); break; case IF_PORT_10BASET: - outb((inb(addr) & 0xf8), addr); + writeb((readb(addr) & 0xf8), addr); break; } break; @@ -200,7 +217,7 @@ stat = 1; break; case IF_PORT_10BASET: - stat = inb(dev->base_addr+EN0_RCNTHI) & 4; + stat = readb(dev->base_addr+EN0_RCNTHI) & 4; break; } break; @@ -258,7 +275,7 @@ { struct ei_device *ei_local = netdev_priv(dev); - outb_p(E8390_NODMA+E8390_PAGE0+E8390_STOP, dev->base_addr); + writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, dev->base_addr); /* * See if we need to change the interface type. @@ -306,31 +323,31 @@ dma_addr = dev->mem_start; count = (count + 1) & ~1; - outb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); + writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); - outb (0x42, addr + EN0_RCNTLO); - outb (0x00, addr + EN0_RCNTHI); - outb (0x42, addr + EN0_RSARLO); - outb (0x00, addr + EN0_RSARHI); - outb (E8390_RREAD | E8390_START, addr + E8390_CMD); + writeb (0x42, addr + EN0_RCNTLO); + writeb (0x00, addr + EN0_RCNTHI); + writeb (0x42, addr + EN0_RSARLO); + writeb (0x00, addr + EN0_RSARHI); + writeb (E8390_RREAD | E8390_START, addr + E8390_CMD); udelay (1); - outb (ENISR_RDC, addr + EN0_ISR); - outb (count, addr + EN0_RCNTLO); - outb (count >> 8, addr + EN0_RCNTHI); - outb (0, addr + EN0_RSARLO); - outb (start_page, addr + EN0_RSARHI); - outb (E8390_RWRITE | E8390_START, addr + E8390_CMD); + writeb (ENISR_RDC, addr + EN0_ISR); + writeb (count, addr + EN0_RCNTLO); + writeb (count >> 8, addr + EN0_RCNTHI); + writeb (0, addr + EN0_RSARLO); + writeb (start_page, addr + EN0_RSARHI); + writeb (E8390_RWRITE | E8390_START, addr + E8390_CMD); if (ei_local->word16) - outsw (dma_addr, buf, count >> 1); + writesw (dma_addr, buf, count >> 1); else - outsb (dma_addr, buf, count); + writesb (dma_addr, buf, count); dma_start = jiffies; - while ((inb (addr + EN0_ISR) & ENISR_RDC) == 0) + while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0) if (jiffies - dma_start > 2*HZ/100) { /* 20ms */ printk(KERN_ERR "%s: timeout waiting for TX RDC\n", dev->name); @@ -339,7 +356,7 @@ break; } - outb (ENISR_RDC, addr + EN0_ISR); + writeb (ENISR_RDC, addr + EN0_ISR); ei_local->dmaing = 0; } @@ -366,21 +383,21 @@ dma_addr = dev->mem_start; buf = skb->data; - outb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); - outb (count, addr + EN0_RCNTLO); - outb (count >> 8, addr + EN0_RCNTHI); - outb (ring_offset, addr + EN0_RSARLO); - outb (ring_offset >> 8, addr + EN0_RSARHI); - outb (E8390_RREAD | E8390_START, addr + E8390_CMD); + writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); + writeb (count, addr + EN0_RCNTLO); + writeb (count >> 8, addr + EN0_RCNTHI); + writeb (ring_offset, addr + EN0_RSARLO); + writeb (ring_offset >> 8, addr + EN0_RSARHI); + writeb (E8390_RREAD | E8390_START, addr + E8390_CMD); if (ei_local->word16) { - insw (dma_addr, buf, count >> 1); + readsw (dma_addr, buf, count >> 1); if (count & 1) - buf[count - 1] = inb (dma_addr); + buf[count - 1] = readb (dma_addr); } else - insb (dma_addr, buf, count); + readsb (dma_addr, buf, count); - outb (ENISR_RDC, addr + EN0_ISR); + writeb (ENISR_RDC, addr + EN0_ISR); ei_local->dmaing = 0; } @@ -405,19 +422,19 @@ addr = dev->base_addr; dma_addr = dev->mem_start; - outb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); - outb (sizeof (*hdr), addr + EN0_RCNTLO); - outb (0, addr + EN0_RCNTHI); - outb (0, addr + EN0_RSARLO); - outb (ring_page, addr + EN0_RSARHI); - outb (E8390_RREAD | E8390_START, addr + E8390_CMD); + writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); + writeb (sizeof (*hdr), addr + EN0_RCNTLO); + writeb (0, addr + EN0_RCNTHI); + writeb (0, addr + EN0_RSARLO); + writeb (ring_page, addr + EN0_RSARHI); + writeb (E8390_RREAD | E8390_START, addr + E8390_CMD); if (ei_local->word16) - insw (dma_addr, hdr, sizeof (*hdr) >> 1); + readsw (dma_addr, hdr, sizeof (*hdr) >> 1); else - insb (dma_addr, hdr, sizeof (*hdr)); + readsb (dma_addr, hdr, sizeof (*hdr)); - outb (ENISR_RDC, addr + EN0_ISR); + writeb (ENISR_RDC, addr + EN0_ISR); ei_local->dmaing = 0; } @@ -543,18 +560,22 @@ static int __init etherh_probe(struct expansion_card *ec, const struct ecard_id *id) { + const struct etherh_data *data = id->data; struct ei_device *ei_local; struct net_device *dev; struct etherh_priv *eh; - const char *dev_type; - int i, size, ret; + int i, ret; etherh_banner(); + ret = ecard_request_resources(ec); + if (ret) + goto out; + dev = alloc_ei_netdev(); if (!dev) { ret = -ENOMEM; - goto out; + goto release; } eh = netdev_priv(dev); @@ -562,111 +583,64 @@ spin_lock_init(&eh->eidev.page_lock); SET_MODULE_OWNER(dev); + SET_NETDEV_DEV(dev, &ec->dev); dev->open = etherh_open; dev->stop = etherh_close; dev->set_config = etherh_set_config; dev->irq = ec->irq; - dev->base_addr = ecard_address(ec, ECARD_MEMC, 0); + dev->if_port = data->if_port; + dev->flags |= data->flags; - /* - * IRQ and control port handling - */ - if (ec->irq != 11) { - ec->ops = ðerh_ops; - ec->irq_data = eh; - } eh->ctrl = 0; eh->id = ec->cid.product; - - switch (ec->cid.product) { - case PROD_ANT_ETHERM: - etherm_addr(dev->dev_addr); - dev->base_addr += ETHERM_NS8390; - dev->mem_start = dev->base_addr + ETHERM_DATAPORT; - eh->ctrl_port = dev->base_addr + ETHERM_CTRLPORT; - break; - - case PROD_I3_ETHERLAN500: - etherh_addr(dev->dev_addr, ec); - dev->base_addr += ETHERH500_NS8390; - dev->mem_start = dev->base_addr + ETHERH500_DATAPORT; - eh->ctrl_port = ecard_address (ec, ECARD_IOC, ECARD_FAST) - + ETHERH500_CTRLPORT; - break; - - case PROD_I3_ETHERLAN600: - case PROD_I3_ETHERLAN600A: - etherh_addr(dev->dev_addr, ec); - dev->base_addr += ETHERH600_NS8390; - dev->mem_start = dev->base_addr + ETHERH600_DATAPORT; - eh->ctrl_port = dev->base_addr + ETHERH600_CTRLPORT; - break; - - default: - printk(KERN_ERR "%s: unknown card type %x\n", - dev->name, ec->cid.product); - ret = -ENODEV; + eh->memc = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), PAGE_SIZE); + if (!eh->memc) { + ret = -ENOMEM; goto free; } - size = 16; - if (ec->cid.product == PROD_ANT_ETHERM) - size <<= 3; - - if (!request_region(dev->base_addr, size, dev->name)) { - ret = -EBUSY; - goto free; + eh->ctrl_port = eh->memc; + if (data->ctrl_ioc) { + eh->ioc_fast = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), PAGE_SIZE); + if (!eh->ioc_fast) { + ret = -ENOMEM; + goto free; + } + eh->ctrl_port = eh->ioc_fast; } + dev->base_addr = (unsigned long)eh->memc + data->ns8390_offset; + dev->mem_start = (unsigned long)eh->memc + data->dataport_offset; + eh->ctrl_port += data->ctrlport_offset; + /* - * If we're in the NIC slot, make sure the IRQ is enabled + * IRQ and control port handling - only for non-NIC slot cards. */ - if (dev->irq == 11) + if (ec->slot_no != 8) { + ec->ops = ðerh_ops; + ec->irq_data = eh; + } else { + /* + * If we're in the NIC slot, make sure the IRQ is enabled + */ etherh_set_ctrl(eh, ETHERH_CP_IE); - - switch (ec->cid.product) { - case PROD_ANT_ETHERM: - dev_type = "ANT EtherM"; - dev->if_port = IF_PORT_UNKNOWN; - break; - - case PROD_I3_ETHERLAN500: - dev_type = "i3 EtherH 500"; - dev->if_port = IF_PORT_UNKNOWN; - break; - - case PROD_I3_ETHERLAN600: - dev_type = "i3 EtherH 600"; - dev->flags |= IFF_PORTSEL | IFF_AUTOMEDIA; - dev->if_port = IF_PORT_10BASET; - break; - - case PROD_I3_ETHERLAN600A: - dev_type = "i3 EtherH 600A"; - dev->flags |= IFF_PORTSEL | IFF_AUTOMEDIA; - dev->if_port = IF_PORT_10BASET; - break; - - default: - dev_type = "unknown"; - break; } - ei_local = netdev_priv(dev); + ei_local = &eh->eidev; if (ec->cid.product == PROD_ANT_ETHERM) { - ei_local->tx_start_page = ETHERM_TX_START_PAGE; - ei_local->stop_page = ETHERM_STOP_PAGE; - ei_local->reg_offset = etherm_regoffsets; + etherm_addr(dev->dev_addr); + ei_local->reg_offset = etherm_regoffsets; } else { - ei_local->tx_start_page = ETHERH_TX_START_PAGE; - ei_local->stop_page = ETHERH_STOP_PAGE; - ei_local->reg_offset = etherh_regoffsets; + etherh_addr(dev->dev_addr, ec); + ei_local->reg_offset = etherh_regoffsets; } ei_local->name = dev->name; ei_local->word16 = 1; + ei_local->tx_start_page = data->tx_start_page; ei_local->rx_start_page = ei_local->tx_start_page + TX_PAGES; + ei_local->stop_page = data->stop_page; ei_local->reset_8390 = etherh_reset; ei_local->block_input = etherh_block_input; ei_local->block_output = etherh_block_output; @@ -678,10 +652,10 @@ ret = register_netdev(dev); if (ret) - goto release; + goto free; printk(KERN_INFO "%s: %s in slot %d, ", - dev->name, dev_type, ec->slot_no); + dev->name, data->name, ec->slot_no); for (i = 0; i < 6; i++) printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':'); @@ -690,10 +664,14 @@ return 0; - release: - release_region(dev->base_addr, 16); free: + if (eh->ioc_fast) + iounmap(eh->ioc_fast); + if (eh->memc) + iounmap(eh->memc); free_netdev(dev); + release: + ecard_release_resources(ec); out: return ret; } @@ -701,25 +679,69 @@ static void __devexit etherh_remove(struct expansion_card *ec) { struct net_device *dev = ecard_get_drvdata(ec); - int size = 16; + struct etherh_priv *eh = netdev_priv(dev); ecard_set_drvdata(ec, NULL); unregister_netdev(dev); - if (ec->cid.product == PROD_ANT_ETHERM) - size <<= 3; - release_region(dev->base_addr, size); + if (eh->ioc_fast) + iounmap(eh->ioc_fast); + iounmap(eh->memc); free_netdev(dev); ec->ops = NULL; kfree(ec->irq_data); + ecard_release_resources(ec); } +static struct etherh_data etherm_data = { + .ns8390_offset = ETHERM_NS8390, + .dataport_offset = ETHERM_NS8390 + ETHERM_DATAPORT, + .ctrlport_offset = ETHERM_NS8390 + ETHERM_CTRLPORT, + .name = "ANT EtherM", + .if_port = IF_PORT_UNKNOWN, + .tx_start_page = ETHERM_TX_START_PAGE, + .stop_page = ETHERM_STOP_PAGE, +}; + +static struct etherh_data etherlan500_data = { + .ns8390_offset = ETHERH500_NS8390, + .dataport_offset = ETHERH500_NS8390 + ETHERH500_DATAPORT, + .ctrlport_offset = ETHERH500_CTRLPORT, + .ctrl_ioc = 1, + .name = "i3 EtherH 500", + .if_port = IF_PORT_UNKNOWN, + .tx_start_page = ETHERH_TX_START_PAGE, + .stop_page = ETHERH_STOP_PAGE, +}; + +static struct etherh_data etherlan600_data = { + .ns8390_offset = ETHERH600_NS8390, + .dataport_offset = ETHERH600_NS8390 + ETHERH600_DATAPORT, + .ctrlport_offset = ETHERH600_NS8390 + ETHERH600_CTRLPORT, + .name = "i3 EtherH 600", + .flags = IFF_PORTSEL | IFF_AUTOMEDIA, + .if_port = IF_PORT_10BASET, + .tx_start_page = ETHERH_TX_START_PAGE, + .stop_page = ETHERH_STOP_PAGE, +}; + +static struct etherh_data etherlan600a_data = { + .ns8390_offset = ETHERH600_NS8390, + .dataport_offset = ETHERH600_NS8390 + ETHERH600_DATAPORT, + .ctrlport_offset = ETHERH600_NS8390 + ETHERH600_CTRLPORT, + .name = "i3 EtherH 600A", + .flags = IFF_PORTSEL | IFF_AUTOMEDIA, + .if_port = IF_PORT_10BASET, + .tx_start_page = ETHERH_TX_START_PAGE, + .stop_page = ETHERH_STOP_PAGE, +}; + static const struct ecard_id etherh_ids[] = { - { MANU_ANT, PROD_ANT_ETHERM }, - { MANU_I3, PROD_I3_ETHERLAN500 }, - { MANU_I3, PROD_I3_ETHERLAN600 }, - { MANU_I3, PROD_I3_ETHERLAN600A }, + { MANU_ANT, PROD_ANT_ETHERM, ðerm_data }, + { MANU_I3, PROD_I3_ETHERLAN500, ðerlan500_data }, + { MANU_I3, PROD_I3_ETHERLAN600, ðerlan600_data }, + { MANU_I3, PROD_I3_ETHERLAN600A, ðerlan600a_data }, { 0xffff, 0xffff } }; @@ -737,8 +759,8 @@ int i; for (i = 0; i < 16; i++) { - etherh_regoffsets[i] = i; - etherm_regoffsets[i] = i << 3; + etherh_regoffsets[i] = i << 2; + etherm_regoffsets[i] = i << 5; } return ecard_register_driver(ðerh_driver); diff -Nru a/drivers/net/dgrs.c b/drivers/net/dgrs.c --- a/drivers/net/dgrs.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/dgrs.c Wed Apr 14 18:29:04 2004 @@ -327,8 +327,10 @@ */ priv0->vplxdma[PLX_DMA0_MODE/4] = 0xFFFFFFFF; x = priv0->vplxdma[PLX_DMA0_MODE/4]; - if (x != 0x00001FFF) + if (x != 0x00001FFF) { + iounmap((void *)priv0->vplxdma); return (0); + } return (1); } @@ -1020,6 +1022,8 @@ if (!is) { printk("%s: Illegal IRQ %d\n", dev0->name, dev0->irq); + iounmap(priv0->vmem); + priv0->vmem = NULL; return -ENXIO; } OUTB(dev0->base_addr + ES4H_AS_31_24, @@ -1101,6 +1105,8 @@ if (priv0->bcomm->bc_status < BC_RUN) { printk("%s: board not operating\n", dev0->name); + iounmap(priv0->vmem); + priv0->vmem = NULL; return -ENXIO; } diff -Nru a/drivers/net/epic100.c b/drivers/net/epic100.c --- a/drivers/net/epic100.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/epic100.c Wed Apr 14 18:29:04 2004 @@ -96,9 +96,9 @@ Making the Tx ring too large decreases the effectiveness of channel bonding and packet priority. There are no ill effects from too-large receive rings. */ -#define TX_RING_SIZE 16 -#define TX_QUEUE_LEN 10 /* Limit ring entries actually used. */ -#define RX_RING_SIZE 32 +#define TX_RING_SIZE 256 +#define TX_QUEUE_LEN 240 /* Limit ring entries actually used. */ +#define RX_RING_SIZE 256 #define TX_TOTAL_SIZE TX_RING_SIZE*sizeof(struct epic_tx_desc) #define RX_TOTAL_SIZE RX_RING_SIZE*sizeof(struct epic_rx_desc) @@ -292,6 +292,12 @@ StopTxDMA=0x20, StopRxDMA=0x40, RestartTx=0x80, }; +#define EpicRemoved 0xffffffff /* Chip failed or removed (CardBus) */ + +#define EpicNapiEvent (TxEmpty | TxDone | \ + RxDone | RxStarted | RxEarlyWarn | RxOverflow | RxFull) +#define EpicNormalEvent (0x0000ffff & ~EpicNapiEvent) + static u16 media2miictl[16] = { 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -330,9 +336,12 @@ /* Ring pointers. */ spinlock_t lock; /* Group with Tx control cache line. */ + spinlock_t napi_lock; + unsigned int reschedule_in_poll; unsigned int cur_tx, dirty_tx; unsigned int cur_rx, dirty_rx; + u32 irq_mask; unsigned int rx_buf_sz; /* Based on MTU+slack. */ struct pci_dev *pci_dev; /* PCI bus location. */ @@ -359,7 +368,8 @@ static void epic_tx_timeout(struct net_device *dev); static void epic_init_ring(struct net_device *dev); static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev); -static int epic_rx(struct net_device *dev); +static int epic_rx(struct net_device *dev, int budget); +static int epic_poll(struct net_device *dev, int *budget); static irqreturn_t epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static struct ethtool_ops netdev_ethtool_ops; @@ -378,7 +388,7 @@ int irq; struct net_device *dev; struct epic_private *ep; - int i, option = 0, duplex = 0; + int i, ret, option = 0, duplex = 0; void *ring_space; dma_addr_t ring_dma; @@ -392,29 +402,33 @@ card_idx++; - i = pci_enable_device(pdev); - if (i) - return i; + ret = pci_enable_device(pdev); + if (ret) + goto out; irq = pdev->irq; if (pci_resource_len(pdev, 0) < pci_id_tbl[chip_idx].io_size) { printk (KERN_ERR "card %d: no PCI region space\n", card_idx); - return -ENODEV; + ret = -ENODEV; + goto err_out_disable; } pci_set_master(pdev); + ret = pci_request_regions(pdev, DRV_NAME); + if (ret < 0) + goto err_out_disable; + + ret = -ENOMEM; + dev = alloc_etherdev(sizeof (*ep)); if (!dev) { printk (KERN_ERR "card %d: no memory for eth device\n", card_idx); - return -ENOMEM; + goto err_out_free_res; } SET_MODULE_OWNER(dev); SET_NETDEV_DEV(dev, &pdev->dev); - if (pci_request_regions(pdev, DRV_NAME)) - goto err_out_free_netdev; - #ifdef USE_IO_OPS ioaddr = pci_resource_start (pdev, 0); #else @@ -422,7 +436,7 @@ ioaddr = (long) ioremap (ioaddr, pci_resource_len (pdev, 1)); if (!ioaddr) { printk (KERN_ERR DRV_NAME " %d: ioremap failed\n", card_idx); - goto err_out_free_res; + goto err_out_free_netdev; } #endif @@ -459,7 +473,9 @@ dev->base_addr = ioaddr; dev->irq = irq; - spin_lock_init (&ep->lock); + spin_lock_init(&ep->lock); + spin_lock_init(&ep->napi_lock); + ep->reschedule_in_poll = 0; /* Bring the chip out of low-power mode. */ outl(0x4200, ioaddr + GENCTL); @@ -489,6 +505,9 @@ ep->pci_dev = pdev; ep->chip_id = chip_idx; ep->chip_flags = pci_id_tbl[chip_idx].drv_flags; + ep->irq_mask = + (ep->chip_flags & TYPE2_INTR ? PCIBusErr175 : PCIBusErr170) + | CntFull | TxUnderrun | EpicNapiEvent; /* Find the connected MII xcvrs. Doing this in open() would allow detecting external xcvrs later, but @@ -543,10 +562,12 @@ dev->ethtool_ops = &netdev_ethtool_ops; dev->watchdog_timeo = TX_TIMEOUT; dev->tx_timeout = &epic_tx_timeout; + dev->poll = epic_poll; + dev->weight = 64; - i = register_netdev(dev); - if (i) - goto err_out_unmap_tx; + ret = register_netdev(dev); + if (ret < 0) + goto err_out_unmap_rx; printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", dev->name, pci_id_tbl[chip_idx].name, ioaddr, dev->irq); @@ -554,19 +575,24 @@ printk("%2.2x:", dev->dev_addr[i]); printk("%2.2x.\n", dev->dev_addr[i]); - return 0; +out: + return ret; +err_out_unmap_rx: + pci_free_consistent(pdev, RX_TOTAL_SIZE, ep->rx_ring, ep->rx_ring_dma); err_out_unmap_tx: pci_free_consistent(pdev, TX_TOTAL_SIZE, ep->tx_ring, ep->tx_ring_dma); err_out_iounmap: #ifndef USE_IO_OPS iounmap(ioaddr); -err_out_free_res: -#endif - pci_release_regions(pdev); err_out_free_netdev: +#endif free_netdev(dev); - return -ENODEV; +err_out_free_res: + pci_release_regions(pdev); +err_out_disable: + pci_disable_device(pdev); + goto out; } /* Serial EEPROM section. */ @@ -592,6 +618,36 @@ #define EE_READ256_CMD (6 << 8) #define EE_ERASE_CMD (7 << 6) +static void epic_disable_int(struct net_device *dev, struct epic_private *ep) +{ + long ioaddr = dev->base_addr; + + outl(0x00000000, ioaddr + INTMASK); +} + +static inline void __epic_pci_commit(long ioaddr) +{ +#ifndef USE_IO_OPS + inl(ioaddr + INTMASK); +#endif +} + +static void epic_napi_irq_off(struct net_device *dev, struct epic_private *ep) +{ + long ioaddr = dev->base_addr; + + outl(ep->irq_mask & ~EpicNapiEvent, ioaddr + INTMASK); + __epic_pci_commit(ioaddr); +} + +static void epic_napi_irq_on(struct net_device *dev, struct epic_private *ep) +{ + long ioaddr = dev->base_addr; + + /* No need to commit possible posted write */ + outl(ep->irq_mask | EpicNapiEvent, ioaddr + INTMASK); +} + static int __devinit read_eeprom(long ioaddr, int location) { int i; @@ -752,9 +808,8 @@ /* Enable interrupts by setting the interrupt mask. */ outl((ep->chip_flags & TYPE2_INTR ? PCIBusErr175 : PCIBusErr170) - | CntFull | TxUnderrun | TxDone | TxEmpty - | RxError | RxOverflow | RxFull | RxHeader | RxDone, - ioaddr + INTMASK); + | CntFull | TxUnderrun + | RxError | RxHeader | EpicNapiEvent, ioaddr + INTMASK); if (debug > 1) printk(KERN_DEBUG "%s: epic_open() ioaddr %lx IRQ %d status %4.4x " @@ -795,7 +850,7 @@ } /* Remove the packets on the Rx queue. */ - epic_rx(dev); + epic_rx(dev, RX_RING_SIZE); } static void epic_restart(struct net_device *dev) @@ -841,9 +896,9 @@ /* Enable interrupts by setting the interrupt mask. */ outl((ep->chip_flags & TYPE2_INTR ? PCIBusErr175 : PCIBusErr170) - | CntFull | TxUnderrun | TxDone | TxEmpty - | RxError | RxOverflow | RxFull | RxHeader | RxDone, - ioaddr + INTMASK); + | CntFull | TxUnderrun + | RxError | RxHeader | EpicNapiEvent, ioaddr + INTMASK); + printk(KERN_DEBUG "%s: epic_restart() done, cmd status %4.4x, ctl %4.4x" " interrupt %4.4x.\n", dev->name, (int)inl(ioaddr + COMMAND), (int)inl(ioaddr + GENCTL), @@ -929,7 +984,6 @@ int i; ep->tx_full = 0; - ep->lock = (spinlock_t) SPIN_LOCK_UNLOCKED; ep->dirty_tx = ep->cur_tx = 0; ep->cur_rx = ep->dirty_rx = 0; ep->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); @@ -1029,6 +1083,76 @@ return 0; } +static void epic_tx_error(struct net_device *dev, struct epic_private *ep, + int status) +{ + struct net_device_stats *stats = &ep->stats; + +#ifndef final_version + /* There was an major error, log it. */ + if (debug > 1) + printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n", + dev->name, status); +#endif + stats->tx_errors++; + if (status & 0x1050) + stats->tx_aborted_errors++; + if (status & 0x0008) + stats->tx_carrier_errors++; + if (status & 0x0040) + stats->tx_window_errors++; + if (status & 0x0010) + stats->tx_fifo_errors++; +} + +static void epic_tx(struct net_device *dev, struct epic_private *ep) +{ + unsigned int dirty_tx, cur_tx; + + /* + * Note: if this lock becomes a problem we can narrow the locked + * region at the cost of occasionally grabbing the lock more times. + */ + cur_tx = ep->cur_tx; + for (dirty_tx = ep->dirty_tx; cur_tx - dirty_tx > 0; dirty_tx++) { + struct sk_buff *skb; + int entry = dirty_tx % TX_RING_SIZE; + int txstatus = le32_to_cpu(ep->tx_ring[entry].txstatus); + + if (txstatus & DescOwn) + break; /* It still hasn't been Txed */ + + if (likely(txstatus & 0x0001)) { + ep->stats.collisions += (txstatus >> 8) & 15; + ep->stats.tx_packets++; + ep->stats.tx_bytes += ep->tx_skbuff[entry]->len; + } else + epic_tx_error(dev, ep, txstatus); + + /* Free the original skb. */ + skb = ep->tx_skbuff[entry]; + pci_unmap_single(ep->pci_dev, ep->tx_ring[entry].bufaddr, + skb->len, PCI_DMA_TODEVICE); + dev_kfree_skb_irq(skb); + ep->tx_skbuff[entry] = 0; + } + +#ifndef final_version + if (cur_tx - dirty_tx > TX_RING_SIZE) { + printk(KERN_WARNING + "%s: Out-of-sync dirty pointer, %d vs. %d, full=%d.\n", + dev->name, dirty_tx, cur_tx, ep->tx_full); + dirty_tx += TX_RING_SIZE; + } +#endif + ep->dirty_tx = dirty_tx; + if (ep->tx_full && cur_tx - dirty_tx < TX_QUEUE_LEN - 4) { + /* The ring is no longer full, allow new TX entries. */ + ep->tx_full = 0; + netif_wake_queue(dev); + } +} + /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ static irqreturn_t epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) @@ -1042,7 +1166,7 @@ do { status = inl(ioaddr + INTSTAT); /* Acknowledge all of the current interrupt sources ASAP. */ - outl(status & 0x00007fff, ioaddr + INTSTAT); + outl(status & EpicNormalEvent, ioaddr + INTSTAT); if (debug > 4) printk(KERN_DEBUG "%s: Interrupt, status=%#8.8x new " @@ -1053,74 +1177,21 @@ break; handled = 1; - if (status & (RxDone | RxStarted | RxEarlyWarn | RxOverflow)) - epic_rx(dev); - - if (status & (TxEmpty | TxDone)) { - unsigned int dirty_tx, cur_tx; - - /* Note: if this lock becomes a problem we can narrow the locked - region at the cost of occasionally grabbing the lock more - times. */ - spin_lock(&ep->lock); - cur_tx = ep->cur_tx; - dirty_tx = ep->dirty_tx; - for (; cur_tx - dirty_tx > 0; dirty_tx++) { - struct sk_buff *skb; - int entry = dirty_tx % TX_RING_SIZE; - int txstatus = le32_to_cpu(ep->tx_ring[entry].txstatus); - - if (txstatus & DescOwn) - break; /* It still hasn't been Txed */ - - if ( ! (txstatus & 0x0001)) { - /* There was an major error, log it. */ -#ifndef final_version - if (debug > 1) - printk(KERN_DEBUG "%s: Transmit error, Tx status %8.8x.\n", - dev->name, txstatus); -#endif - ep->stats.tx_errors++; - if (txstatus & 0x1050) ep->stats.tx_aborted_errors++; - if (txstatus & 0x0008) ep->stats.tx_carrier_errors++; - if (txstatus & 0x0040) ep->stats.tx_window_errors++; - if (txstatus & 0x0010) ep->stats.tx_fifo_errors++; - } else { - ep->stats.collisions += (txstatus >> 8) & 15; - ep->stats.tx_packets++; - ep->stats.tx_bytes += ep->tx_skbuff[entry]->len; - } - - /* Free the original skb. */ - skb = ep->tx_skbuff[entry]; - pci_unmap_single(ep->pci_dev, ep->tx_ring[entry].bufaddr, - skb->len, PCI_DMA_TODEVICE); - dev_kfree_skb_irq(skb); - ep->tx_skbuff[entry] = 0; - } - -#ifndef final_version - if (cur_tx - dirty_tx > TX_RING_SIZE) { - printk(KERN_WARNING "%s: Out-of-sync dirty pointer, %d vs. %d, full=%d.\n", - dev->name, dirty_tx, cur_tx, ep->tx_full); - dirty_tx += TX_RING_SIZE; - } -#endif - ep->dirty_tx = dirty_tx; - if (ep->tx_full - && cur_tx - dirty_tx < TX_QUEUE_LEN - 4) { - /* The ring is no longer full, allow new TX entries. */ - ep->tx_full = 0; - spin_unlock(&ep->lock); - netif_wake_queue(dev); + if ((status & EpicNapiEvent) && !ep->reschedule_in_poll) { + spin_lock(&ep->napi_lock); + if (netif_rx_schedule_prep(dev)) { + epic_napi_irq_off(dev, ep); + __netif_rx_schedule(dev); } else - spin_unlock(&ep->lock); + ep->reschedule_in_poll++; + spin_unlock(&ep->napi_lock); } + status &= ~EpicNapiEvent; /* Check uncommon events all at once. */ - if (status & (CntFull | TxUnderrun | RxOverflow | RxFull | - PCIBusErr170 | PCIBusErr175)) { - if (status == 0xffffffff) /* Chip failed or removed (CardBus). */ + if (status & + (CntFull | TxUnderrun | PCIBusErr170 | PCIBusErr175)) { + if (status == EpicRemoved) break; /* Always update the error counts to avoid overhead later. */ ep->stats.rx_missed_errors += inb(ioaddr + MPCNT); @@ -1133,11 +1204,6 @@ /* Restart the transmit process. */ outl(RestartTx, ioaddr + COMMAND); } - if (status & RxOverflow) { /* Missed a Rx frame. */ - ep->stats.rx_errors++; - } - if (status & (RxOverflow | RxFull)) - outw(RxQueued, ioaddr + COMMAND); if (status & PCIBusErr170) { printk(KERN_ERR "%s: PCI Bus Error! EPIC status %4.4x.\n", dev->name, status); @@ -1147,6 +1213,8 @@ /* Clear all error sources. */ outl(status & 0x7f18, ioaddr + INTSTAT); } + if (!(status & EpicNormalEvent)) + break; if (--boguscnt < 0) { printk(KERN_ERR "%s: Too much work at interrupt, " "IntrStatus=0x%8.8x.\n", @@ -1164,7 +1232,7 @@ return IRQ_RETVAL(handled); } -static int epic_rx(struct net_device *dev) +static int epic_rx(struct net_device *dev, int budget) { struct epic_private *ep = dev->priv; int entry = ep->cur_rx % RX_RING_SIZE; @@ -1174,6 +1242,10 @@ if (debug > 4) printk(KERN_DEBUG " In epic_rx(), entry %d %8.8x.\n", entry, ep->rx_ring[entry].rxstatus); + + if (rx_work_limit > budget) + rx_work_limit = budget; + /* If we own the next entry, it's a new packet. Send it up. */ while ((ep->rx_ring[entry].rxstatus & cpu_to_le32(DescOwn)) == 0) { int status = le32_to_cpu(ep->rx_ring[entry].rxstatus); @@ -1234,7 +1306,7 @@ ep->rx_skbuff[entry] = NULL; } skb->protocol = eth_type_trans(skb, dev); - netif_rx(skb); + netif_receive_skb(skb); dev->last_rx = jiffies; ep->stats.rx_packets++; ep->stats.rx_bytes += pkt_len; @@ -1262,6 +1334,61 @@ return work_done; } +static void epic_rx_err(struct net_device *dev, struct epic_private *ep) +{ + long ioaddr = dev->base_addr; + int status; + + status = inl(ioaddr + INTSTAT); + + if (status == EpicRemoved) + return; + if (status & RxOverflow) /* Missed a Rx frame. */ + ep->stats.rx_errors++; + if (status & (RxOverflow | RxFull)) + outw(RxQueued, ioaddr + COMMAND); +} + +static int epic_poll(struct net_device *dev, int *budget) +{ + struct epic_private *ep = dev->priv; + int work_done, orig_budget; + long ioaddr = dev->base_addr; + + orig_budget = (*budget > dev->quota) ? dev->quota : *budget; + +rx_action: + + epic_tx(dev, ep); + + work_done = epic_rx(dev, *budget); + + epic_rx_err(dev, ep); + + *budget -= work_done; + dev->quota -= work_done; + + if (netif_running(dev) && (work_done < orig_budget)) { + unsigned long flags; + + spin_lock_irqsave(&ep->napi_lock, flags); + + if (ep->reschedule_in_poll) { + ep->reschedule_in_poll--; + spin_unlock_irqrestore(&ep->napi_lock, flags); + goto rx_action; + } + + outl(EpicNapiEvent, ioaddr + INTSTAT); + epic_napi_irq_on(dev, ep); + __netif_rx_complete(dev); + + spin_unlock_irqrestore(&ep->napi_lock, flags); + } + + return (work_done >= orig_budget); +} + static int epic_close(struct net_device *dev) { long ioaddr = dev->base_addr; @@ -1276,9 +1403,13 @@ dev->name, (int)inl(ioaddr + INTSTAT)); del_timer_sync(&ep->timer); - epic_pause(dev); + + epic_disable_int(dev, ep); + free_irq(dev->irq, dev); + epic_pause(dev); + /* Free all the skbuffs in the Rx queue. */ for (i = 0; i < RX_RING_SIZE; i++) { skb = ep->rx_skbuff[i]; @@ -1476,6 +1607,7 @@ #endif pci_release_regions(pdev); free_netdev(dev); + pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); /* pci_power_off(pdev, -1); */ } diff -Nru a/drivers/net/fc/iph5526.c b/drivers/net/fc/iph5526.c --- a/drivers/net/fc/iph5526.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/fc/iph5526.c Wed Apr 14 18:29:04 2004 @@ -2910,7 +2910,7 @@ { struct fc_info *fi = dev->priv; printk(KERN_WARNING "%s: timed out on send.\n", dev->name); - fi->fc_stats.rx_dropped++; + fi->fc_stats.tx_dropped++; dev->trans_start = jiffies; netif_wake_queue(dev); } @@ -2953,7 +2953,7 @@ fi->fc_stats.tx_packets++; } else - fi->fc_stats.rx_dropped++; + fi->fc_stats.tx_dropped++; dev->trans_start = jiffies; /* We free up the IP buffers in the OCI_interrupt handler. * status == 0 implies that the frame was not transmitted. So the diff -Nru a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c --- a/drivers/net/gt96100eth.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/gt96100eth.c Wed Apr 14 18:29:04 2004 @@ -1212,7 +1212,7 @@ cmdstat, nextOut); if (cmdstat & (u32)rxOwn) { - //err(__FUNCTION__ ": device owns descriptor!\n"); + //err("%s: device owns descriptor!\n", __FUNCTION__); // DMA is not finished updating descriptor??? // Leave and come back later to pick-up where // we left off. diff -Nru a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c --- a/drivers/net/irda/smsc-ircc2.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/irda/smsc-ircc2.c Wed Apr 14 18:29:04 2004 @@ -1429,7 +1429,7 @@ } if (iir & IRCC_IIR_ACTIVE_FRAME) { - /*printk(KERN_WARNING __FUNCTION__ "(): Active Frame\n");*/ + /*printk(KERN_WARNING "%s(): Active Frame\n", __FUNCTION__);*/ } /* Enable interrupts again */ @@ -1995,7 +1995,7 @@ while(address->cfg_base){ cfg_base = address->cfg_base; - /*printk(KERN_WARNING __FUNCTION__ "(): probing: 0x%02x for: 0x%02x\n", cfg_base, address->type);*/ + /*printk(KERN_WARNING "%s(): probing: 0x%02x for: 0x%02x\n", __FUNCTION__, cfg_base, address->type);*/ if( address->type & SMSCSIO_TYPE_FDC){ type = "FDC"; @@ -2040,7 +2040,7 @@ outb(SMSCSIOFLAT_UARTMODE0C_REG, cfgbase); mode = inb(cfgbase+1); - /*printk(KERN_WARNING __FUNCTION__ "(): mode: 0x%02x\n", mode);*/ + /*printk(KERN_WARNING "%s(): mode: 0x%02x\n", __FUNCTION__, mode);*/ if(!(mode & SMSCSIOFLAT_UART2MODE_VAL_IRDA)) WARNING("%s(): IrDA not enabled\n", __FUNCTION__); diff -Nru a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c --- a/drivers/net/irda/via-ircc.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/irda/via-ircc.c Wed Apr 14 18:29:04 2004 @@ -360,7 +360,7 @@ /* Reserve the ioports that we need */ if (!request_region(self->io.fir_base, self->io.fir_ext, driver_name)) { -// WARNING(__FUNCTION__ "(), can't get iobase of 0x%03x\n",self->io.fir_base); +// WARNING("%s(), can't get iobase of 0x%03x\n", __FUNCTION__, self->io.fir_base); err = -ENODEV; goto err_out1; } diff -Nru a/drivers/net/natsemi.c b/drivers/net/natsemi.c --- a/drivers/net/natsemi.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/natsemi.c Wed Apr 14 18:29:04 2004 @@ -387,7 +387,7 @@ IntrStatus = 0x10, IntrMask = 0x14, IntrEnable = 0x18, - IntrHoldoff = 0x16, /* DP83816 only */ + IntrHoldoff = 0x1C, /* DP83816 only */ TxRingPtr = 0x20, TxConfig = 0x24, RxRingPtr = 0x30, diff -Nru a/drivers/net/net_init.c b/drivers/net/net_init.c --- a/drivers/net/net_init.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/net_init.c Wed Apr 14 18:29:04 2004 @@ -79,8 +79,9 @@ /* ensure 32-byte alignment of both the device and private area */ - alloc_size = (sizeof(struct net_device) + 31) & ~31; - alloc_size += sizeof_priv + 31; + alloc_size = (sizeof(struct net_device) + NETDEV_ALIGN_CONST) + & ~NETDEV_ALIGN_CONST; + alloc_size += sizeof_priv + NETDEV_ALIGN_CONST; p = kmalloc (alloc_size, GFP_KERNEL); if (!p) { @@ -90,7 +91,8 @@ memset(p, 0, alloc_size); - dev = (struct net_device *)(((long)p + 31) & ~31); + dev = (struct net_device *)(((long)p + NETDEV_ALIGN_CONST) + & ~NETDEV_ALIGN_CONST); dev->padded = (char *)dev - (char *)p; if (sizeof_priv) diff -Nru a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c --- a/drivers/net/pcmcia/nmclan_cs.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/pcmcia/nmclan_cs.c Wed Apr 14 18:29:04 2004 @@ -470,7 +470,7 @@ dev = alloc_etherdev(sizeof(mace_private)); if (!dev) return NULL; - lp = dev->priv; + lp = netdev_priv(dev); link = &lp->link; link->priv = dev; @@ -707,7 +707,7 @@ { client_handle_t handle = link->handle; struct net_device *dev = link->priv; - mace_private *lp = dev->priv; + mace_private *lp = netdev_priv(dev); tuple_t tuple; cisparse_t parse; u_char buf[64]; @@ -875,7 +875,7 @@ ---------------------------------------------------------------------------- */ static void nmclan_reset(struct net_device *dev) { - mace_private *lp = dev->priv; + mace_private *lp = netdev_priv(dev); #if RESET_XILINX dev_link_t *link = &lp->link; @@ -944,7 +944,7 @@ static int mace_open(struct net_device *dev) { ioaddr_t ioaddr = dev->base_addr; - mace_private *lp = dev->priv; + mace_private *lp = netdev_priv(dev); dev_link_t *link = &lp->link; if (!DEV_OK(link)) @@ -967,7 +967,7 @@ static int mace_close(struct net_device *dev) { ioaddr_t ioaddr = dev->base_addr; - mace_private *lp = dev->priv; + mace_private *lp = netdev_priv(dev); dev_link_t *link = &lp->link; DEBUG(2, "%s: shutting down ethercard.\n", dev->name); @@ -1022,7 +1022,7 @@ static void mace_tx_timeout(struct net_device *dev) { - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); dev_link_t *link = &lp->link; printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); @@ -1038,7 +1038,7 @@ static int mace_start_xmit(struct sk_buff *skb, struct net_device *dev) { - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; netif_stop_queue(dev); @@ -1099,7 +1099,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = (struct net_device *) dev_id; - mace_private *lp = dev->priv; + mace_private *lp = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; int status; int IntrCnt = MACE_MAX_IR_ITERATIONS; @@ -1241,7 +1241,7 @@ ---------------------------------------------------------------------------- */ static int mace_rx(struct net_device *dev, unsigned char RxCnt) { - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; unsigned char rx_framecnt; unsigned short rx_status; @@ -1408,7 +1408,7 @@ ---------------------------------------------------------------------------- */ static void update_stats(ioaddr_t ioaddr, struct net_device *dev) { - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); lp->mace_stats.rcvcc += mace_read(lp, ioaddr, MACE_RCVCC); lp->mace_stats.rntpc += mace_read(lp, ioaddr, MACE_RNTPC); @@ -1454,7 +1454,7 @@ ---------------------------------------------------------------------------- */ static struct net_device_stats *mace_get_stats(struct net_device *dev) { - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); update_stats(dev->base_addr, dev); @@ -1549,7 +1549,7 @@ ---------------------------------------------------------------------------- */ static void restore_multicast_list(struct net_device *dev) { - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); int num_addrs = lp->multicast_num_addrs; int *ladrf = lp->multicast_ladrf; ioaddr_t ioaddr = dev->base_addr; @@ -1606,7 +1606,7 @@ static void set_multicast_list(struct net_device *dev) { - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); int adr[ETHER_ADDR_LEN] = {0}; /* Ethernet address */ int i; struct dev_mc_list *dmi = dev->mc_list; @@ -1645,10 +1645,10 @@ static void restore_multicast_list(struct net_device *dev) { ioaddr_t ioaddr = dev->base_addr; - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); DEBUG(2, "%s: restoring Rx mode to %d addresses.\n", dev->name, - ((mace_private *)(dev->priv))->multicast_num_addrs); + lp->multicast_num_addrs); if (dev->flags & IFF_PROMISC) { /* Promiscuous mode: receive all packets */ @@ -1665,7 +1665,7 @@ static void set_multicast_list(struct net_device *dev) { - mace_private *lp = (mace_private *)dev->priv; + mace_private *lp = netdev_priv(dev); #ifdef PCMCIA_DEBUG if (pc_debug > 1) { diff -Nru a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c --- a/drivers/net/pcmcia/xirc2ps_cs.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/pcmcia/xirc2ps_cs.c Wed Apr 14 18:29:04 2004 @@ -595,7 +595,7 @@ dev = alloc_etherdev(sizeof(local_info_t)); if (!dev) return NULL; - local = dev->priv; + local = netdev_priv(dev); link = &local->link; link->priv = dev; @@ -710,7 +710,7 @@ set_card_type(dev_link_t *link, const void *s) { struct net_device *dev = link->priv; - local_info_t *local = dev->priv; + local_info_t *local = netdev_priv(dev); #ifdef PCMCIA_DEBUG unsigned cisrev = ((const unsigned char *)s)[2]; #endif @@ -805,7 +805,7 @@ { client_handle_t handle = link->handle; struct net_device *dev = link->priv; - local_info_t *local = dev->priv; + local_info_t *local = netdev_priv(dev); tuple_t tuple; cisparse_t parse; ioaddr_t ioaddr; @@ -1159,7 +1159,7 @@ if (link->win) { struct net_device *dev = link->priv; - local_info_t *local = dev->priv; + local_info_t *local = netdev_priv(dev); if (local->dingo) iounmap(local->dingo_ccr - 0x0800); pcmcia_release_window(link->win); @@ -1246,7 +1246,7 @@ xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = (struct net_device *)dev_id; - local_info_t *lp = dev->priv; + local_info_t *lp = netdev_priv(dev); ioaddr_t ioaddr; u_char saved_page; unsigned bytes_rcvd; @@ -1468,7 +1468,7 @@ static void do_tx_timeout(struct net_device *dev) { - local_info_t *lp = dev->priv; + local_info_t *lp = netdev_priv(dev); printk(KERN_NOTICE "%s: transmit timed out\n", dev->name); lp->stats.tx_errors++; /* reset the card */ @@ -1480,7 +1480,7 @@ static int do_start_xmit(struct sk_buff *skb, struct net_device *dev) { - local_info_t *lp = dev->priv; + local_info_t *lp = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; int okay; unsigned freespace; @@ -1537,7 +1537,7 @@ static struct net_device_stats * do_get_stats(struct net_device *dev) { - local_info_t *lp = dev->priv; + local_info_t *lp = netdev_priv(dev); /* lp->stats.rx_missed_errors = GetByte(?) */ return &lp->stats; @@ -1552,7 +1552,7 @@ set_addresses(struct net_device *dev) { ioaddr_t ioaddr = dev->base_addr; - local_info_t *lp = dev->priv; + local_info_t *lp = netdev_priv(dev); struct dev_mc_list *dmi = dev->mc_list; char *addr; int i,j,k,n; @@ -1617,7 +1617,7 @@ static int do_config(struct net_device *dev, struct ifmap *map) { - local_info_t *local = dev->priv; + local_info_t *local = netdev_priv(dev); DEBUG(0, "do_config(%p)\n", dev); if (map->port != 255 && map->port != dev->if_port) { @@ -1643,7 +1643,7 @@ static int do_open(struct net_device *dev) { - local_info_t *lp = dev->priv; + local_info_t *lp = netdev_priv(dev); dev_link_t *link = &lp->link; DEBUG(0, "do_open(%p)\n", dev); @@ -1676,7 +1676,7 @@ static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - local_info_t *local = dev->priv; + local_info_t *local = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; u16 *data = (u16 *)&rq->ifr_data; @@ -1708,7 +1708,7 @@ static void hardreset(struct net_device *dev) { - local_info_t *local = dev->priv; + local_info_t *local = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; SelectPage(4); @@ -1725,7 +1725,7 @@ static void do_reset(struct net_device *dev, int full) { - local_info_t *local = dev->priv; + local_info_t *local = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; unsigned value; @@ -1886,7 +1886,7 @@ static int init_mii(struct net_device *dev) { - local_info_t *local = dev->priv; + local_info_t *local = netdev_priv(dev); ioaddr_t ioaddr = dev->base_addr; unsigned control, status, linkpartner; int i; @@ -1973,7 +1973,7 @@ do_stop(struct net_device *dev) { ioaddr_t ioaddr = dev->base_addr; - local_info_t *lp = dev->priv; + local_info_t *lp = netdev_priv(dev); dev_link_t *link = &lp->link; DEBUG(0, "do_stop(%p)\n", dev); diff -Nru a/drivers/net/r8169.c b/drivers/net/r8169.c --- a/drivers/net/r8169.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/r8169.c Wed Apr 14 18:29:04 2004 @@ -50,6 +50,9 @@ #define DMA_32BIT_MASK 0xffffffffULL #define DMA_64BIT_MASK 0xffffffffffffffffULL +#define DMA_64BIT_MASK 0xffffffffffffffffULL +#define DMA_32BIT_MASK 0xffffffffULL + #define RTL8169_VERSION "1.2" #define MODULENAME "r8169" #define RTL8169_DRIVER_NAME MODULENAME " Gigabit Ethernet driver " RTL8169_VERSION diff -Nru a/drivers/net/sk_mca.c b/drivers/net/sk_mca.c --- a/drivers/net/sk_mca.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/sk_mca.c Wed Apr 14 18:29:04 2004 @@ -997,13 +997,13 @@ block.Mode &= ~LANCE_INIT_PROM; if (dev->flags & IFF_ALLMULTI) { /* get all multicasts */ - memset(block.LAdrF, 8, 0xff); + memset(block.LAdrF, 0xff, sizeof(block.LAdrF)); } else { /* get selected/no multicasts */ struct dev_mc_list *mptr; int code; - memset(block.LAdrF, 8, 0x00); + memset(block.LAdrF, 0, sizeof(block.LAdrF)); for (mptr = dev->mc_list; mptr != NULL; mptr = mptr->next) { code = GetHash(mptr->dmi_addr); block.LAdrF[(code >> 3) & 7] |= 1 << (code & 7); diff -Nru a/drivers/net/tc35815.c b/drivers/net/tc35815.c --- a/drivers/net/tc35815.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/tc35815.c Wed Apr 14 18:29:04 2004 @@ -1724,12 +1724,7 @@ static int __init tc35815_init_module(void) { - int err; - - if ((err = pci_module_init(&tc35815_driver)) < 0 ) - return err; - else - return 0; + return pci_module_init(&tc35815_driver); } static void __exit tc35815_cleanup_module(void) diff -Nru a/drivers/net/wan/lmc/lmc_proto.c b/drivers/net/wan/lmc/lmc_proto.c --- a/drivers/net/wan/lmc/lmc_proto.c Wed Apr 14 18:29:04 2004 +++ b/drivers/net/wan/lmc/lmc_proto.c Wed Apr 14 18:29:04 2004 @@ -50,7 +50,6 @@ #include "lmc_debug.h" #include "lmc_ioctl.h" #include "lmc_proto.h" -//#include "lmc_proto_raw.h" /* * The compile-time variable SPPPSTUP causes the module to be diff -Nru a/drivers/net/wan/lmc/lmc_proto_raw.h b/drivers/net/wan/lmc/lmc_proto_raw.h --- a/drivers/net/wan/lmc/lmc_proto_raw.h Wed Apr 14 18:29:04 2004 +++ /dev/null Wed Dec 31 16:00:00 1969 @@ -1,4 +0,0 @@ -#ifndef _LMC_PROTO_RAW_H_ -#define _LMC_PROTO_RAW_H_ - -#endif diff -Nru a/drivers/net/wan/lmc/lmc_ver.h b/drivers/net/wan/lmc/lmc_ver.h --- a/drivers/net/wan/lmc/lmc_ver.h Wed Apr 14 18:29:04 2004 +++ /dev/null Wed Dec 31 16:00:00 1969 @@ -1,123 +0,0 @@ -#include - -#ifndef _IF_LMC_LINUXVER_ -#define _IF_LMC_LINUXVER_ - - /* - * Copyright (c) 1997-2000 LAN Media Corporation (LMC) - * All rights reserved. www.lanmedia.com - * - * This code is written by: - * Andrew Stanley-Jones (asj@cban.com) - * Rob Braun (bbraun@vix.com), - * Michael Graff (explorer@vix.com) and - * Matt Thomas (matt@3am-software.com). - * - * This software may be used and distributed according to the terms - * of the GNU General Public License version 2, incorporated herein by reference. - */ - - /* - * This file defines and controls all linux version - * differences. - * - * This is being done to keep 1 central location where all linux - * version differences can be kept and maintained. as this code was - * found version issues where pepered throughout the source code and - * made the souce code not only hard to read but version problems hard - * to track down. If I'm overiding a function/etc with something in - * this file it will be prefixed by "LMC_" which will mean look - * here for the version dependent change that's been done. - * - */ - -#if LINUX_VERSION_CODE < 0x20363 -#define net_device device -#endif - -#if LINUX_VERSION_CODE < 0x20363 -#define LMC_XMITTER_BUSY(x) (x)->tbusy = 1 -#define LMC_XMITTER_FREE(x) (x)->tbusy = 0 -#define LMC_XMITTER_INIT(x) (x)->tbusy = 0 -#else -#define LMC_XMITTER_BUSY(x) netif_stop_queue(x) -#define LMC_XMITTER_FREE(x) netif_wake_queue(x) -#define LMC_XMITTER_INIT(x) netif_start_queue(x) - -#endif - - -#if LINUX_VERSION_CODE < 0x20100 -//typedef unsigned int u_int32_t; - -#define LMC_SETUP_20_DEV {\ - int indx; \ - for (indx = 0; indx < DEV_NUMBUFFS; indx++) \ - skb_queue_head_init (&dev->buffs[indx]); \ - } \ - dev->family = AF_INET; \ - dev->pa_addr = 0; \ - dev->pa_brdaddr = 0; \ - dev->pa_mask = 0xFCFFFFFF; \ - dev->pa_alen = 4; /* IP addr. sizeof(u32) */ - -#else - -#define LMC_SETUP_20_DEV - -#endif - - -#if LINUX_VERSION_CODE < 0x20155 /* basically 2.2 plus */ - -#define LMC_DEV_KFREE_SKB(skb) dev_kfree_skb((skb), FREE_WRITE) - -#else /* Mostly 2.0 kernels */ - -#define LMC_DEV_KFREE_SKB(skb) dev_kfree_skb(skb) - -#endif - -#if LINUX_VERSION_CODE < 0x20200 -#else - -#endif - -#if LINUX_VERSION_CODE < 0x20100 -#define LMC_SKB_FREE(skb, val) (skb->free = val) -#else -#define LMC_SKB_FREE(skb, val) -#endif - - -#if (LINUX_VERSION_CODE >= 0x20200) - -#define LMC_SPIN_FLAGS unsigned long flags; -#define LMC_SPIN_LOCK_INIT(x) spin_lock_init(&(x)->lmc_lock); -#define LMC_SPIN_UNLOCK(x) ((x)->lmc_lock = SPIN_LOCK_UNLOCKED) -#define LMC_SPIN_LOCK_IRQSAVE(x) spin_lock_irqsave (&(x)->lmc_lock, flags); -#define LMC_SPIN_UNLOCK_IRQRESTORE(x) spin_unlock_irqrestore (&(x)->lmc_lock, flags); -#else -#define LMC_SPIN_FLAGS -#define LMC_SPIN_LOCK_INIT(x) -#define LMC_SPIN_UNLOCK(x) -#define LMC_SPIN_LOCK_IRQSAVE(x) -#define LMC_SPIN_UNLOCK_IRQRESTORE(x) -#endif - - -#if LINUX_VERSION_CODE >= 0x20100 -#define LMC_COPY_FROM_USER(x, y, z) if(copy_from_user ((x), (y), (z))) return -EFAULT -#define LMC_COPY_TO_USER(x, y, z) if(copy_to_user ((x), (y), (z))) return -EFAULT -#else -#define LMC_COPY_FROM_USER(x, y, z) if(verify_area(VERIFY_READ, (y), (z))) \ - return -EFAULT; \ - memcpy_fromfs ((x), (y), (z)) - -#define LMC_COPY_TO_USER(x, y, z) if(verify_area(VERIFY_WRITE, (x), (z))) \ - return -EFAULT; \ - memcpy_tofs ((x), (y), (z)) -#endif - - -#endif diff -Nru a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h --- a/drivers/net/wireless/orinoco.h Wed Apr 14 18:29:04 2004 +++ b/drivers/net/wireless/orinoco.h Wed Apr 14 18:29:04 2004 @@ -125,8 +125,8 @@ #define DEBUG(n, args...) do { } while (0) #endif /* ORINOCO_DEBUG */ -#define TRACE_ENTER(devname) DEBUG(2, "%s: -> " __FUNCTION__ "()\n", devname); -#define TRACE_EXIT(devname) DEBUG(2, "%s: <- " __FUNCTION__ "()\n", devname); +#define TRACE_ENTER(devname) DEBUG(2, "%s: -> %s()\n", devname, __FUNCTION__); +#define TRACE_EXIT(devname) DEBUG(2, "%s: <- %s()\n", devname, __FUNCTION__); extern struct net_device *alloc_orinocodev(int sizeof_card, int (*hard_reset)(struct orinoco_private *)); diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h --- a/include/linux/netdevice.h Wed Apr 14 18:29:04 2004 +++ b/include/linux/netdevice.h Wed Apr 14 18:29:04 2004 @@ -42,13 +42,14 @@ struct vlan_group; struct ethtool_ops; - /* source back-compat hook */ + /* source back-compat hooks */ #define SET_ETHTOOL_OPS(netdev,ops) \ ( (netdev)->ethtool_ops = (ops) ) #define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev functions are available. */ -#define HAVE_FREE_NETDEV +#define HAVE_FREE_NETDEV /* free_netdev() */ +#define HAVE_NETDEV_PRIV /* netdev_priv() */ #define NET_XMIT_SUCCESS 0 #define NET_XMIT_DROP 1 /* skb dropped */ @@ -484,9 +485,14 @@ int padded; }; +#define NETDEV_ALIGN 32 +#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) + static inline void *netdev_priv(struct net_device *dev) { - return (char *)dev + ((sizeof(struct net_device) + 31) & ~31); + return (char *)dev + ((sizeof(struct net_device) + + NETDEV_ALIGN_CONST) + & ~NETDEV_ALIGN_CONST); } #define SET_MODULE_OWNER(dev) do { } while (0) diff -Nru a/net/core/netpoll.c b/net/core/netpoll.c --- a/net/core/netpoll.c Wed Apr 14 18:29:04 2004 +++ b/net/core/netpoll.c Wed Apr 14 18:29:04 2004 @@ -163,21 +163,15 @@ spin_lock(&np->dev->xmit_lock); np->dev->xmit_lock_owner = smp_processor_id(); - if (netif_queue_stopped(np->dev)) { - np->dev->xmit_lock_owner = -1; - spin_unlock(&np->dev->xmit_lock); - - netpoll_poll(np); - goto repeat; - } - status = np->dev->hard_start_xmit(skb, np->dev); np->dev->xmit_lock_owner = -1; spin_unlock(&np->dev->xmit_lock); /* transmit busy */ - if(status) + if(status) { + netpoll_poll(np); goto repeat; + } } void netpoll_send_udp(struct netpoll *np, const char *msg, int len) @@ -231,9 +225,8 @@ static void arp_reply(struct sk_buff *skb) { - struct in_device *in_dev = (struct in_device *) skb->dev->ip_ptr; struct arphdr *arp; - unsigned char *arp_ptr, *sha, *tha; + unsigned char *arp_ptr; int size, type = ARPOP_REPLY, ptype = ETH_P_ARP; u32 sip, tip; struct sk_buff *send_skb; @@ -253,7 +246,7 @@ if (!np) return; /* No arp on this interface */ - if (!in_dev || skb->dev->flags & IFF_NOARP) + if (skb->dev->flags & IFF_NOARP) return; if (!pskb_may_pull(skb, (sizeof(struct arphdr) + @@ -270,21 +263,15 @@ arp->ar_op != htons(ARPOP_REQUEST)) return; - arp_ptr= (unsigned char *)(arp+1); - sha = arp_ptr; - arp_ptr += skb->dev->addr_len; + arp_ptr = (unsigned char *)(arp+1) + skb->dev->addr_len; memcpy(&sip, arp_ptr, 4); - arp_ptr += 4; - tha = arp_ptr; - arp_ptr += skb->dev->addr_len; + arp_ptr += 4 + skb->dev->addr_len; memcpy(&tip, arp_ptr, 4); /* Should we ignore arp? */ - if (tip != in_dev->ifa_list->ifa_address || - LOOPBACK(tip) || MULTICAST(tip)) + if (tip != htonl(np->local_ip) || LOOPBACK(tip) || MULTICAST(tip)) return; - size = sizeof(struct arphdr) + 2 * (skb->dev->addr_len + 4); send_skb = find_skb(np, size + LL_RESERVED_SPACE(np->dev), LL_RESERVED_SPACE(np->dev)); @@ -325,7 +312,7 @@ arp_ptr += np->dev->addr_len; memcpy(arp_ptr, &tip, 4); arp_ptr += 4; - memcpy(arp_ptr, np->local_mac, np->dev->addr_len); + memcpy(arp_ptr, np->remote_mac, np->dev->addr_len); arp_ptr += np->dev->addr_len; memcpy(arp_ptr, &sip, 4);