Commit 12de3673 authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

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: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7621


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent e9a43503
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -157,8 +157,6 @@ struct nvmf_vfio_user_ctrlr {
	struct nvmf_vfio_user_endpoint		*endpoint;
	struct nvmf_vfio_user_transport		*transport;

	/* True when the socket connection is active */
	bool					ready;
	/* Number of connected queue pairs */
	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));
	}

	ctrlr->ready = false;
	ctrlr->cfs = 1U;
}

@@ -1655,7 +1652,6 @@ nvmf_vfio_user_create_ctrlr(struct nvmf_vfio_user_transport *transport,
		goto out;
	}
	endpoint->ctrlr = ctrlr;
	ctrlr->ready = true;

	/* Notify the generic layer about the new admin queue pair */
	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);

	TAILQ_FOREACH(endpoint, &vu_transport->endpoints, link) {
		/* we need try to attach the controller again after reset or shutdown */
		if (endpoint->ctrlr != NULL && endpoint->ctrlr->ready) {
		/* try to attach a new controller  */
		if (endpoint->ctrlr != NULL) {
			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));

	ctrlr->ready = false;
	endpoint = ctrlr->endpoint;
	assert(endpoint != NULL);