From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Christoph Hellwig <hch@lst.de>,
Chaitanya Kulkarni <chaitanyak@nvidia.com>
Cc: "hare@suse.de" <hare@suse.de>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
"sagi@grimberg.me" <sagi@grimberg.me>
Subject: Re: [PATCH 3/3] nvme-fabrics: factor out common for auth
Date: Tue, 23 May 2023 08:31:32 +0000 [thread overview]
Message-ID: <4425b03a-bd62-b18f-c260-65cb44b53561@nvidia.com> (raw)
In-Reply-To: <20230523070036.GA8599@lst.de>
On 5/23/2023 12:00 AM, Christoph Hellwig wrote:
> On Mon, May 22, 2023 at 06:04:08AM -0700, Chaitanya Kulkarni wrote:
>> nvmf_connect_admin_queue and nvmf_connect_io_queue() shares common code
>> for post connect command authentication processing that includes,
>> returning appropriate NVMe authentication status based on the
>> command result, authentication negotiation per qid, waiting on
>> negotiation per qid.
>>
>> Add a common helper function to reduce the code duplication with
>> necessary aruments of qid and result of connect command.
>>
>> No functional changes in this patch.
>>
>> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
>> ---
>> drivers/nvme/host/fabrics.c | 81 ++++++++++++++++---------------------
>> 1 file changed, 35 insertions(+), 46 deletions(-)
>>
>> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
>> index 9d3df63eb49a..1d48c0b77cd0 100644
>> --- a/drivers/nvme/host/fabrics.c
>> +++ b/drivers/nvme/host/fabrics.c
>> @@ -433,6 +433,39 @@ static void nvmf_connect_cmd_prep(struct nvme_ctrl *ctrl, u16 qid,
>> cmd->connect.cattr |= NVME_CONNECT_DISABLE_SQFLOW;
>> }
>>
>> +static u16 nvmf_auth_post_queue_connect(struct nvme_ctrl *ctrl, u16 qid,
>> + u32 result)
>> +{
>> + int ret;
>> +
>> + if (!(result & (NVME_CONNECT_AUTHREQ_ATR | NVME_CONNECT_AUTHREQ_ASCR)))
>> + return NVME_SC_SUCCESS;
>
> While it's a minor duplication, I'd prepfer to keep this check in the
> callers. That makes it very explicit we are only calling into the helper
> when authentication is required.
>
we are cleaning up so much code I guess addition of 2 lines in
send/receive callers should be fine, I'll add it in the V2.
>> + ret = nvme_auth_wait(ctrl, qid);
>> + if (ret) {
>> + dev_warn(ctrl->device, "qid %u: authentication failed\n", qid);
>> + return ret;
>> + }
>> + if (!ret && qid == 0)
>
> ret must be 0 at this point bsed on the check above.
will fix it in V2 .
-ck
prev parent reply other threads:[~2023-05-23 8:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 13:04 [PATCH 0/3] nvme-fabrics: auth fixes and cleanup Chaitanya Kulkarni
2023-05-22 13:04 ` [PATCH 1/3] nvme-fabrics: fix qid in error message Chaitanya Kulkarni
2023-05-23 6:58 ` Christoph Hellwig
2023-05-22 13:04 ` [PATCH 2/3] nvme-fabrics: error out when connect I/O fails Chaitanya Kulkarni
2023-05-23 6:58 ` Christoph Hellwig
2023-05-22 13:04 ` [PATCH 3/3] nvme-fabrics: factor out common for auth Chaitanya Kulkarni
2023-05-23 7:00 ` Christoph Hellwig
2023-05-23 8:31 ` Chaitanya Kulkarni [this message]
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=4425b03a-bd62-b18f-c260-65cb44b53561@nvidia.com \
--to=chaitanyak@nvidia.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--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