[PATCH 1/2] nvme-tcp: check sgl supported by target

Keith Busch kbusch at kernel.org
Wed Mar 31 01:29:52 BST 2021


On Tue, Mar 30, 2021 at 11:01:19PM +0000, Max Gurtovoy wrote:
> SGLs support is mandatory for NVMe/tcp, make sure that the target is
> aligned to the specification.

Logging an error seems fine. Are there existing controllers that do
this? If so, what currently happens? If they just have a broken Identify
Controller structure but still work with this driver, should we proceed
with trying to use it anyway with the existing assumption?
 
> Signed-off-by: Max Gurtovoy <mgurtovoy at nvidia.com>
> ---
>  drivers/nvme/host/tcp.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index a0f00cb8f9f3..e5fbb921165e 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -1973,6 +1973,11 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
>  		goto destroy_admin;
>  	}
>  
> +	if (!(ctrl->sgls & ((1 << 0) | (1 << 1)))) {
> +		dev_err(ctrl->device, "Mandatory sgls are not supported!\n");
> +		goto destroy_admin;
> +	}
> +
>  	if (opts->queue_size > ctrl->sqsize + 1)
>  		dev_warn(ctrl->device,
>  			"queue_size %zu > ctrl sqsize %u, clamping down\n",
> -- 



More information about the Linux-nvme mailing list