if (vq == NULL)
return ret;
- ret = 0;
-
- if (!vq->async)
- return ret;
-
if (!rte_spinlock_trylock(&vq->access_lock)) {
VHOST_LOG_CONFIG(ERR, "(%s) failed to unregister async channel, virtqueue busy.\n",
dev->ifname);
- return -1;
+ return ret;
}
- if (vq->async->pkts_inflight_n) {
+ if (!vq->async) {
+ ret = 0;
+ } else if (vq->async->pkts_inflight_n) {
VHOST_LOG_CONFIG(ERR, "(%s) failed to unregister async channel.\n", dev->ifname);
VHOST_LOG_CONFIG(ERR, "(%s) inflight packets must be completed before unregistration.\n",
dev->ifname);
- ret = -1;
- goto out;
+ } else {
+ vhost_free_async_mem(vq);
+ ret = 0;
}
- vhost_free_async_mem(vq);
-out:
rte_spinlock_unlock(&vq->access_lock);
return ret;
if (vq == NULL)
return ret;
- if (!vq->async)
- return ret;
-
if (!rte_spinlock_trylock(&vq->access_lock)) {
VHOST_LOG_CONFIG(DEBUG,
"(%s) failed to check in-flight packets. virtqueue busy.\n",
return ret;
}
- ret = vq->async->pkts_inflight_n;
+ if (vq->async)
+ ret = vq->async->pkts_inflight_n;
+
rte_spinlock_unlock(&vq->access_lock);
return ret;