MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_vhost_async_channel_unregister

Function rte_vhost_async_channel_unregister

dpdk/lib/vhost/vhost.c:1899–1943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1897}
1898
1899int
1900rte_vhost_async_channel_unregister(int vid, uint16_t queue_id)
1901{
1902 struct vhost_virtqueue *vq;
1903 struct virtio_net *dev = get_device(vid);
1904 int ret = -1;
1905
1906 if (dev == NULL)
1907 return ret;
1908
1909 if (queue_id >= VHOST_MAX_VRING)
1910 return ret;
1911
1912 vq = dev->virtqueue[queue_id];
1913
1914 if (vq == NULL)
1915 return ret;
1916
1917 if (rte_rwlock_write_trylock(&vq->access_lock)) {
1918 VHOST_LOG_CONFIG(dev->ifname, ERR,
1919 "failed to unregister async channel, virtqueue busy.\n");
1920 return ret;
1921 }
1922
1923 if (unlikely(!vq->access_ok)) {
1924 ret = -1;
1925 goto out_unlock;
1926 }
1927
1928 if (!vq->async) {
1929 ret = 0;
1930 } else if (vq->async->pkts_inflight_n) {
1931 VHOST_LOG_CONFIG(dev->ifname, ERR, "failed to unregister async channel.\n");
1932 VHOST_LOG_CONFIG(dev->ifname, ERR,
1933 "inflight packets must be completed before unregistration.\n");
1934 } else {
1935 vhost_free_async_mem(vq);
1936 ret = 0;
1937 }
1938
1939out_unlock:
1940 rte_rwlock_write_unlock(&vq->access_lock);
1941
1942 return ret;
1943}
1944
1945int
1946rte_vhost_async_channel_unregister_thread_unsafe(int vid, uint16_t queue_id)

Callers 1

destroy_deviceFunction · 0.85

Calls 2

get_deviceFunction · 0.85
vhost_free_async_memFunction · 0.85

Tested by

no test coverage detected