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

Function vhost_user_postcopy_region_register

dpdk/lib/vhost/vhost_user.c:1118–1152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1116
1117#ifdef RTE_LIBRTE_VHOST_POSTCOPY
1118static int
1119vhost_user_postcopy_region_register(struct virtio_net *dev,
1120 struct rte_vhost_mem_region *reg)
1121{
1122 struct uffdio_register reg_struct;
1123
1124 /*
1125 * Let's register all the mmapped area to ensure
1126 * alignment on page boundary.
1127 */
1128 reg_struct.range.start = (uint64_t)(uintptr_t)reg->mmap_addr;
1129 reg_struct.range.len = reg->mmap_size;
1130 reg_struct.mode = UFFDIO_REGISTER_MODE_MISSING;
1131
1132 if (ioctl(dev->postcopy_ufd, UFFDIO_REGISTER,
1133 &reg_struct)) {
1134 VHOST_LOG_CONFIG(dev->ifname, ERR,
1135 "failed to register ufd for region "
1136 "%" PRIx64 " - %" PRIx64 " (ufd = %d) %s\n",
1137 (uint64_t)reg_struct.range.start,
1138 (uint64_t)reg_struct.range.start +
1139 (uint64_t)reg_struct.range.len - 1,
1140 dev->postcopy_ufd,
1141 strerror(errno));
1142 return -1;
1143 }
1144
1145 VHOST_LOG_CONFIG(dev->ifname, INFO,
1146 "\t userfaultfd registered for range : %" PRIx64 " - %" PRIx64 "\n",
1147 (uint64_t)reg_struct.range.start,
1148 (uint64_t)reg_struct.range.start +
1149 (uint64_t)reg_struct.range.len - 1);
1150
1151 return 0;
1152}
1153#else
1154static int
1155vhost_user_postcopy_region_register(struct virtio_net *dev __rte_unused,

Callers 1

Calls 1

ioctlFunction · 0.50

Tested by

no test coverage detected