| 2053 | } |
| 2054 | |
| 2055 | int |
| 2056 | rte_vhost_async_get_inflight(int vid, uint16_t queue_id) |
| 2057 | { |
| 2058 | struct vhost_virtqueue *vq; |
| 2059 | struct virtio_net *dev = get_device(vid); |
| 2060 | int ret = -1; |
| 2061 | |
| 2062 | if (dev == NULL) |
| 2063 | return ret; |
| 2064 | |
| 2065 | if (queue_id >= VHOST_MAX_VRING) |
| 2066 | return ret; |
| 2067 | |
| 2068 | vq = dev->virtqueue[queue_id]; |
| 2069 | |
| 2070 | if (vq == NULL) |
| 2071 | return ret; |
| 2072 | |
| 2073 | if (rte_rwlock_write_trylock(&vq->access_lock)) { |
| 2074 | VHOST_LOG_CONFIG(dev->ifname, DEBUG, |
| 2075 | "failed to check in-flight packets. virtqueue busy.\n"); |
| 2076 | return ret; |
| 2077 | } |
| 2078 | |
| 2079 | if (unlikely(!vq->access_ok)) { |
| 2080 | ret = -1; |
| 2081 | goto out_unlock; |
| 2082 | } |
| 2083 | |
| 2084 | if (vq->async) |
| 2085 | ret = vq->async->pkts_inflight_n; |
| 2086 | |
| 2087 | out_unlock: |
| 2088 | rte_rwlock_write_unlock(&vq->access_lock); |
| 2089 | |
| 2090 | return ret; |
| 2091 | } |
| 2092 | |
| 2093 | int |
| 2094 | rte_vhost_async_get_inflight_thread_unsafe(int vid, uint16_t queue_id) |
no test coverage detected