mbox series

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

Message ID 20220517105109.1086090-1-joyce.kong@arm.com (mailing list archive)
Headers
Series add a fast path for memif Rx/Tx |

Message

Joyce Kong May 17, 2022, 10:51 a.m. UTC
  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(-)
  

Comments

Morten Brørup May 17, 2022, 1:59 p.m. UTC | #1
> From: Joyce Kong [mailto:joyce.kong@arm.com]
> Sent: Tuesday, 17 May 2022 12.51
> 
> 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
> 

Series-Acked-by: Morten Brørup <mb@smartsharesystems.com>
  
Ruifeng Wang May 18, 2022, 2:48 a.m. UTC | #2
> -----Original Message-----
> From: Joyce Kong <joyce.kong@arm.com>
> Sent: Tuesday, May 17, 2022 6:51 PM
> Cc: Ruifeng Wang <Ruifeng.Wang@arm.com>; dev@dpdk.org; nd
> <nd@arm.com>; Joyce Kong <Joyce.Kong@arm.com>
> Subject: [PATCH v1 0/2] add a fast path for memif Rx/Tx
> 
> 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
Series-reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>