mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 13:30:45 -05:00
nvmet: remove redundant subsysnqn field from ctrl
The subsysnqn field in the nvmet controller structure is redundant, since the subsystem NQN can always be accessed via the controller's subsystem reference. Remove this field to save memory and avoid unnecessary duplication. Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
committed by
Keith Busch
parent
7fce856f11
commit
edd17206e3
@@ -380,8 +380,8 @@ int nvmet_auth_host_hash(struct nvmet_req *req, u8 *response,
|
||||
ret = crypto_shash_update(shash, buf, 1);
|
||||
if (ret)
|
||||
goto out;
|
||||
ret = crypto_shash_update(shash, ctrl->subsysnqn,
|
||||
strlen(ctrl->subsysnqn));
|
||||
ret = crypto_shash_update(shash, ctrl->subsys->subsysnqn,
|
||||
strlen(ctrl->subsys->subsysnqn));
|
||||
if (ret)
|
||||
goto out;
|
||||
ret = crypto_shash_final(shash, response);
|
||||
@@ -428,7 +428,7 @@ int nvmet_auth_ctrl_hash(struct nvmet_req *req, u8 *response,
|
||||
}
|
||||
|
||||
transformed_key = nvme_auth_transform_key(ctrl->ctrl_key,
|
||||
ctrl->subsysnqn);
|
||||
ctrl->subsys->subsysnqn);
|
||||
if (IS_ERR(transformed_key)) {
|
||||
ret = PTR_ERR(transformed_key);
|
||||
goto out_free_tfm;
|
||||
@@ -483,8 +483,8 @@ int nvmet_auth_ctrl_hash(struct nvmet_req *req, u8 *response,
|
||||
ret = crypto_shash_update(shash, "Controller", 10);
|
||||
if (ret)
|
||||
goto out;
|
||||
ret = crypto_shash_update(shash, ctrl->subsysnqn,
|
||||
strlen(ctrl->subsysnqn));
|
||||
ret = crypto_shash_update(shash, ctrl->subsys->subsysnqn,
|
||||
strlen(ctrl->subsys->subsysnqn));
|
||||
if (ret)
|
||||
goto out;
|
||||
ret = crypto_shash_update(shash, buf, 1);
|
||||
@@ -574,7 +574,7 @@ void nvmet_auth_insert_psk(struct nvmet_sq *sq)
|
||||
return;
|
||||
}
|
||||
ret = nvme_auth_generate_digest(sq->ctrl->shash_id, psk, psk_len,
|
||||
sq->ctrl->subsysnqn,
|
||||
sq->ctrl->subsys->subsysnqn,
|
||||
sq->ctrl->hostnqn, &digest);
|
||||
if (ret) {
|
||||
pr_warn("%s: ctrl %d qid %d failed to generate digest, error %d\n",
|
||||
@@ -589,8 +589,10 @@ void nvmet_auth_insert_psk(struct nvmet_sq *sq)
|
||||
goto out_free_digest;
|
||||
}
|
||||
#ifdef CONFIG_NVME_TARGET_TCP_TLS
|
||||
tls_key = nvme_tls_psk_refresh(NULL, sq->ctrl->hostnqn, sq->ctrl->subsysnqn,
|
||||
sq->ctrl->shash_id, tls_psk, psk_len, digest);
|
||||
tls_key = nvme_tls_psk_refresh(NULL, sq->ctrl->hostnqn,
|
||||
sq->ctrl->subsys->subsysnqn,
|
||||
sq->ctrl->shash_id, tls_psk, psk_len,
|
||||
digest);
|
||||
if (IS_ERR(tls_key)) {
|
||||
pr_warn("%s: ctrl %d qid %d failed to refresh key, error %ld\n",
|
||||
__func__, sq->ctrl->cntlid, sq->qid, PTR_ERR(tls_key));
|
||||
|
||||
@@ -1628,7 +1628,6 @@ struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args)
|
||||
INIT_WORK(&ctrl->fatal_err_work, nvmet_fatal_error_handler);
|
||||
INIT_DELAYED_WORK(&ctrl->ka_work, nvmet_keep_alive_timer);
|
||||
|
||||
memcpy(ctrl->subsysnqn, args->subsysnqn, NVMF_NQN_SIZE);
|
||||
memcpy(ctrl->hostnqn, args->hostnqn, NVMF_NQN_SIZE);
|
||||
|
||||
kref_init(&ctrl->ref);
|
||||
|
||||
@@ -284,7 +284,6 @@ struct nvmet_ctrl {
|
||||
__le32 *changed_ns_list;
|
||||
u32 nr_changed_ns;
|
||||
|
||||
char subsysnqn[NVMF_NQN_FIELD_LEN];
|
||||
char hostnqn[NVMF_NQN_FIELD_LEN];
|
||||
|
||||
struct device *p2p_client;
|
||||
|
||||
@@ -150,7 +150,7 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)
|
||||
* code path with duplicate ctrl subsysnqn. In order to prevent that we
|
||||
* mask the passthru-ctrl subsysnqn with the target ctrl subsysnqn.
|
||||
*/
|
||||
memcpy(id->subnqn, ctrl->subsysnqn, sizeof(id->subnqn));
|
||||
memcpy(id->subnqn, ctrl->subsys->subsysnqn, sizeof(id->subnqn));
|
||||
|
||||
/* use fabric id-ctrl values */
|
||||
id->ioccsz = cpu_to_le32((sizeof(struct nvme_command) +
|
||||
|
||||
Reference in New Issue
Block a user