From: "Arnd Bergmann" <arnd@arndb.de>
To: "Hannes Reinecke" <hare@suse.de>,
"Arnd Bergmann" <arnd@kernel.org>,
"Keith Busch" <kbusch@kernel.org>, "Jens Axboe" <axboe@kernel.dk>,
"Christoph Hellwig" <hch@lst.de>,
"Sagi Grimberg" <sagi@grimberg.me>,
"Chaitanya Kulkarni" <kch@nvidia.com>
Cc: "Mike Christie" <michael.christie@oracle.com>,
"Uday Shankar" <ushankar@purestorage.com>,
"David Howells" <dhowells@redhat.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] nvme: keyring: fix conditional compilation
Date: Fri, 20 Oct 2023 16:56:18 +0200 [thread overview]
Message-ID: <a30328f6-d3d4-46f8-9ce9-b5ca5ff8aed8@app.fastmail.com> (raw)
In-Reply-To: <69afc25c-ffc7-4ec4-a290-8c67f4dd36bd@suse.de>
On Fri, Oct 20, 2023, at 15:50, Hannes Reinecke wrote:
> On 10/20/23 15:05, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> static void __exit nvme_core_exit(void)
>> {
>> - nvme_exit_auth();
>> - nvme_keyring_exit();
>> + if (IS_ENABLED(CONFIG_NVME_HOST_AUTH))
>> + nvme_exit_auth();
>> + if (IS_ENABLED(CONFIG_NVME_TCP_TLS))
>> + nvme_keyring_exit();
>> class_destroy(nvme_ns_chr_class);
>> class_destroy(nvme_subsys_class);
>> class_destroy(nvme_class);
>
> Please add stub calls and avoid sprinkle the code with
> IS_ENABLED statements.
That seems to add a lot of complexity, but I can try. If I can't
figure it out, someone else might have to try it. Since we need
to check separately for the host and target options, this will
lead to having two extra stubs per function call, right?
key_serial_t nvme_tls_psk_default(struct key *keyring,
const char *hostnqn, const char *subnqn);
static inline key_serial_t nvme_host_tls_psk_default(struct key *keyring,
const char *hostnqn, const char *subnqn)
{
if (IS_ENABLED(CONFIG_NVME_TCP_TLS)
return nvme_tls_psk_default(keyring, hostnqn, subnqn);
return 0;
}
static inline key_serial_t nvme_target_tls_psk_default(struct key *keyring,
const char *hostnqn, const char *subnqn)
{
if (IS_ENABLED(CONFIG_NVME_TARGET_TCP_TLS))
return nvme_host_tls_psk_default(keyring, hostnqn, subnqn);
return 0;
}
>> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
>> index 4714a902f4caa..e2b90789c0407 100644
>> --- a/drivers/nvme/host/tcp.c
>> +++ b/drivers/nvme/host/tcp.c
>> @@ -1915,7 +1915,7 @@ static int nvme_tcp_alloc_admin_queue(struct nvme_ctrl *ctrl)
>> int ret;
>> key_serial_t pskid = 0;
>>
>> - if (ctrl->opts->tls) {
>> + if (IS_ENABLED(CONFIG_NVME_TCP_TLS) && ctrl->opts->tls) {
>
> Why? '->tls' is not protected by a CONFIG options, and should be
> available in general ...
>
>> if (ctrl->opts->tls_key)
>> pskid = key_serial(ctrl->opts->tls_key);
>> else
It's the nvme_tls_psk_default() call that needs to be protected
here, but I found that the entire code block is dead if tls_key
is false, so it seemed more logical to make the entire block
conditional when we know the condition is always false at
compile time.
Arnd
next prev parent reply other threads:[~2023-10-20 14:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 13:05 [PATCH 1/2] nvme: common: make keyring and auth separate modules Arnd Bergmann
2023-10-20 13:05 ` [PATCH 2/2] nvme: keyring: fix conditional compilation Arnd Bergmann
2023-10-20 13:50 ` Hannes Reinecke
2023-10-20 14:56 ` Arnd Bergmann [this message]
2023-10-20 13:42 ` [PATCH 1/2] nvme: common: make keyring and auth separate modules Hannes Reinecke
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=a30328f6-d3d4-46f8-9ce9-b5ca5ff8aed8@app.fastmail.com \
--to=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=axboe@kernel.dk \
--cc=dhowells@redhat.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=michael.christie@oracle.com \
--cc=sagi@grimberg.me \
--cc=ushankar@purestorage.com \
/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
all inboxes | Powered by JetHome®