Print this page
XXXX introduce drv_sectohz

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/rpc/clnt_cots.c
          +++ new/usr/src/uts/common/rpc/clnt_cots.c
↓ open down ↓ 979 lines elided ↑ open up ↑
 980  980                           * on the side of caution. If we got here then
 981  981                           * status could have been RPC_SUCCESS, but we
 982  982                           * know that we did not get a connection, so
 983  983                           * force the rpc status to RPC_CANTCONNECT.
 984  984                           */
 985  985                          p->cku_err.re_status = RPC_CANTCONNECT;
 986  986                          p->cku_err.re_errno = EIO;
 987  987                          break;
 988  988                  }
 989  989                  if (delay_first == TRUE)
 990      -                        ticks = clnt_cots_min_tout * drv_usectohz(1000000);
      990 +                        ticks = drv_sectohz(clnt_cots_min_tout);
 991  991                  goto cots_done;
 992  992          }
 993  993  
 994  994          /*
 995  995           * If we've never sent any request on this connection (send count
 996  996           * is zero, or the connection has been reset), cache the
 997  997           * the connection's create time and send a request (possibly a retry)
 998  998           */
 999  999          if ((p->cku_flags & CKU_SENT) == 0 ||
1000 1000              p->cku_ctime != cm_entry->x_ctime) {
↓ open down ↓ 111 lines elided ↑ open up ↑
1112 1112                   * QFULL condition, allow some time for queue to drain
1113 1113                   * and try again. Give up after waiting for all timeout
1114 1114                   * specified for the call, or zone is going away.
1115 1115                   */
1116 1116                  max_waitsecs = wait.tv_sec ? wait.tv_sec : clnt_cots_min_tout;
1117 1117                  if ((waitsecs++ < max_waitsecs) &&
1118 1118                      !(zone_status_get(curproc->p_zone) >=
1119 1119                      ZONE_IS_SHUTTING_DOWN)) {
1120 1120  
1121 1121                          /* wait 1 sec for queue to drain */
1122      -                        if (clnt_delay(drv_usectohz(1000000),
     1122 +                        if (clnt_delay(drv_sectohz(1),
1123 1123                              h->cl_nosignal) == EINTR) {
1124 1124                                  p->cku_err.re_errno = EINTR;
1125 1125                                  p->cku_err.re_status = RPC_INTR;
1126 1126  
1127 1127                                  goto cots_done;
1128 1128                          }
1129 1129  
1130 1130                          /* and try again */
1131 1131                          goto dispatch_again;
1132 1132                  }
↓ open down ↓ 43 lines elided ↑ open up ↑
1176 1176                  clock_t cv_wait_ret;
1177 1177                  clock_t timout;
1178 1178                  clock_t oldlbolt;
1179 1179  
1180 1180                  klwp_t *lwp = ttolwp(curthread);
1181 1181  
1182 1182                  if (lwp != NULL)
1183 1183                          lwp->lwp_nostop++;
1184 1184  
1185 1185                  oldlbolt = ddi_get_lbolt();
1186      -                timout = wait.tv_sec * drv_usectohz(1000000) +
     1186 +                timout = drv_sectohz(wait.tv_sec) +
1187 1187                      drv_usectohz(wait.tv_usec) + oldlbolt;
1188 1188                  /*
1189 1189                   * Iterate until the call_status is changed to something
1190 1190                   * other that RPC_TIMEDOUT, or if cv_timedwait_sig() returns
1191 1191                   * something <=0 zero. The latter means that we timed
1192 1192                   * out.
1193 1193                   */
1194 1194                  if (h->cl_nosignal)
1195 1195                          while ((cv_wait_ret = cv_timedwait(&call->call_cv,
1196 1196                              &call->call_lock, timout)) > 0 &&
↓ open down ↓ 28 lines elided ↑ open up ↑
1225 1225                           * try to call us again and thus force the
1226 1226                           * same condition that got us here (such
1227 1227                           * as a RPC_XPRTFAILED due to the server not
1228 1228                           * listening on the end-point.
1229 1229                           */
1230 1230                          if (call->call_status != RPC_SUCCESS) {
1231 1231                                  clock_t curlbolt;
1232 1232                                  clock_t diff;
1233 1233  
1234 1234                                  curlbolt = ddi_get_lbolt();
1235      -                                ticks = clnt_cots_min_tout *
1236      -                                    drv_usectohz(1000000);
     1235 +                                ticks = drv_sectohz(clnt_cots_min_tout);
1237 1236                                  diff = curlbolt - oldlbolt;
1238 1237                                  if (diff < ticks) {
1239 1238                                          delay_first = TRUE;
1240 1239                                          if (diff > 0)
1241 1240                                                  ticks -= diff;
1242 1241                                  }
1243 1242                          }
1244 1243                          break;
1245 1244                  }
1246 1245  
↓ open down ↓ 461 lines elided ↑ open up ↑
1708 1707          interrupted = FALSE;
1709 1708  
1710 1709          old_state = cm_entry->x_state_flags;
1711 1710          /*
1712 1711           * Now loop until cv_timedwait{_sig} returns because of
1713 1712           * a signal(0) or timeout(-1) or cv_signal(>0). But it may be
1714 1713           * cv_signalled for various other reasons too. So loop
1715 1714           * until there is a state change on the connection.
1716 1715           */
1717 1716  
1718      -        timout = waitp->tv_sec * drv_usectohz(1000000) +
     1717 +        timout = drv_sectohz(waitp->tv_sec) +
1719 1718              drv_usectohz(waitp->tv_usec) + ddi_get_lbolt();
1720 1719  
1721 1720          if (nosignal) {
1722 1721                  while ((cv_stat = cv_timedwait(&cm_entry->x_conn_cv,
1723 1722                      &connmgr_lock, timout)) > 0 &&
1724 1723                      cm_entry->x_state_flags == old_state)
1725 1724                          ;
1726 1725          } else {
1727 1726                  while ((cv_stat = cv_timedwait_sig(&cm_entry->x_conn_cv,
1728 1727                      &connmgr_lock, timout)) > 0 &&
↓ open down ↓ 617 lines elided ↑ open up ↑
2346 2345          } else {
2347 2346                  bool_t connected;
2348 2347                  calllist_t call;
2349 2348  
2350 2349                  cm_entry->x_thread = TRUE;
2351 2350  
2352 2351                  while (cm_entry->x_needrel == TRUE) {
2353 2352                          cm_entry->x_needrel = FALSE;
2354 2353  
2355 2354                          connmgr_sndrel(cm_entry);
2356      -                        delay(drv_usectohz(1000000));
     2355 +                        delay(drv_sectohz(1));
2357 2356  
2358 2357                          mutex_enter(&connmgr_lock);
2359 2358                  }
2360 2359  
2361 2360                  /*
2362 2361                   * If we need to send a T_DISCON_REQ, send one.
2363 2362                   */
2364 2363                  connmgr_dis_and_wait(cm_entry);
2365 2364  
2366 2365                  mutex_exit(&connmgr_lock);
↓ open down ↓ 95 lines elided ↑ open up ↑
2462 2461                          mutex_enter(&connmgr_lock);
2463 2462                  }
2464 2463  
2465 2464                  if (cm_entry->x_waitdis == TRUE) {
2466 2465                          clock_t timout;
2467 2466  
2468 2467                          RPCLOG(8, "connmgr_dis_and_wait waiting for "
2469 2468                              "T_DISCON_REQ's ACK for connection %p\n",
2470 2469                              (void *)cm_entry);
2471 2470  
2472      -                        timout = clnt_cots_min_conntout * drv_usectohz(1000000);
     2471 +                        timout = drv_sectohz(clnt_cots_min_conntout);
2473 2472  
2474 2473                          /*
2475 2474                           * The TPI spec says that the T_DISCON_REQ
2476 2475                           * will get acknowledged, but in practice
2477 2476                           * the ACK may never get sent. So don't
2478 2477                           * block forever.
2479 2478                           */
2480 2479                          (void) cv_reltimedwait(&cm_entry->x_dis_cv,
2481 2480                              &connmgr_lock, timout, TR_CLOCK_TICK);
2482 2481                  }
↓ open down ↓ 1218 lines elided ↑ open up ↑
3701 3700  waitforack(calllist_t *e, t_scalar_t ack_prim, const struct timeval *waitp,
3702 3701      bool_t nosignal)
3703 3702  {
3704 3703          union T_primitives *tpr;
3705 3704          clock_t timout;
3706 3705          int cv_stat = 1;
3707 3706  
3708 3707          ASSERT(MUTEX_HELD(&clnt_pending_lock));
3709 3708          while (e->call_reply == NULL) {
3710 3709                  if (waitp != NULL) {
3711      -                        timout = waitp->tv_sec * drv_usectohz(MICROSEC) +
     3710 +                        timout = drv_sectohz(waitp->tv_sec) +
3712 3711                              drv_usectohz(waitp->tv_usec);
3713 3712                          if (nosignal)
3714 3713                                  cv_stat = cv_reltimedwait(&e->call_cv,
3715 3714                                      &clnt_pending_lock, timout, TR_CLOCK_TICK);
3716 3715                          else
3717 3716                                  cv_stat = cv_reltimedwait_sig(&e->call_cv,
3718 3717                                      &clnt_pending_lock, timout, TR_CLOCK_TICK);
3719 3718                  } else {
3720 3719                          if (nosignal)
3721 3720                                  cv_wait(&e->call_cv, &clnt_pending_lock);
↓ open down ↓ 29 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX