CVS commit: [netbsd-4] src/sys/dev/pci

Module Name: src
Committed By: pavel
Date: Fri Apr 20 21:56:00 UTC 2007
Modified Files:
src/sys/dev/pci [netbsd-4]: if_bnx.c if_bnxreg.h
Log Message:
Pull up following revision(s) (requested by bouyer in ticket #566):
sys/dev/pci/if_bnx.c: revision 1.4
sys/dev/pci/if_bnx.c: revision 1.5
sys/dev/pci/if_bnx.c: revision 1.6
sys/dev/pci/if_bnxreg.h: revision 1.2
Protect bnx_tick() with splnet.
Bring in fixes and improvements from OpenBSD:
revision 1.25
- Simplify the arguments to bnx_tx_encap.
- Don't copy the bd_chain head pointers into temporary objects, they are
available globally.
>From scottl@FreeBSD
revision 1.26
Overhaul the transmit path:
- Eliminate the bnx_dmamap_arg structure.
- Refactor the loop that fills the buffer descriptor so that it can be done
with a single set of logic in a single loop instead of two sets of logic.
- Eliminate the need to cache and pass descriptor indexes between the start
loop and the encap function.
- Change the start loop to always check the ifnet sendq for more work.
>From scottl@FreeBSD
revision 1.27
make the exit label naming scheme match the current function names, removes
a FreeBSD-ism from the original driver.
revision 1.28 -> 1.30
- Ensure that at least 16 TX descriptors are kept unused in the ring.
- Use more complete error handling for TX load problems.
>From scottl@FreeBSD
revision 1.31
replace a few more instances of hand rolled code with the LIST_FOREACH macro.
revision 1.33
In bnx_start, check the used_tx_bd count rather than the descriptors
mbuf pointer to see if the transmit ring is full. The mbuf pointer
is set only in the last descriptor of a multi-descriptor packet.
By relying on the mbuf pointers of the earlier descriptors, the
driver would sometimes overwrite a descriptor belonging to a
packet that wasn't completed yet. Also, tx_chain_prod wasn't
updated inside the loop, causing the wrong descriptor to be checked
after the first iteration. The upshot of all this was the loss of
some transmitted packets at medium to high packet rates.
In bnx_tx_encap, remove a couple of old statements that shuffled
around the tx_mbuf_map pointers. These now correspond 1-to-1 with
the transmit descriptors, and they are not supposed to be changed.
Correct a couple of inaccurate comments.
>From jdp@FreeBSD
revision 1.43
Allow the bnx(4) driver to make use of all of the available hardware
multicast hash slots. The bnx(4) hardware supports 8 slots instead of
4 like the bge(4) hardware.
>From Mike Karels via FreeBSD
Tested by Brad, biorn@ and Johan M:son Lindman
RX buffers are malloced memory of 9216 bytes. This can require from 1 to
4 DMA memory segments, depending on how the buffer is in memory.
When receiving a packet, we allocate a new one to remplace the one we've
used. It can need more segments than the one it remplace, leading to
corrution of the RX descriptors, and a panic in bus_dmamap_sync() (DIAGNOSTIC
kernels) or possibly memory corruption.
Fix:
- bnx_get_buf() allocates as many buffer as possible, checking the number
of free RX descriptors. Because one receive buffer is not guaranteed to
be remplaced on receive, call bnx_get_buf() from bnx_tick() too.
This also improve error handling from bnx_get_buf().
- use MCLGET() instead of MEXTMALLOC() if we're running with the standard
ethernet MTU. This gives us more receive buffers and waste less memory.
Fix build on 32bit ports; should fix GENERIC_DIAGNOSTIC build problem reported
by Hisashi T Fujinaka on current-users.
To generate a diff of this commit:
cvs rdiff -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/if_bnx.c
cvs rdiff -r1.1.4.1 -r1.1.4.2 src/sys/dev/pci/if_bnxreg.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.