From: Hannes Reinecke <hare@suse.de>
To: Chaitanya Kulkarni <kch@nvidia.com>
Cc: kbusch@kernel.org, hch@lst.de, sagi@grimberg.me,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH 2/3] nvme-fabrics: use post connect auth helper
Date: Thu, 23 May 2024 11:39:50 +0200 [thread overview]
Message-ID: <e5f719b1-1fec-4685-a961-aa03acbdbbed@suse.de> (raw)
In-Reply-To: <20240208062427.31255-3-kch@nvidia.com>
On 2/8/24 07:24, Chaitanya Kulkarni wrote:
> Use previously added helper to handle post connect command auth in
> nvmf_connect_io_queue().
>
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> drivers/nvme/host/fabrics.c | 25 +------------------------
> 1 file changed, 1 insertion(+), 24 deletions(-)
>
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index 24f0d298825b..19130e3bd00a 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -493,7 +493,6 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
> struct nvmf_connect_data *data;
> union nvme_result res;
> int ret;
> - u32 result;
>
> nvmf_connect_cmd_prep(ctrl, qid, &cmd);
>
> @@ -508,29 +507,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
> nvmf_log_connect_error(ctrl, ret, le32_to_cpu(res.u32),
> &cmd, data);
> }
> - result = le32_to_cpu(res.u32);
> - if (result & (NVME_CONNECT_AUTHREQ_ATR | NVME_CONNECT_AUTHREQ_ASCR)) {
> - /* Secure concatenation is not implemented */
> - if (result & NVME_CONNECT_AUTHREQ_ASCR) {
> - dev_warn(ctrl->device,
> - "qid 0: secure concatenation is not supported\n");
> - ret = NVME_SC_AUTH_REQUIRED;
> - goto out_free_data;
> - }
> - /* Authentication required */
> - ret = nvme_auth_negotiate(ctrl, qid);
> - if (ret) {
> - dev_warn(ctrl->device,
> - "qid %d: authentication setup failed\n", qid);
> - ret = NVME_SC_AUTH_REQUIRED;
> - } else {
> - ret = nvme_auth_wait(ctrl, qid);
> - if (ret)
> - dev_warn(ctrl->device,
> - "qid %u: authentication failed\n", qid);
> - }
> - }
> -out_free_data:
> + ret = nvme_auth_post_connect(ctrl, 0, le32_to_cpu(res.u32));
> kfree(data);
> return ret;
> }
Agree with Sagi; move the first 'if' clause out of the helper:
if (result & (NVME_CONNECT_AUTHREQ_ATR | NVME_CONNECT_AUTHREQ_ASCR))
ret = nvme_auth_post_connect(ctrl, 0, le32_to_cpu(res.u32));
Cheers,
Hannes
next prev parent reply other threads:[~2024-05-23 9:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 6:24 [PATCH 0/3] nvme-fabrics: add post connect auth code helper Chaitanya Kulkarni
2024-02-08 6:24 ` [PATCH 1/3] nvme-fabrics: factor out auth code into helper Chaitanya Kulkarni
2024-04-18 9:30 ` Sagi Grimberg
2024-04-23 19:57 ` Chaitanya Kulkarni
2024-05-23 9:35 ` Hannes Reinecke
2024-02-08 6:24 ` [PATCH 2/3] nvme-fabrics: use post connect auth helper Chaitanya Kulkarni
2024-04-18 9:31 ` Sagi Grimberg
2024-05-23 9:39 ` Hannes Reinecke [this message]
2024-02-08 6:24 ` [PATCH 3/3] nvme-auth: unexport negotiate and wait functions Chaitanya Kulkarni
2024-04-18 9:32 ` Sagi Grimberg
2024-05-23 9:40 ` Hannes Reinecke
2024-04-16 3:53 ` [PATCH 0/3] nvme-fabrics: add post connect auth code helper Chaitanya Kulkarni
2024-04-18 4:24 ` Chaitanya Kulkarni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e5f719b1-1fec-4685-a961-aa03acbdbbed@suse.de \
--to=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox