nvmf/vfio-user: remove controller ready field
The controller concept in NVMf is like a session, for any new connection in nvmf_vfio_user_accept() with the endpoint, we treat it as a new controller, we don't need the `ready` field in controller to indicate the connection state, we need the connection state in endpoint, so here just use endpoint->ctrlr point to indicate the socket connection is valid or not. Change-Id: I588dbba7973cb61a1d79d81324a43e052f7dafb0 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7621 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
e9a4350381
commit
12de3673f0
@ -157,8 +157,6 @@ struct nvmf_vfio_user_ctrlr {
|
|||||||
struct nvmf_vfio_user_endpoint *endpoint;
|
struct nvmf_vfio_user_endpoint *endpoint;
|
||||||
struct nvmf_vfio_user_transport *transport;
|
struct nvmf_vfio_user_transport *transport;
|
||||||
|
|
||||||
/* True when the socket connection is active */
|
|
||||||
bool ready;
|
|
||||||
/* Number of connected queue pairs */
|
/* Number of connected queue pairs */
|
||||||
uint32_t num_connected_qps;
|
uint32_t num_connected_qps;
|
||||||
|
|
||||||
@ -268,7 +266,6 @@ fail_ctrlr(struct nvmf_vfio_user_ctrlr *ctrlr)
|
|||||||
SPDK_ERRLOG(":%s failing controller\n", ctrlr_id(ctrlr));
|
SPDK_ERRLOG(":%s failing controller\n", ctrlr_id(ctrlr));
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrlr->ready = false;
|
|
||||||
ctrlr->cfs = 1U;
|
ctrlr->cfs = 1U;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1655,7 +1652,6 @@ nvmf_vfio_user_create_ctrlr(struct nvmf_vfio_user_transport *transport,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
endpoint->ctrlr = ctrlr;
|
endpoint->ctrlr = ctrlr;
|
||||||
ctrlr->ready = true;
|
|
||||||
|
|
||||||
/* Notify the generic layer about the new admin queue pair */
|
/* Notify the generic layer about the new admin queue pair */
|
||||||
TAILQ_INSERT_TAIL(&ctrlr->transport->new_qps, ctrlr->qp[0], link);
|
TAILQ_INSERT_TAIL(&ctrlr->transport->new_qps, ctrlr->qp[0], link);
|
||||||
@ -1852,8 +1848,8 @@ nvmf_vfio_user_accept(struct spdk_nvmf_transport *transport)
|
|||||||
pthread_mutex_lock(&vu_transport->lock);
|
pthread_mutex_lock(&vu_transport->lock);
|
||||||
|
|
||||||
TAILQ_FOREACH(endpoint, &vu_transport->endpoints, link) {
|
TAILQ_FOREACH(endpoint, &vu_transport->endpoints, link) {
|
||||||
/* we need try to attach the controller again after reset or shutdown */
|
/* try to attach a new controller */
|
||||||
if (endpoint->ctrlr != NULL && endpoint->ctrlr->ready) {
|
if (endpoint->ctrlr != NULL) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1948,7 +1944,6 @@ vfio_user_stop_ctrlr(struct nvmf_vfio_user_ctrlr *ctrlr)
|
|||||||
|
|
||||||
SPDK_DEBUGLOG(nvmf_vfio, "%s stop processing\n", ctrlr_id(ctrlr));
|
SPDK_DEBUGLOG(nvmf_vfio, "%s stop processing\n", ctrlr_id(ctrlr));
|
||||||
|
|
||||||
ctrlr->ready = false;
|
|
||||||
endpoint = ctrlr->endpoint;
|
endpoint = ctrlr->endpoint;
|
||||||
assert(endpoint != NULL);
|
assert(endpoint != NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user