Blob Blame History Raw
From: Max Gurtovoy <mgurtovoy@nvidia.com>
Date: Tue, 30 Mar 2021 23:01:20 +0000
Subject: nvme-fc: check sgl supported by target
Patch-mainline: v5.13-rc1
Git-commit: 8df1bff57c7e5fc7747b9236561079907d8cf82e
References: bsc#1179827

SGLs support is mandatory for NVMe/FC, make sure that the target is
aligned to the specification.

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Daniel Wagner <dwagner@suse.de>
---
 drivers/nvme/host/fc.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -3097,6 +3097,11 @@ nvme_fc_create_association(struct nvme_f
 	}
 
 	/* FC-NVME supports normal SGL Data Block Descriptors */
+	if (!(ctrl->ctrl.sgls & ((1 << 0) | (1 << 1)))) {
+		dev_err(ctrl->ctrl.device,
+			"Mandatory sgls are not supported!\n");
+		goto out_disconnect_admin_queue;
+	}
 
 	if (opts->queue_size > ctrl->ctrl.maxcmd) {
 		/* warn if maxcmd is lower than queue_size */