lkml.org 
[lkml]   [2023]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH rdma-next 12/13] nvme: Add crypto profile at nvme controller
Date
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 51a9880db6ce..f09e4e0216b3 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1928,6 +1928,9 @@ static void nvme_update_disk_info(struct gendisk *disk,
> capacity = 0;
> }
>
> + if (ctrl->crypto_enable)
> + blk_crypto_register(&ctrl->crypto_profile, disk->queue);
> +
> set_capacity_and_notify(disk, capacity);
>
> nvme_config_discard(disk, ns);
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index 424c8a467a0c..591380f53744 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -16,6 +16,7 @@
> #include <linux/rcupdate.h>
> #include <linux/wait.h>
> #include <linux/t10-pi.h>
> +#include <linux/blk-crypto-profile.h>
>
> #include <trace/events/block.h>
>
> @@ -374,6 +375,9 @@ struct nvme_ctrl {
>
> enum nvme_ctrl_type cntrltype;
> enum nvme_dctype dctype;
> +
> + bool crypto_enable;

why not decalre crypto_profile a pointer, allocate that at init
controller and NULL check against that pointer instead of using
an extra variable crypto_enable ?

e.g. :-

if (ctrl->crypto_profile)
blk_crypto_register(ctrl->crypto_profile, disk->queue);

> + struct blk_crypto_profile crypto_profile;

you are increasing the size of struct nvme_ctrl unconditionally,
why not guard above with CONFIG_BLK_INLINE_ENCRYPTION ?

-ck

\
 
 \ /
  Last update: 2023-03-26 23:43    [W:0.304 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site