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

Function vhost_user_set_req_fd

dpdk/lib/vhost/vhost_user.c:2457–2480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2455}
2456
2457static int
2458vhost_user_set_req_fd(struct virtio_net **pdev,
2459 struct vhu_msg_context *ctx,
2460 int main_fd __rte_unused)
2461{
2462 struct virtio_net *dev = *pdev;
2463 int fd = ctx->fds[0];
2464
2465 if (validate_msg_fds(dev, ctx, 1) != 0)
2466 return RTE_VHOST_MSG_RESULT_ERR;
2467
2468 if (fd < 0) {
2469 VHOST_LOG_CONFIG(dev->ifname, ERR,
2470 "invalid file descriptor for backend channel (%d)\n", fd);
2471 return RTE_VHOST_MSG_RESULT_ERR;
2472 }
2473
2474 if (dev->backend_req_fd >= 0)
2475 close(dev->backend_req_fd);
2476
2477 dev->backend_req_fd = fd;
2478
2479 return RTE_VHOST_MSG_RESULT_OK;
2480}
2481
2482static int
2483is_vring_iotlb_split(struct vhost_virtqueue *vq, struct vhost_iotlb_msg *imsg)

Callers

nothing calls this directly

Calls 2

validate_msg_fdsFunction · 0.85
closeFunction · 0.50

Tested by

no test coverage detected