Print this page
XXXX introduce drv_sectohz


 664 {
 665         tavor_state_t           *state = (tavor_state_t *)arg;
 666         tavor_ks_info_t         *ksi = state->ts_ks_info;
 667         uint_t                  i;
 668 
 669         mutex_enter(&ksi->tki_perfcntr64_lock);
 670         /*
 671          * Every one second update the values 64 bit software counters
 672          * for all ports. Exit if TAVOR_PERFCNTR64_THREAD_EXIT flag is set.
 673          */
 674         while (!(ksi->tki_perfcntr64_flags & TAVOR_PERFCNTR64_THREAD_EXIT)) {
 675                 for (i = 0; i < state->ts_cfg_profile->cp_num_ports; i++) {
 676                         if (ksi->tki_perfcntr64[i].tki64_enabled) {
 677                                 (void) tavor_kstat_perfcntr64_read(state,
 678                                     i + 1, 1);
 679                         }
 680                 }
 681                 /* sleep for a second */
 682                 (void) cv_timedwait(&ksi->tki_perfcntr64_cv,
 683                     &ksi->tki_perfcntr64_lock,
 684                     ddi_get_lbolt() + drv_usectohz(1000000));
 685         }
 686         ksi->tki_perfcntr64_flags = 0;
 687         mutex_exit(&ksi->tki_perfcntr64_lock);
 688 }
 689 
 690 /*
 691  * tavor_kstat_perfcntr64_thread_create()
 692  *    Context: Called from the kstat context
 693  *
 694  * Create a thread that maintains 64 bit performance counters in software.
 695  */
 696 static void
 697 tavor_kstat_perfcntr64_thread_create(tavor_state_t *state)
 698 {
 699         tavor_ks_info_t *ksi = state->ts_ks_info;
 700         kthread_t               *thr;
 701 
 702         ASSERT(MUTEX_HELD(&ksi->tki_perfcntr64_lock));
 703 
 704         /*




 664 {
 665         tavor_state_t           *state = (tavor_state_t *)arg;
 666         tavor_ks_info_t         *ksi = state->ts_ks_info;
 667         uint_t                  i;
 668 
 669         mutex_enter(&ksi->tki_perfcntr64_lock);
 670         /*
 671          * Every one second update the values 64 bit software counters
 672          * for all ports. Exit if TAVOR_PERFCNTR64_THREAD_EXIT flag is set.
 673          */
 674         while (!(ksi->tki_perfcntr64_flags & TAVOR_PERFCNTR64_THREAD_EXIT)) {
 675                 for (i = 0; i < state->ts_cfg_profile->cp_num_ports; i++) {
 676                         if (ksi->tki_perfcntr64[i].tki64_enabled) {
 677                                 (void) tavor_kstat_perfcntr64_read(state,
 678                                     i + 1, 1);
 679                         }
 680                 }
 681                 /* sleep for a second */
 682                 (void) cv_timedwait(&ksi->tki_perfcntr64_cv,
 683                     &ksi->tki_perfcntr64_lock,
 684                     ddi_get_lbolt() + drv_sectohz(1));
 685         }
 686         ksi->tki_perfcntr64_flags = 0;
 687         mutex_exit(&ksi->tki_perfcntr64_lock);
 688 }
 689 
 690 /*
 691  * tavor_kstat_perfcntr64_thread_create()
 692  *    Context: Called from the kstat context
 693  *
 694  * Create a thread that maintains 64 bit performance counters in software.
 695  */
 696 static void
 697 tavor_kstat_perfcntr64_thread_create(tavor_state_t *state)
 698 {
 699         tavor_ks_info_t *ksi = state->ts_ks_info;
 700         kthread_t               *thr;
 701 
 702         ASSERT(MUTEX_HELD(&ksi->tki_perfcntr64_lock));
 703 
 704         /*