[dpdk-dev] [PATCH v4 1/2] vhost: introduce async enqueue registration API

Liu, Yong yong.liu at intel.com
Mon Jul 6 05:05:49 CEST 2020


Hi Patrick,
Few comments are inline,  others are fine to me.

Regards,
Marvin

> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
> index 0d822d6..58ee3ef 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -332,8 +332,13 @@
>  {
>  	if (vq_is_packed(dev))
>  		rte_free(vq->shadow_used_packed);
> -	else
> +	else {
>  		rte_free(vq->shadow_used_split);
> +		if (vq->async_pkts_pending)
> +			rte_free(vq->async_pkts_pending);
> +		if (vq->async_pending_info)
> +			rte_free(vq->async_pending_info);

Missed pointer set and feature set to 0. 


> +int rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
> +{
> +	struct vhost_virtqueue *vq;
> +	struct virtio_net *dev = get_device(vid);
> +	int ret = -1;
> +
> +	if (dev == NULL)
> +		return ret;
> +
> +	vq = dev->virtqueue[queue_id];
> +
> +	if (vq == NULL)
> +		return ret;
> +
> +	ret = 0;
> +	rte_spinlock_lock(&vq->access_lock);
> +
> +	if (!vq->async_registered)
> +		goto out;
> +
> +	if (vq->async_pkts_inflight_n) {
> +		VHOST_LOG_CONFIG(ERR, "Failed to unregister async
> channel. "
> +			"async inflight packets must be completed before
> unregistration.\n");
> +		ret = -1;
> +		goto out;
> +	}
> +
> +	if (vq->async_pkts_pending) {
> +		rte_free(vq->async_pkts_pending);
> +		vq->async_pkts_pending = 0;
> +	}
> +
> +	if (vq->async_pending_info) {
> +		rte_free(vq->async_pending_info);
> +		vq->async_pending_info = 0;
> +	}
> +

Please unify the async pending pointer check and free logic and pointer should be set to NULL.

> +	vq->async_ops.transfer_data = NULL;
> +	vq->async_ops.check_completed_copies = NULL;
> +	vq->async_registered = false;
> +
> +out:
> +	rte_spinlock_unlock(&vq->access_lock);
> +
> +	return ret;
> +}
> +



More information about the dev mailing list