Print this page
XXXX introduce drv_sectohz


 637          */
 638         if (ulp_info->ulp_rev != FCTL_ULP_MODREV_4) {
 639                 cmn_err(CE_WARN, "fctl: ULP %s version mismatch;"
 640                     " ULP %s would not be loaded", ulp_info->ulp_name,
 641                     ulp_info->ulp_name);
 642                 return (FC_BADULP);
 643         }
 644 
 645         new = kmem_zalloc(sizeof (*new), KM_SLEEP);
 646         ASSERT(new != NULL);
 647 
 648         mutex_enter(&fctl_ulp_list_mutex);
 649         new->ulp_info = ulp_info;
 650         if (fctl_ulp_list != NULL) {
 651                 new->ulp_next = fctl_ulp_list;
 652         }
 653         fctl_ulp_list = new;
 654         mutex_exit(&fctl_ulp_list_mutex);
 655 
 656         while (rw_tryenter(&fctl_ulp_lock, RW_WRITER) == 0) {
 657                 delay(drv_usectohz(1000000));
 658                 if (ntry++ > FC_ULP_ADD_RETRY_COUNT) {
 659                         fc_ulp_list_t   *list;
 660                         fc_ulp_list_t   *last;
 661                         mutex_enter(&fctl_ulp_list_mutex);
 662                         for (last = NULL, list = fctl_ulp_list; list != NULL;
 663                             list = list->ulp_next) {
 664                                 if (list->ulp_info == ulp_info) {
 665                                         break;
 666                                 }
 667                                 last = list;
 668                         }
 669 
 670                         if (list) {
 671                                 if (last) {
 672                                         last->ulp_next = list->ulp_next;
 673                                 } else {
 674                                         fctl_ulp_list = list->ulp_next;
 675                                 }
 676                                 kmem_free(list, sizeof (*list));
 677                         }




 637          */
 638         if (ulp_info->ulp_rev != FCTL_ULP_MODREV_4) {
 639                 cmn_err(CE_WARN, "fctl: ULP %s version mismatch;"
 640                     " ULP %s would not be loaded", ulp_info->ulp_name,
 641                     ulp_info->ulp_name);
 642                 return (FC_BADULP);
 643         }
 644 
 645         new = kmem_zalloc(sizeof (*new), KM_SLEEP);
 646         ASSERT(new != NULL);
 647 
 648         mutex_enter(&fctl_ulp_list_mutex);
 649         new->ulp_info = ulp_info;
 650         if (fctl_ulp_list != NULL) {
 651                 new->ulp_next = fctl_ulp_list;
 652         }
 653         fctl_ulp_list = new;
 654         mutex_exit(&fctl_ulp_list_mutex);
 655 
 656         while (rw_tryenter(&fctl_ulp_lock, RW_WRITER) == 0) {
 657                 delay(drv_sectohz(1));
 658                 if (ntry++ > FC_ULP_ADD_RETRY_COUNT) {
 659                         fc_ulp_list_t   *list;
 660                         fc_ulp_list_t   *last;
 661                         mutex_enter(&fctl_ulp_list_mutex);
 662                         for (last = NULL, list = fctl_ulp_list; list != NULL;
 663                             list = list->ulp_next) {
 664                                 if (list->ulp_info == ulp_info) {
 665                                         break;
 666                                 }
 667                                 last = list;
 668                         }
 669 
 670                         if (list) {
 671                                 if (last) {
 672                                         last->ulp_next = list->ulp_next;
 673                                 } else {
 674                                         fctl_ulp_list = list->ulp_next;
 675                                 }
 676                                 kmem_free(list, sizeof (*list));
 677                         }