Subject: Re: bus_dmamap_sync() in ti(4) or the lack thereof
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Tobias Nygren <tnn+nbsd@nygren.pp.se>
List: tech-kern
Date: 03/02/2007 23:41:25
Izumi Tsutsui wrote:
> tnn+nbsd@nygren.pp.se wrote:
>
>   
>> For what it's worth, this patch fixes the problems I had.
>>     
>
> PREREAD sync calls are required after new mbufs are allocated,
> not where dmamaps are reused, I think.
>
> On POSTREAD sync ops, you can use cur_rx->ti_len for sync length
> to avoid unneeded (possible) cache flush ops (or copy from
> bounce buffer) for small packets.
>
> BTW, we should also have more TI_CD*SYNC() and TI_CE*SYNC()
> calls where DMA descriptor is accessed.
>
>   
>> I'm not sure what to do about the jumbo case, because it uses a single
>> dmamap for all descriptors.
>>     
>
> With a quick glance, ti(4) allocates its own buffer and uses
> MEXTADD(9) for jumbo frames so we don't have to call
> bus_dmamap_load() and bus_dmamap_unload() for each xfers,
> though bus_dmamap_sync() ops are required like this
> (probably we should have some proper macro):
> ---
> 	bus_dmamap_sync(sc->sc_dmat, sc->jumbo_dmamap,
> 	    mtod(m_new, char *) - (char *)sc->ti_cdata.ti_jumbo_buf,
> 	    TI_JLEN, BUS_DMASYNC_PREREAD);
> ---
> Izumi Tsutsui
>   

Yeah, I've noticed it still doesn't work right. It's gone from 
non-functional
to usable, but tcpdump still shows bogus packets with invalid checksums
and performance is bad.

I'll try the changes you suggested.

-Tobias