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

Function vhost_user_set_vring_call

dpdk/lib/vhost/vhost_user.c:1816–1852  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1814}
1815
1816static int
1817vhost_user_set_vring_call(struct virtio_net **pdev,
1818 struct vhu_msg_context *ctx,
1819 int main_fd __rte_unused)
1820{
1821 struct virtio_net *dev = *pdev;
1822 struct vhost_vring_file file;
1823 struct vhost_virtqueue *vq;
1824 int expected_fds;
1825
1826 expected_fds = (ctx->msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK) ? 0 : 1;
1827 if (validate_msg_fds(dev, ctx, expected_fds) != 0)
1828 return RTE_VHOST_MSG_RESULT_ERR;
1829
1830 file.index = ctx->msg.payload.u64 & VHOST_USER_VRING_IDX_MASK;
1831 if (ctx->msg.payload.u64 & VHOST_USER_VRING_NOFD_MASK)
1832 file.fd = VIRTIO_INVALID_EVENTFD;
1833 else
1834 file.fd = ctx->fds[0];
1835 VHOST_LOG_CONFIG(dev->ifname, INFO,
1836 "vring call idx:%d file:%d\n",
1837 file.index, file.fd);
1838
1839 vq = dev->virtqueue[file.index];
1840
1841 if (vq->ready) {
1842 vq->ready = false;
1843 vhost_user_notify_queue_state(dev, vq, 0);
1844 }
1845
1846 if (vq->callfd >= 0)
1847 close(vq->callfd);
1848
1849 vq->callfd = file.fd;
1850
1851 return RTE_VHOST_MSG_RESULT_OK;
1852}
1853
1854static int vhost_user_set_vring_err(struct virtio_net **pdev,
1855 struct vhu_msg_context *ctx,

Callers

nothing calls this directly

Calls 3

validate_msg_fdsFunction · 0.85
closeFunction · 0.50

Tested by

no test coverage detected