Print this page
XXXX introduce drv_sectohz


 162 
 163 /*
 164  * Thread to setup switching mode. This thread is created during vsw_attach()
 165  * initially. It invokes vsw_setup_switching() and keeps retrying while the
 166  * returned value is EAGAIN. The thread exits when the switching mode setup is
 167  * done successfully or when the error returned is not EAGAIN. This thread may
 168  * also get created from vsw_update_md_prop() if the switching mode needs to be
 169  * updated.
 170  */
 171 void
 172 vsw_setup_switching_thread(void *arg)
 173 {
 174         callb_cpr_t     cprinfo;
 175         vsw_t           *vswp =  (vsw_t *)arg;
 176         clock_t         wait_time;
 177         clock_t         xwait;
 178         clock_t         wait_rv;
 179         int             rv;
 180 
 181         /* wait time used on successive retries */
 182         xwait = drv_usectohz(vsw_setup_switching_delay * MICROSEC);
 183 
 184         CALLB_CPR_INIT(&cprinfo, &vswp->sw_thr_lock, callb_generic_cpr,
 185             "vsw_setup_sw_thread");
 186 
 187         mutex_enter(&vswp->sw_thr_lock);
 188 
 189         while ((vswp->sw_thr_flags & VSW_SWTHR_STOP) == 0) {
 190 
 191                 CALLB_CPR_SAFE_BEGIN(&cprinfo);
 192 
 193                 /* Wait for sometime before (re)trying setup_switching() */
 194                 wait_time = ddi_get_lbolt() + xwait;
 195                 while ((vswp->sw_thr_flags & VSW_SWTHR_STOP) == 0) {
 196                         wait_rv = cv_timedwait(&vswp->sw_thr_cv,
 197                             &vswp->sw_thr_lock, wait_time);
 198                         if (wait_rv == -1) {    /* timed out */
 199                                 break;
 200                         }
 201                 }
 202 




 162 
 163 /*
 164  * Thread to setup switching mode. This thread is created during vsw_attach()
 165  * initially. It invokes vsw_setup_switching() and keeps retrying while the
 166  * returned value is EAGAIN. The thread exits when the switching mode setup is
 167  * done successfully or when the error returned is not EAGAIN. This thread may
 168  * also get created from vsw_update_md_prop() if the switching mode needs to be
 169  * updated.
 170  */
 171 void
 172 vsw_setup_switching_thread(void *arg)
 173 {
 174         callb_cpr_t     cprinfo;
 175         vsw_t           *vswp =  (vsw_t *)arg;
 176         clock_t         wait_time;
 177         clock_t         xwait;
 178         clock_t         wait_rv;
 179         int             rv;
 180 
 181         /* wait time used on successive retries */
 182         xwait = drv_sectohz(vsw_setup_switching_delay);
 183 
 184         CALLB_CPR_INIT(&cprinfo, &vswp->sw_thr_lock, callb_generic_cpr,
 185             "vsw_setup_sw_thread");
 186 
 187         mutex_enter(&vswp->sw_thr_lock);
 188 
 189         while ((vswp->sw_thr_flags & VSW_SWTHR_STOP) == 0) {
 190 
 191                 CALLB_CPR_SAFE_BEGIN(&cprinfo);
 192 
 193                 /* Wait for sometime before (re)trying setup_switching() */
 194                 wait_time = ddi_get_lbolt() + xwait;
 195                 while ((vswp->sw_thr_flags & VSW_SWTHR_STOP) == 0) {
 196                         wait_rv = cv_timedwait(&vswp->sw_thr_cv,
 197                             &vswp->sw_thr_lock, wait_time);
 198                         if (wait_rv == -1) {    /* timed out */
 199                                 break;
 200                         }
 201                 }
 202