Re: [PATCH 01/18] nvme-keyring: register '.nvme' keyring and add CONFIG_NVME_TLS

Sagi Grimberg
2023-03-30T14:38:09Z

On 3/30/23 11:53, Daniel Wagner wrote:
> On Wed, Mar 29, 2023 at 03:59:21PM +0200, Hannes Reinecke wrote:
>> +++ b/drivers/nvme/host/core.c
>> @@ -25,6 +25,9 @@
>> #include "nvme.h"
>> #include "fabrics.h"
>> #include <linux/nvme-auth.h>
>> +#ifdef CONFIG_NVME_TLS
>> +#include <linux/nvme-keyring.h>
>> +#endif
>>
>> #define CREATE_TRACE_POINTS
>> #include "trace.h"
>> @@ -3954,7 +3957,6 @@ static umode_t nvme_dev_attrs_are_visible(struct kobject *kobj,
>> if (a == &dev_attr_dhchap_ctrl_secret.attr && !ctrl->opts)
>> return 0;
>> #endif
>> -
>> return a->mode;
>> }
>>
>> @@ -5414,13 +5416,21 @@ static int __init nvme_core_init(void)
>> result = PTR_ERR(nvme_ns_chr_class);
>> goto unregister_generic_ns;
>> }
>> -
>> - result = nvme_init_auth();
>> +#ifdef CONFIG_NVME_TLS
>> + result = nvme_keyring_init();
>> if (result)
>> goto destroy_ns_chr;
>> +#endif
>
> Would it make sense to introduce empty nvme_keyring_init() function for
> !CONFIG_NVME_TLS and avoid this ifdefery here?

Yes.