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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14924
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Changpeng Liu 2022-10-11 15:15:25 +08:00 committed by Tomasz Zawadzki
parent 835490b1d5
commit a1cd28c6f3

View File

@ -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