From 6c2ce12217653c5c2688070e0407ace804c41fbc Mon Sep 17 00:00:00 2001 From: Alexis Lescouet Date: Fri, 27 May 2022 11:36:47 +0100 Subject: [PATCH] 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 Change-Id: I3900218c0e9884f86a5c8698a030f8106b64f2f7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12919 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Reviewed-by: John Levon Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- lib/nvmf/vfio_user.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/nvmf/vfio_user.c b/lib/nvmf/vfio_user.c index 209775b9b..19e0c94d6 100644 --- a/lib/nvmf/vfio_user.c +++ b/lib/nvmf/vfio_user.c @@ -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