[PATCH v2 15/20] nvme: move nvme_dhchap_queue_context declaration to nvme.h header

Sagi Grimberg sagi at grimberg.me
Sun Nov 13 03:24:19 PST 2022


We are going to have an array reference from nvme ctrl, and we want
to avoid a casting on reference.

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/auth.c | 28 ----------------------------
 drivers/nvme/host/nvme.h | 31 +++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index 2bcb33c83534..5fad1b6f8439 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -17,34 +17,6 @@
 struct kmem_cache *nvme_chap_buf_cache;
 mempool_t *nvme_chap_buf_pool;
 
-struct nvme_dhchap_queue_context {
-	struct list_head entry;
-	struct work_struct auth_work;
-	struct nvme_ctrl *ctrl;
-	struct crypto_shash *shash_tfm;
-	struct crypto_kpp *dh_tfm;
-	void *buf;
-	int qid;
-	int error;
-	u32 s1;
-	u32 s2;
-	u16 transaction;
-	u8 status;
-	u8 hash_id;
-	size_t hash_len;
-	u8 dhgroup_id;
-	u8 c1[64];
-	u8 c2[64];
-	u8 response[64];
-	u8 *host_response;
-	u8 *ctrl_key;
-	int ctrl_key_len;
-	u8 *host_key;
-	int host_key_len;
-	u8 *sess_key;
-	int sess_key_len;
-};
-
 #define nvme_auth_flags_from_qid(qid) \
 	(qid == 0) ? 0 : BLK_MQ_REQ_NOWAIT | BLK_MQ_REQ_RESERVED
 #define nvme_auth_queue_from_qid(ctrl, qid) \
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 136582c80ee8..8bd7554b68a8 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -188,6 +188,37 @@ static inline u16 nvme_req_qid(struct request *req)
 	return req->mq_hctx->queue_num + 1;
 }
 
+
+#ifdef CONFIG_NVME_AUTH
+struct nvme_dhchap_queue_context {
+	struct list_head entry;
+	struct work_struct auth_work;
+	struct nvme_ctrl *ctrl;
+	struct crypto_shash *shash_tfm;
+	struct crypto_kpp *dh_tfm;
+	void *buf;
+	int qid;
+	int error;
+	u32 s1;
+	u32 s2;
+	u16 transaction;
+	u8 status;
+	u8 hash_id;
+	size_t hash_len;
+	u8 dhgroup_id;
+	u8 c1[64];
+	u8 c2[64];
+	u8 response[64];
+	u8 *host_response;
+	u8 *ctrl_key;
+	int ctrl_key_len;
+	u8 *host_key;
+	int host_key_len;
+	u8 *sess_key;
+	int sess_key_len;
+};
+#endif
+
 /* The below value is the specific amount of delay needed before checking
  * readiness in case of the PCI_DEVICE(0x1c58, 0x0003), which needs the
  * NVME_QUIRK_DELAY_BEFORE_CHK_RDY quirk enabled. The value (in ms) was
-- 
2.34.1




More information about the Linux-nvme mailing list