[...]On 03/08/2023 05.58, Wei Fang wrote:
To Jakub, using 0 here you are trying to bypass the DMA-sync (which is valid} else {If you implement Jesper's syncing suggestions, I think you can use
- xdp_return_frame(xdpf);
+ xdp_return_frame_rx_napi(xdpf);
page_pool_put_page(pool, page, 0, true);
as driver knows XDP_TX have already done the sync).
The code will still call into DMA-sync calls with zero as size, so wonder if we
should detect size zero and skip that call?
(I mean is this something page_pool should support.)
Maybe, I just tested once before. So I test several times again, the
The optimization will only have effect on those devices which havefor XDP_TX here to avoid the DMA sync on page recycle.I tried Jasper's syncing suggestion and used page_pool_put_page() to
recycle pages, but the results does not seem to improve the
performance of XDP_TX,
dev->dma_coherent=false else DMA function [1] (e.g.
dma_direct_sync_single_for_device) will skip the sync calls.
[1] https://elixir.bootlin.com/linux/v6.5-rc4/source/kernel/dma/direct.h#L63
(Cc. Andrew Lunn)
Does any of the imx generations have dma-noncoherent memory?
And does any of these use the fec NIC driver?
it even degrades the speed.
Could be low runs simply be a variation between your test runs?
results of the two methods do not seem to be much different so far,
both about 255000 pkt/s.
The specific device (imx8mpevk) this was tested on, clearly haveThe FEC of i.MX8MP-EVK has dma_coherent=false, and as I mentioned
dma_coherent=true, or else we would have seen a difference.
But the code change should not have any overhead for the
dma_coherent=true case, the only extra overhead is the extra empty DMA
sync call with size zero (as discussed in top).
above, I did not see an obvious difference in the performance. :(
The test environment is slightly different, in patch-1, the FEC port wasThe result of the current modification.
root@imx8mpevk:~# ./xdp2 eth0
proto 17: 260180 pkt/s
These results are*significantly* better than reported in patch-1.
What happened?!?
directly connected to the port of another board. But in the latest test,
the ports of the two boards were connected to a switch, so the ports of
the two boards are not directly connected.
[...]e.g.
root@imx8mpevk:~# ./xdp2 eth0
proto 17: 135817 pkt/s
proto 17: 142776 pkt/s
proto 17: 260373 pkt/s
proto 17: 260363 pkt/s
proto 17: 259036 pkt/s
After using the sync suggestion, the result shows as follow.
root@imx8mpevk:~# ./xdp2 eth0
proto 17: 255956 pkt/s
proto 17: 255841 pkt/s
proto 17: 255835 pkt/s