[dpdk-dev] [PATCH v7 5/5] net/af_xdp: enable zero copy

Ferruh Yigit ferruh.yigit at intel.com
Thu Mar 28 19:44:40 CET 2019


On 3/27/2019 9:00 AM, Xiaolong Ye wrote:
> Try to check if external mempool (from rx_queue_setup) is fit for
> af_xdp, if it is, it will be registered to af_xdp socket directly and
> there will be no packet data copy on Rx and Tx.
> 
> Signed-off-by: Xiaolong Ye <xiaolong.ye at intel.com>
> ---
>  drivers/net/af_xdp/rte_eth_af_xdp.c | 130 ++++++++++++++++++++--------
>  1 file changed, 96 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index a1fda9212..c6ade4c94 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -67,6 +67,7 @@ struct xsk_umem_info {
>  	struct xsk_umem *umem;
>  	struct rte_mempool *mb_pool;
>  	void *buffer;
> +	uint8_t zc;
>  };
>  
>  struct rx_stats {
> @@ -85,6 +86,7 @@ struct pkt_rx_queue {
>  
>  	struct pkt_tx_queue *pair;
>  	uint16_t queue_idx;
> +	uint8_t zc;
>  };
>  
>  struct tx_stats {

<...>

> @@ -630,6 +685,13 @@ eth_rx_queue_setup(struct rte_eth_dev *dev,
>  
>  	internals->umem = rxq->umem;
>  
> +	if (mb_pool == internals->umem->mb_pool)
> +		rxq->zc = internals->umem->zc;
> +
> +	if (rxq->zc)
> +		AF_XDP_LOG(INFO,
> +			"zero copy enabled on rx queue %d\n", rx_queue_id);
> +

The "zero copy" implemented in this patch, also the variable 'zc', is from
'af_xdp' umem to mbuf data via versa copy, right?
There is also another "zero copy" support in af_xdp, device to buffers...
Do you think can these be confused with each other, should we have another log
message and variable name for this one?
Indeed I can't think of a good name, but something like, "pmd/driver zero copy"
& 'pmd_zc' ??


More information about the dev mailing list