From 835490b1d548cf975796274aa2b05e4aee1d0819 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Tue, 11 Oct 2022 14:39:08 +0800 Subject: [PATCH] lib/vhost: check memory table earlier Before starting a device, the memory table is already there, so we can check it earlier. Change-Id: I4996705501577cfa78c89621f7081eb0c3d4dd78 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14923 Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- lib/vhost/rte_vhost_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/vhost/rte_vhost_user.c b/lib/vhost/rte_vhost_user.c index f8db35c6e..cde959ab4 100644 --- a/lib/vhost/rte_vhost_user.c +++ b/lib/vhost/rte_vhost_user.c @@ -1036,6 +1036,11 @@ start_device(int vid) goto out; } + if (!vsession->mem) { + SPDK_ERRLOG("Session %s doesn't set memory table yet\n", vsession->name); + 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; @@ -1120,11 +1125,6 @@ start_device(int vid) vsession->max_queues = i + 1; } - if (!vsession->mem) { - SPDK_ERRLOG("Session %s doesn't set memory table yet\n", vsession->name); - goto out; - } - vhost_user_session_set_coalescing(vdev, vsession, NULL); vsession->initialized = true; rc = vhost_user_session_start(vdev, vsession);