tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: rbuf starvation in the iwn driver
On Wed April 7 2010 17:18:35 Thor Lancelot Simon wrote:
> On Wed, Apr 07, 2010 at 04:38:37PM -0600, Sverre Froyen wrote:
> > On Wed April 7 2010 15:54:49 Thor Lancelot Simon wrote:
> > > Doesn't this memory need to be dma-safe?
> >
> > It does. I assume it needs to be contiguous and properly aligned, which
> > malloc(9) seems to imply. Does it also need to be wired? I notice that
> > the malloc man page says it's deprecated and to use pool_cache(9) or
> > kmem(9) instead. kmem provides wired memory.
>
> If you want memory you can DMA to/from, I think you need to use
> bus_dmamem_alloc().
Yes, reading the man page for bus_dmamap_load etc. I see that is required. Is
this a requirement for NetBSD but not for OpenBSD? Look at this code fragment
from the OpenBSD iwn driver:
data->m = MCLGETI(NULL, M_DONTWAIT, NULL, IWN_RBUF_SIZE);
if (data->m == NULL) {
printf("%s: could not allocate RX mbuf\n",
sc->sc_dev.dv_xname);
error = ENOBUFS;
goto fail;
}
error = bus_dmamap_load(sc->sc_dmat, data->map,
mtod(data->m, void *), IWN_RBUF_SIZE, NULL,
BUS_DMA_NOWAIT | BUS_DMA_READ);
MCLGETI returns an mbuf cluster where the mbuf data buffer is allocated like
this (from uipc_mbuf.c):
data->m->m_ext.ext_buf = pool_get(&mclpools[pi],
how == M_WAIT ? PR_WAITOK : 0);
This seems to imply that, at least for OpenBSD, pool_get returns an address
that can be used by bus_dmamap_load etc.
I am probably missing something.
Thanks,
Sverre
Home |
Main Index |
Thread Index |
Old Index