Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jun 2007 10:49:52 +0100
From:      Tom Judge <tom@tomjudge.com>
To:        David Christensen <davidch@broadcom.com>
Cc:        freebsd-net <freebsd-net@freebsd.org>
Subject:   Re: Problems with BCE network adapter (Dell PE2950)
Message-ID:  <4684D5C0.3040709@tomjudge.com>
In-Reply-To: <09BFF2FA5EAB4A45B6655E151BBDD903045714EF@NT-IRVA-0750.brcm.ad.broadcom.com>
References:  <46680DB1.9050905@tomjudge.com>	<09BFF2FA5EAB4A45B6655E151BBDD9030414B1EC@NT-IRVA-0750.brcm.ad.broadcom.com>	<466873FA.9030800@tomjudge.com>	<09BFF2FA5EAB4A45B6655E151BBDD9030423EE13@NT-IRVA-0750.brcm.ad.broadcom.com>	<46823A78.7020501@tomjudge.com> <4683C578.6070009@tomjudge.com>	<09BFF2FA5EAB4A45B6655E151BBDD90304571430@NT-IRVA-0750.brcm.ad.broadcom.com> <09BFF2FA5EAB4A45B6655E151BBDD903045714EF@NT-IRVA-0750.brcm.ad.broadcom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030907020009000402030006
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

David Christensen wrote:
>>>> Sorry for the top post, but I have just managed to repeat is 
>>>> exact crash 
>>>> twice on a new PE 1950 system.   I have core files available.
>>>>
>>>> It seems that after a couple of reboots the problem goes 
>> away. The 
>>>> system actually crashed 4 times but 2 of the cores where corrupt.
>>>>
>>>> It also seems that the system will be stable if the following 
>>>> message is 
>>>> not produced shortly after /etc/rc.d/netif start:
>>>>
>>>> bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free 
>>>> rx_bd (0xFFF9 > 
>>>> 0x01FE)!
>>>>
>>> The error indicates that too many receive buffer descriptors
>>> were freed from the receive chain.  The driver must be losing
>>> count somewhere.  The process for duplicating the error sounds
>>> simple enough, how much data is in your NFS mounted directory?
>>> Are you using TCP or UDP for the NFS mount?
>>>
>>> Any idea what type of network activity is happening just after
>>> /etc/rc.d/netif start (DHCP, NTP, anything else)?
>>>
>>> Dave
>> One other thing, are you using jumbo frames?  What's your MTU setting?
>>
> 
> And one more thing.  I've been passing line rate traffic for a few 
> hours (with both netperf running the tcp_stream_script and a constant
> stream of UDP traffic to the discard server on the FreeBSD system)
> and I haven't seen a hiccup yet on the tip of RELENG_6 with jumbo
> frames enabled on my Dell PE2950 (one dual-core CPU, 4GB RAM).  Of
> course I don't have any real services running on it (load average is
> 0.19).  Any unusual settings I should be aware of?
> 
> Does anyone know a simple way to drive up CPU utilization and consume
> large amounts of memory to try and simulate a heavily loaded system?
> 
> Dave
> 

Hi,

As the NIC's are coming UP (as indicated by messages on the console) the 
system is trying to mount NFS file systems.  At this stage if the system 
does not produce the "Too many free rx_bd" error the system will be stable.

We are using Jumbo Frames with an MTU of 8192.  The switches are Dell 
PowerConnect 5324's.  The NFS server is a Dell PE1850 with EM cards.

The bug can be triggered by NFS data (there was arround 600Mb of data in 
the directory that I ran "cat * > /dev/null" in).  Also the bug can be 
triggered by heavy rsync traffic. (Rsync over ssh where the box crashing 
is the SSH client, also SSH has the HPN patches applied to it.)

The box that crashed 4 times did so in the following sequence:

1) First boot with debug driver crash very shortly after nfs mounts 
start/complete (Corrupt dump).  "Too many free rx_bd" message is present 
on the console before the crash.

2) Second boot with the debug driver system does not crash after cat * 
over NFS.  Crashes a few minutes after starting a rsync from an 
identical PE1950 the system crashed (Again producing a corrupt core 
dump). "Too many free rx_bd" message is present on the console before 
the crash.

3) Third boot NFS crash was not tested. Restarted rsync process and the 
system crashed again.  (Core ok this time but log buffer not present in 
the dump, or was empty.) Back trace indicates the driver crashed the 
system at the same place as the next crash on this system and the only 
core I have from a PE2950. "Too many free rx_bd" message is present on 
the console before the crash.

4) Fourth boot again did not test the NFS crash.  Restarted the rsync 
process causing the system to crash. ( Core and log buffer present in 
core, buffer and back trace at the end of this email.)  "Too many free 
rx_bd" message is present on the console before the crash.

5) Fifth boot of the system. No  "Too many free rx_bd" messages appear 
on the console. The system rsync's ~290Gb of data and is still up.

At each reboot the system was just left to reboot itself the system was 
not powered off at any point.  I have a PE2950 that went through a 
similar cycle of crashes only to boot into a stable configuration 3-4 
reboots later. (I have the last core available from this system.)


The system crashing above is a PE1950 with 1 5110 1.6Ghz Dual Core Xeon, 
2Gb RAM, PREC5/i (2 * 80 Gb SATA RAID 1), PERC5/e (MD1000 3 * 500Gb SATA 
RAID 5).  The source of the data being rsynced was an identical system.


I have attached the patch for the driver we are running (patch is 
against RELENG_6_2).


Tom
root@sultan '10:48:28' '/var/crash'
 > $ ifconfig bce0
bce0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 8192
         options=3b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU>
         inet 172.31.0.28 netmask 0xffffff00 broadcast 172.31.0.255
         ether 00:19:b9:e4:4d:cc
         media: Ethernet autoselect (1000baseTX <full-duplex>)
         status: active


root@sultan '10:48:34' '/var/crash'
 > $ pciconf -lv | fgrep -A 3 bce0
bce0@pci9:0:0:  class=0x020000 card=0x01b31028 chip=0x164c14e4 rev=0x12 
hdr=0x00
     vendor   = 'Broadcom Corporation'
     class    = network
     subclass = ethernet


root@sultan '10:47:08' '/var/crash'
 > $ kgdb /usr/obj/usr/src/sys/PE2950/kernel.debug vmcore.3
[GDB will not be able to debug user-mode threads: 
/usr/lib/libthread_db.so: Undefined symbol "ps_pglobal_lookup"]
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd".

Unread portion of the kernel message buffer:
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFF > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFF > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFF > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFE > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFD > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFD > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFD > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFD > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFD > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFC > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFC > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFC > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFFB > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3489): Too many free rx_bd (0xFFF9 > 
0x01FE)!
bce0: /usr/src/sys/dev/bce/if_bce.c(3973): Unexpected mbuf found in 
rx_bd[0x0098]!
bce0: ----------------------------  Driver State 
----------------------------
bce0: 0xFFFFFFFF:866A6000 - (sc) driver softc structure virtual address
bce0: 0xFFFFFF00:F4000000 - (sc->bce_vhandle) PCI BAR virtual address
bce0: 0xFFFFFF00:009C3DC0 - (sc->status_block) status block virtual address
bce0: 0xFFFFFF00:009D7400 - (sc->stats_block) statistics block virtual 
address
bce0: 0xFFFFFFFF:866A61B0 - (sc->tx_bd_chain) tx_bd chain virtual adddress
bce0: 0xFFFFFFFF:866A61E8 - (sc->rx_bd_chain) rx_bd chain virtual address
bce0: 0xFFFFFFFF:866A7260 - (sc->tx_mbuf_ptr) tx mbuf chain virtual address
bce0: 0xFFFFFFFF:866A9260 - (sc->rx_mbuf_ptr) rx mbuf chain virtual address
bce0:          0x0006D4FE - (sc->interrupts_generated) h/w intrs
bce0:          0x00039B5F - (sc->rx_interrupts) rx interrupts handled
bce0:          0x000339FB - (sc->tx_interrupts) tx interrupts handled
bce0:          0x0000A413 - (sc->last_status_idx) status block index
bce0:          0x00009500 - (sc->tx_prod) tx producer index
bce0:          0x000094FD - (sc->tx_cons) tx consumer index
bce0:          0x01FC8BFD - (sc->tx_prod_bseq) tx producer bseq index
bce0:          0x0000B69A - (sc->rx_prod) rx producer index
bce0:          0x0000B497 - (sc->rx_cons) rx consumer index
bce0:          0xBF89D400 - (sc->rx_prod_bseq) rx producer bseq index
bce0:          0x000000AB - (sc->rx_mbuf_alloc) rx mbufs allocated
bce0:          0x0000FFF8 - (sc->free_rx_bd) free rx_bd's
bce0: 0x00000000/000001FE - (sc->rx_low_watermark) rx low watermark
bce0:          0x00000002 - (sc->txmbuf_alloc) tx mbufs allocated
bce0:          0x000000AB - (sc->rx_mbuf_alloc) rx mbufs allocated
bce0:          0x00000002 - (sc->used_tx_bd) used tx_bd's
bce0: 0x000001FE/000001FE - (sc->tx_hi_watermark) tx hi watermark
bce0:          0x00000000 - (sc->mbuf_alloc_failed) failed mbuf alloc
bce0: 
------------------------------------------------------------------------
bce0: ----------------------------  Status Block 
----------------------------
bce0: attn_bits  = 0x00000001, attn_bits_ack = 0x00000001, index = 0xA422
bce0: rx_cons0   = 0x0000B4BF, tx_cons0      = 0x000094FF
bce0: status_idx = 0xA422
bce0: 
------------------------------------------------------------------------


Fatal trap 3: breakpoint instruction fault while in kernel mode
cpuid = 0; apic id = 00
instruction pointer     = 0x8:0xffffffff801ee956
stack pointer           = 0x10:0xffffffffb1922b40
frame pointer           = 0x10:0x98
code segment            = base 0x0, limit 0xfffff, type 0x1b
                         = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, IOPL = 0
current process         = 21 (irq16: bce0 bce1)
trap number             = 3
panic: breakpoint instruction fault
cpuid = 0
Uptime: 1h5m39s
Dumping 2047 MB (2 chunks)
   chunk 0: 1MB (156 pages) ... ok
   chunk 1: 2047MB (523944 pages) 2031 2015 1999 1983 1967 1951 1935 
1919 1903 1887 1871 1855 1839 1823 1807 1791 1775 1759 1743 1727 1711 
1695 1679 1663 1647 1631 1615 1599 1583 1567 1551 1535 1519 1503 1487 
1471 1455 1439 1423 1407 1391 1375 1359 1343 1327 1311 1295 1279 1263 
1247 1231 1215 1199 1183 1167 1151 1135 1119 1103 1087 1071 1055 1039 
1023 1007 991 975 959 943 927 911 895 879 863 847 831 815 799 783 767 
751 735 719 703 687 671 655 639 623 607 591 575 559 543 527 511 495 479 
463 447 431 415 399 383 367 351 335 319 303 287 271 255 239 223 207 191 
175 159 143 127 111 95 79 63 47 31 15

#0  doadump () at pcpu.h:172
172     pcpu.h: No such file or directory.
         in pcpu.h
(kgdb) bt
#0  doadump () at pcpu.h:172
#1  0x0000000000000004 in ?? ()
#2  0xffffffff8029e0e7 in boot (howto=260) at 
/usr/src/sys/kern/kern_shutdown.c:409
#3  0xffffffff8029e781 in panic (fmt=0xffffff007b9ed720 "\b?\236{") at 
/usr/src/sys/kern/kern_shutdown.c:565
#4  0xffffffff803f9e3f in trap_fatal (frame=0xffffff007b9ed720, 
eva=18446742976271936008) at /usr/src/sys/amd64/amd64/trap.c:660
#5  0xffffffff803fa2e2 in trap (frame=
       {tf_rdi = 0, tf_rsi = -2139025408, tf_rdx = 1, tf_rcx = 1298717, 
tf_r8 = 1048064, tf_r9 = 10, tf_rax = 79, tf_rbx = -2039848960, tf_rbp = 
152, tf_r10 = -1315820960, tf_r11 = 4294967274, tf_r12 = -2039848960, 
tf_r13 = 152, tf_r14 = 46242, tf_r15 = 46232, tf_trapno = 3, tf_addr = 
0, tf_flags = -1099501388352, tf_err = 0, tf_rip = -2145457834, tf_cs = 
8, tf_rflags = 642, tf_rsp = -1315820720, tf_ss = 16}) at 
/usr/src/sys/amd64/amd64/trap.c:469
#6  0xffffffff803e55fb in calltrap () at 
/usr/src/sys/amd64/amd64/exception.S:168
#7  0xffffffff801ee956 in bce_breakpoint (sc=0xffffffff866a6000) at 
cpufunc.h:63
#8  0xffffffff801ef0f6 in bce_intr (xsc=0x0) at 
/usr/src/sys/dev/bce/if_bce.c:3970
#9  0xffffffff80284919 in ithread_loop (arg=0xffffff00009d35a0) at 
/usr/src/sys/kern/kern_intr.c:682
#10 0xffffffff802830b7 in fork_exit (callout=0xffffffff802847d0 
<ithread_loop>, arg=0xffffff00009d35a0, frame=0xffffffffb1922c50) at 
/usr/src/sys/kern/kern_fork.c:821
#11 0xffffffff803e595e in fork_trampoline () at 
/usr/src/sys/amd64/amd64/exception.S:394
#12 0x0000000000000000 in ?? ()
#13 0x0000000000000000 in ?? ()
#14 0x0000000000000001 in ?? ()
#15 0x0000000000000000 in ?? ()
#16 0x0000000000000000 in ?? ()
#17 0x0000000000000000 in ?? ()
#18 0x0000000000000000 in ?? ()
#19 0x0000000000000000 in ?? ()
#20 0x0000000000000000 in ?? ()
#21 0x0000000000000000 in ?? ()
#22 0x0000000000000000 in ?? ()
#23 0x0000000000000000 in ?? ()
#24 0x0000000000000000 in ?? ()
#25 0x0000000000000000 in ?? ()
#26 0x0000000000000000 in ?? ()
#27 0x0000000000000000 in ?? ()
#28 0x0000000000000000 in ?? ()
#29 0x0000000000000000 in ?? ()
#30 0x0000000000000000 in ?? ()
#31 0x0000000000000000 in ?? ()
#32 0x0000000000000000 in ?? ()
#33 0x0000000000000000 in ?? ()
#34 0x0000000000000000 in ?? ()
#35 0x0000000000000000 in ?? ()
#36 0x0000000000000000 in ?? ()
#37 0x0000000000000000 in ?? ()
#38 0x0000000000000000 in ?? ()
#39 0x0000000000000000 in ?? ()
#40 0x0000000000000000 in ?? ()
#41 0x0000000000000000 in ?? ()
#42 0x0000000000000000 in ?? ()
#43 0x0000000000000000 in ?? ()
#44 0x00000000007f3000 in ?? ()
#45 0xffffff007b9ed720 in ?? ()
#46 0xffffff00009d35a0 in ?? ()
#47 0x0000000000000001 in ?? ()
#48 0xffffff007b9eea08 in ?? ()
#49 0xffffff007b9a5980 in ?? ()
#50 0xffffffffb1922b58 in ?? ()
#51 0xffffff007b9ed720 in ?? ()
#52 0xffffffff802b4856 in sched_switch (td=0xffffff00009d35a0, 
newtd=0x0, flags=0) at /usr/src/sys/kern/sched_4bsd.c:973
#53 0x0000000000000000 in ?? ()
#54 0x0000000000000000 in ?? ()
#55 0x0000000000000000 in ?? ()
#56 0x0000000000000000 in ?? ()
#57 0x0000000000000000 in ?? ()
#58 0x0000000000000000 in ?? ()
#59 0x0000000000000000 in ?? ()
---Type <return> to continue, or q <return> to quit---
#60 0x0000000000000000 in ?? ()
#61 0x0000000000000000 in ?? ()
#62 0x0000000000000000 in ?? ()
#63 0x0000000000000000 in ?? ()
#64 0x0000000000000000 in ?? ()
#65 0x0000000000000000 in ?? ()
#66 0x0000000000000000 in ?? ()
#67 0x0000000000000000 in ?? ()
#68 0x0000000000000000 in ?? ()
#69 0x0000000000000000 in ?? ()
#70 0x0000000000000000 in ?? ()
#71 0x0000000000000000 in ?? ()
#72 0x0000000000000000 in ?? ()
#73 0x0000000000000000 in ?? ()
#74 0x0000000000000000 in ?? ()
#75 0x0000000000000000 in ?? ()
#76 0x0000000000000000 in ?? ()
#77 0x0000000000000000 in ?? ()
#78 0x0000000000000000 in ?? ()
#79 0x0000000000000000 in ?? ()
#80 0x0000000000000000 in ?? ()
#81 0x0000000000000000 in ?? ()
#82 0x0000000000000000 in ?? ()
#83 0x0000000000000000 in ?? ()
#84 0x0000000000000000 in ?? ()
#85 0x0000000000000000 in ?? ()
#86 0x0000000000000000 in ?? ()
#87 0x0000000000000000 in ?? ()
#88 0x0000000000000000 in ?? ()
#89 0x0000000000000000 in ?? ()
#90 0x0000000000000000 in ?? ()
#91 0x0000000000000000 in ?? ()
#92 0x0000000000000000 in ?? ()
#93 0x0000000000000000 in ?? ()
#94 0x0000000000000000 in ?? ()
#95 0x0000000000000000 in ?? ()
#96 0x0000000000000000 in ?? ()
#97 0x0000000000000000 in ?? ()
#98 0x0000000000000000 in ?? ()
#99 0x0000000000000000 in ?? ()
#100 0x0000000000000000 in ?? ()
#101 0x0000000000000000 in ?? ()
#102 0x0000000000000000 in ?? ()
#103 0x0000000000000000 in ?? ()
#104 0x0000000000000000 in ?? ()
#105 0x0000000000000000 in ?? ()
#106 0x0000000000000000 in ?? ()
#107 0x0000000000000000 in ?? ()
#108 0x0000000000000000 in ?? ()
#109 0x0000000000000000 in ?? ()
#110 0x0000000000000000 in ?? ()
#111 0x0000000000000000 in ?? ()
#112 0x0000000000000000 in ?? ()
#113 0x0000000000000000 in ?? ()
#114 0x0000000000000000 in ?? ()
#115 0x0000000000000000 in ?? ()
#116 0x0000000000000000 in ?? ()
#117 0x0000000000000000 in ?? ()
#118 0x0000000000000000 in ?? ()
#119 0x0000000000000000 in ?? ()
#120 0x0000000000000000 in ?? ()
#121 0x0000000000000000 in ?? ()
#122 0x0000000000000000 in ?? ()
---Type <return> to continue, or q <return> to quit---
#123 0x0000000000000000 in ?? ()
#124 0x0000000000000000 in ?? ()
Cannot access memory at address 0xffffffffb1923000
(kgdb) frame 8
#8  0xffffffff801ef0f6 in bce_intr (xsc=0x0) at 
/usr/src/sys/dev/bce/if_bce.c:3970
3970                            DBRUNIF((!(rxbd->rx_bd_flags & 
RX_BD_FLAGS_END)),
(kgdb) list
3965
3966                    /* The mbuf is stored with the last rx_bd entry 
of a packet. */
3967                    if (sc->rx_mbuf_ptr[sw_chain_cons] != NULL) {
3968
3969                            /* Validate that this is the last rx_bd. */
3970                            DBRUNIF((!(rxbd->rx_bd_flags & 
RX_BD_FLAGS_END)),
3971                                    BCE_PRINTF("%s(%d): Unexpected 
mbuf found in rx_bd[0x%04X]!\n",
3972                                    __FILE__, __LINE__, sw_chain_cons);
3973                                    bce_breakpoint(sc));
3974
(kgdb)



root@sultan '10:50:15' '/var/crash'
 > $ sysctl dev.bce.0
dev.bce.0.%desc: Broadcom NetXtreme II BCM5708 1000Base-T (B2)
dev.bce.0.%driver: bce
dev.bce.0.%location: slot=0 function=0
dev.bce.0.%pnpinfo: vendor=0x14e4 device=0x164c subvendor=0x1028 
subdevice=0x01b3 class=0x020000
dev.bce.0.%parent: pci9
dev.bce.0.rx_low_watermark: 0
dev.bce.0.tx_hi_watermark: 510
dev.bce.0.l2fhdr_status_errors: 0
dev.bce.0.unexpected_attentions: 0
dev.bce.0.lost_status_block_updates: 0
dev.bce.0.mbuf_alloc_failed: 0
dev.bce.0.stat_IfHcInOctets: 306538083283
dev.bce.0.stat_IfHCInBadOctets: 54437647
dev.bce.0.stat_IfHCOutOctets: 3416768690
dev.bce.0.stat_IfHCOutBadOctets: 0
dev.bce.0.stat_IfHCInUcastPkts: 76567319
dev.bce.0.stat_IfHCInMulticastPkts: 0
dev.bce.0.stat_IfHCInBroadcastPkts: 44564
dev.bce.0.stat_IfHCOutUcastPkts: 44874071
dev.bce.0.stat_IfHCOutMulticastPkts: 0
dev.bce.0.stat_IfHCOutBroadcastPkts: 200
dev.bce.0.stat_emac_tx_stat_dot3statsinternalmactransmiterrors: 0
dev.bce.0.stat_Dot3StatsCarrierSenseErrors: 0
dev.bce.0.stat_Dot3StatsFCSErrors: 0
dev.bce.0.stat_Dot3StatsAlignmentErrors: 0
dev.bce.0.stat_Dot3StatsSingleCollisionFrames: 0
dev.bce.0.stat_Dot3StatsMultipleCollisionFrames: 0
dev.bce.0.stat_Dot3StatsDeferredTransmissions: 0
dev.bce.0.stat_Dot3StatsExcessiveCollisions: 0
dev.bce.0.stat_Dot3StatsLateCollisions: 0
dev.bce.0.stat_EtherStatsCollisions: 0
dev.bce.0.stat_EtherStatsFragments: 0
dev.bce.0.stat_EtherStatsJabbers: 0
dev.bce.0.stat_EtherStatsUndersizePkts: 0
dev.bce.0.stat_EtherStatsOverrsizePkts: 0
dev.bce.0.stat_EtherStatsPktsRx64Octets: 7255
dev.bce.0.stat_EtherStatsPktsRx65Octetsto127Octets: 3084173
dev.bce.0.stat_EtherStatsPktsRx128Octetsto255Octets: 548353
dev.bce.0.stat_EtherStatsPktsRx256Octetsto511Octets: 70953
dev.bce.0.stat_EtherStatsPktsRx512Octetsto1023Octets: 7546
dev.bce.0.stat_EtherStatsPktsRx1024Octetsto1522Octets: 3221
dev.bce.0.stat_EtherStatsPktsRx1523Octetsto9022Octets: 72890382
dev.bce.0.stat_EtherStatsPktsTx64Octets: 277
dev.bce.0.stat_EtherStatsPktsTx65Octetsto127Octets: 42379729
dev.bce.0.stat_EtherStatsPktsTx128Octetsto255Octets: 2485130
dev.bce.0.stat_EtherStatsPktsTx256Octetsto511Octets: 727
dev.bce.0.stat_EtherStatsPktsTx512Octetsto1023Octets: 709
dev.bce.0.stat_EtherStatsPktsTx1024Octetsto1522Octets: 853
dev.bce.0.stat_EtherStatsPktsTx1523Octetsto9022Octets: 6846
dev.bce.0.stat_XonPauseFramesReceived: 0
dev.bce.0.stat_XoffPauseFramesReceived: 0
dev.bce.0.stat_OutXonSent: 0
dev.bce.0.stat_OutXoffSent: 0
dev.bce.0.stat_FlowControlDone: 0
dev.bce.0.stat_MacControlFramesReceived: 0
dev.bce.0.stat_XoffStateEntered: 0
dev.bce.0.stat_IfInFramesL2FilterDiscards: 351690
dev.bce.0.stat_IfInRuleCheckerDiscards: 0
dev.bce.0.stat_IfInFTQDiscards: 0
dev.bce.0.stat_IfInMBUFDiscards: 0
dev.bce.0.stat_IfInRuleCheckerP4Hit: 44564
dev.bce.0.stat_CatchupInRuleCheckerDiscards: 0
dev.bce.0.stat_CatchupInFTQDiscards: 0
dev.bce.0.stat_CatchupInMBUFDiscards: 0
dev.bce.0.stat_CatchupInRuleCheckerP4Hit: 0
dev.bce.0.com_no_bufers: 0
dev.bce.0.driver_state: -1
dev.bce.0.hw_state: -1
dev.bce.0.dump_rx_chain: -1
dev.bce.0.dump_tx_chain: -1
dev.bce.0.breakpoint: -1
dev.bce.0.reg_read: -1


--------------030907020009000402030006
Content-Type: text/x-patch;
 name="bce_patch.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="bce_patch.diff"

Index: if_bce.c
===================================================================
--- if_bce.c	(.../trunk/6_2/sys/dev/bce)	(revision 55)
+++ if_bce.c	(.../branches/mintel_6_2/sys/dev/bce)	(revision 55)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2006 Broadcom Corporation
+ * Copyright (c) 2006-2007 Broadcom Corporation
  *	David Christensen <davidch@broadcom.com>.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,12 +29,12 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.2.2.6.2.1 2006/11/28 17:14:07 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.2.2.15 2007/06/05 01:56:08 davidch Exp $");
 
 /*
  * The following controllers are supported by this driver:
  *   BCM5706C A2, A3
- *   BCM5708C B1
+ *   BCM5708C B1, B2
  *
  * The following controllers are not supported by this driver:
  * (These are not "Production" versions of the controller.)
@@ -42,7 +42,7 @@
  *   BCM5706C A0, A1
  *   BCM5706S A0, A1, A2, A3
  *   BCM5708C A0, B0
- *   BCM5708S A0, B0, B1
+ *   BCM5708S A0, B0, B1, B2
  */
 
 #include "opt_bce.h"
@@ -51,12 +51,6 @@
 #include <dev/bce/if_bcefw.h>
 
 /****************************************************************************/
-/* BCE Driver Version                                                       */
-/****************************************************************************/
-char bce_driver_version[] = "v0.9.6";
-
-
-/****************************************************************************/
 /* BCE Debug Options                                                        */
 /****************************************************************************/
 #ifdef BCE_DEBUG
@@ -116,8 +110,8 @@
 		"Broadcom NetXtreme II BCM5708 1000Base-T" },
 
 	/* BCM5708S controllers and OEM boards. */
-	{ BRCM_VENDORID, BRCM_DEVICEID_BCM5708,  PCI_ANY_ID,  PCI_ANY_ID,
-		"Broadcom NetXtreme II BCM5708 1000Base-T" },
+	{ BRCM_VENDORID, BRCM_DEVICEID_BCM5708S,  PCI_ANY_ID,  PCI_ANY_ID,
+		"Broadcom NetXtreme II BCM5708S 1000Base-T" },
 	{ 0, 0, 0, 0, NULL }
 };
 
@@ -303,8 +297,9 @@
 static void bce_start_locked		(struct ifnet *);
 static void bce_start				(struct ifnet *);
 static int  bce_ioctl				(struct ifnet *, u_long, caddr_t);
-static void bce_watchdog			(struct ifnet *);
+static void bce_watchdog			(struct bce_softc *);
 static int  bce_ifmedia_upd			(struct ifnet *);
+static void bce_ifmedia_upd_locked		(struct ifnet *);
 static void bce_ifmedia_sts			(struct ifnet *, struct ifmediareq *);
 static void bce_init_locked			(struct bce_softc *);
 static void bce_init				(void *);
@@ -326,7 +321,6 @@
 static void bce_intr				(void *);
 static void bce_set_rx_mode			(struct bce_softc *);
 static void bce_stats_update		(struct bce_softc *);
-static void bce_tick_locked			(struct bce_softc *);
 static void bce_tick				(void *);
 static void bce_add_sysctls			(struct bce_softc *);
 
@@ -416,11 +410,10 @@
 				return(ENOMEM);
 
 			/* Print out the device identity. */
-			snprintf(descbuf, BCE_DEVDESC_MAX, "%s (%c%d), %s", 
+			snprintf(descbuf, BCE_DEVDESC_MAX, "%s (%c%d)", 
 				t->bce_name,
 			    (((pci_read_config(dev, PCIR_REVID, 4) & 0xf0) >> 4) + 'A'),
-			    (pci_read_config(dev, PCIR_REVID, 4) & 0xf),
-			    bce_driver_version);
+			    (pci_read_config(dev, PCIR_REVID, 4) & 0xf));
 
 			device_set_desc_copy(dev, descbuf);
 			free(descbuf, M_TEMP);
@@ -473,7 +466,7 @@
 		RF_ACTIVE | PCI_RF_DENSE);	/* flags */
 
 	if (sc->bce_res == NULL) {
-		BCE_PRINTF(sc, "%s(%d): PCI memory allocation failed\n", 
+		BCE_PRINTF("%s(%d): PCI memory allocation failed\n", 
 			__FILE__, __LINE__);
 		rc = ENXIO;
 		goto bce_attach_fail;
@@ -484,13 +477,12 @@
 	sc->bce_bhandle = rman_get_bushandle(sc->bce_res);
 	sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res);
 
-	/* Allocate PCI IRQ resources. */
 	rid = 0;
 	sc->bce_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
 	    RF_SHAREABLE | RF_ACTIVE);
 
 	if (sc->bce_irq == NULL) {
-		BCE_PRINTF(sc, "%s(%d): PCI map interrupt failed\n", 
+		BCE_PRINTF("%s(%d): PCI map interrupt failed\n", 
 			__FILE__, __LINE__);
 		rc = ENXIO;
 		goto bce_attach_fail;
@@ -518,7 +510,7 @@
 		case BCE_CHIP_ID_5706_A1:
 		case BCE_CHIP_ID_5708_A0:
 		case BCE_CHIP_ID_5708_B0:
-			BCE_PRINTF(sc, "%s(%d): Unsupported controller revision (%c%d)!\n",
+			BCE_PRINTF("%s(%d): Unsupported controller revision (%c%d)!\n",
 				__FILE__, __LINE__, 
 				(((pci_read_config(dev, PCIR_REVID, 4) & 0xf0) >> 4) + 'A'),
 			    (pci_read_config(dev, PCIR_REVID, 4) & 0xf));
@@ -526,13 +518,6 @@
 			goto bce_attach_fail;
 	}
 
-	if (BCE_CHIP_BOND_ID(sc) & BCE_CHIP_BOND_ID_SERDES_BIT) {
-		BCE_PRINTF(sc, "%s(%d): SerDes controllers are not supported!\n",
-			__FILE__, __LINE__);
-		rc = ENODEV;
-		goto bce_attach_fail;
-	}
-
 	/* 
 	 * The embedded PCIe to PCI-X bridge (EPB) 
 	 * in the 5708 cannot address memory above 
@@ -605,7 +590,7 @@
 	if (val & BCE_PCICFG_MISC_STATUS_32BIT_DET)
 		sc->bce_flags |= BCE_PCI_32BIT_FLAG;
 
-	BCE_PRINTF(sc, "ASIC ID 0x%08X; Revision (%c%d); PCI%s %s %dMHz\n",
+	BCE_PRINTF("ASIC ID 0x%08X; Revision (%c%d); PCI%s %s %dMHz\n",
 		sc->bce_chipid,
 		((BCE_CHIP_ID(sc) & 0xf000) >> 12) + 'A',
 		((BCE_CHIP_ID(sc) & 0x0ff0) >> 4),
@@ -621,7 +606,7 @@
 
 	/* Initialize the controller. */
 	if (bce_chipinit(sc)) {
-		BCE_PRINTF(sc, "%s(%d): Controller initialization failed!\n",
+		BCE_PRINTF("%s(%d): Controller initialization failed!\n",
 			__FILE__, __LINE__);
 		rc = ENXIO;
 		goto bce_attach_fail;
@@ -629,7 +614,7 @@
 
 	/* Perform NVRAM test. */
 	if (bce_nvram_test(sc)) {
-		BCE_PRINTF(sc, "%s(%d): NVRAM test failed!\n",
+		BCE_PRINTF("%s(%d): NVRAM test failed!\n",
 			__FILE__, __LINE__);
 		rc = ENXIO;
 		goto bce_attach_fail;
@@ -695,7 +680,7 @@
 
 	/* Allocate DMA memory resources. */
 	if (bce_dma_alloc(dev)) {
-		BCE_PRINTF(sc, "%s(%d): DMA resource allocation failed!\n",
+		BCE_PRINTF("%s(%d): DMA resource allocation failed!\n",
 		    __FILE__, __LINE__);
 		rc = ENXIO;
 		goto bce_attach_fail;
@@ -704,7 +689,7 @@
 	/* Allocate an ifnet structure. */
 	ifp = sc->bce_ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
-		BCE_PRINTF(sc, "%s(%d): Interface allocation failed!\n", 
+		BCE_PRINTF("%s(%d): Interface allocation failed!\n", 
 			__FILE__, __LINE__);
 		rc = ENXIO;
 		goto bce_attach_fail;
@@ -716,8 +701,6 @@
 	ifp->if_flags        = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl        = bce_ioctl;
 	ifp->if_start        = bce_start;
-	ifp->if_timer        = 0;
-	ifp->if_watchdog     = bce_watchdog;
 	ifp->if_init         = bce_init;
 	ifp->if_mtu          = ETHERMTU;
 	ifp->if_hwassist     = BCE_IF_HWASSIST;
@@ -739,20 +722,13 @@
 	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
 	IFQ_SET_READY(&ifp->if_snd);
 
-	if (sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) {
-		BCE_PRINTF(sc, "%s(%d): SerDes is not supported by this driver!\n", 
+	/* Look for our PHY. */
+	if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd,
+		bce_ifmedia_sts)) {
+		BCE_PRINTF("%s(%d): PHY probe failed!\n", 
 			__FILE__, __LINE__);
-		rc = ENODEV;
+		rc = ENXIO;
 		goto bce_attach_fail;
-	} else {
-		/* Look for our PHY. */
-		if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd,
-			bce_ifmedia_sts)) {
-			BCE_PRINTF(sc, "%s(%d): PHY probe failed!\n", 
-				__FILE__, __LINE__);
-			rc = ENXIO;
-			goto bce_attach_fail;
-		}
 	}
 
 	/* Attach to the Ethernet interface list. */
@@ -761,7 +737,7 @@
 #if __FreeBSD_version < 500000
 	callout_init(&sc->bce_stat_ch);
 #else
-	callout_init(&sc->bce_stat_ch, CALLOUT_MPSAFE);
+	callout_init_mtx(&sc->bce_stat_ch, &sc->bce_mtx, 0);
 #endif
 
 	/* Hookup IRQ last. */
@@ -769,7 +745,7 @@
 	   bce_intr, sc, &sc->bce_intrhand);
 
 	if (rc) {
-		BCE_PRINTF(sc, "%s(%d): Failed to setup IRQ!\n", 
+		BCE_PRINTF("%s(%d): Failed to setup IRQ!\n", 
 			__FILE__, __LINE__);
 		bce_detach(dev);
 		goto bce_attach_exit;
@@ -833,12 +809,8 @@
 	ether_ifdetach(ifp);
 
 	/* If we have a child device on the MII bus remove it too. */
-	if (sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) {
-		ifmedia_removeall(&sc->bce_ifmedia);
-	} else {
-		bus_generic_detach(dev);
-		device_delete_child(dev, sc->bce_miibus);
-	}
+	bus_generic_detach(dev);
+	device_delete_child(dev, sc->bce_miibus);
 
 	/* Release all remaining resources. */
 	bce_release_resources(sc);
@@ -999,7 +971,7 @@
 	}
 
 	if (val & BCE_EMAC_MDIO_COMM_START_BUSY) {
-		BCE_PRINTF(sc, "%s(%d): Error: PHY read timeout! phy = %d, reg = 0x%04X\n",
+		BCE_PRINTF("%s(%d): Error: PHY read timeout! phy = %d, reg = 0x%04X\n",
 			__FILE__, __LINE__, phy, reg);
 		val = 0x0;
 	} else {
@@ -1076,7 +1048,7 @@
 	}
 
 	if (val1 & BCE_EMAC_MDIO_COMM_START_BUSY)
-		BCE_PRINTF(sc, "%s(%d): PHY write timeout!\n", 
+		BCE_PRINTF("%s(%d): PHY write timeout!\n", 
 			__FILE__, __LINE__);
 
 	if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) {
@@ -1115,7 +1087,8 @@
 	BCE_CLRBIT(sc, BCE_EMAC_MODE, BCE_EMAC_MODE_PORT);
 
 	/* Set MII or GMII inerface based on the speed negotiated by the PHY. */
-	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) {
+	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T || 
+	    IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX) {
 		DBPRINT(sc, BCE_INFO, "Setting GMII interface.\n");
 		BCE_SETBIT(sc, BCE_EMAC_MODE, BCE_EMAC_MODE_PORT_GMII);
 	} else {
@@ -1429,7 +1402,7 @@
 
 	/* Check for errors. */
 	if (i >= NVRAM_TIMEOUT_COUNT) {
-		BCE_PRINTF(sc, "%s(%d): Timeout error reading NVRAM at offset 0x%08X!\n",
+		BCE_PRINTF("%s(%d): Timeout error reading NVRAM at offset 0x%08X!\n",
 			__FILE__, __LINE__, offset);
 		rc = EBUSY;
 	}
@@ -1485,7 +1458,7 @@
 			break;
 	}
 	if (j >= NVRAM_TIMEOUT_COUNT) {
-		BCE_PRINTF(sc, "%s(%d): Timeout error writing NVRAM at offset 0x%08X\n",
+		BCE_PRINTF("%s(%d): Timeout error writing NVRAM at offset 0x%08X\n",
 			__FILE__, __LINE__, offset);
 		return EBUSY;
 	}
@@ -1582,7 +1555,7 @@
 	/* Check if a matching device was found. */
 	if (j == entry_count) {
 		sc->bce_flash_info = NULL;
-		BCE_PRINTF(sc, "%s(%d): Unknown Flash NVRAM found!\n", 
+		BCE_PRINTF("%s(%d): Unknown Flash NVRAM found!\n", 
 			__FILE__, __LINE__);
 		rc = ENODEV;
 	}
@@ -1940,7 +1913,7 @@
     magic = bce_be32toh(buf[0]);
 	if (magic != BCE_NVRAM_MAGIC) {
 		rc = ENODEV;
-		BCE_PRINTF(sc, "%s(%d): Invalid NVRAM magic value! Expected: 0x%08X, "
+		BCE_PRINTF("%s(%d): Invalid NVRAM magic value! Expected: 0x%08X, "
 			"Found: 0x%08X\n",
 			__FILE__, __LINE__, BCE_NVRAM_MAGIC, magic);
 		goto bce_nvram_test_done;
@@ -1956,7 +1929,7 @@
 	csum = ether_crc32_le(data, 0x100);
 	if (csum != BCE_CRC32_RESIDUAL) {
 		rc = ENODEV;
-		BCE_PRINTF(sc, "%s(%d): Invalid Manufacturing Information NVRAM CRC! "
+		BCE_PRINTF("%s(%d): Invalid Manufacturing Information NVRAM CRC! "
 			"Expected: 0x%08X, Found: 0x%08X\n",
 			__FILE__, __LINE__, BCE_CRC32_RESIDUAL, csum);
 		goto bce_nvram_test_done;
@@ -1964,7 +1937,7 @@
 
 	csum = ether_crc32_le(data + 0x100, 0x100);
 	if (csum != BCE_CRC32_RESIDUAL) {
-		BCE_PRINTF(sc, "%s(%d): Invalid Feature Configuration Information "
+		BCE_PRINTF("%s(%d): Invalid Feature Configuration Information "
 			"NVRAM CRC! Expected: 0x%08X, Found: 08%08X\n",
 			__FILE__, __LINE__, BCE_CRC32_RESIDUAL, csum);
 		rc = ENODEV;
@@ -2188,7 +2161,7 @@
 			NULL, 			/* locfunc    */
 			NULL,			/* lockarg    */
 			&sc->parent_tag)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate parent DMA tag!\n",
+		BCE_PRINTF("%s(%d): Could not allocate parent DMA tag!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2214,7 +2187,7 @@
 	    	NULL, 				/* lockfunc    */
 	    	NULL,				/* lockarg     */
 	    	&sc->status_tag)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate status block DMA tag!\n",
+		BCE_PRINTF("%s(%d): Could not allocate status block DMA tag!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2225,7 +2198,7 @@
 	    	(void **)&sc->status_block,	/* vaddr       */
 	    	BUS_DMA_NOWAIT,			/* flags       */
 	    	&sc->status_map)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate status block DMA memory!\n",
+		BCE_PRINTF("%s(%d): Could not allocate status block DMA memory!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2243,7 +2216,7 @@
 	    	BUS_DMA_NOWAIT);		/* flags       */
 	    	
 	if (error) {
-		BCE_PRINTF(sc, "%s(%d): Could not map status block DMA memory!\n",
+		BCE_PRINTF("%s(%d): Could not map status block DMA memory!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2274,7 +2247,7 @@
 	    	NULL, 		 		/* lockfunc    */
 	    	NULL, 		  		/* lockarg     */
 	    	&sc->stats_tag)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate statistics block DMA tag!\n",
+		BCE_PRINTF("%s(%d): Could not allocate statistics block DMA tag!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2285,7 +2258,7 @@
 	    	(void **)&sc->stats_block,	/* vaddr       */
 	    	BUS_DMA_NOWAIT,			/* flags       */
 	    	&sc->stats_map)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate statistics block DMA memory!\n",
+		BCE_PRINTF("%s(%d): Could not allocate statistics block DMA memory!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2303,7 +2276,7 @@
 	    	BUS_DMA_NOWAIT);	/* flags       */
 
 	if(error) {
-		BCE_PRINTF(sc, "%s(%d): Could not map statistics block DMA memory!\n",
+		BCE_PRINTF("%s(%d): Could not map statistics block DMA memory!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2334,7 +2307,7 @@
 			NULL,			/* lockfunc    */
 			NULL,			/* lockarg     */
 			&sc->tx_bd_chain_tag)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate TX descriptor chain DMA tag!\n",
+		BCE_PRINTF("%s(%d): Could not allocate TX descriptor chain DMA tag!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2347,7 +2320,7 @@
 	    		(void **)&sc->tx_bd_chain[i],	/* vaddr */
 	    		BUS_DMA_NOWAIT,			/* flags */
 		    	&sc->tx_bd_chain_map[i])) {
-			BCE_PRINTF(sc, "%s(%d): Could not allocate TX descriptor "
+			BCE_PRINTF("%s(%d): Could not allocate TX descriptor "
 				"chain DMA memory!\n", __FILE__, __LINE__);
 			rc = ENOMEM;
 			goto bce_dma_alloc_exit;
@@ -2363,7 +2336,7 @@
 	    		BUS_DMA_NOWAIT);		/* flags       */
 
 		if (error) {
-			BCE_PRINTF(sc, "%s(%d): Could not map TX descriptor chain DMA memory!\n",
+			BCE_PRINTF("%s(%d): Could not map TX descriptor chain DMA memory!\n",
 				__FILE__, __LINE__);
 			rc = ENOMEM;
 			goto bce_dma_alloc_exit;
@@ -2391,7 +2364,7 @@
 			NULL,				/* lockfunc    */
 			NULL,				/* lockarg     */
 			&sc->tx_mbuf_tag)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate TX mbuf DMA tag!\n",
+		BCE_PRINTF("%s(%d): Could not allocate TX mbuf DMA tag!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2401,7 +2374,7 @@
 	for (i = 0; i < TOTAL_TX_BD; i++) {
 		if (bus_dmamap_create(sc->tx_mbuf_tag, BUS_DMA_NOWAIT, 
 			&sc->tx_mbuf_map[i])) {
-			BCE_PRINTF(sc, "%s(%d): Unable to create TX mbuf DMA map!\n",
+			BCE_PRINTF("%s(%d): Unable to create TX mbuf DMA map!\n",
 				__FILE__, __LINE__);
 			rc = ENOMEM;
 			goto bce_dma_alloc_exit;
@@ -2428,7 +2401,7 @@
 			NULL,				/* lockfunc    */
 			NULL,				/* lockarg     */
 			&sc->rx_bd_chain_tag)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate RX descriptor chain DMA tag!\n",
+		BCE_PRINTF("%s(%d): Could not allocate RX descriptor chain DMA tag!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2441,7 +2414,7 @@
 	    		(void **)&sc->rx_bd_chain[i], 	/* vaddr */
 	    		BUS_DMA_NOWAIT,		  	/* flags */
 		    	&sc->rx_bd_chain_map[i])) {
-			BCE_PRINTF(sc, "%s(%d): Could not allocate RX descriptor chain "
+			BCE_PRINTF("%s(%d): Could not allocate RX descriptor chain "
 				"DMA memory!\n", __FILE__, __LINE__);
 			rc = ENOMEM;
 			goto bce_dma_alloc_exit;
@@ -2459,7 +2432,7 @@
 	    		BUS_DMA_NOWAIT);	/* flags       */
 
 		if (error) {
-			BCE_PRINTF(sc, "%s(%d): Could not map RX descriptor chain DMA memory!\n",
+			BCE_PRINTF("%s(%d): Could not map RX descriptor chain DMA memory!\n",
 				__FILE__, __LINE__);
 			rc = ENOMEM;
 			goto bce_dma_alloc_exit;
@@ -2489,7 +2462,7 @@
 			NULL, 			/* lockfunc    */
 			NULL,			/* lockarg     */
 	    	&sc->rx_mbuf_tag)) {
-		BCE_PRINTF(sc, "%s(%d): Could not allocate RX mbuf DMA tag!\n",
+		BCE_PRINTF("%s(%d): Could not allocate RX mbuf DMA tag!\n",
 			__FILE__, __LINE__);
 		rc = ENOMEM;
 		goto bce_dma_alloc_exit;
@@ -2499,7 +2472,7 @@
 	for (i = 0; i < TOTAL_RX_BD; i++) {
 		if (bus_dmamap_create(sc->rx_mbuf_tag, BUS_DMA_NOWAIT,
 				&sc->rx_mbuf_map[i])) {
-			BCE_PRINTF(sc, "%s(%d): Unable to create RX mbuf DMA map!\n",
+			BCE_PRINTF("%s(%d): Unable to create RX mbuf DMA map!\n",
 				__FILE__, __LINE__);
 			rc = ENOMEM;
 			goto bce_dma_alloc_exit;
@@ -2603,7 +2576,7 @@
 	if (((val & BCE_FW_MSG_ACK) != (msg_data & BCE_DRV_MSG_SEQ)) &&
 		((msg_data & BCE_DRV_MSG_DATA) != BCE_DRV_MSG_DATA_WAIT0)) {
 
-		BCE_PRINTF(sc, "%s(%d): Firmware synchronization timeout! "
+		BCE_PRINTF("%s(%d): Firmware synchronization timeout! "
 			"msg_data = 0x%08X\n",
 			__FILE__, __LINE__, msg_data);
 
@@ -3015,7 +2988,7 @@
 		BCE_PORT_HW_CFG_MAC_LOWER);
 
 	if ((mac_lo == 0) && (mac_hi == 0)) {
-		BCE_PRINTF(sc, "%s(%d): Invalid Ethernet address!\n", 
+		BCE_PRINTF("%s(%d): Invalid Ethernet address!\n", 
 			__FILE__, __LINE__);
 	} else {
 		sc->eaddr[0] = (u_char)(mac_hi >> 8);
@@ -3115,7 +3088,7 @@
 	}
 
 	ifp->if_flags = itmp;
-	ifp->if_timer = 0;
+	sc->watchdog_timer = 0;
 
 	sc->bce_link = 0;
 
@@ -3178,7 +3151,7 @@
 	/* Check that reset completed successfully. */
 	if (val & (BCE_PCICFG_MISC_CONFIG_CORE_RST_REQ |
 		   BCE_PCICFG_MISC_CONFIG_CORE_RST_BSY)) {
-		BCE_PRINTF(sc, "%s(%d): Reset failed!\n", 
+		BCE_PRINTF("%s(%d): Reset failed!\n", 
 			__FILE__, __LINE__);
 		rc = EBUSY;
 		goto bce_reset_exit;
@@ -3187,7 +3160,7 @@
 	/* Make sure byte swapping is properly configured. */
 	val = REG_RD(sc, BCE_PCI_SWAP_DIAG0);
 	if (val != 0x01020304) {
-		BCE_PRINTF(sc, "%s(%d): Byte swap is incorrect!\n", 
+		BCE_PRINTF("%s(%d): Byte swap is incorrect!\n", 
 			__FILE__, __LINE__);
 		rc = ENODEV;
 		goto bce_reset_exit;
@@ -3199,7 +3172,7 @@
 	/* Wait for the firmware to finish its initialization. */
 	rc = bce_fw_sync(sc, BCE_DRV_MSG_DATA_WAIT1 | reset_code);
 	if (rc)
-		BCE_PRINTF(sc, "%s(%d): Firmware did not complete initialization!\n",
+		BCE_PRINTF("%s(%d): Firmware did not complete initialization!\n",
 			__FILE__, __LINE__);
 
 bce_reset_exit:
@@ -3284,6 +3257,7 @@
 	REG_WR(sc, BCE_MQ_KNL_BYP_WIND_START, val);
 	REG_WR(sc, BCE_MQ_KNL_WIND_END, val);
 
+	/* Set the page size and clear the RV2P processor stall bits. */
 	val = (BCM_PAGE_BITS - 8) << 24;
 	REG_WR(sc, BCE_RV2P_CONFIG, val);
 
@@ -3371,13 +3345,13 @@
 	reg = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_SIGNATURE);
 
 	DBRUNIF(DB_RANDOMTRUE(bce_debug_bootcode_running_failure),
-		BCE_PRINTF(sc, "%s(%d): Simulating bootcode failure.\n",
+		BCE_PRINTF("%s(%d): Simulating bootcode failure.\n",
 			__FILE__, __LINE__);
 		reg = 0);
 
 	if ((reg & BCE_DEV_INFO_SIGNATURE_MAGIC_MASK) !=
 	    BCE_DEV_INFO_SIGNATURE_MAGIC) {
-		BCE_PRINTF(sc, "%s(%d): Bootcode not running! Found: 0x%08X, "
+		BCE_PRINTF("%s(%d): Bootcode not running! Found: 0x%08X, "
 			"Expected: 08%08X\n", __FILE__, __LINE__,
 			(reg & BCE_DEV_INFO_SIGNATURE_MAGIC_MASK),
 			BCE_DEV_INFO_SIGNATURE_MAGIC);
@@ -3441,7 +3415,7 @@
 
 	/* Make sure the inputs are valid. */
 	DBRUNIF((*chain_prod > MAX_RX_BD),
-		BCE_PRINTF(sc, "%s(%d): RX producer out of range: 0x%04X > 0x%04X\n",
+		BCE_PRINTF("%s(%d): RX producer out of range: 0x%04X > 0x%04X\n",
 		__FILE__, __LINE__, *chain_prod, (u16) MAX_RX_BD));
 
 	DBPRINT(sc, BCE_VERBOSE_RECV, "%s(enter): prod = 0x%04X, chain_prod = 0x%04X, "
@@ -3450,7 +3424,7 @@
 	if (m == NULL) {
 
 		DBRUNIF(DB_RANDOMTRUE(bce_debug_mbuf_allocation_failure),
-			BCE_PRINTF(sc, "%s(%d): Simulating mbuf allocation failure.\n", 
+			BCE_PRINTF("%s(%d): Simulating mbuf allocation failure.\n", 
 				__FILE__, __LINE__);
 			sc->mbuf_alloc_failed++;
 			rc = ENOBUFS;
@@ -3498,7 +3472,7 @@
 	    segs, &nsegs, BUS_DMA_NOWAIT);
 
 	if (error) {
-		BCE_PRINTF(sc, "%s(%d): Error mapping mbuf into RX chain!\n",
+		BCE_PRINTF("%s(%d): Error mapping mbuf into RX chain!\n",
 			__FILE__, __LINE__);
 
 		m_freem(m_new);
@@ -3511,7 +3485,7 @@
 
 	/* Watch for overflow. */
 	DBRUNIF((sc->free_rx_bd > USABLE_RX_BD),
-		BCE_PRINTF(sc, "%s(%d): Too many free rx_bd (0x%04X > 0x%04X)!\n", 
+		BCE_PRINTF("%s(%d): Too many free rx_bd (0x%04X > 0x%04X)!\n", 
 			__FILE__, __LINE__, sc->free_rx_bd, (u16) USABLE_RX_BD));
 
 	DBRUNIF((sc->free_rx_bd < sc->rx_low_watermark), 
@@ -3663,7 +3637,7 @@
 
 	/* Check if we lost any mbufs in the process. */
 	DBRUNIF((sc->tx_mbuf_alloc),
-		BCE_PRINTF(sc, "%s(%d): Memory leak! Lost %d mbufs "
+		BCE_PRINTF("%s(%d): Memory leak! Lost %d mbufs "
 			"from tx chain!\n",
 			__FILE__, __LINE__, sc->tx_mbuf_alloc));
 
@@ -3728,7 +3702,7 @@
 	while (prod < BCE_RX_SLACK_SPACE) {
 		chain_prod = RX_CHAIN_IDX(prod);
 		if (bce_get_buf(sc, NULL, &prod, &chain_prod, &prod_bseq)) {
-			BCE_PRINTF(sc, "%s(%d): Error filling RX chain: rx_bd[0x%04X]!\n",
+			BCE_PRINTF("%s(%d): Error filling RX chain: rx_bd[0x%04X]!\n",
 				__FILE__, __LINE__, chain_prod);
 			rc = ENOBUFS;
 			break;
@@ -3790,7 +3764,7 @@
 
 	/* Check if we lost any mbufs in the process. */
 	DBRUNIF((sc->rx_mbuf_alloc),
-		BCE_PRINTF(sc, "%s(%d): Memory leak! Lost %d mbufs from rx chain!\n",
+		BCE_PRINTF("%s(%d): Memory leak! Lost %d mbufs from rx chain!\n",
 			__FILE__, __LINE__, sc->rx_mbuf_alloc));
 
 	DBPRINT(sc, BCE_VERBOSE_RESET, "Exiting %s()\n", __FUNCTION__);
@@ -3807,26 +3781,38 @@
 bce_ifmedia_upd(struct ifnet *ifp)
 {
 	struct bce_softc *sc;
+
+	sc = ifp->if_softc;
+	BCE_LOCK(sc);
+	bce_ifmedia_upd_locked(ifp);
+	BCE_UNLOCK(sc);
+	return (0);
+}
+
+static void
+bce_ifmedia_upd_locked(struct ifnet *ifp)
+{
+	struct bce_softc *sc;
 	struct mii_data *mii;
 	struct ifmedia *ifm;
-	int rc = 0;
 
 	sc = ifp->if_softc;
 	ifm = &sc->bce_ifmedia;
+	BCE_LOCK_ASSERT(sc);
 
-	/* DRC - ToDo: Add SerDes support. */
+	mii = device_get_softc(sc->bce_miibus);
 
-	mii = device_get_softc(sc->bce_miibus);
-	sc->bce_link = 0;
-	if (mii->mii_instance) {
-		struct mii_softc *miisc;
-		for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
-		    miisc = LIST_NEXT(miisc, mii_list))
-			mii_phy_reset(miisc);
+	/* Make sure the MII bus has been enumerated. */
+	if (mii) {
+		sc->bce_link = 0;
+		if (mii->mii_instance) {
+			struct mii_softc *miisc;
+
+			LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
+				mii_phy_reset(miisc);
+		}
+		mii_mediachg(mii);
 	}
-	mii_mediachg(mii);
-
-	return(rc);
 }
 
 
@@ -3848,8 +3834,6 @@
 
 	mii = device_get_softc(sc->bce_miibus);
 
-	/* DRC - ToDo: Add SerDes support. */
-
 	mii_pollstat(mii);
 	ifmr->ifm_active = mii->mii_media_active;
 	ifmr->ifm_status = mii->mii_media_status;
@@ -3881,7 +3865,7 @@
 
 		sc->bce_link = 0;
 		callout_stop(&sc->bce_stat_ch);
-		bce_tick_locked(sc);
+		bce_tick(sc);
 
 		/* Update the status_attn_bits_ack field in the status block. */
 		if (new_link_state) {
@@ -3956,6 +3940,9 @@
 		unsigned int len;
 		u32 status;
 
+		/* Clear the MBUF pointer. */
+		m = NULL;
+
 		/* Convert the producer/consumer indices to an actual rx_bd index. */
 		sw_chain_cons = RX_CHAIN_IDX(sw_cons);
 		sw_chain_prod = RX_CHAIN_IDX(sw_prod);
@@ -3965,7 +3952,7 @@
 		sc->free_rx_bd++;
 	
 		DBRUN(BCE_VERBOSE_RECV, 
-			BCE_PRINTF(sc, "%s(): ", __FUNCTION__); 
+			BCE_PRINTF("%s(): ", __FUNCTION__); 
 			bce_dump_rxbd(sc, sw_chain_cons, rxbd));
 
 #ifdef DEVICE_POLLING
@@ -3981,7 +3968,7 @@
 
 			/* Validate that this is the last rx_bd. */
 			DBRUNIF((!(rxbd->rx_bd_flags & RX_BD_FLAGS_END)),
-				BCE_PRINTF(sc, "%s(%d): Unexpected mbuf found in rx_bd[0x%04X]!\n",
+				BCE_PRINTF("%s(%d): Unexpected mbuf found in rx_bd[0x%04X]!\n",
 				__FILE__, __LINE__, sw_chain_cons);
 				bce_breakpoint(sc));
 
@@ -4016,17 +4003,17 @@
 			status = l2fhdr->l2_fhdr_status;
 
 			DBRUNIF(DB_RANDOMTRUE(bce_debug_l2fhdr_status_check),
-				BCE_PRINTF(sc, "Simulating l2_fhdr status error.\n");
+				BCE_PRINTF("Simulating l2_fhdr status error.\n");
 				status = status | L2_FHDR_ERRORS_PHY_DECODE);
 
 			/* Watch for unusual sized frames. */
 			DBRUNIF(((len < BCE_MIN_MTU) || (len > BCE_MAX_JUMBO_ETHER_MTU_VLAN)),
-				BCE_PRINTF(sc, "%s(%d): Unusual frame size found. "
+				BCE_PRINTF("%s(%d): Unusual frame size found. "
 					"Min(%d), Actual(%d), Max(%d)\n", 
 					__FILE__, __LINE__, (int) BCE_MIN_MTU, 
 					len, (int) BCE_MAX_JUMBO_ETHER_MTU_VLAN);
-				bce_dump_mbuf(sc, m);
-		 		bce_breakpoint(sc));
+				bce_dump_mbuf(sc, m));
+//		 		bce_breakpoint(sc));
 
 			len -= ETHER_CRC_LEN;
 
@@ -4057,7 +4044,7 @@
 			if (bce_get_buf(sc, NULL, &sw_prod, &sw_chain_prod, &sw_prod_bseq)) {
 
 				DBRUN(BCE_WARN, 
-					BCE_PRINTF(sc, "%s(%d): Failed to allocate "
+					BCE_PRINTF("%s(%d): Failed to allocate "
 					"new mbuf, incoming frame dropped!\n", 
 					__FILE__, __LINE__));
 
@@ -4085,7 +4072,7 @@
 			DBRUN(BCE_VERBOSE_RECV,
 				struct ether_header *eh;
 				eh = mtod(m, struct ether_header *);
-				BCE_PRINTF(sc, "%s(): to: %6D, from: %6D, type: 0x%04X\n",
+				BCE_PRINTF("%s(): to: %6D, from: %6D, type: 0x%04X\n",
 					__FUNCTION__, eh->ether_dhost, ":", 
 					eh->ether_shost, ":", htons(eh->ether_type)));
 
@@ -4142,19 +4129,35 @@
 
 			/* Pass the mbuf off to the upper layers. */
 			ifp->if_ipackets++;
+
+bce_rx_int_next_rx:
+			sw_prod = NEXT_RX_BD(sw_prod);
+		}
+
+		sw_cons = NEXT_RX_BD(sw_cons);
+
+		/* If we have a packet, pass it up the stack. */
+		if (m) {
+			sc->rx_cons = sw_cons;
+			sc->rx_prod = sw_prod;
+			sc->rx_prod_bseq = sw_prod_bseq;
+
 			DBPRINT(sc, BCE_VERBOSE_RECV, "%s(): Passing received frame up.\n",
 				__FUNCTION__);
 			BCE_UNLOCK(sc);
 			(*ifp->if_input)(ifp, m);
 			DBRUNIF(1, sc->rx_mbuf_alloc--);
 			BCE_LOCK(sc);
-
-bce_rx_int_next_rx:
-			sw_prod = NEXT_RX_BD(sw_prod);
+			
+			/* Recover our place. */
+			sw_cons = sc->rx_cons;
+			sw_prod = sc->rx_prod;
+			sw_prod_bseq = sc->rx_prod_bseq;
+			hw_cons = sc->hw_rx_cons = sblk->status_rx_quick_consumer_index0;
+			if ((hw_cons & USABLE_RX_BD_PER_PAGE) == USABLE_RX_BD_PER_PAGE)
+				hw_cons++;
 		}
 
-		sw_cons = NEXT_RX_BD(sw_cons);
-
 		/* Refresh hw_cons to see if there's new work */
 		if (sw_cons == hw_cons) {
 			hw_cons = sc->hw_rx_cons = sblk->status_rx_quick_consumer_index0;
@@ -4227,7 +4230,7 @@
 			__FUNCTION__, hw_tx_cons, sw_tx_cons, sw_tx_chain_cons);
 
 		DBRUNIF((sw_tx_chain_cons > MAX_TX_BD),
-			BCE_PRINTF(sc, "%s(%d): TX chain consumer out of range! "
+			BCE_PRINTF("%s(%d): TX chain consumer out of range! "
 				" 0x%04X > 0x%04X\n",
 				__FILE__, __LINE__, sw_tx_chain_cons, 
 				(int) MAX_TX_BD);
@@ -4238,12 +4241,12 @@
 				[TX_IDX(sw_tx_chain_cons)]);
 		
 		DBRUNIF((txbd == NULL),
-			BCE_PRINTF(sc, "%s(%d): Unexpected NULL tx_bd[0x%04X]!\n", 
+			BCE_PRINTF("%s(%d): Unexpected NULL tx_bd[0x%04X]!\n", 
 				__FILE__, __LINE__, sw_tx_chain_cons);
 			bce_breakpoint(sc));
 
 		DBRUN(BCE_INFO_SEND, 
-			BCE_PRINTF(sc, "%s(): ", __FUNCTION__);
+			BCE_PRINTF("%s(): ", __FUNCTION__);
 			bce_dump_txbd(sc, sw_tx_chain_cons, txbd));
 
 		/*
@@ -4255,12 +4258,12 @@
 
 			/* Validate that this is the last tx_bd. */
 			DBRUNIF((!(txbd->tx_bd_flags & TX_BD_FLAGS_END)),
-				BCE_PRINTF(sc, "%s(%d): tx_bd END flag not set but "
+				BCE_PRINTF("%s(%d): tx_bd END flag not set but "
 				"txmbuf == NULL!\n", __FILE__, __LINE__);
 				bce_breakpoint(sc));
 
 			DBRUN(BCE_INFO_SEND, 
-				BCE_PRINTF(sc, "%s(): Unloading map/freeing mbuf "
+				BCE_PRINTF("%s(): Unloading map/freeing mbuf "
 					"from tx_bd[0x%04X]\n", __FUNCTION__, sw_tx_chain_cons));
 
 			/* Unmap the mbuf. */
@@ -4289,13 +4292,13 @@
 	}
 
 	/* Clear the TX timeout timer. */
-	ifp->if_timer = 0;
+	sc->watchdog_timer = 0;
 
 	/* Clear the tx hardware queue full flag. */
 	if ((sc->used_tx_bd + BCE_TX_SLACK_SPACE) < USABLE_TX_BD) {
-		DBRUNIF((ifp->if_drv_flags & IFF_DRV_OACTIVE),
-			BCE_PRINTF(sc, "%s(): TX chain is open for business! Used tx_bd = %d\n", 
-				__FUNCTION__, sc->used_tx_bd));
+/*		DBRUNIF((ifp->if_drv_flags & IFF_DRV_OACTIVE),
+			BCE_PRINTF("%s(): TX chain is open for business! Used tx_bd = %d\n", 
+				__FUNCTION__, sc->used_tx_bd)); */
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 	}
 
@@ -4344,8 +4347,6 @@
 /****************************************************************************/
 /* Handles controller initialization.                                       */
 /*                                                                          */
-/* Must be called from a locked routine.                                    */
-/*                                                                          */
 /* Returns:                                                                 */
 /*   Nothing.                                                               */
 /****************************************************************************/
@@ -4368,19 +4369,19 @@
 	bce_stop(sc);
 
 	if (bce_reset(sc, BCE_DRV_MSG_CODE_RESET)) {
-		BCE_PRINTF(sc, "%s(%d): Controller reset failed!\n", 
+		BCE_PRINTF("%s(%d): Controller reset failed!\n", 
 			__FILE__, __LINE__);
 		goto bce_init_locked_exit;
 	}
 
 	if (bce_chipinit(sc)) {
-		BCE_PRINTF(sc, "%s(%d): Controller initialization failed!\n", 
+		BCE_PRINTF("%s(%d): Controller initialization failed!\n", 
 			__FILE__, __LINE__);
 		goto bce_init_locked_exit;
 	}
 
 	if (bce_blockinit(sc)) {
-		BCE_PRINTF(sc, "%s(%d): Block initialization failed!\n", 
+		BCE_PRINTF("%s(%d): Block initialization failed!\n", 
 			__FILE__, __LINE__);
 		goto bce_init_locked_exit;
 	}
@@ -4440,7 +4441,7 @@
 	/* Enable host interrupts. */
 	bce_enable_intr(sc);
 
-	bce_ifmedia_upd(ifp);
+	bce_ifmedia_upd_locked(ifp);
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
@@ -4453,6 +4454,14 @@
 	return;
 }
 
+
+/****************************************************************************/
+/* Initialize the controller just enough so that any management firmware    */
+/* running on the device will continue to operate correctly.                */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_mgmt_init_locked(struct bce_softc *sc)
 {
@@ -4472,6 +4481,7 @@
 	/* Initialize the on-boards CPUs */
 	bce_init_cpus(sc);
 
+	/* Set the page size and clear the RV2P processor stall bits. */
 	val = (BCM_PAGE_BITS - 8) << 24;
 	REG_WR(sc, BCE_RV2P_CONFIG, val);
 
@@ -4483,7 +4493,7 @@
 	REG_RD(sc, BCE_MISC_ENABLE_SET_BITS);
 	DELAY(20);
 
-	bce_ifmedia_upd(ifp);
+	bce_ifmedia_upd_locked(ifp);
 bce_mgmt_init_locked_exit:
 	DBPRINT(sc, BCE_VERBOSE_RESET, "Exiting %s()\n", __FUNCTION__);
 
@@ -4561,7 +4571,7 @@
             
 		/* Try to defrag the mbuf if there are too many segments. */
 	        DBPRINT(sc, BCE_WARN, "%s(): fragmented mbuf (%d pieces)\n",
-                    __FUNCTION__, map_arg.maxsegs);
+                    __FUNCTION__, nsegs);
 
                 m0 = m_defrag(*m_head, M_DONTWAIT);
                 if (m0 == NULL) {
@@ -4578,7 +4588,7 @@
 		if (error == ENOMEM) {
 			return (error);
 		} else if (error != 0) {
-			BCE_PRINTF(sc,
+			BCE_PRINTF(
 			    "%s(%d): Error mapping mbuf into TX chain!\n",
 			    __FILE__, __LINE__);
 			m_freem(m0);
@@ -4614,7 +4624,7 @@
 	DBPRINT(sc, BCE_INFO_SEND,
 		"%s(): Start: prod = 0x%04X, chain_prod = %04X, "
 		"prod_bseq = 0x%08X\n",
-		__FUNCTION__, *prod, chain_prod, prod_bseq);
+		__FUNCTION__, prod, chain_prod, prod_bseq);
 
 	/*
 	 * Cycle through each mbuf segment that makes up
@@ -4641,7 +4651,7 @@
 	/* Set the END flag on the last TX buffer descriptor. */
 	txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_END);
 
-	DBRUN(BCE_INFO_SEND, bce_dump_tx_chain(sc, debug_prod, nseg));
+	DBRUN(BCE_INFO_SEND, bce_dump_tx_chain(sc, debug_prod, nsegs));
 
 	DBPRINT(sc, BCE_INFO_SEND,
 		"%s(): End: prod = 0x%04X, chain_prod = %04X, "
@@ -4757,7 +4767,7 @@
 	REG_WR(sc, MB_TX_CID_ADDR + BCE_L2CTX_TX_HOST_BSEQ, sc->tx_prod_bseq);
 
 	/* Set the tx timeout. */
-	ifp->if_timer = BCE_TX_TIMEOUT;
+	sc->watchdog_timer = BCE_TX_TIMEOUT;
 
 bce_start_locked_exit:
 	return;
@@ -4866,17 +4876,10 @@
 			DBPRINT(sc, BCE_VERBOSE, "bce_phy_flags = 0x%08X\n",
 				sc->bce_phy_flags);
 
-			if (sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) {
-				DBPRINT(sc, BCE_VERBOSE, "SerDes media set/get\n");
-
-				error = ifmedia_ioctl(ifp, ifr,
-				    &sc->bce_ifmedia, command);
-			} else {
-				DBPRINT(sc, BCE_VERBOSE, "Copper media set/get\n");
-				mii = device_get_softc(sc->bce_miibus);
-				error = ifmedia_ioctl(ifp, ifr,
-				    &mii->mii_media, command);
-			}
+			DBPRINT(sc, BCE_VERBOSE, "Copper media set/get\n");
+			mii = device_get_softc(sc->bce_miibus);
+			error = ifmedia_ioctl(ifp, ifr,
+			    &mii->mii_media, command);
 			break;
 
 		/* Set interface capability */
@@ -4891,7 +4894,7 @@
 					/* Setup the poll routine to call. */
 					error = ether_poll_register(bce_poll, ifp);
 					if (error) {
-						BCE_PRINTF(sc, "%s(%d): Error registering poll function!\n",
+						BCE_PRINTF("%s(%d): Error registering poll function!\n",
 							__FILE__, __LINE__);
 						goto bce_ioctl_exit;
 					}
@@ -4948,18 +4951,18 @@
 
 			/* Toggle VLAN_MTU capabilities enable flag. */
 			if (mask & IFCAP_VLAN_MTU) {
-				BCE_PRINTF(sc, "%s(%d): Changing VLAN_MTU not supported.\n",
+				BCE_PRINTF("%s(%d): Changing VLAN_MTU not supported.\n",
 					__FILE__, __LINE__);
 			}
 
 			/* Toggle VLANHWTAG capabilities enabled flag. */
 			if (mask & IFCAP_VLAN_HWTAGGING) {
 				if (sc->bce_flags & BCE_MFW_ENABLE_FLAG)
-					BCE_PRINTF(sc, "%s(%d): Cannot change VLAN_HWTAGGING while "
+					BCE_PRINTF("%s(%d): Cannot change VLAN_HWTAGGING while "
 						"management firmware (ASF/IPMI/UMP) is running!\n",
 						__FILE__, __LINE__);
 				else
-					BCE_PRINTF(sc, "%s(%d): Changing VLAN_HWTAGGING not supported!\n",
+					BCE_PRINTF("%s(%d): Changing VLAN_HWTAGGING not supported!\n",
 						__FILE__, __LINE__);
 			}
 
@@ -4990,25 +4993,34 @@
 /*   Nothing.                                                               */
 /****************************************************************************/
 static void
-bce_watchdog(struct ifnet *ifp)
+bce_watchdog(struct bce_softc *sc)
 {
-	struct bce_softc *sc = ifp->if_softc;
 
-	DBRUN(BCE_WARN_SEND, 
+	DBRUN(BCE_VERBOSE_SEND, 
 		bce_dump_driver_state(sc);
 		bce_dump_status_block(sc));
 
-	BCE_PRINTF(sc, "%s(%d): Watchdog timeout occurred, resetting!\n", 
+	BCE_LOCK_ASSERT(sc);
+
+	if (sc->watchdog_timer == 0 || --sc->watchdog_timer)
+		return;
+
+	/*
+	 * If we are in this routine because of pause frames, then
+	 * don't reset the hardware.
+	 */
+	if (REG_RD(sc, BCE_EMAC_TX_STATUS) & BCE_EMAC_TX_STATUS_XOFFED)	
+		return;
+
+	BCE_PRINTF("%s(%d): Watchdog timeout occurred, resetting!\n", 
 		__FILE__, __LINE__);
 
 	/* DBRUN(BCE_FATAL, bce_breakpoint(sc)); */
 
-	BCE_LOCK(sc);
-	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+	sc->bce_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 
 	bce_init_locked(sc);
-	ifp->if_oerrors++;
-	BCE_UNLOCK(sc);
+	sc->bce_ifp->if_oerrors++;
 
 }
 
@@ -5096,6 +5108,7 @@
 	sc = xsc;
 	ifp = sc->bce_ifp;
 
+	DBPRINT(sc, BCE_EXCESSIVE, "Entering %s()\n", __FUNCTION__);
 	BCE_LOCK(sc);
 
 	DBRUNIF(1, sc->interrupts_generated++);
@@ -5131,7 +5144,7 @@
 		status_attn_bits = sc->status_block->status_attn_bits;
 
 		DBRUNIF(DB_RANDOMTRUE(bce_debug_unexpected_attention),
-			BCE_PRINTF(sc, "Simulating unexpected status attention bit set.");
+			BCE_PRINTF("Simulating unexpected status attention bit set.");
 			status_attn_bits = status_attn_bits | STATUS_ATTN_BITS_PARITY_ERROR);
 
 		/* Was it a link change interrupt? */
@@ -5146,7 +5159,7 @@
 
 			DBRUN(1, sc->unexpected_attentions++);
 
-			BCE_PRINTF(sc, "%s(%d): Fatal attention detected: 0x%08X\n", 
+			BCE_PRINTF("%s(%d): Fatal attention detected: 0x%08X\n", 
 				__FILE__, __LINE__, sc->status_block->status_attn_bits);
 
 			DBRUN(BCE_FATAL, 
@@ -5209,7 +5222,7 @@
 {
 	struct ifnet *ifp;
 	struct ifmultiaddr *ifma;
-	u32 hashes[4] = { 0, 0, 0, 0 };
+	u32 hashes[NUM_MC_HASH_REGISTERS] = { 0, 0, 0, 0, 0, 0, 0, 0 };
 	u32 rx_mode, sort_mode;
 	int h, i;
 
@@ -5257,12 +5270,12 @@
 			if (ifma->ifma_addr->sa_family != AF_LINK)
 				continue;
 			h = ether_crc32_le(LLADDR((struct sockaddr_dl *)
-		    	ifma->ifma_addr), ETHER_ADDR_LEN) & 0x7F;
-			hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
+			    ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF;
+			    hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F);
 		}
 		IF_ADDR_UNLOCK(ifp);
 
-		for (i = 0; i < 4; i++)
+		for (i = 0; i < NUM_MC_HASH_REGISTERS; i++)
 			REG_WR(sc, BCE_EMAC_MULTICAST_HASH0 + (i * 4), hashes[i]);
 
 		sort_mode |= BCE_RPM_SORT_USER0_MC_HSH_EN;
@@ -5504,14 +5517,23 @@
 	sc->stat_CatchupInRuleCheckerP4Hit =
 		stats->stat_CatchupInRuleCheckerP4Hit;
 
+	sc->com_no_buffers = REG_RD_IND(sc, 0x120084);
+
 	DBPRINT(sc, BCE_EXCESSIVE, "Exiting %s()\n", __FUNCTION__);
 }
 
 
+/****************************************************************************/
+/* Periodic function to perform maintenance tasks.                          */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
-bce_tick_locked(struct bce_softc *sc)
+bce_tick(void *xsc)
 {
-	struct mii_data *mii = NULL;
+	struct bce_softc *sc = xsc;
+	struct mii_data *mii;
 	struct ifnet *ifp;
 	u32 msg;
 
@@ -5530,9 +5552,12 @@
 	/* Update the statistics from the hardware statistics block. */
 	bce_stats_update(sc);
 
+	/* Check that chip hasn't hung. */
+	bce_watchdog(sc);
+
 	/* Schedule the next tick. */
 	callout_reset(
-		&sc->bce_stat_ch,		/* callout */
+		&sc->bce_stat_ch, 		/* callout */
 		hz, 					/* ticks */
 		bce_tick, 				/* function */
 		sc);					/* function argument */
@@ -5541,8 +5566,6 @@
 	if (sc->bce_link)
 		goto bce_tick_locked_exit;
 
-	/* DRC - ToDo: Add SerDes support and check SerDes link here. */
-
 	mii = device_get_softc(sc->bce_miibus);
 	mii_tick(mii);
 
@@ -5553,7 +5576,7 @@
 		if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T ||
 		    IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX) &&
 		    bootverbose)
-			BCE_PRINTF(sc, "Gigabit link up\n");
+			BCE_PRINTF("Gigabit link up\n");
 		/* Now that link is up, handle any outstanding TX traffic. */
 		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 			bce_start_locked(ifp);
@@ -5564,19 +5587,6 @@
 }
 
 
-static void
-bce_tick(void *xsc)
-{
-	struct bce_softc *sc;
-
-	sc = xsc;
-
-	BCE_LOCK(sc);
-	bce_tick_locked(sc);
-	BCE_UNLOCK(sc);
-}
-
-
 #ifdef BCE_DEBUG
 /****************************************************************************/
 /* Allows the driver state to be dumped through the sysctl interface.       */
@@ -5635,8 +5645,8 @@
 
 
 /****************************************************************************/
+/* Provides a sysctl interface to allow dumping the RX chain.               */
 /*                                                                          */
-/*                                                                          */
 /* Returns:                                                                 */
 /*   0 for success, positive value for failure.                             */
 /****************************************************************************/
@@ -5663,12 +5673,75 @@
 
 
 /****************************************************************************/
+/* Provides a sysctl interface to allow dumping the TX chain.               */
 /*                                                                          */
+/* Returns:                                                                 */
+/*   0 for success, positive value for failure.                             */
+/****************************************************************************/
+static int
+bce_sysctl_dump_tx_chain(SYSCTL_HANDLER_ARGS)
+{
+        int error;
+        int result;
+        struct bce_softc *sc;
+
+        result = -1;
+        error = sysctl_handle_int(oidp, &result, 0, req);
+
+        if (error || !req->newptr)
+                return (error);
+
+        if (result == 1) {
+                sc = (struct bce_softc *)arg1;
+                bce_dump_tx_chain(sc, 0, USABLE_TX_BD);
+        }
+
+        return error;
+}
+
+
+/****************************************************************************/
+/* Provides a sysctl interface to allow reading arbitrary registers in the  */
+/* device.  DO NOT ENABLE ON PRODUCTION SYSTEMS!                            */
 /*                                                                          */
 /* Returns:                                                                 */
 /*   0 for success, positive value for failure.                             */
 /****************************************************************************/
 static int
+bce_sysctl_reg_read(SYSCTL_HANDLER_ARGS)
+{
+	struct bce_softc *sc;
+	int error;
+	u32 val, result;
+  	 
+	result = -1;
+	error = sysctl_handle_int(oidp, &result, 0, req);
+	if (error || (req->newptr == NULL))
+		return (error);
+  	 
+	/* Make sure the register is accessible. */
+	if (result < 0x8000) {
+		sc = (struct bce_softc *)arg1;
+		val = REG_RD(sc, result);
+		BCE_PRINTF("reg 0x%08X = 0x%08X\n", result, val);
+	} else if (result < 0x0280000) {
+		sc = (struct bce_softc *)arg1;
+		val = REG_RD_IND(sc, result);
+		BCE_PRINTF("reg 0x%08X = 0x%08X\n", result, val);
+	}
+  	 
+	return (error);
+}
+
+  	 
+/****************************************************************************/
+/* Provides a sysctl interface to force the driver to dump state and enter  */
+/* the debugger.  DO NOT ENABLE ON PRODUCTION SYSTEMS!                      */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   0 for success, positive value for failure.                             */
+/****************************************************************************/
+static int
 bce_sysctl_breakpoint(SYSCTL_HANDLER_ARGS)
 {
         int error;
@@ -5706,11 +5779,6 @@
 	ctx = device_get_sysctl_ctx(sc->bce_dev);
 	children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bce_dev));
 
-	SYSCTL_ADD_STRING(ctx, children, OID_AUTO,
-		"driver_version",
-		CTLFLAG_RD, &bce_driver_version,
-		0, "bce driver version");
-
 #ifdef BCE_DEBUG
 	SYSCTL_ADD_INT(ctx, children, OID_AUTO, 
 		"rx_low_watermark",
@@ -6013,6 +6081,11 @@
 		CTLFLAG_RD, &sc->stat_CatchupInRuleCheckerP4Hit,
 		0, "Received packets rule checker hits in Catchup path");
 
+	SYSCTL_ADD_UINT(ctx, children, OID_AUTO, 
+		"com_no_bufers",
+		CTLFLAG_RD, &sc->com_no_buffers,
+		0, "Valid packets received but no RX buffers available");
+
 #ifdef BCE_DEBUG
 	SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
 		"driver_state", CTLTYPE_INT | CTLFLAG_RW,
@@ -6030,9 +6103,20 @@
 		bce_sysctl_dump_rx_chain, "I", "Dump rx_bd chain");
 
 	SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
+		"dump_tx_chain", CTLTYPE_INT | CTLFLAG_RW,
+		(void *)sc, 0,
+		bce_sysctl_dump_tx_chain, "I", "Dump tx_bd chain");
+
+	SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
 		"breakpoint", CTLTYPE_INT | CTLFLAG_RW,
 		(void *)sc, 0,
 		bce_sysctl_breakpoint, "I", "Driver breakpoint");
+
+	SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
+		"reg_read", CTLTYPE_INT | CTLFLAG_RW,
+		(void *)sc, 0,
+		bce_sysctl_reg_read, "I", "Register read");
+
 #endif
 
 }
@@ -6052,8 +6136,12 @@
 static void
 bce_dump_mbuf(struct bce_softc *sc, struct mbuf *m)
 {
-	u32 val_hi, val_lo;
-	struct mbuf *mp = m;
+//	u32 val_hi, val_lo;
+//	struct mbuf *mp = m;
+    u32 val_hi, val_lo;
+    int i;
+    struct mbuf *mp = m;
+    u_char *d;
 
 	if (m == NULL) {
 		/* Index out of range. */
@@ -6064,8 +6152,24 @@
 	while (mp) {
 		val_hi = BCE_ADDR_HI(mp);
 		val_lo = BCE_ADDR_LO(mp);
-		BCE_PRINTF(sc, "mbuf: vaddr = 0x%08X:%08X, m_len = %d, m_flags = ", 
+		BCE_PRINTF("mbuf: vaddr = 0x%08X:%08X, m_len = %d, m_flags = ", 
 			   val_hi, val_lo, mp->m_len);
+        /* Print up to 128 bytes of data (should be the Ethernet header) */
+        d = mtod(m, u_char *);
+        for (i = 0; (i < m->m_len && i < 128); ) {
+            if ((i % 16) == 0)
+                printf("0x%02X: ", i);
+            if (i <= m->m_len) {
+                printf("%02X ", *d);
+                d++;
+                i++;
+            } else
+                break;
+            if ((i % 16) == 0)
+                printf("\n");
+        }
+        if (i != 128)
+            printf("\n");
 
 		if (mp->m_flags & M_EXT)
 			printf("M_EXT ");
@@ -6076,7 +6180,7 @@
 		if (mp->m_flags & M_EXT) {
 			val_hi = BCE_ADDR_HI(mp->m_ext.ext_buf);
 			val_lo = BCE_ADDR_LO(mp->m_ext.ext_buf);
-			BCE_PRINTF(sc, "- m_ext: vaddr = 0x%08X:%08X, ext_size = 0x%04X\n", 
+			BCE_PRINTF("- m_ext: vaddr = 0x%08X:%08X, ext_size = 0x%04X\n", 
 				val_hi, val_lo, mp->m_ext.ext_size);
 		}
 
@@ -6098,96 +6202,156 @@
 {
 	struct mbuf *m;
 
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
 		"  tx mbuf data  "
 		"----------------------------\n");
 
 	for (int i = 0; i < count; i++) {
 	 	m = sc->tx_mbuf_ptr[chain_prod];
-		BCE_PRINTF(sc, "txmbuf[%d]\n", chain_prod);
+		BCE_PRINTF("txmbuf[%d]\n", chain_prod);
 		bce_dump_mbuf(sc, m);
 		chain_prod = TX_CHAIN_IDX(NEXT_TX_BD(chain_prod));
 	}
 
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
 		"----------------"
 		"----------------------------\n");
 }
 
 
-/*
- * This routine prints the RX mbuf chain.
- */
+/****************************************************************************/
+/* Prints out the mbufs in the RX mbuf chain.                               */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_rx_mbuf_chain(struct bce_softc *sc, int chain_prod, int count)
 {
 	struct mbuf *m;
 
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
 		"  rx mbuf data  "
 		"----------------------------\n");
 
 	for (int i = 0; i < count; i++) {
 	 	m = sc->rx_mbuf_ptr[chain_prod];
-		BCE_PRINTF(sc, "rxmbuf[0x%04X]\n", chain_prod);
+		BCE_PRINTF("rxmbuf[0x%04X]\n", chain_prod);
 		bce_dump_mbuf(sc, m);
 		chain_prod = RX_CHAIN_IDX(NEXT_RX_BD(chain_prod));
 	}
 
 
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
 		"----------------"
 		"----------------------------\n");
 }
 
 
+/****************************************************************************/
+/* Prints out a tx_bd structure.                                            */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_txbd(struct bce_softc *sc, int idx, struct tx_bd *txbd)
 {
 	if (idx > MAX_TX_BD)
 		/* Index out of range. */
-		BCE_PRINTF(sc, "tx_bd[0x%04X]: Invalid tx_bd index!\n", idx);
+		BCE_PRINTF("tx_bd[0x%04X]: Invalid tx_bd index!\n", idx);
 	else if ((idx & USABLE_TX_BD_PER_PAGE) == USABLE_TX_BD_PER_PAGE)
 		/* TX Chain page pointer. */
-		BCE_PRINTF(sc, "tx_bd[0x%04X]: haddr = 0x%08X:%08X, chain page pointer\n", 
+		BCE_PRINTF("tx_bd[0x%04X]: haddr = 0x%08X:%08X, chain page pointer\n", 
 			idx, txbd->tx_bd_haddr_hi, txbd->tx_bd_haddr_lo);
-	else
+	else {
 		/* Normal tx_bd entry. */
-		BCE_PRINTF(sc, "tx_bd[0x%04X]: haddr = 0x%08X:%08X, nbytes = 0x%08X, "
-			"vlan tag= 0x%4X, "flags = 0x%04X\n", idx, 
+		BCE_PRINTF("tx_bd[0x%04X]: haddr = 0x%08X:%08X, nbytes = 0x%08X, "
+			"vlan tag= 0x%4X, flags = 0x%04X (", idx, 
 			txbd->tx_bd_haddr_hi, txbd->tx_bd_haddr_lo,
 			txbd->tx_bd_mss_nbytes, txbd->tx_bd_vlan_tag,
 			txbd->tx_bd_flags);
+
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_CONN_FAULT)
+			printf(" CONN_FAULT");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_TCP_UDP_CKSUM)
+			printf(" TCP_UDP_CKSUM");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_IP_CKSUM)
+			printf(" IP_CKSUM");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_VLAN_TAG)
+			printf("  VLAN");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_COAL_NOW)
+			printf(" COAL_NOW");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_DONT_GEN_CRC)
+			printf(" DONT_GEN_CRC");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_START)
+			printf(" START");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_END)
+			printf(" END");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_OPTION_WORD)
+			printf(" OPTION_WORD");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_FLAGS)
+			printf(" FLAGS");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_SNAP)
+			printf(" SNAP");
+ 	
+		if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_LSO)
+			printf(" LSO");
+ 	
+		printf(" )\n");
+	}
 }
 
 
+/****************************************************************************/
+/* Prints out a rx_bd structure.                                            */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_rxbd(struct bce_softc *sc, int idx, struct rx_bd *rxbd)
 {
 	if (idx > MAX_RX_BD)
 		/* Index out of range. */
-		BCE_PRINTF(sc, "rx_bd[0x%04X]: Invalid rx_bd index!\n", idx);
+		BCE_PRINTF("rx_bd[0x%04X]: Invalid rx_bd index!\n", idx);
 	else if ((idx & USABLE_RX_BD_PER_PAGE) == USABLE_RX_BD_PER_PAGE)
 		/* TX Chain page pointer. */
-		BCE_PRINTF(sc, "rx_bd[0x%04X]: haddr = 0x%08X:%08X, chain page pointer\n", 
+		BCE_PRINTF("rx_bd[0x%04X]: haddr = 0x%08X:%08X, chain page pointer\n", 
 			idx, rxbd->rx_bd_haddr_hi, rxbd->rx_bd_haddr_lo);
 	else
 		/* Normal tx_bd entry. */
-		BCE_PRINTF(sc, "rx_bd[0x%04X]: haddr = 0x%08X:%08X, nbytes = 0x%08X, "
+		BCE_PRINTF("rx_bd[0x%04X]: haddr = 0x%08X:%08X, nbytes = 0x%08X, "
 			"flags = 0x%08X\n", idx, 
 			rxbd->rx_bd_haddr_hi, rxbd->rx_bd_haddr_lo,
 			rxbd->rx_bd_len, rxbd->rx_bd_flags);
 }
 
 
+/****************************************************************************/
+/* Prints out a l2_fhdr structure.                                          */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_l2fhdr(struct bce_softc *sc, int idx, struct l2_fhdr *l2fhdr)
 {
-	BCE_PRINTF(sc, "l2_fhdr[0x%04X]: status = 0x%08X, "
+	BCE_PRINTF("l2_fhdr[0x%04X]: status = 0x%08X, "
 		"pkt_len = 0x%04X, vlan = 0x%04x, ip_xsum = 0x%04X, "
 		"tcp_udp_xsum = 0x%04X\n", idx,
 		l2fhdr->l2_fhdr_status, l2fhdr->l2_fhdr_pkt_len,
@@ -6196,29 +6360,32 @@
 }
 
 
-/*
- * This routine prints the TX chain.
- */
+/****************************************************************************/
+/* Prints out the TX chain.                                                 */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_tx_chain(struct bce_softc *sc, int tx_prod, int count)
 {
 	struct tx_bd *txbd;
 
 	/* First some info about the tx_bd chain structure. */
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
 		"  tx_bd  chain  "
 		"----------------------------\n");
 
-	BCE_PRINTF(sc, "page size      = 0x%08X, tx chain pages        = 0x%08X\n",
+	BCE_PRINTF("page size      = 0x%08X, tx chain pages        = 0x%08X\n",
 		(u32) BCM_PAGE_SIZE, (u32) TX_PAGES);
 
-	BCE_PRINTF(sc, "tx_bd per page = 0x%08X, usable tx_bd per page = 0x%08X\n",
+	BCE_PRINTF("tx_bd per page = 0x%08X, usable tx_bd per page = 0x%08X\n",
 		(u32) TOTAL_TX_BD_PER_PAGE, (u32) USABLE_TX_BD_PER_PAGE);
 
-	BCE_PRINTF(sc, "total tx_bd    = 0x%08X\n", (u32) TOTAL_TX_BD);
+	BCE_PRINTF("total tx_bd    = 0x%08X\n", (u32) TOTAL_TX_BD);
 
-	BCE_PRINTF(sc, ""
+	BCE_PRINTF(
 		"-----------------------------"
 		"   tx_bd data   "
 		"-----------------------------\n");
@@ -6230,38 +6397,39 @@
 		tx_prod = TX_CHAIN_IDX(NEXT_TX_BD(tx_prod));
 	}
 
-	BCE_PRINTF(sc,
-		"-----------------------------"
-		"--------------"
-		"-----------------------------\n");
+	BCE_PRINTF(
+		"----------------------------"
+		"----------------"
+		"----------------------------\n");
 }
 
 
-/*
- * This routine prints the RX chain.
- */
+/****************************************************************************/
+/* Prints out the RX chain.                                                 */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_rx_chain(struct bce_softc *sc, int rx_prod, int count)
 {
 	struct rx_bd *rxbd;
 
 	/* First some info about the tx_bd chain structure. */
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
 		"  rx_bd  chain  "
 		"----------------------------\n");
 
-	BCE_PRINTF(sc, "----- RX_BD Chain -----\n");
-
-	BCE_PRINTF(sc, "page size      = 0x%08X, rx chain pages        = 0x%08X\n",
+	BCE_PRINTF("page size      = 0x%08X, rx chain pages        = 0x%08X\n", 
 		(u32) BCM_PAGE_SIZE, (u32) RX_PAGES);
 
-	BCE_PRINTF(sc, "rx_bd per page = 0x%08X, usable rx_bd per page = 0x%08X\n",
+	BCE_PRINTF("rx_bd per page = 0x%08X, usable rx_bd per page = 0x%08X\n",
 		(u32) TOTAL_RX_BD_PER_PAGE, (u32) USABLE_RX_BD_PER_PAGE);
 
-	BCE_PRINTF(sc, "total rx_bd    = 0x%08X\n", (u32) TOTAL_RX_BD);
+	BCE_PRINTF("total rx_bd    = 0x%08X\n", (u32) TOTAL_RX_BD);
 
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
 		"   rx_bd data   "
 		"----------------------------\n");
@@ -6273,16 +6441,19 @@
 		rx_prod = RX_CHAIN_IDX(NEXT_RX_BD(rx_prod));
 	}
 
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
-		"--------------"
+		"----------------"
 		"----------------------------\n");
 }
 
 
-/*
- * This routine prints the status block.
- */
+/****************************************************************************/
+/* Prints out the status block from host memory.                            */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_status_block(struct bce_softc *sc)
 {
@@ -6290,88 +6461,95 @@
 
 	sblk = sc->status_block;
 
-   	BCE_PRINTF(sc, "----------------------------- Status Block "
-		"-----------------------------\n");
+   	BCE_PRINTF(
+   		"----------------------------"
+   		"  Status Block  "
+		"----------------------------\n");
 
-	BCE_PRINTF(sc, "attn_bits  = 0x%08X, attn_bits_ack = 0x%08X, index = 0x%04X\n",
+	BCE_PRINTF("attn_bits  = 0x%08X, attn_bits_ack = 0x%08X, index = 0x%04X\n",
 		sblk->status_attn_bits, sblk->status_attn_bits_ack,
 		sblk->status_idx);
 
-	BCE_PRINTF(sc, "rx_cons0   = 0x%08X, tx_cons0      = 0x%08X\n",
+	BCE_PRINTF("rx_cons0   = 0x%08X, tx_cons0      = 0x%08X\n",
 		sblk->status_rx_quick_consumer_index0,
 		sblk->status_tx_quick_consumer_index0);
 
-	BCE_PRINTF(sc, "status_idx = 0x%04X\n", sblk->status_idx);
+	BCE_PRINTF("status_idx = 0x%04X\n", sblk->status_idx);
 
 	/* Theses indices are not used for normal L2 drivers. */
 	if (sblk->status_rx_quick_consumer_index1 || 
 		sblk->status_tx_quick_consumer_index1)
-		BCE_PRINTF(sc, "rx_cons1  = 0x%08X, tx_cons1      = 0x%08X\n",
+		BCE_PRINTF("rx_cons1  = 0x%08X, tx_cons1      = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index1,
 			sblk->status_tx_quick_consumer_index1);
 
 	if (sblk->status_rx_quick_consumer_index2 || 
 		sblk->status_tx_quick_consumer_index2)
-		BCE_PRINTF(sc, "rx_cons2  = 0x%08X, tx_cons2      = 0x%08X\n",
+		BCE_PRINTF("rx_cons2  = 0x%08X, tx_cons2      = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index2,
 			sblk->status_tx_quick_consumer_index2);
 
 	if (sblk->status_rx_quick_consumer_index3 || 
 		sblk->status_tx_quick_consumer_index3)
-		BCE_PRINTF(sc, "rx_cons3  = 0x%08X, tx_cons3      = 0x%08X\n",
+		BCE_PRINTF("rx_cons3  = 0x%08X, tx_cons3      = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index3,
 			sblk->status_tx_quick_consumer_index3);
 
 	if (sblk->status_rx_quick_consumer_index4 || 
 		sblk->status_rx_quick_consumer_index5)
-		BCE_PRINTF(sc, "rx_cons4  = 0x%08X, rx_cons5      = 0x%08X\n",
+		BCE_PRINTF("rx_cons4  = 0x%08X, rx_cons5      = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index4,
 			sblk->status_rx_quick_consumer_index5);
 
 	if (sblk->status_rx_quick_consumer_index6 || 
 		sblk->status_rx_quick_consumer_index7)
-		BCE_PRINTF(sc, "rx_cons6  = 0x%08X, rx_cons7      = 0x%08X\n",
+		BCE_PRINTF("rx_cons6  = 0x%08X, rx_cons7      = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index6,
 			sblk->status_rx_quick_consumer_index7);
 
 	if (sblk->status_rx_quick_consumer_index8 || 
 		sblk->status_rx_quick_consumer_index9)
-		BCE_PRINTF(sc, "rx_cons8  = 0x%08X, rx_cons9      = 0x%08X\n",
+		BCE_PRINTF("rx_cons8  = 0x%08X, rx_cons9      = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index8,
 			sblk->status_rx_quick_consumer_index9);
 
 	if (sblk->status_rx_quick_consumer_index10 || 
 		sblk->status_rx_quick_consumer_index11)
-		BCE_PRINTF(sc, "rx_cons10 = 0x%08X, rx_cons11     = 0x%08X\n",
+		BCE_PRINTF("rx_cons10 = 0x%08X, rx_cons11     = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index10,
 			sblk->status_rx_quick_consumer_index11);
 
 	if (sblk->status_rx_quick_consumer_index12 || 
 		sblk->status_rx_quick_consumer_index13)
-		BCE_PRINTF(sc, "rx_cons12 = 0x%08X, rx_cons13     = 0x%08X\n",
+		BCE_PRINTF("rx_cons12 = 0x%08X, rx_cons13     = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index12,
 			sblk->status_rx_quick_consumer_index13);
 
 	if (sblk->status_rx_quick_consumer_index14 || 
 		sblk->status_rx_quick_consumer_index15)
-		BCE_PRINTF(sc, "rx_cons14 = 0x%08X, rx_cons15     = 0x%08X\n",
+		BCE_PRINTF("rx_cons14 = 0x%08X, rx_cons15     = 0x%08X\n",
 			sblk->status_rx_quick_consumer_index14,
 			sblk->status_rx_quick_consumer_index15);
 
 	if (sblk->status_completion_producer_index || 
 		sblk->status_cmd_consumer_index)
-		BCE_PRINTF(sc, "com_prod  = 0x%08X, cmd_cons      = 0x%08X\n",
+		BCE_PRINTF("com_prod  = 0x%08X, cmd_cons      = 0x%08X\n",
 			sblk->status_completion_producer_index,
 			sblk->status_cmd_consumer_index);
 
-	BCE_PRINTF(sc, "-------------------------------------------"
-		"-----------------------------\n");
+	BCE_PRINTF(
+		"----------------------------"
+		"----------------"
+		"----------------------------\n");
 }
 
 
-/*
- * This routine prints the statistics block.
- */
+/****************************************************************************/
+/* Prints out the statistics block from host memory.                        */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_stats_block(struct bce_softc *sc)
 {
@@ -6379,393 +6557,414 @@
 
 	sblk = sc->stats_block;
 
-	BCE_PRINTF(sc, ""
-		"-----------------------------"
-		" Stats  Block "
-		"-----------------------------\n");
+	BCE_PRINTF(
+		"----------------------------"
+		"  Stats  Block  "
+		"----------------------------\n");
 
-	BCE_PRINTF(sc, "IfHcInOctets         = 0x%08X:%08X, "
+	BCE_PRINTF("IfHcInOctets         = 0x%08X:%08X, "
 		"IfHcInBadOctets      = 0x%08X:%08X\n",
 		sblk->stat_IfHCInOctets_hi, sblk->stat_IfHCInOctets_lo,
 		sblk->stat_IfHCInBadOctets_hi, sblk->stat_IfHCInBadOctets_lo);
 
-	BCE_PRINTF(sc, "IfHcOutOctets        = 0x%08X:%08X, "
+	BCE_PRINTF("IfHcOutOctets        = 0x%08X:%08X, "
 		"IfHcOutBadOctets     = 0x%08X:%08X\n",
 		sblk->stat_IfHCOutOctets_hi, sblk->stat_IfHCOutOctets_lo,
 		sblk->stat_IfHCOutBadOctets_hi, sblk->stat_IfHCOutBadOctets_lo);
 
-	BCE_PRINTF(sc, "IfHcInUcastPkts      = 0x%08X:%08X, "
+	BCE_PRINTF("IfHcInUcastPkts      = 0x%08X:%08X, "
 		"IfHcInMulticastPkts  = 0x%08X:%08X\n",
 		sblk->stat_IfHCInUcastPkts_hi, sblk->stat_IfHCInUcastPkts_lo,
 		sblk->stat_IfHCInMulticastPkts_hi, sblk->stat_IfHCInMulticastPkts_lo);
 
-	BCE_PRINTF(sc, "IfHcInBroadcastPkts  = 0x%08X:%08X, "
+	BCE_PRINTF("IfHcInBroadcastPkts  = 0x%08X:%08X, "
 		"IfHcOutUcastPkts     = 0x%08X:%08X\n",
 		sblk->stat_IfHCInBroadcastPkts_hi, sblk->stat_IfHCInBroadcastPkts_lo,
 		sblk->stat_IfHCOutUcastPkts_hi, sblk->stat_IfHCOutUcastPkts_lo);
 
-	BCE_PRINTF(sc, "IfHcOutMulticastPkts = 0x%08X:%08X, IfHcOutBroadcastPkts = 0x%08X:%08X\n",
+	BCE_PRINTF("IfHcOutMulticastPkts = 0x%08X:%08X, IfHcOutBroadcastPkts = 0x%08X:%08X\n",
 		sblk->stat_IfHCOutMulticastPkts_hi, sblk->stat_IfHCOutMulticastPkts_lo,
 		sblk->stat_IfHCOutBroadcastPkts_hi, sblk->stat_IfHCOutBroadcastPkts_lo);
 
 	if (sblk->stat_emac_tx_stat_dot3statsinternalmactransmiterrors)
-		BCE_PRINTF(sc, "0x%08X : "
+		BCE_PRINTF("0x%08X : "
 		"emac_tx_stat_dot3statsinternalmactransmiterrors\n", 
 		sblk->stat_emac_tx_stat_dot3statsinternalmactransmiterrors);
 
 	if (sblk->stat_Dot3StatsCarrierSenseErrors)
-		BCE_PRINTF(sc, "0x%08X : Dot3StatsCarrierSenseErrors\n",
+		BCE_PRINTF("0x%08X : Dot3StatsCarrierSenseErrors\n",
 			sblk->stat_Dot3StatsCarrierSenseErrors);
 
 	if (sblk->stat_Dot3StatsFCSErrors)
-		BCE_PRINTF(sc, "0x%08X : Dot3StatsFCSErrors\n",
+		BCE_PRINTF("0x%08X : Dot3StatsFCSErrors\n",
 			sblk->stat_Dot3StatsFCSErrors);
 
 	if (sblk->stat_Dot3StatsAlignmentErrors)
-		BCE_PRINTF(sc, "0x%08X : Dot3StatsAlignmentErrors\n",
+		BCE_PRINTF("0x%08X : Dot3StatsAlignmentErrors\n",
 			sblk->stat_Dot3StatsAlignmentErrors);
 
 	if (sblk->stat_Dot3StatsSingleCollisionFrames)
-		BCE_PRINTF(sc, "0x%08X : Dot3StatsSingleCollisionFrames\n",
+		BCE_PRINTF("0x%08X : Dot3StatsSingleCollisionFrames\n",
 			sblk->stat_Dot3StatsSingleCollisionFrames);
 
 	if (sblk->stat_Dot3StatsMultipleCollisionFrames)
-		BCE_PRINTF(sc, "0x%08X : Dot3StatsMultipleCollisionFrames\n",
+		BCE_PRINTF("0x%08X : Dot3StatsMultipleCollisionFrames\n",
 			sblk->stat_Dot3StatsMultipleCollisionFrames);
 	
 	if (sblk->stat_Dot3StatsDeferredTransmissions)
-		BCE_PRINTF(sc, "0x%08X : Dot3StatsDeferredTransmissions\n",
+		BCE_PRINTF("0x%08X : Dot3StatsDeferredTransmissions\n",
 			sblk->stat_Dot3StatsDeferredTransmissions);
 
 	if (sblk->stat_Dot3StatsExcessiveCollisions)
-		BCE_PRINTF(sc, "0x%08X : Dot3StatsExcessiveCollisions\n",
+		BCE_PRINTF("0x%08X : Dot3StatsExcessiveCollisions\n",
 			sblk->stat_Dot3StatsExcessiveCollisions);
 
 	if (sblk->stat_Dot3StatsLateCollisions)
-		BCE_PRINTF(sc, "0x%08X : Dot3StatsLateCollisions\n",
+		BCE_PRINTF("0x%08X : Dot3StatsLateCollisions\n",
 			sblk->stat_Dot3StatsLateCollisions);
 
 	if (sblk->stat_EtherStatsCollisions)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsCollisions\n",
+		BCE_PRINTF("0x%08X : EtherStatsCollisions\n",
 			sblk->stat_EtherStatsCollisions);
 
 	if (sblk->stat_EtherStatsFragments) 
-		BCE_PRINTF(sc, "0x%08X : EtherStatsFragments\n",
+		BCE_PRINTF("0x%08X : EtherStatsFragments\n",
 			sblk->stat_EtherStatsFragments);
 
 	if (sblk->stat_EtherStatsJabbers)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsJabbers\n",
+		BCE_PRINTF("0x%08X : EtherStatsJabbers\n",
 			sblk->stat_EtherStatsJabbers);
 
 	if (sblk->stat_EtherStatsUndersizePkts)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsUndersizePkts\n",
+		BCE_PRINTF("0x%08X : EtherStatsUndersizePkts\n",
 			sblk->stat_EtherStatsUndersizePkts);
 
 	if (sblk->stat_EtherStatsOverrsizePkts)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsOverrsizePkts\n",
+		BCE_PRINTF("0x%08X : EtherStatsOverrsizePkts\n",
 			sblk->stat_EtherStatsOverrsizePkts);
 
 	if (sblk->stat_EtherStatsPktsRx64Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsRx64Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsRx64Octets\n",
 			sblk->stat_EtherStatsPktsRx64Octets);
 
 	if (sblk->stat_EtherStatsPktsRx65Octetsto127Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsRx65Octetsto127Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsRx65Octetsto127Octets\n",
 			sblk->stat_EtherStatsPktsRx65Octetsto127Octets);
 
 	if (sblk->stat_EtherStatsPktsRx128Octetsto255Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsRx128Octetsto255Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsRx128Octetsto255Octets\n",
 			sblk->stat_EtherStatsPktsRx128Octetsto255Octets);
 
 	if (sblk->stat_EtherStatsPktsRx256Octetsto511Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsRx256Octetsto511Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsRx256Octetsto511Octets\n",
 			sblk->stat_EtherStatsPktsRx256Octetsto511Octets);
 
 	if (sblk->stat_EtherStatsPktsRx512Octetsto1023Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsRx512Octetsto1023Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsRx512Octetsto1023Octets\n",
 			sblk->stat_EtherStatsPktsRx512Octetsto1023Octets);
 
 	if (sblk->stat_EtherStatsPktsRx1024Octetsto1522Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsRx1024Octetsto1522Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsRx1024Octetsto1522Octets\n",
 			sblk->stat_EtherStatsPktsRx1024Octetsto1522Octets);
 
 	if (sblk->stat_EtherStatsPktsRx1523Octetsto9022Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsRx1523Octetsto9022Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsRx1523Octetsto9022Octets\n",
 			sblk->stat_EtherStatsPktsRx1523Octetsto9022Octets);
 
 	if (sblk->stat_EtherStatsPktsTx64Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsTx64Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsTx64Octets\n",
 			sblk->stat_EtherStatsPktsTx64Octets);
 
 	if (sblk->stat_EtherStatsPktsTx65Octetsto127Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsTx65Octetsto127Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsTx65Octetsto127Octets\n",
 			sblk->stat_EtherStatsPktsTx65Octetsto127Octets);
 
 	if (sblk->stat_EtherStatsPktsTx128Octetsto255Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsTx128Octetsto255Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsTx128Octetsto255Octets\n",
 			sblk->stat_EtherStatsPktsTx128Octetsto255Octets);
 
 	if (sblk->stat_EtherStatsPktsTx256Octetsto511Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsTx256Octetsto511Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsTx256Octetsto511Octets\n",
 			sblk->stat_EtherStatsPktsTx256Octetsto511Octets);
 
 	if (sblk->stat_EtherStatsPktsTx512Octetsto1023Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsTx512Octetsto1023Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsTx512Octetsto1023Octets\n",
 			sblk->stat_EtherStatsPktsTx512Octetsto1023Octets);
 
 	if (sblk->stat_EtherStatsPktsTx1024Octetsto1522Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsTx1024Octetsto1522Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsTx1024Octetsto1522Octets\n",
 			sblk->stat_EtherStatsPktsTx1024Octetsto1522Octets);
 
 	if (sblk->stat_EtherStatsPktsTx1523Octetsto9022Octets)
-		BCE_PRINTF(sc, "0x%08X : EtherStatsPktsTx1523Octetsto9022Octets\n",
+		BCE_PRINTF("0x%08X : EtherStatsPktsTx1523Octetsto9022Octets\n",
 			sblk->stat_EtherStatsPktsTx1523Octetsto9022Octets);
 
 	if (sblk->stat_XonPauseFramesReceived)
-		BCE_PRINTF(sc, "0x%08X : XonPauseFramesReceived\n",
+		BCE_PRINTF("0x%08X : XonPauseFramesReceived\n",
 			sblk->stat_XonPauseFramesReceived);
 
 	if (sblk->stat_XoffPauseFramesReceived)
-	   BCE_PRINTF(sc, "0x%08X : XoffPauseFramesReceived\n",
+	   BCE_PRINTF("0x%08X : XoffPauseFramesReceived\n",
 			sblk->stat_XoffPauseFramesReceived);
 
 	if (sblk->stat_OutXonSent)
-		BCE_PRINTF(sc, "0x%08X : OutXonSent\n",
+		BCE_PRINTF("0x%08X : OutXonSent\n",
 			sblk->stat_OutXonSent);
 
 	if (sblk->stat_OutXoffSent)
-		BCE_PRINTF(sc, "0x%08X : OutXoffSent\n",
+		BCE_PRINTF("0x%08X : OutXoffSent\n",
 			sblk->stat_OutXoffSent);
 
 	if (sblk->stat_FlowControlDone)
-		BCE_PRINTF(sc, "0x%08X : FlowControlDone\n",
+		BCE_PRINTF("0x%08X : FlowControlDone\n",
 			sblk->stat_FlowControlDone);
 
 	if (sblk->stat_MacControlFramesReceived)
-		BCE_PRINTF(sc, "0x%08X : MacControlFramesReceived\n",
+		BCE_PRINTF("0x%08X : MacControlFramesReceived\n",
 			sblk->stat_MacControlFramesReceived);
 
 	if (sblk->stat_XoffStateEntered)
-		BCE_PRINTF(sc, "0x%08X : XoffStateEntered\n",
+		BCE_PRINTF("0x%08X : XoffStateEntered\n",
 			sblk->stat_XoffStateEntered);
 
 	if (sblk->stat_IfInFramesL2FilterDiscards)
-		BCE_PRINTF(sc, "0x%08X : IfInFramesL2FilterDiscards\n",
+		BCE_PRINTF("0x%08X : IfInFramesL2FilterDiscards\n",
 			sblk->stat_IfInFramesL2FilterDiscards);
 
 	if (sblk->stat_IfInRuleCheckerDiscards)
-		BCE_PRINTF(sc, "0x%08X : IfInRuleCheckerDiscards\n",
+		BCE_PRINTF("0x%08X : IfInRuleCheckerDiscards\n",
 			sblk->stat_IfInRuleCheckerDiscards);
 
 	if (sblk->stat_IfInFTQDiscards)
-		BCE_PRINTF(sc, "0x%08X : IfInFTQDiscards\n",
+		BCE_PRINTF("0x%08X : IfInFTQDiscards\n",
 			sblk->stat_IfInFTQDiscards);
 
 	if (sblk->stat_IfInMBUFDiscards)
-		BCE_PRINTF(sc, "0x%08X : IfInMBUFDiscards\n",
+		BCE_PRINTF("0x%08X : IfInMBUFDiscards\n",
 			sblk->stat_IfInMBUFDiscards);
 
 	if (sblk->stat_IfInRuleCheckerP4Hit)
-		BCE_PRINTF(sc, "0x%08X : IfInRuleCheckerP4Hit\n",
+		BCE_PRINTF("0x%08X : IfInRuleCheckerP4Hit\n",
 			sblk->stat_IfInRuleCheckerP4Hit);
 
 	if (sblk->stat_CatchupInRuleCheckerDiscards)
-		BCE_PRINTF(sc, "0x%08X : CatchupInRuleCheckerDiscards\n",
+		BCE_PRINTF("0x%08X : CatchupInRuleCheckerDiscards\n",
 			sblk->stat_CatchupInRuleCheckerDiscards);
 
 	if (sblk->stat_CatchupInFTQDiscards)
-		BCE_PRINTF(sc, "0x%08X : CatchupInFTQDiscards\n",
+		BCE_PRINTF("0x%08X : CatchupInFTQDiscards\n",
 			sblk->stat_CatchupInFTQDiscards);
 
 	if (sblk->stat_CatchupInMBUFDiscards)
-		BCE_PRINTF(sc, "0x%08X : CatchupInMBUFDiscards\n",
+		BCE_PRINTF("0x%08X : CatchupInMBUFDiscards\n",
 			sblk->stat_CatchupInMBUFDiscards);
 
 	if (sblk->stat_CatchupInRuleCheckerP4Hit)
-		BCE_PRINTF(sc, "0x%08X : CatchupInRuleCheckerP4Hit\n",
+		BCE_PRINTF("0x%08X : CatchupInRuleCheckerP4Hit\n",
 			sblk->stat_CatchupInRuleCheckerP4Hit);
 
-	BCE_PRINTF(sc,
-		"-----------------------------"
-		"--------------"
-		"-----------------------------\n");
+	BCE_PRINTF(
+		"----------------------------"
+		"----------------"
+		"----------------------------\n");
 }
 
 
+/****************************************************************************/
+/* Prints out a summary of the driver state.                                */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_driver_state(struct bce_softc *sc)
 {
 	u32 val_hi, val_lo;
 
-	BCE_PRINTF(sc,
-		"-----------------------------"
-		" Driver State "
-		"-----------------------------\n");
+	BCE_PRINTF(
+		"----------------------------"
+		"  Driver State  "
+		"----------------------------\n");
 
 	val_hi = BCE_ADDR_HI(sc);
 	val_lo = BCE_ADDR_LO(sc);
-	BCE_PRINTF(sc, "0x%08X:%08X - (sc) driver softc structure virtual address\n",
+	BCE_PRINTF("0x%08X:%08X - (sc) driver softc structure virtual address\n",
 		val_hi, val_lo);
 
 	val_hi = BCE_ADDR_HI(sc->bce_vhandle);
 	val_lo = BCE_ADDR_LO(sc->bce_vhandle);
-	BCE_PRINTF(sc, "0x%08X:%08X - (sc->bce_vhandle) PCI BAR virtual address\n",
+	BCE_PRINTF("0x%08X:%08X - (sc->bce_vhandle) PCI BAR virtual address\n",
 		val_hi, val_lo);
 
 	val_hi = BCE_ADDR_HI(sc->status_block);
 	val_lo = BCE_ADDR_LO(sc->status_block);
-	BCE_PRINTF(sc, "0x%08X:%08X - (sc->status_block) status block virtual address\n",
+	BCE_PRINTF(
+		"0x%08X:%08X - (sc->status_block) status block virtual address\n",
 		val_hi, val_lo);
 
 	val_hi = BCE_ADDR_HI(sc->stats_block);
 	val_lo = BCE_ADDR_LO(sc->stats_block);
-	BCE_PRINTF(sc, "0x%08X:%08X - (sc->stats_block) statistics block virtual address\n",
+	BCE_PRINTF(
+		"0x%08X:%08X - (sc->stats_block) statistics block virtual address\n",
 		val_hi, val_lo);
 
 	val_hi = BCE_ADDR_HI(sc->tx_bd_chain);
 	val_lo = BCE_ADDR_LO(sc->tx_bd_chain);
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"0x%08X:%08X - (sc->tx_bd_chain) tx_bd chain virtual adddress\n",
 		val_hi, val_lo);
 
 	val_hi = BCE_ADDR_HI(sc->rx_bd_chain);
 	val_lo = BCE_ADDR_LO(sc->rx_bd_chain);
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"0x%08X:%08X - (sc->rx_bd_chain) rx_bd chain virtual address\n",
 		val_hi, val_lo);
 
 	val_hi = BCE_ADDR_HI(sc->tx_mbuf_ptr);
 	val_lo = BCE_ADDR_LO(sc->tx_mbuf_ptr);
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"0x%08X:%08X - (sc->tx_mbuf_ptr) tx mbuf chain virtual address\n",
 		val_hi, val_lo);
 
 	val_hi = BCE_ADDR_HI(sc->rx_mbuf_ptr);
 	val_lo = BCE_ADDR_LO(sc->rx_mbuf_ptr);
-	BCE_PRINTF(sc, 
+	BCE_PRINTF(
 		"0x%08X:%08X - (sc->rx_mbuf_ptr) rx mbuf chain virtual address\n",
 		val_hi, val_lo);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->interrupts_generated) h/w intrs\n",
+	BCE_PRINTF("         0x%08X - (sc->interrupts_generated) h/w intrs\n",
 		sc->interrupts_generated);
 	
-	BCE_PRINTF(sc, "         0x%08X - (sc->rx_interrupts) rx interrupts handled\n",
+	BCE_PRINTF("         0x%08X - (sc->rx_interrupts) rx interrupts handled\n",
 		sc->rx_interrupts);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->tx_interrupts) tx interrupts handled\n",
+	BCE_PRINTF("         0x%08X - (sc->tx_interrupts) tx interrupts handled\n",
 		sc->tx_interrupts);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->last_status_idx) status block index\n",
+	BCE_PRINTF("         0x%08X - (sc->last_status_idx) status block index\n",
 		sc->last_status_idx);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->tx_prod) tx producer index\n",
+	BCE_PRINTF("         0x%08X - (sc->tx_prod) tx producer index\n",
 		sc->tx_prod);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->tx_cons) tx consumer index\n",
+	BCE_PRINTF("         0x%08X - (sc->tx_cons) tx consumer index\n",
 		sc->tx_cons);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->tx_prod_bseq) tx producer bseq index\n",
+	BCE_PRINTF("         0x%08X - (sc->tx_prod_bseq) tx producer bseq index\n",
 		sc->tx_prod_bseq);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->rx_prod) rx producer index\n",
+	BCE_PRINTF("         0x%08X - (sc->rx_prod) rx producer index\n",
 		sc->rx_prod);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->rx_cons) rx consumer index\n",
+	BCE_PRINTF("         0x%08X - (sc->rx_cons) rx consumer index\n",
 		sc->rx_cons);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->rx_prod_bseq) rx producer bseq index\n",
+	BCE_PRINTF("         0x%08X - (sc->rx_prod_bseq) rx producer bseq index\n",
 		sc->rx_prod_bseq);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->rx_mbuf_alloc) rx mbufs allocated\n",
+	BCE_PRINTF("         0x%08X - (sc->rx_mbuf_alloc) rx mbufs allocated\n",
 		sc->rx_mbuf_alloc);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->free_rx_bd) free rx_bd's\n",
+	BCE_PRINTF("         0x%08X - (sc->free_rx_bd) free rx_bd's\n",
 		sc->free_rx_bd);
 
-	BCE_PRINTF(sc, "0x%08X/%08X - (sc->rx_low_watermark) rx low watermark\n",
+	BCE_PRINTF("0x%08X/%08X - (sc->rx_low_watermark) rx low watermark\n",
 		sc->rx_low_watermark, (u32) USABLE_RX_BD);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->txmbuf_alloc) tx mbufs allocated\n",
+	BCE_PRINTF("         0x%08X - (sc->txmbuf_alloc) tx mbufs allocated\n",
 		sc->tx_mbuf_alloc);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->rx_mbuf_alloc) rx mbufs allocated\n",
+	BCE_PRINTF("         0x%08X - (sc->rx_mbuf_alloc) rx mbufs allocated\n",
 		sc->rx_mbuf_alloc);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->used_tx_bd) used tx_bd's\n",
+	BCE_PRINTF("         0x%08X - (sc->used_tx_bd) used tx_bd's\n",
 		sc->used_tx_bd);
 
-	BCE_PRINTF(sc, "0x%08X/%08X - (sc->tx_hi_watermark) tx hi watermark\n",
+	BCE_PRINTF("0x%08X/%08X - (sc->tx_hi_watermark) tx hi watermark\n",
 		sc->tx_hi_watermark, (u32) USABLE_TX_BD);
 
-	BCE_PRINTF(sc, "         0x%08X - (sc->mbuf_alloc_failed) failed mbuf alloc\n",
+	BCE_PRINTF("         0x%08X - (sc->mbuf_alloc_failed) failed mbuf alloc\n",
 		sc->mbuf_alloc_failed);
 
-	BCE_PRINTF(sc,
-		"-----------------------------"
-		"--------------"
-		"-----------------------------\n");
+	BCE_PRINTF(
+		"----------------------------"
+		"----------------"
+		"----------------------------\n");
 }
 
 
+/****************************************************************************/
+/* Prints out the hardware state through a summary of important register,   */
+/* followed by a complete register dump.                                    */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_dump_hw_state(struct bce_softc *sc)
 {
 	u32 val1;
 
-	BCE_PRINTF(sc,
+	BCE_PRINTF(
 		"----------------------------"
 		" Hardware State "
 		"----------------------------\n");
 
-	BCE_PRINTF(sc, "0x%08X : bootcode version\n", sc->bce_fw_ver);
+	BCE_PRINTF("0x%08X : bootcode version\n", sc->bce_fw_ver);
 
 	val1 = REG_RD(sc, BCE_MISC_ENABLE_STATUS_BITS);
-	BCE_PRINTF(sc, "0x%08X : (0x%04X) misc_enable_status_bits\n",
+	BCE_PRINTF("0x%08X : (0x%04X) misc_enable_status_bits\n",
 		val1, BCE_MISC_ENABLE_STATUS_BITS);
 
 	val1 = REG_RD(sc, BCE_DMA_STATUS);
-	BCE_PRINTF(sc, "0x%08X : (0x%04X) dma_status\n", val1, BCE_DMA_STATUS);
+	BCE_PRINTF("0x%08X : (0x%04X) dma_status\n", val1, BCE_DMA_STATUS);
 
 	val1 = REG_RD(sc, BCE_CTX_STATUS);
-	BCE_PRINTF(sc, "0x%08X : (0x%04X) ctx_status\n", val1, BCE_CTX_STATUS);
+	BCE_PRINTF("0x%08X : (0x%04X) ctx_status\n", val1, BCE_CTX_STATUS);
 
 	val1 = REG_RD(sc, BCE_EMAC_STATUS);
-	BCE_PRINTF(sc, "0x%08X : (0x%04X) emac_status\n", val1, BCE_EMAC_STATUS);
+	BCE_PRINTF("0x%08X : (0x%04X) emac_status\n", val1, BCE_EMAC_STATUS);
 
 	val1 = REG_RD(sc, BCE_RPM_STATUS);
-	BCE_PRINTF(sc, "0x%08X : (0x%04X) rpm_status\n", val1, BCE_RPM_STATUS);
+	BCE_PRINTF("0x%08X : (0x%04X) rpm_status\n", val1, BCE_RPM_STATUS);
 
 	val1 = REG_RD(sc, BCE_TBDR_STATUS);
-	BCE_PRINTF(sc, "0x%08X : (0x%04X) tbdr_status\n", val1, BCE_TBDR_STATUS);
+	BCE_PRINTF("0x%08X : (0x%04X) tbdr_status\n", val1, BCE_TBDR_STATUS);
 
 	val1 = REG_RD(sc, BCE_TDMA_STATUS);
-	BCE_PRINTF(sc, "0x%08X : (0x%04X) tdma_status\n", val1, BCE_TDMA_STATUS);
+	BCE_PRINTF("0x%08X : (0x%04X) tdma_status\n", val1, BCE_TDMA_STATUS);
 
 	val1 = REG_RD(sc, BCE_HC_STATUS);
-	BCE_PRINTF(sc, "0x%08X : (0x%04X) hc_status\n", val1, BCE_HC_STATUS);
+	BCE_PRINTF("0x%08X : (0x%04X) hc_status\n", val1, BCE_HC_STATUS);
 
-	BCE_PRINTF(sc, 
+	BCE_PRINTF(
 		"----------------------------"
 		"----------------"
 		"----------------------------\n");
 
-	BCE_PRINTF(sc, 
+	BCE_PRINTF(
 		"----------------------------"
 		" Register  Dump "
 		"----------------------------\n");
 
 	for (int i = 0x400; i < 0x8000; i += 0x10)
-		BCE_PRINTF(sc, "0x%04X: 0x%08X 0x%08X 0x%08X 0x%08X\n",
+		BCE_PRINTF("0x%04X: 0x%08X 0x%08X 0x%08X 0x%08X\n",
 			i, REG_RD(sc, i), REG_RD(sc, i + 0x4),
 			REG_RD(sc, i + 0x8), REG_RD(sc, i + 0xC));
 
-	BCE_PRINTF(sc, 
+	BCE_PRINTF(
 		"----------------------------"
 		"----------------"
 		"----------------------------\n");
 }
 
 
+/****************************************************************************/
+/* Prints out the driver state and then enters the debugger.                */
+/*                                                                          */
+/* Returns:                                                                 */
+/*   Nothing.                                                               */
+/****************************************************************************/
 static void
 bce_breakpoint(struct bce_softc *sc)
 {
@@ -6786,7 +6985,6 @@
 	}
 
 	bce_dump_driver_state(sc);
-	/* Print the important status block fields. */
 	bce_dump_status_block(sc);
 
 	/* Call the debugger. */
Index: if_bcereg.h
===================================================================
--- if_bcereg.h	(.../trunk/6_2/sys/dev/bce)	(revision 55)
+++ if_bcereg.h	(.../branches/mintel_6_2/sys/dev/bce)	(revision 55)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2006 Broadcom Corporation
+ * Copyright (c) 2006-2007 Broadcom Corporation
  *	David Christensen <davidch@broadcom.com>.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.1.2.3.2.1 2006/11/28 17:14:07 scottl Exp $
+ * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.1.2.6 2007/06/05 01:56:08 davidch Exp $
  */
 
 #ifndef	_BCE_H_DEFINED
@@ -97,6 +97,7 @@
 /****************************************************************************/
 /* Debugging macros and definitions.                                        */
 /****************************************************************************/
+#define BCE_DEBUG 1
 #define BCE_CP_LOAD 			0x00000001
 #define BCE_CP_SEND		 		0x00000002
 #define BCE_CP_RECV				0x00000004
@@ -248,9 +249,11 @@
 #define BCE_CHIP_ID_5706_A0			0x57060000
 #define BCE_CHIP_ID_5706_A1			0x57060010
 #define BCE_CHIP_ID_5706_A2			0x57060020
+#define BCE_CHIP_ID_5706_A3			0x57060030
 #define BCE_CHIP_ID_5708_A0			0x57080000
 #define BCE_CHIP_ID_5708_B0			0x57081000
 #define BCE_CHIP_ID_5708_B1			0x57081010
+#define BCE_CHIP_ID_5708_B2			0x57081020
 
 #define BCE_CHIP_BOND_ID(sc)		(((sc)->bce_chipid) & 0xf)
 
@@ -689,7 +692,7 @@
 /****************************************************************************/
 /* Convenience definitions.                                                 */
 /****************************************************************************/
-#define BCE_PRINTF(sc, fmt, args...)	device_printf(sc->bce_dev, fmt, ##args)
+#define BCE_PRINTF(fmt, args...)	device_printf(sc->bce_dev, fmt, ##args)
 
 #define	BCE_LOCK_INIT(_sc, _name)	mtx_init(&(_sc)->bce_mtx, _name, MTX_NETWORK_LOCK, MTX_DEF)
 #define	BCE_LOCK(_sc)				mtx_lock(&(_sc)->bce_mtx)
@@ -4755,6 +4758,8 @@
 	int					bce_link;
 	struct callout		bce_stat_ch;
 
+	int watchdog_timer;			/* ticks until chip reset */
+
 	/* Frame size and mbuf allocation size for RX frames. */
 	u32					max_frame_size;
 	int					mbuf_alloc_size;
@@ -4871,6 +4876,8 @@
 	u32 stat_CatchupInMBUFDiscards;
 	u32 stat_CatchupInRuleCheckerP4Hit;
 
+	/* Provides access to certain firmware statistics. */
+	u32 com_no_buffers;
 #ifdef BCE_DEBUG
 	/* Track the number of enqueued mbufs. */
 	int	tx_mbuf_alloc;

--------------030907020009000402030006--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4684D5C0.3040709>