tun: dma engine support
Subsystems (5)
RFC PATCH 1/1 tun: dma engine support
Simple hack to use dma engine for tun RX.
Only one skb in flight at the moment.
---
I am still looking at handling multiple skbs, but sending this out for early flames and improvement suggestions.
Loopback testing seems to show only minor performance gains:
this is not really suprising as data is hot in cache already. Where I would expect this to help more is with incoming traffic from an external NIC. This still needs to be tested.
drivers/dma/Kconfig | 2 +- drivers/dma/iovlock.c | 2 +- drivers/net/tun.c | 389 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 390 insertions(+), 3 deletions(-)
drivers/dma/Kconfig +1 -1
@@ -202,7 +202,7 @@ comment "DMA Clients" depends on DMA_ENGINE config NET_DMA - bool "Network: TCP receive copy offload" + bool "Network: TCP/TUN receive copy offload" depends on DMA_ENGINE && NET default (INTEL_IOATDMA || FSL_DMA) help
drivers/dma/iovlock.c +1 -1
@@ -138,7 +138,7 @@ void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list)kfree (pinned_list); } - +EXPORT_SYMBOL_GPL (dma_unpin_iovec_pages);/* * We have already pinned down the pages we will be using in the iovecs.
drivers/net/tun.c +388 -1
420 lines not on this page · raw message
Signature · 1 line
1.7.3-rc1
[ added Maciej ]
Quoted 6 lines · Michael S. Tsirkin
Simple hack to use dma engine for tun RX.
Only one skb in flight at the moment.Signed-off-by Michael S. Tsirkin <[email protected]>---
Quoted 7 lines
I am still looking at handling multiple skbs, but sending this out for early flames and improvement suggestions.
Loopback testing seems to show only minor performance gains:
this is not really suprising as data is hot in cache already. Where I would expect this to help more is with incoming traffic from an external NIC. This still needs to be tested.
Actually it is interesting that you did not see a performance loss because the dma performs the transfer in memory so the destination will be cache cold in the dma case compared to a cpu copy.
[..]
drivers/net/tun.c line 76
Quoted 2 lines
drivers/net/tun.c +2
-0+int tun_dma_copybreak =0x10000 ; +module_param_named (dma_copybreak, tun_dma_copybreak, int,0644 );
What platform are you using for testing? If this proves beneficial we may need to adjust this value to have a platform specific default, similar to how ioatdma sets tcp_dma_copybreak depending on the hardware version. You will notice that on Nehalem class hardware (drivers/dma/ioat/dma_v3.c) the default is set to 256K effectively disabling offload as the overhead of managing the dma engine overshadows any offload advantage.
--
Dan