From 9cdf015d0a1713c213f1bd5cbda956995a79c74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 22 Dec 2021 21:55:37 +0100 Subject: [PATCH] module: icp: spi: remove crypto_{provider,op}_notification() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #12901 --- module/icp/core/kcf_mech_tabs.c | 1 - module/icp/include/sys/crypto/spi.h | 2 - module/icp/spi/kcf_spi.c | 136 ---------------------------- 3 files changed, 139 deletions(-) diff --git a/module/icp/core/kcf_mech_tabs.c b/module/icp/core/kcf_mech_tabs.c index 60055e78af..9df5f0734a 100644 --- a/module/icp/core/kcf_mech_tabs.c +++ b/module/icp/core/kcf_mech_tabs.c @@ -769,7 +769,6 @@ kcf_get_mech_entry(crypto_mech_type_t mech_type, kcf_mech_entry_t **mep) return (KCF_SUCCESS); } -/* CURRENTLY UNSUPPORTED: attempting to load the module if it isn't found */ /* * Lookup the hash table for an entry that matches the mechname. * If there are no hardware or software providers for the mechanism, diff --git a/module/icp/include/sys/crypto/spi.h b/module/icp/include/sys/crypto/spi.h index 0f1b455c80..8938b25ea6 100644 --- a/module/icp/include/sys/crypto/spi.h +++ b/module/icp/include/sys/crypto/spi.h @@ -714,8 +714,6 @@ typedef struct crypto_provider_info { extern int crypto_register_provider(const crypto_provider_info_t *, crypto_kcf_provider_handle_t *); extern int crypto_unregister_provider(crypto_kcf_provider_handle_t); -extern void crypto_provider_notification(crypto_kcf_provider_handle_t, uint_t); -extern void crypto_op_notification(crypto_req_handle_t, int); extern int crypto_kmflag(crypto_req_handle_t); diff --git a/module/icp/spi/kcf_spi.c b/module/icp/spi/kcf_spi.c index 25fe9b5b66..e6b8e29a1d 100644 --- a/module/icp/spi/kcf_spi.c +++ b/module/icp/spi/kcf_spi.c @@ -402,142 +402,6 @@ crypto_unregister_provider(crypto_kcf_provider_handle_t handle) return (CRYPTO_SUCCESS); } -/* - * This routine is used to notify the framework that the state of - * a cryptographic provider has changed. Valid state codes are: - * - * CRYPTO_PROVIDER_READY - * The provider indicates that it can process more requests. A provider - * will notify with this event if it previously has notified us with a - * CRYPTO_PROVIDER_BUSY. - * - * CRYPTO_PROVIDER_BUSY - * The provider can not take more requests. - * - * CRYPTO_PROVIDER_FAILED - * The provider encountered an internal error. The framework will not - * be sending any more requests to the provider. The provider may notify - * with a CRYPTO_PROVIDER_READY, if it is able to recover from the error. - * - * This routine can be called from user or interrupt context. - */ -void -crypto_provider_notification(crypto_kcf_provider_handle_t handle, uint_t state) -{ - kcf_provider_desc_t *pd; - - /* lookup the provider from the given handle */ - if ((pd = kcf_prov_tab_lookup((crypto_provider_id_t)handle)) == NULL) - return; - - mutex_enter(&pd->pd_lock); - - if (pd->pd_state <= KCF_PROV_VERIFICATION_FAILED) - goto out; - - if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) { - cmn_err(CE_WARN, "crypto_provider_notification: " - "logical provider (%x) ignored\n", handle); - goto out; - } - switch (state) { - case CRYPTO_PROVIDER_READY: - switch (pd->pd_state) { - case KCF_PROV_BUSY: - pd->pd_state = KCF_PROV_READY; - /* - * Signal the per-provider taskq threads that they - * can start submitting requests. - */ - cv_broadcast(&pd->pd_resume_cv); - break; - - case KCF_PROV_FAILED: - /* - * The provider recovered from the error. Let us - * use it now. - */ - pd->pd_state = KCF_PROV_READY; - break; - default: - break; - } - break; - - case CRYPTO_PROVIDER_BUSY: - switch (pd->pd_state) { - case KCF_PROV_READY: - pd->pd_state = KCF_PROV_BUSY; - break; - default: - break; - } - break; - - case CRYPTO_PROVIDER_FAILED: - /* - * We note the failure and return. The per-provider taskq - * threads check this flag and start failing the - * requests, if it is set. See process_req_hwp() for details. - */ - switch (pd->pd_state) { - case KCF_PROV_READY: - pd->pd_state = KCF_PROV_FAILED; - break; - - case KCF_PROV_BUSY: - pd->pd_state = KCF_PROV_FAILED; - /* - * The per-provider taskq threads may be waiting. We - * signal them so that they can start failing requests. - */ - cv_broadcast(&pd->pd_resume_cv); - break; - default: - break; - } - break; - default: - break; - } -out: - mutex_exit(&pd->pd_lock); - KCF_PROV_REFRELE(pd); -} - -/* - * This routine is used to notify the framework the result of - * an asynchronous request handled by a provider. Valid error - * codes are the same as the CRYPTO_* errors defined in common.h. - * - * This routine can be called from user or interrupt context. - */ -void -crypto_op_notification(crypto_req_handle_t handle, int error) -{ - kcf_call_type_t ctype; - - if (handle == NULL) - return; - - if ((ctype = GET_REQ_TYPE(handle)) == CRYPTO_SYNCH) { - kcf_sreq_node_t *sreq = (kcf_sreq_node_t *)handle; - - if (error != CRYPTO_SUCCESS) - sreq->sn_provider->pd_sched_info.ks_nfails++; - KCF_PROV_IREFRELE(sreq->sn_provider); - kcf_sop_done(sreq, error); - } else { - kcf_areq_node_t *areq = (kcf_areq_node_t *)handle; - - ASSERT(ctype == CRYPTO_ASYNCH); - if (error != CRYPTO_SUCCESS) - areq->an_provider->pd_sched_info.ks_nfails++; - KCF_PROV_IREFRELE(areq->an_provider); - kcf_aop_done(areq, error); - } -} - /* * This routine is used by software providers to determine * whether to use KM_SLEEP or KM_NOSLEEP during memory allocation.