XDP: Make RX packet-pages writable

Jesper Dangaard Brouer

It is a fundamental requirement that the RX pages (handed over to XDP)
are writable. This is usually _not_ the case in NIC drivers. Thus,
the current XDP prove-of-concept code violates the DMA API.

(Why: NIC driver work-around a performance problem in the page
allocator (and DMA API), by allocating a larger page size and
subdividing this page. DMA unmapping when last RX page-frag is
seen. This is partigular problematic for page recycling, as recycling
a page-fragment would violate this unmap ordering)

My proposal, to make RX pages writable, is to keep the pages DMA
mapped and recycle them. I call this the page-pool:

My proposal is multi fold:
1) is makes the RX pages writable.
2) it makes page (order-0) access faster.
3) it moves the DMA map/unmap cost to setup time

For the single-legged load balancing router scenario, I think we can
come up with a local driver hack, until I have my solution ready. Just
so you don't stall on my page-pool work.

Alexei proposed "just" using the DMA direction "DMA_BIDIRECTIONAL".
But I don't see how this solves the problem. (A) DMA-API-HOWTO.txt
states that this mode maybe slower performance wise. (B) It does not
solve the problem of page allocator is too slow for our use-case.
(C) It does not help (making RX pages writable) for normal network stack.

Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
Author of http://www.iptv-analyzer.org
LinkedIn: http://www.linkedin.com/in/brouer