Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-22 Thread Bill Paul
> >Maybe, but bus_dmamap_load() only lets you map one buffer at a time. > >I want to map a bunch of little buffers, and the API doesn't let me > >do that. And I don't want to change the API, because that would mean > >modifying busdma_machdep.c on each platform, which is a hell that I > >would ra

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-22 Thread Justin T. Gibbs
> >> The fact that the data is less than a page in size matters little >> to the bus dma concept. In other words, how is this packet presented >> to the hardware? Does it care that all of the component pieces are >> < PAGE_SIZE in length? Probably not. It just wants the list of >> address/leng

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-22 Thread Bill Paul
> The fact that the data is less than a page in size matters little > to the bus dma concept. In other words, how is this packet presented > to the hardware? Does it care that all of the component pieces are > < PAGE_SIZE in length? Probably not. It just wants the list of > address/length pai

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-22 Thread Justin T. Gibbs
>> >My understanding is that you need a dmamap for every buffer that you want >> >to map into bus space. >> >> You need one dmamap for each independantly manageable mapping. A >> single mapping may result in a long list of segments, regardless >> of whether you have a single KVA buffer or multip

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-22 Thread Bill Paul
> >My understanding is that you need a dmamap for every buffer that you want > >to map into bus space. > > You need one dmamap for each independantly manageable mapping. A > single mapping may result in a long list of segments, regardless > of whether you have a single KVA buffer or multiple KVA

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-20 Thread Justin T. Gibbs
> >Correction. > >This sample: >> >> if (bus_dma_tag_create(pci->parent_dmat, PAGE_SIZE, lim, >> BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, len, 1, >> BUS_SPACE_MAXSIZE_32BIT, 0, &pci->cntrol_dmat) != 0) { >> isp_prt(isp, ISP_LOGERR, >>

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-20 Thread Justin T. Gibbs
>Every hear the phrase "you get what you pay for?" The API isn't all that >clear, and we don't have a man page or document that describes in detail >how to use it properly. Rather than whining about that, I decided to >tinker with it and Use The Source, Luke (tm). This is the result. Fair enough.

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-20 Thread Matthew Jacob
Correction. This sample: > > if (bus_dma_tag_create(pci->parent_dmat, PAGE_SIZE, lim, > BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, len, 1, > BUS_SPACE_MAXSIZE_32BIT, 0, &pci->cntrol_dmat) != 0) { > isp_prt(isp, ISP_LOGERR, >

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-20 Thread Matthew Jacob
On Mon, 20 Aug 2001, Bill Paul wrote: > Every hear the phrase "you get what you pay for?" The API isn't all that > clear, and we don't have a man page or document that describes in detail > how to use it properly. Rather than whining about that, I decided to > tinker with it and Use The Source,

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-20 Thread Bill Paul
> > Another thing- maybe I'm confused- but I still don't see why you want to > require the creating of a map each time you want to load an mbuf > chain. Wouldn't it be better and more efficient to let the driver decide when > and where the map is created and just use the common code for loads/unl

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-20 Thread Matthew Jacob
Another thing- maybe I'm confused- but I still don't see why you want to require the creating of a map each time you want to load an mbuf chain. Wouldn't it be better and more efficient to let the driver decide when and where the map is created and just use the common code for loads/unloads? On

Re: Where to put new bus_dmamap_load_mbuf() code

2001-08-20 Thread Matthew Jacob
Yay! The current suggestion is fine except that each platform might have a more efficient, or even required, actual h/w mechanism for mapping mbufs. I'd also be a little concerned with the way you're overloading stuff into mbuf itself- but I'm a little shakier on this. Finally- why not make th

Where to put new bus_dmamap_load_mbuf() code

2001-08-20 Thread Bill Paul
Okay, I decided today to write a bus_dmamap_load_mbuf() routine to make it a little easier to convert the PCI NIC drivers to use the busdma API. It's not the same as the NetBSD code. There are four new functions: bus_dmamap_load_mbuf() bus_dmamap_unload_mbuf() bus_dmamap_sync_mbuf() bus_dmamap_de