mbox

[v4,0/2] add a fast path for memif Rx/Tx

Message ID 20220915065825.26169-1-joyce.kong@arm.com (mailing list archive)
Headers

Message

Joyce Kong Sept. 15, 2022, 6:58 a.m. UTC
  For memif non-zero-copy mode, there is a branch to compare
the mbuf and memif buffer size during memory copy. Add a
fast memcpy path by removing this branch with mbuf and memif
buffer size defined at compile time. For Rx fast path, bulk
allocating mbufs to get additional speedup. For Tx fast path,
bulk free 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 N1SDP AArch64 server,
---------------------------------------------------------
  buf size  | memif = mbuf | memif < mbuf | memif > mbuf
---------------------------------------------------------
non-zc gain |    47.16%    |    24.67%    |    12.47%
---------------------------------------------------------
   zc gain  |    20.96%    |     9.16%    |    10.66%
---------------------------------------------------------

Test with 1p1q on Cascade Lake Xeon X86 server,
---------------------------------------------------------
  buf size  | memif = mbuf | memif < mbuf | memif > mbuf
---------------------------------------------------------
non-zc gain |    23.52%    |    14.20%    |     5.10%
---------------------------------------------------------
   zc gain  |    17.49%    |    10.62%    |    12.42%
---------------------------------------------------------

v4:
 1.Fix incorrect indentation.
 2.Fix the mbuf array length to avoid additional overhead if
   stack-protector strong is enabled. <Stephen Hemminger>

v3:
 Add bulk allocation to get additional speedup for memif Rx
 fast path. <Stephen Hemminger>

v2:
 Rebase v1 and update commit message.

Joyce Kong (2):
  net/memif: add a Rx fast path
  net/memif: add a Tx fast path

 drivers/net/memif/rte_eth_memif.c | 280 +++++++++++++++++++++---------
 drivers/net/memif/rte_eth_memif.h |   2 +
 2 files changed, 199 insertions(+), 83 deletions(-)