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

nvmf/vfio-user: use transport cdata_init callback for custom IDENTIFY



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


Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 5118878c
Loading
Loading
Loading
Loading
+9 −21
Original line number Diff line number Diff line
@@ -557,14 +557,6 @@ static int
handle_cmd_req(struct nvmf_vfio_user_ctrlr *ctrlr, struct spdk_nvme_cmd *cmd,
	       struct spdk_nvmf_request *req);

static void
handle_identify_ctrlr_rsp(struct spdk_nvme_ctrlr_data *data)
{
	assert(data != NULL);

	data->sgls.supported = SPDK_NVME_SGLS_NOT_SUPPORTED;
}

/*
 * Posts a CQE in the completion queue.
 *
@@ -985,23 +977,10 @@ static int
handle_cmd_rsp(struct nvmf_vfio_user_req *req, void *cb_arg)
{
	struct nvmf_vfio_user_qpair *qpair = cb_arg;
	struct spdk_nvme_cmd *cmd = &req->req.cmd->nvme_cmd;

	assert(qpair != NULL);
	assert(req != NULL);

	if (nvmf_qpair_is_admin_queue(&qpair->qpair)) {
		switch (cmd->opc) {
		case SPDK_NVME_OPC_IDENTIFY:
			if ((cmd->cdw10 & 0xFF) == SPDK_NVME_IDENTIFY_CTRLR) {
				handle_identify_ctrlr_rsp(req->req.data);
			}
			break;
		default:
			break;
		}
	}

	vfu_unmap_sg(qpair->ctrlr->endpoint->vfu_ctx, req->sg, req->iov, req->iovcnt);

	return post_completion(qpair->ctrlr, &req->req.cmd->nvme_cmd,
@@ -1696,6 +1675,14 @@ nvmf_vfio_user_stop_listen(struct spdk_nvmf_transport *transport,
	SPDK_DEBUGLOG(nvmf_vfio, "%s: not found\n", trid->traddr);
}

static void
nvmf_vfio_user_cdata_init(struct spdk_nvmf_transport *transport,
			  struct spdk_nvmf_subsystem *subsystem,
			  struct spdk_nvmf_ctrlr_data *cdata)
{
	cdata->sgls.supported = SPDK_NVME_SGLS_NOT_SUPPORTED;
}

static int
nvmf_vfio_user_listen_associate(struct spdk_nvmf_transport *transport,
				const struct spdk_nvmf_subsystem *subsystem,
@@ -2305,6 +2292,7 @@ const struct spdk_nvmf_transport_ops spdk_nvmf_transport_vfio_user = {
	.listen = nvmf_vfio_user_listen,
	.stop_listen = nvmf_vfio_user_stop_listen,
	.accept = nvmf_vfio_user_accept,
	.cdata_init = nvmf_vfio_user_cdata_init,
	.listen_associate = nvmf_vfio_user_listen_associate,

	.listener_discover = nvmf_vfio_user_discover,