Print this page
XXXX introduce drv_sectohz


 497         /* remove provider from providers table */
 498         if (kcf_prov_tab_rem_provider((crypto_provider_id_t)handle) !=
 499             CRYPTO_SUCCESS) {
 500                 /* Release reference held by kcf_prov_tab_lookup(). */
 501                 KCF_PROV_REFRELE(desc);
 502                 ret = CRYPTO_UNKNOWN_PROVIDER;
 503                 goto errormsg;
 504         }
 505 
 506         delete_kstat(desc);
 507 
 508         if (desc->pd_prov_type == CRYPTO_SW_PROVIDER) {
 509                 /*
 510                  * Wait till the existing requests with the provider complete
 511                  * and all the holds are released. All the holds on a software
 512                  * provider are from kernel clients and the hold time
 513                  * is expected to be short. So, we won't be stuck here forever.
 514                  */
 515                 while (kcf_get_refcnt(desc, B_TRUE) > 1) {
 516                         /* wait 1 second and try again. */
 517                         delay(1 * drv_usectohz(1000000));
 518                 }
 519         } else {
 520                 int i;
 521                 kcf_prov_cpu_t *mp;
 522 
 523                 /*
 524                  * Wait until requests that have been sent to the provider
 525                  * complete.
 526                  */
 527                 for (i = 0; i < desc->pd_nbins; i++) {
 528                         mp = &(desc->pd_percpu_bins[i]);
 529 
 530                         mutex_enter(&mp->kp_lock);
 531                         while (mp->kp_jobcnt > 0) {
 532                                 cv_wait(&mp->kp_cv, &mp->kp_lock);
 533                         }
 534                         mutex_exit(&mp->kp_lock);
 535                 }
 536         }
 537 




 497         /* remove provider from providers table */
 498         if (kcf_prov_tab_rem_provider((crypto_provider_id_t)handle) !=
 499             CRYPTO_SUCCESS) {
 500                 /* Release reference held by kcf_prov_tab_lookup(). */
 501                 KCF_PROV_REFRELE(desc);
 502                 ret = CRYPTO_UNKNOWN_PROVIDER;
 503                 goto errormsg;
 504         }
 505 
 506         delete_kstat(desc);
 507 
 508         if (desc->pd_prov_type == CRYPTO_SW_PROVIDER) {
 509                 /*
 510                  * Wait till the existing requests with the provider complete
 511                  * and all the holds are released. All the holds on a software
 512                  * provider are from kernel clients and the hold time
 513                  * is expected to be short. So, we won't be stuck here forever.
 514                  */
 515                 while (kcf_get_refcnt(desc, B_TRUE) > 1) {
 516                         /* wait 1 second and try again. */
 517                         delay(drv_sectohz(1));
 518                 }
 519         } else {
 520                 int i;
 521                 kcf_prov_cpu_t *mp;
 522 
 523                 /*
 524                  * Wait until requests that have been sent to the provider
 525                  * complete.
 526                  */
 527                 for (i = 0; i < desc->pd_nbins; i++) {
 528                         mp = &(desc->pd_percpu_bins[i]);
 529 
 530                         mutex_enter(&mp->kp_lock);
 531                         while (mp->kp_jobcnt > 0) {
 532                                 cv_wait(&mp->kp_cv, &mp->kp_lock);
 533                         }
 534                         mutex_exit(&mp->kp_lock);
 535                 }
 536         }
 537