mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
module: icp: spi: remove crypto_{provider,op}_notification()
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12901
This commit is contained in:
parent
4759342a5e
commit
9cdf015d0a
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user