[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220127171758.GB2266713@dhcp-10-100-145-180.wdc.com>
Date: Thu, 27 Jan 2022 09:17:58 -0800
From: Keith Busch <kbusch@...nel.org>
To: Daniel Wagner <dwagner@...e.de>
Cc: linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC] nvme: Do not reject dynamic controller cntlid
On Thu, Jan 27, 2022 at 02:36:48PM +0100, Daniel Wagner wrote:
> index dd18861f77c0..918abb54771c 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2701,7 +2701,7 @@ static bool nvme_validate_cntlid(struct nvme_subsystem *subsys,
> if (nvme_state_terminal(tmp))
> continue;
>
> - if (tmp->cntlid == ctrl->cntlid) {
> + if (!nvme_ctrl_dynamic(tmp) && tmp->cntlid == ctrl->cntlid) {
> dev_err(ctrl->device,
> "Duplicate cntlid %u with %s, subsys %s, rejecting\n",
> ctrl->cntlid, dev_name(tmp->device),
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index a162f6c6da6e..ed75245263f5 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -539,6 +539,11 @@ static inline struct request *nvme_cid_to_rq(struct blk_mq_tags *tags,
> return blk_mq_tag_to_rq(tags, nvme_tag_from_cid(command_id));
> }
>
> +static inline bool nvme_ctrl_dynamic(struct nvme_ctrl *ctrl)
> +{
> + return ctrl->cntlid == 0xffff;
> +}
It's probably safe to assume 0xffff is dynamic, but spec suggests we
check ID_CTRL.FCATT bit 0.
Powered by blists - more mailing lists