For memif non-zero-copy mode, there is a branch to compare the mbuf and memif buffer size during memory copying. Add a fast memory copy path by removing this branch with mbuf and memif buffer size defined at compile time. And for Tx fast path, bulk free the mbufs which come from the same mempool.
When mbuf == memif buffer size, both Rx/Tx would choose the fast memcpy path. When mbuf < memif buffer size, the Rx chooses previous memcpy path while Tx chooses fast memcpy path. When mbuf > memif buffer size, the Rx chooses fast memcpy path while Tx chooses previous memcpy path. Test with 1p1q on Ampere Altra AArch64 server, --------------------------------------------------------- buf size | memif = mbuf | memif < mbuf | memif > mbuf --------------------------------------------------------- non-zc gain | 16.95% | 3.28% | 13.29% --------------------------------------------------------- zc gain | 19.43% | 4.62% | 18.14% --------------------------------------------------------- Test with 1p1q on Cascade Lake Xeon X86server, --------------------------------------------------------- buf size | memif = mbuf | memif < mbuf | memif > mbuf --------------------------------------------------------- non-zc gain | 19.97% | 2.35% | 21.43% --------------------------------------------------------- zc gain | 14.30% | -1.21% | 11.98% --------------------------------------------------------- Joyce Kong (2): net/memif: add a Rx fast path net/memif: add a Tx fast path drivers/net/memif/rte_eth_memif.c | 258 ++++++++++++++++++++---------- 1 file changed, 176 insertions(+), 82 deletions(-) -- 2.25.1