Subject: Re: CVS commit: src/sys/dev/pci
To: None <bouyer@netbsd.org>
From: Matt Thomas <matt@3am-software.com>
List: source-changes
Date: 04/09/2007 14:00:25
Manuel Bouyer wrote:
> Module Name:	src
> Committed By:	bouyer
> Date:		Mon Apr  9 19:34:51 UTC 2007
> 
> Modified Files:
> 	src/sys/dev/pci: if_bnx.c
> 
> Log Message:
> 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.

mbuf.h support alternatively-sized cluster mbufs.  You might consider adding
a 9216 length cluster bucket.