nvmf/vfio_user: Add an option to disable compare in vfio_user_transport_opts

Add an option to stop nvmf transport advertising support for both the
compare command and the fused compare_and_write operation in vfio_user
transport.

Signed-off-by: Alexis Lescouet <alexis.lescouet@nutanix.com>
Change-Id: I3900218c0e9884f86a5c8698a030f8106b64f2f7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12919
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: John Levon <levon@movementarian.org>
Reviewed-by: Changpeng Liu <changpeng.liu@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:
Alexis Lescouet 2022-05-27 11:36:47 +01:00 committed by Tomasz Zawadzki
parent 16c65744d8
commit 6c2ce12217

View File

@ -415,6 +415,7 @@ struct nvmf_vfio_user_transport_opts {
bool disable_mappable_bar0;
bool disable_adaptive_irq;
bool disable_shadow_doorbells;
bool disable_compare;
};
struct nvmf_vfio_user_transport {
@ -1116,6 +1117,11 @@ static const struct spdk_json_object_decoder vfio_user_transport_opts_decoder[]
offsetof(struct nvmf_vfio_user_transport, transport_opts.disable_shadow_doorbells),
spdk_json_decode_bool, true
},
{
"disable_compare",
offsetof(struct nvmf_vfio_user_transport, transport_opts.disable_compare),
spdk_json_decode_bool, true
},
};
static struct spdk_nvmf_transport *
@ -4211,9 +4217,11 @@ nvmf_vfio_user_cdata_init(struct spdk_nvmf_transport *transport,
cdata->ieee[2] = 0x50;
memset(&cdata->sgls, 0, sizeof(struct spdk_nvme_cdata_sgls));
cdata->sgls.supported = SPDK_NVME_SGLS_SUPPORTED_DWORD_ALIGNED;
cdata->oncs.compare = !vu_transport->transport_opts.disable_compare;
/* libvfio-user can only support 1 connection for now */
cdata->oncs.reservations = 0;
cdata->oacs.doorbell_buffer_config = !vu_transport->transport_opts.disable_shadow_doorbells;
cdata->fuses.compare_and_write = !vu_transport->transport_opts.disable_compare;
}
static int