vhost: support IOTLB miss slave requests
[dpdk.git] / lib / librte_vhost / vhost_user.c
index 0ba66e1..628da2d 100644 (file)
@@ -1168,3 +1168,29 @@ vhost_user_msg_handler(int vid, int fd)
 
        return 0;
 }
+
+int
+vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm)
+{
+       int ret;
+       struct VhostUserMsg msg = {
+               .request = (enum VhostUserRequest)VHOST_USER_SLAVE_IOTLB_MSG,
+               .flags = VHOST_USER_VERSION,
+               .size = sizeof(msg.payload.iotlb),
+               .payload.iotlb = {
+                       .iova = iova,
+                       .perm = perm,
+                       .type = VHOST_IOTLB_MISS,
+               },
+       };
+
+       ret = send_vhost_message(dev->slave_req_fd, &msg);
+       if (ret < 0) {
+               RTE_LOG(ERR, VHOST_CONFIG,
+                               "Failed to send IOTLB miss message (%d)\n",
+                               ret);
+               return ret;
+       }
+
+       return 0;
+}