* [PATCH 1/3] nvme-fabrics: factor out auth code into helper
2024-02-08 6:24 [PATCH 0/3] nvme-fabrics: add post connect auth code helper Chaitanya Kulkarni
@ 2024-02-08 6:24 ` Chaitanya Kulkarni
2024-04-18 9:30 ` Sagi Grimberg
2024-05-23 9:35 ` Hannes Reinecke
2024-02-08 6:24 ` [PATCH 2/3] nvme-fabrics: use post connect auth helper Chaitanya Kulkarni
` (2 subsequent siblings)
3 siblings, 2 replies; 13+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-08 6:24 UTC (permalink / raw)
To: hare; +Cc: kbusch, hch, sagi, linux-nvme, Chaitanya Kulkarni
Post connect command authentication handling code is repeated into in
nvmf_connect_admin_queue() and nvmf_connect_io_queue().
Add a helper to handle post connect command authentication helper. Use
the same helper in nvmf_connect_admin_queue(). This also removes
authentication specific code from a build where authentication feature
is not configured.
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/nvme/host/auth.c | 32 ++++++++++++++++++++++++++++++++
drivers/nvme/host/fabrics.c | 25 +------------------------
drivers/nvme/host/nvme.h | 8 ++++++++
3 files changed, 41 insertions(+), 24 deletions(-)
diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index 3dce480d932e..159071462738 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -988,6 +988,38 @@ void nvme_auth_stop(struct nvme_ctrl *ctrl)
}
EXPORT_SYMBOL_GPL(nvme_auth_stop);
+u16 nvme_auth_post_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;
+
+ /* Secure concatenation is not implemented */
+ if (result & NVME_CONNECT_AUTHREQ_ASCR) {
+ dev_warn(ctrl->device,
+ "qid %u: secure concatenation is not supported\n",
+ qid);
+ return NVME_SC_AUTH_REQUIRED;
+ }
+ /* Authentication required */
+ ret = nvme_auth_negotiate(ctrl, qid);
+ if (ret) {
+ dev_warn(ctrl->device,
+ "qid %u: authentication setup failed\n", qid);
+ return NVME_SC_AUTH_REQUIRED;
+ }
+ ret = nvme_auth_wait(ctrl, qid);
+ if (ret) {
+ dev_warn(ctrl->device, "qid %u: authentication failed\n", qid);
+ return ret;
+ }
+ if (!qid)
+ dev_info(ctrl->device, "qid 0: authenticated\n");
+ return ret;
+}
+EXPORT_SYMBOL_GPL(nvme_auth_post_connect);
+
void nvme_auth_free(struct nvme_ctrl *ctrl)
{
int i;
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 373ed08e6b92..24f0d298825b 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -460,30 +460,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
result = le32_to_cpu(res.u32);
ctrl->cntlid = result & 0xFFFF;
- 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, 0);
- if (ret) {
- dev_warn(ctrl->device,
- "qid 0: authentication setup failed\n");
- ret = NVME_SC_AUTH_REQUIRED;
- goto out_free_data;
- }
- ret = nvme_auth_wait(ctrl, 0);
- if (ret)
- dev_warn(ctrl->device,
- "qid 0: authentication failed\n");
- else
- dev_info(ctrl->device,
- "qid 0: authenticated\n");
- }
+ ret = nvme_auth_post_connect(ctrl, 0, result);
out_free_data:
kfree(data);
return ret;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 1700063bc24d..bb1c9b74aa55 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -1085,6 +1085,7 @@ void nvme_auth_stop(struct nvme_ctrl *ctrl);
int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid);
int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid);
void nvme_auth_free(struct nvme_ctrl *ctrl);
+u16 nvme_auth_post_connect(struct nvme_ctrl *ctrl, u16 qid, u32 result);
#else
static inline int nvme_auth_init_ctrl(struct nvme_ctrl *ctrl)
{
@@ -1107,6 +1108,13 @@ static inline int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid)
return NVME_SC_AUTH_REQUIRED;
}
static inline void nvme_auth_free(struct nvme_ctrl *ctrl) {};
+static inline u16 nvme_auth_post_connect(struct nvme_ctrl *ctrl, u16 qid,
+ u32 result)
+{
+ if (result & (NVME_CONNECT_AUTHREQ_ATR | NVME_CONNECT_AUTHREQ_ASCR))
+ return NVME_SC_AUTH_REQUIRED;
+ return NVME_SC_SUCCESS;
+}
#endif
u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
--
2.40.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 1/3] nvme-fabrics: factor out auth code into helper
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
1 sibling, 1 reply; 13+ messages in thread
From: Sagi Grimberg @ 2024-04-18 9:30 UTC (permalink / raw)
To: Chaitanya Kulkarni, hare; +Cc: kbusch, hch, linux-nvme
On 08/02/2024 8:24, Chaitanya Kulkarni wrote:
> Post connect command authentication handling code is repeated into in
> nvmf_connect_admin_queue() and nvmf_connect_io_queue().
>
> Add a helper to handle post connect command authentication helper. Use
> the same helper in nvmf_connect_admin_queue(). This also removes
> authentication specific code from a build where authentication feature
> is not configured.
>
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> drivers/nvme/host/auth.c | 32 ++++++++++++++++++++++++++++++++
> drivers/nvme/host/fabrics.c | 25 +------------------------
> drivers/nvme/host/nvme.h | 8 ++++++++
> 3 files changed, 41 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
> index 3dce480d932e..159071462738 100644
> --- a/drivers/nvme/host/auth.c
> +++ b/drivers/nvme/host/auth.c
> @@ -988,6 +988,38 @@ void nvme_auth_stop(struct nvme_ctrl *ctrl)
> }
> EXPORT_SYMBOL_GPL(nvme_auth_stop);
>
> +u16 nvme_auth_post_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;
I really dislike functions that may or may not do anything. I vote that
we avoid
as much as possible.
How about calling the function nvme_authenticate_queue() and more the above
condition to the call-site?
> +
> + /* Secure concatenation is not implemented */
> + if (result & NVME_CONNECT_AUTHREQ_ASCR) {
> + dev_warn(ctrl->device,
> + "qid %u: secure concatenation is not supported\n",
> + qid);
> + return NVME_SC_AUTH_REQUIRED;
> + }
> + /* Authentication required */
> + ret = nvme_auth_negotiate(ctrl, qid);
> + if (ret) {
> + dev_warn(ctrl->device,
> + "qid %u: authentication setup failed\n", qid);
> + return NVME_SC_AUTH_REQUIRED;
> + }
> + ret = nvme_auth_wait(ctrl, qid);
> + if (ret) {
> + dev_warn(ctrl->device, "qid %u: authentication failed\n", qid);
> + return ret;
> + }
> + if (!qid)
> + dev_info(ctrl->device, "qid 0: authenticated\n");
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(nvme_auth_post_connect);
> +
> void nvme_auth_free(struct nvme_ctrl *ctrl)
> {
> int i;
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index 373ed08e6b92..24f0d298825b 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -460,30 +460,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
>
> result = le32_to_cpu(res.u32);
> ctrl->cntlid = result & 0xFFFF;
> - 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, 0);
> - if (ret) {
> - dev_warn(ctrl->device,
> - "qid 0: authentication setup failed\n");
> - ret = NVME_SC_AUTH_REQUIRED;
> - goto out_free_data;
> - }
> - ret = nvme_auth_wait(ctrl, 0);
> - if (ret)
> - dev_warn(ctrl->device,
> - "qid 0: authentication failed\n");
> - else
> - dev_info(ctrl->device,
> - "qid 0: authenticated\n");
> - }
> + ret = nvme_auth_post_connect(ctrl, 0, result);
> out_free_data:
> kfree(data);
> return ret;
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index 1700063bc24d..bb1c9b74aa55 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -1085,6 +1085,7 @@ void nvme_auth_stop(struct nvme_ctrl *ctrl);
> int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid);
> int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid);
> void nvme_auth_free(struct nvme_ctrl *ctrl);
> +u16 nvme_auth_post_connect(struct nvme_ctrl *ctrl, u16 qid, u32 result);
> #else
> static inline int nvme_auth_init_ctrl(struct nvme_ctrl *ctrl)
> {
> @@ -1107,6 +1108,13 @@ static inline int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid)
> return NVME_SC_AUTH_REQUIRED;
> }
> static inline void nvme_auth_free(struct nvme_ctrl *ctrl) {};
> +static inline u16 nvme_auth_post_connect(struct nvme_ctrl *ctrl, u16 qid,
> + u32 result)
> +{
> + if (result & (NVME_CONNECT_AUTHREQ_ATR | NVME_CONNECT_AUTHREQ_ASCR))
> + return NVME_SC_AUTH_REQUIRED;
> + return NVME_SC_SUCCESS;
> +}
> #endif
>
> u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 1/3] nvme-fabrics: factor out auth code into helper
2024-04-18 9:30 ` Sagi Grimberg
@ 2024-04-23 19:57 ` Chaitanya Kulkarni
0 siblings, 0 replies; 13+ messages in thread
From: Chaitanya Kulkarni @ 2024-04-23 19:57 UTC (permalink / raw)
To: Sagi Grimberg, Chaitanya Kulkarni, hare@suse.de
Cc: kbusch@kernel.org, hch@lst.de, linux-nvme@lists.infradead.org
On 4/18/24 02:30, Sagi Grimberg wrote:
>
>
> On 08/02/2024 8:24, Chaitanya Kulkarni wrote:
>> Post connect command authentication handling code is repeated into in
>> nvmf_connect_admin_queue() and nvmf_connect_io_queue().
>>
>> Add a helper to handle post connect command authentication helper. Use
>> the same helper in nvmf_connect_admin_queue(). This also removes
>> authentication specific code from a build where authentication feature
>> is not configured.
>>
>> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
>> ---
>> drivers/nvme/host/auth.c | 32 ++++++++++++++++++++++++++++++++
>> drivers/nvme/host/fabrics.c | 25 +------------------------
>> drivers/nvme/host/nvme.h | 8 ++++++++
>> 3 files changed, 41 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
>> index 3dce480d932e..159071462738 100644
>> --- a/drivers/nvme/host/auth.c
>> +++ b/drivers/nvme/host/auth.c
>> @@ -988,6 +988,38 @@ void nvme_auth_stop(struct nvme_ctrl *ctrl)
>> }
>> EXPORT_SYMBOL_GPL(nvme_auth_stop);
>> +u16 nvme_auth_post_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;
>
> I really dislike functions that may or may not do anything. I vote
> that we avoid
> as much as possible.
>
> How about calling the function nvme_authenticate_queue() and more the
> above
> condition to the call-site?
sounds good, will send v2, thanks for the comments.
-ck
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] nvme-fabrics: factor out auth code into helper
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-05-23 9:35 ` Hannes Reinecke
1 sibling, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2024-05-23 9:35 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: kbusch, hch, sagi, linux-nvme
On 2/8/24 07:24, Chaitanya Kulkarni wrote:
> Post connect command authentication handling code is repeated into in
> nvmf_connect_admin_queue() and nvmf_connect_io_queue().
>
> Add a helper to handle post connect command authentication helper. Use
> the same helper in nvmf_connect_admin_queue(). This also removes
> authentication specific code from a build where authentication feature
> is not configured.
>
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> drivers/nvme/host/auth.c | 32 ++++++++++++++++++++++++++++++++
> drivers/nvme/host/fabrics.c | 25 +------------------------
> drivers/nvme/host/nvme.h | 8 ++++++++
> 3 files changed, 41 insertions(+), 24 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] nvme-fabrics: use post connect auth helper
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-02-08 6:24 ` Chaitanya Kulkarni
2024-04-18 9:31 ` Sagi Grimberg
2024-05-23 9:39 ` Hannes Reinecke
2024-02-08 6:24 ` [PATCH 3/3] nvme-auth: unexport negotiate and wait functions Chaitanya Kulkarni
2024-04-16 3:53 ` [PATCH 0/3] nvme-fabrics: add post connect auth code helper Chaitanya Kulkarni
3 siblings, 2 replies; 13+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-08 6:24 UTC (permalink / raw)
To: hare; +Cc: kbusch, hch, sagi, linux-nvme, Chaitanya Kulkarni
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;
}
--
2.40.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 2/3] nvme-fabrics: use post connect auth helper
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
1 sibling, 0 replies; 13+ messages in thread
From: Sagi Grimberg @ 2024-04-18 9:31 UTC (permalink / raw)
To: Chaitanya Kulkarni, hare; +Cc: kbusch, hch, linux-nvme
same comment here.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] nvme-fabrics: use post connect auth helper
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
1 sibling, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2024-05-23 9:39 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: kbusch, hch, sagi, linux-nvme
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/3] nvme-auth: unexport negotiate and wait functions
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-02-08 6:24 ` [PATCH 2/3] nvme-fabrics: use post connect auth helper Chaitanya Kulkarni
@ 2024-02-08 6:24 ` 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
3 siblings, 2 replies; 13+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-08 6:24 UTC (permalink / raw)
To: hare; +Cc: kbusch, hch, sagi, linux-nvme, Chaitanya Kulkarni
Now that post connect functionality is moved from host/fabrics.c to
host/auth.c we don't need nvme_auth_wait() and nvme_auth_negotiate() to
be exported from nvme authentication code, unexport them to make it
private.
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
drivers/nvme/host/auth.c | 6 ++----
drivers/nvme/host/nvme.h | 10 ----------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index 159071462738..2fa8c4ee50ed 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -852,7 +852,7 @@ static void nvme_queue_auth_work(struct work_struct *work)
chap->error = ret;
}
-int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid)
+static int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid)
{
struct nvme_dhchap_queue_context *chap;
@@ -871,9 +871,8 @@ int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid)
queue_work(nvme_auth_wq, &chap->auth_work);
return 0;
}
-EXPORT_SYMBOL_GPL(nvme_auth_negotiate);
-int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid)
+static int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid)
{
struct nvme_dhchap_queue_context *chap;
int ret;
@@ -885,7 +884,6 @@ int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid)
nvme_auth_reset_dhchap(chap);
return ret;
}
-EXPORT_SYMBOL_GPL(nvme_auth_wait);
static void nvme_ctrl_auth_work(struct work_struct *work)
{
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index bb1c9b74aa55..a4d13ed8f6c3 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -1082,8 +1082,6 @@ int __init nvme_init_auth(void);
void __exit nvme_exit_auth(void);
int nvme_auth_init_ctrl(struct nvme_ctrl *ctrl);
void nvme_auth_stop(struct nvme_ctrl *ctrl);
-int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid);
-int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid);
void nvme_auth_free(struct nvme_ctrl *ctrl);
u16 nvme_auth_post_connect(struct nvme_ctrl *ctrl, u16 qid, u32 result);
#else
@@ -1099,14 +1097,6 @@ static inline void __exit nvme_exit_auth(void)
{
}
static inline void nvme_auth_stop(struct nvme_ctrl *ctrl) {};
-static inline int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid)
-{
- return -EPROTONOSUPPORT;
-}
-static inline int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid)
-{
- return NVME_SC_AUTH_REQUIRED;
-}
static inline void nvme_auth_free(struct nvme_ctrl *ctrl) {};
static inline u16 nvme_auth_post_connect(struct nvme_ctrl *ctrl, u16 qid,
u32 result)
--
2.40.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH 3/3] nvme-auth: unexport negotiate and wait functions
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
1 sibling, 0 replies; 13+ messages in thread
From: Sagi Grimberg @ 2024-04-18 9:32 UTC (permalink / raw)
To: Chaitanya Kulkarni, hare; +Cc: kbusch, hch, linux-nvme
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] nvme-auth: unexport negotiate and wait functions
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
1 sibling, 0 replies; 13+ messages in thread
From: Hannes Reinecke @ 2024-05-23 9:40 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: kbusch, hch, sagi, linux-nvme
On 2/8/24 07:24, Chaitanya Kulkarni wrote:
> Now that post connect functionality is moved from host/fabrics.c to
> host/auth.c we don't need nvme_auth_wait() and nvme_auth_negotiate() to
> be exported from nvme authentication code, unexport them to make it
> private.
>
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
> drivers/nvme/host/auth.c | 6 ++----
> drivers/nvme/host/nvme.h | 10 ----------
> 2 files changed, 2 insertions(+), 14 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/3] nvme-fabrics: add post connect auth code helper
2024-02-08 6:24 [PATCH 0/3] nvme-fabrics: add post connect auth code helper Chaitanya Kulkarni
` (2 preceding siblings ...)
2024-02-08 6:24 ` [PATCH 3/3] nvme-auth: unexport negotiate and wait functions Chaitanya Kulkarni
@ 2024-04-16 3:53 ` Chaitanya Kulkarni
2024-04-18 4:24 ` Chaitanya Kulkarni
3 siblings, 1 reply; 13+ messages in thread
From: Chaitanya Kulkarni @ 2024-04-16 3:53 UTC (permalink / raw)
To: hare@suse.de
Cc: kbusch@kernel.org, hch@lst.de, sagi@grimberg.me,
Chaitanya Kulkarni, linux-nvme@lists.infradead.org
On 2/7/24 22:24, Chaitanya Kulkarni wrote:
> Hi,
>
> Post connect command authentication handling code is repeated into in
> nvmf_connect_admin_queue() and nvmf_connect_io_queue(). Moreover this
> code actully belongs to authentication and should not be a part of
> common code.
>
> Add a helper to handle post connect command authentication. Use the
> same helper in nvmf_connect_[admin|io]_queue(). This also removes
> authentication specific code from a build where authentication feature
> is not configured.
>
> I've tested the code with and without NVME_AUTH configured with blktests
> they are passing. Below is a detailed log.
>
> -ck
>
> Chaitanya Kulkarni (3):
> nvme-fabrics: factor out auth code into helper
> nvme-fabrics: use post connect auth helper
> nvme-auth: unexport negotiate and wait functions
>
> drivers/nvme/host/auth.c | 38 +++++++++++++++++++++++++---
> drivers/nvme/host/fabrics.c | 50 ++-----------------------------------
> drivers/nvme/host/nvme.h | 16 ++++++------
> 3 files changed, 43 insertions(+), 61 deletions(-)
>
>
Can someone please look into this series ? this remove unnecessary code
sitting in the fabrics that should be a part of authentication ...
-ck
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 0/3] nvme-fabrics: add post connect auth code helper
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
0 siblings, 0 replies; 13+ messages in thread
From: Chaitanya Kulkarni @ 2024-04-18 4:24 UTC (permalink / raw)
To: hare@suse.de
Cc: kbusch@kernel.org, hch@lst.de, sagi@grimberg.me,
linux-nvme@lists.infradead.org
On 4/15/24 20:53, Chaitanya Kulkarni wrote:
> On 2/7/24 22:24, Chaitanya Kulkarni wrote:
>> Hi,
>>
>> Post connect command authentication handling code is repeated into in
>> nvmf_connect_admin_queue() and nvmf_connect_io_queue(). Moreover this
>> code actully belongs to authentication and should not be a part of
>> common code.
>>
>> Add a helper to handle post connect command authentication. Use the
>> same helper in nvmf_connect_[admin|io]_queue(). This also removes
>> authentication specific code from a build where authentication feature
>> is not configured.
>>
>> I've tested the code with and without NVME_AUTH configured with blktests
>> they are passing. Below is a detailed log.
>>
>> -ck
>>
>> Chaitanya Kulkarni (3):
>> nvme-fabrics: factor out auth code into helper
>> nvme-fabrics: use post connect auth helper
>> nvme-auth: unexport negotiate and wait functions
>>
>> drivers/nvme/host/auth.c | 38 +++++++++++++++++++++++++---
>> drivers/nvme/host/fabrics.c | 50 ++-----------------------------------
>> drivers/nvme/host/nvme.h | 16 ++++++------
>> 3 files changed, 43 insertions(+), 61 deletions(-)
>>
>>
> Can someone please look into this series ? this remove unnecessary code
> sitting in the fabrics that should be a part of authentication ...
>
> -ck
>
>
gentle ping, can I get some feedback if this is not needed for any reason ?
-ck
^ permalink raw reply [flat|nested] 13+ messages in thread