[ofa-general] Re: socket buffer accounting with UDP/ipoib
Michael S. Tsirkin
mst at dev.mellanox.co.il
Thu Jul 19 09:18:20 PDT 2007
> Quoting Roland Dreier <rdreier at cisco.com>:
> Subject: Re: socket buffer accounting with UDP/ipoib
>
> > > + ib_dma_sync_single_for_cpu(priv->ca, addr, IPOIB_BUF_SIZE,
> > > + DMA_FROM_DEVICE);
> > > + skb_copy_from_linear_data_offset(skb, IB_GRH_BYTES, new_skb->data,
> > > + wc->byte_len - IB_GRH_BYTES);
> > > + ib_dma_sync_single_for_device(priv->ca, addr, IPOIB_BUF_SIZE,
> > > + DMA_FROM_DEVICE);
> >
> > BTW, why is ib_dma_sync_single_for_device necessary here?
>
> Not sure what you're asking exactly. The sync for device is needed to
> match the previous sync for the cpu obviously.
That's what I'm missing: must each sync_for_cpu be paired
with sync_for_device? Is there documentation for this somewhere?
> We need both syncs for
> the same reason we need the unmap when we don't copy -- we're copying
> data out of the skb we gave to the device earlier, so we need to make
> sure the cpu sees the right data.
Right, but device never reads the buffer, and CPU never modifies it.
--
MST
More information about the general
mailing list