Subject: Re: [PATCH net-next] xsk: introduce xsk_dma_ops

From: Jakub Kicinski <[email-masked]>
Date: Mon, 17 Apr 2023 18:19:50 -0700

On Tue, 18 Apr 2023 09:07:30 +0800 Jason Wang wrote:
> > > Would you mind explaining this a bit more to folks like me who are not
> > > familiar with VirtIO?  DMA API is supposed to hide the DMA mapping
> > > details from the stack, why is it not sufficient here.  
> 
> The reason is that legacy virtio device don't use DMA(vring_use_dma_api()).
> 
> The AF_XDP assumes DMA for netdev doesn't work in this case. We need a
> way to make it work.

Can we not push this down to be bus level? virtio has its own bus it
can plug in whatever magic it wants into dma ops.

Doesn't have to be super fast for af_xdp's sake - for af_xdp dma mapping
is on the control path. You can keep using the if (vring_use_dma_api())
elsewhere for now if there is a perf concern.

Otherwise it really seems like we're bubbling up a virtio hack into
generic code :(