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

Function vhost_user_set_postcopy_advise

dpdk/lib/vhost/vhost_user.c:2691–2728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2689}
2690
2691static int
2692vhost_user_set_postcopy_advise(struct virtio_net **pdev,
2693 struct vhu_msg_context *ctx,
2694 int main_fd __rte_unused)
2695{
2696 struct virtio_net *dev = *pdev;
2697#ifdef RTE_LIBRTE_VHOST_POSTCOPY
2698 struct uffdio_api api_struct;
2699
2700 dev->postcopy_ufd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK);
2701
2702 if (dev->postcopy_ufd == -1) {
2703 VHOST_LOG_CONFIG(dev->ifname, ERR,
2704 "userfaultfd not available: %s\n",
2705 strerror(errno));
2706 return RTE_VHOST_MSG_RESULT_ERR;
2707 }
2708 api_struct.api = UFFD_API;
2709 api_struct.features = 0;
2710 if (ioctl(dev->postcopy_ufd, UFFDIO_API, &api_struct)) {
2711 VHOST_LOG_CONFIG(dev->ifname, ERR,
2712 "UFFDIO_API ioctl failure: %s\n",
2713 strerror(errno));
2714 close(dev->postcopy_ufd);
2715 dev->postcopy_ufd = -1;
2716 return RTE_VHOST_MSG_RESULT_ERR;
2717 }
2718 ctx->fds[0] = dev->postcopy_ufd;
2719 ctx->fd_num = 1;
2720
2721 return RTE_VHOST_MSG_RESULT_REPLY;
2722#else
2723 dev->postcopy_ufd = -1;
2724 ctx->fd_num = 0;
2725
2726 return RTE_VHOST_MSG_RESULT_ERR;
2727#endif
2728}
2729
2730static int
2731vhost_user_set_postcopy_listen(struct virtio_net **pdev,

Callers

nothing calls this directly

Calls 3

syscallFunction · 0.50
ioctlFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected