On Sat, 2010-10-23 at 12:47 +0200, Bart Van Assche wrote: > On Mon, Oct 18, 2010 at 3:10 PM, David Dillow <[email protected]> wrote: > > > > [ ... ] > > While looking at this, I noticed that we didn't do any syncs in > > srp_send_tsk_mgmt(), so I've pushed this patch for now. We can remove > > the *_sync_for_cpu() calls later if it turns out we really don't need > > them. > > [ ... ] > > + ib_dma_sync_single_for_cpu(dev, iu->dma, sizeof *tsk_mgmt, > > + DMA_TO_DEVICE); > > Hello Dave, > > Sorry for the late comment, but I just noticed that the above code > performs a partial buffer synchronization. If I remember correctly, > the DMA API doesn't allow this and the "size" argument must match the > size argument passed to the corresponding ib_dma_map_single() call, > that is, target->max_ti_iu_len ?
One only needs to sync the part of the buffer that is going to be touched/was tocuhed; it doesn't have to match the map call like the unmap call does. This is pretty common in the network stack -- as is the sync_for_cpu/sync_for_device question -- it is common in the drivers to only sync the length of the packet in the buffer. It's a bit of a cargo cultish argument I suppose, but we've not received a response about it on LKML, so I continued to check the existing uses for guidance. I really wish I could pin down my recollection of the discussion, though. I'd like to understand the reasoning, as your comment about not needing the sync_for_cpu makes a lot of sense intuitively. -- Dave Dillow National Center for Computational Science Oak Ridge National Laboratory (865) 241-6602 office -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
