Commit a1cd28c6 authored by Changpeng Liu's avatar Changpeng Liu Committed by Tomasz Zawadzki
Browse files

lib/vhost: get negotiated features after SET_FEATURES message



Feature negotiation is done after SET_FEATURES message, here we
move it in this message context, so that we can use the negotiated
features before starting the device.

Change-Id: Ic6388dbcebd72bc5ef182e65798d34c07f6fc35c
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14924


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 835490b1
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1041,11 +1041,6 @@ start_device(int vid)
		goto out;
	}

	if (vhost_get_negotiated_features(vid, &vsession->negotiated_features) != 0) {
		SPDK_ERRLOG("vhost device %d: Failed to get negotiated driver features\n", vid);
		goto out;
	}

	packed_ring = ((vsession->negotiated_features & (1ULL << VIRTIO_F_RING_PACKED)) != 0);

	vsession->max_queues = 0;
@@ -1564,6 +1559,7 @@ extern_vhost_post_msg_handler(int vid, void *_msg)
{
	struct vhost_user_msg *msg = _msg;
	struct spdk_vhost_session *vsession;
	int rc;

	vsession = vhost_session_find_by_vid(vid);
	if (vsession == NULL) {
@@ -1584,6 +1580,12 @@ extern_vhost_post_msg_handler(int vid, void *_msg)

	switch (msg->request) {
	case VHOST_USER_SET_FEATURES:
		rc = vhost_get_negotiated_features(vid, &vsession->negotiated_features);
		if (rc) {
			SPDK_ERRLOG("vhost device %d: Failed to get negotiated driver features\n", vid);
			return RTE_VHOST_MSG_RESULT_ERR;
		}

		/* rte_vhost requires all queues to be fully initialized in order
		 * to start I/O processing. This behavior is not compliant with the
		 * vhost-user specification and doesn't work with QEMU 2.12+, which