Subject: Re: bus_dmamap_load: struct proc *p: finding process p
To: Sam Thigpen <sthigpen@sdf.lonestar.org>
From: Jachym Holecek <freza@liberouter.org>
List: tech-kern
Date: 10/04/2004 21:35:24
Hello,

> >In this case, bus_dmamap_load operates on the Tx/Rx descriptor rings.
> >The rings are shared between the kernel and the adapter; they are not
> >shared with userland.
> 
> for FreeBSD acx(100)() the rx/tx (tx here) loads as:
> 
> [...]
> 
> the FreeBSD callback is acx_packet_map_addr -- but I'm assuming NULL for 
> NetBSD in this case as well..
> 
> ath.c uses the same rx/tx descriptor, so for NetBSD acx(100)():
> 
> error = bus_dmamap_load(sc->sc_dmat, sc->sc_ddmamap,
>                         sc->sc_desc, sc->sc_desc_len,
>                         NULL, &sc->sc_desc_paddr,
>                      // ^^^^ assuming this is not shared with userland

Minor clarification: even in this situation, you could still share those
pages with userland if you needed to. What matters to bus_dmamap_load()
is "in whose address space does the buf live" - since it's capable of
mapping both kernel and user memory. So, if that memory comes from
bus_dmamem_alloc(), then it's kernel --> NULL proc pointer.

	Regards,
		-- Jachym Holecek