* Interface to vhost-user
*/
+#include <stdbool.h>
#include <stdint.h>
#include <sys/eventfd.h>
int
rte_vhost_get_vdpa_device_id(int vid);
+/**
+ * Notify the guest that should get virtio configuration space from backend.
+ *
+ * @param vid
+ * vhost device ID
+ * @param need_reply
+ * wait for the master response the status of this operation
+ * @return
+ * 0 on success, < 0 on failure
+ */
+__rte_experimental
+int
+rte_vhost_slave_config_change(int vid, bool need_reply);
+
#ifdef __cplusplus
}
#endif
return 0;
}
+static int
+vhost_user_slave_config_change(struct virtio_net *dev, bool need_reply)
+{
+ int ret;
+ struct VhostUserMsg msg = {
+ .request.slave = VHOST_USER_SLAVE_CONFIG_CHANGE_MSG,
+ .flags = VHOST_USER_VERSION,
+ .size = 0,
+ };
+
+ if (need_reply)
+ msg.flags |= VHOST_USER_NEED_REPLY;
+
+ ret = send_vhost_slave_message(dev, &msg);
+ if (ret < 0) {
+ VHOST_LOG_CONFIG(ERR,
+ "Failed to send config change (%d)\n",
+ ret);
+ return ret;
+ }
+
+ return process_slave_message_reply(dev, &msg);
+}
+
+int
+rte_vhost_slave_config_change(int vid, bool need_reply)
+{
+ struct virtio_net *dev;
+
+ dev = get_device(vid);
+ if (!dev)
+ return -ENODEV;
+
+ return vhost_user_slave_config_change(dev, need_reply);
+}
+
static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev,
int index, int fd,
uint64_t offset,
typedef enum VhostUserSlaveRequest {
VHOST_USER_SLAVE_NONE = 0,
VHOST_USER_SLAVE_IOTLB_MSG = 1,
+ VHOST_USER_SLAVE_CONFIG_CHANGE_MSG = 2,
VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG = 3,
VHOST_USER_SLAVE_MAX
} VhostUserSlaveRequest;