[dpdk-dev] [PATCH v1] vhost: add vq status check in async enqueue poll
Maxime Coquelin
maxime.coquelin at redhat.com
Mon Jul 20 17:57:36 CEST 2020
What about this commit title?
vhost: fix missing virtqueue status check in async path
On 7/16/20 5:30 PM, patrick.fu at intel.com wrote:
> From: Patrick Fu <patrick.fu at intel.com>
>
> Vring should not be touched if vq is disabled. This patch adds the vq
> status check in async enqueue polling to avoid accessing to a disabled
> queue.
>
> 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 | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 1d0be3dd4..b197d76d3 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1686,9 +1686,11 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
>
> if (n_pkts_put) {
> vq->async_pkts_inflight_n -= n_pkts_put;
> - __atomic_add_fetch(&vq->used->idx, n_descs, __ATOMIC_RELEASE);
> -
> - vhost_vring_call_split(dev, vq);
> + if (likely(vq->enabled && vq->access_ok)) {
> + __atomic_add_fetch(&vq->used->idx,
> + n_descs, __ATOMIC_RELEASE);
> + vhost_vring_call_split(dev, vq);
> + }
> }
>
> if (start_idx + n_pkts_put <= vq_size) {
>
More information about the dev
mailing list