[dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there is no buffer

Xie, Huawei huawei.xie at intel.com
Thu Jan 29 11:39:49 CET 2015


> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of linhaifeng
> Sent: Thursday, January 29, 2015 6:30 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH] vhost: notify guest to fill buffer when there is no
> buffer
> 
> From: Linhaifeng <haifeng.lin at huawei.com>
> 
> If we found there is no buffer we should notify virtio_net to
> fill buffers.
> 
> We use mz send buffers from VM to VM,found that the other VM
> stop to receive data after many hours.
> 
> Signed-off-by: Linhaifeng <haifeng.lin at huawei.com>
> ---
>  lib/librte_vhost/vhost_rxtx.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
> index ccfd82f..013c526 100644
> --- a/lib/librte_vhost/vhost_rxtx.c
> +++ b/lib/librte_vhost/vhost_rxtx.c
> @@ -87,9 +87,14 @@ virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,
>  		/*check that we have enough buffers*/
>  		if (unlikely(count > free_entries))
>  			count = free_entries;
> -
> -		if (count == 0)
> +		/* If there is no buffers we should notify guest to fill.
> +		* This is need when guest use virtio_net driver(not pmd).
> +		*/
> +		if (count == 0) {
> +			if (!(vq->avail->flags &
> VRING_AVAIL_F_NO_INTERRUPT))
> +				eventfd_write((int)vq->kickfd, 1);
>  			return 0;
> +		}

Haifeng:
Is it the root cause and is it protocol required?
Could you give a detailed description for that scenario?

> 
>  		res_end_idx = res_base_idx + count;
>  		/* vq->last_used_idx_res is atomically updated. */
> --
> 1.9.0
> 



More information about the dev mailing list