]> www.infradead.org Git - nvme.git/commitdiff
nvme-fabrics: handle zero MAXCMD without closing the connection
authorMaurizio Lombardi <mlombard@redhat.com>
Fri, 29 Nov 2024 14:17:06 +0000 (15:17 +0100)
committerKeith Busch <kbusch@kernel.org>
Wed, 4 Dec 2024 17:19:54 +0000 (09:19 -0800)
The NVMe specification states that MAXCMD is mandatory
for NVMe-over-Fabrics implementations. However, some NVMe/TCP
and NVMe/FC arrays from major vendors have buggy firmware
that reports MAXCMD as zero in the Identify Controller data structure.

Currently, the implementation closes the connection in such cases,
completely preventing the host from connecting to the target.

Fix the issue by printing a clear error message about the firmware bug
and allowing the connection to proceed. It assumes that the
target supports a MAXCMD value of SQSIZE + 1. If any issues arise,
the user can manually adjust SQSIZE to mitigate them.

Fixes: 4999568184e5 ("nvme-fabrics: check max outstanding commands")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c

index 5e5c9e15ad0ca4d29b0a461a3b1bd16256e0b1a7..1e904a794a4f34cd73cdcdc701a82a603063bf29 100644 (file)
@@ -3233,8 +3233,9 @@ static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ct
        }
 
        if (!ctrl->maxcmd) {
-               dev_err(ctrl->device, "Maximum outstanding commands is 0\n");
-               return -EINVAL;
+               dev_warn(ctrl->device,
+                       "Firmware bug: maximum outstanding commands is 0\n");
+               ctrl->maxcmd = ctrl->sqsize + 1;
        }
 
        return 0;