[dpdk-dev] [PATCH v1] vhost: support cross page buf in async data path

Maxime Coquelin maxime.coquelin at redhat.com
Mon Jul 20 18:39:31 CEST 2020


The title could be improved, it is not very clear IMHO.

On 7/20/20 4:52 AM, patrick.fu at intel.com wrote:
> From: Patrick Fu <patrick.fu at intel.com>
> 
> Async copy fails when ring buffer cross two physical pages. This patch
> fix the failure by letting copies occur in sync mode if crossing page
> buffers are given.

Wouldn't it be possible to have the buffer split into two iovecs?

> Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
> 
> Signed-off-by: Patrick Fu <patrick.fu at intel.com>
> ---
>  lib/librte_vhost/virtio_net.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 1d0be3dd4..44b22a8ad 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1071,16 +1071,10 @@ async_mbuf_to_desc(struct virtio_net *dev, struct vhost_virtqueue *vq,
>  		}
>  
>  		cpy_len = RTE_MIN(buf_avail, mbuf_avail);
> +		hpa = (void *)(uintptr_t)gpa_to_hpa(dev,
> +				buf_iova + buf_offset, cpy_len);
>  
> -		if (unlikely(cpy_len >= cpy_threshold)) {
> -			hpa = (void *)(uintptr_t)gpa_to_hpa(dev,
> -					buf_iova + buf_offset, cpy_len);
> -
> -			if (unlikely(!hpa)) {
> -				error = -1;
> -				goto out;
> -			}
> -
> +		if (unlikely(cpy_len >= cpy_threshold && hpa)) {
>  			async_fill_vec(src_iovec + tvec_idx,
>  				(void *)(uintptr_t)rte_pktmbuf_iova_offset(m,
>  						mbuf_offset), cpy_len);
> 



More information about the dev mailing list