Print this page
XXXX introduce drv_sectohz

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.c
          +++ new/usr/src/uts/common/io/comstar/port/iscsit/iscsit_isns.c
↓ open down ↓ 507 lines elided ↑ open up ↑
 508  508                  hostinfo->length = ISCSIT_MAX_HOSTNAME_LEN;
 509  509          isns_eid = kmem_alloc(hostinfo->length, KM_SLEEP);
 510  510          (void) strlcpy(isns_eid, hostinfo->fqhn, hostinfo->length);
 511  511          avl_create(&isns_target_list, isnst_tgt_avl_compare,
 512  512              sizeof (isns_target_t), offsetof(isns_target_t, target_node));
 513  513  
 514  514          /* initialize isns client */
 515  515          mutex_init(&isns_monitor_mutex, NULL, MUTEX_DEFAULT, NULL);
 516  516          mutex_init(&esi.esi_mutex, NULL, MUTEX_DEFAULT, NULL);
 517  517          isns_monitor_thr_id = NULL;
 518      -        monitor_idle_interval = ISNS_IDLE_TIME * drv_usectohz(1000000);
      518 +        monitor_idle_interval = drv_sectohz(ISNS_IDLE_TIME);
 519  519          cv_init(&isns_idle_cv, NULL, CV_DEFAULT, NULL);
 520  520          cv_init(&esi.esi_cv, NULL, CV_DEFAULT, NULL);
 521  521          xid = 0;
 522  522          ISNS_GLOBAL_UNLOCK();
 523  523  
 524  524          return (0);
 525  525  }
 526  526  
 527  527  void
 528  528  iscsit_isns_fini()
↓ open down ↓ 542 lines elided ↑ open up ↑
1071 1071          isns_monitor_thr_running = B_TRUE;
1072 1072          cv_signal(&isns_idle_cv);
1073 1073  
1074 1074          /*
1075 1075           * Start with a short pause (5 sec) to allow all targets
1076 1076           * to be registered before we send register-all.  This is
1077 1077           * purely an optimization to cut down on the number of
1078 1078           * messages we send to the iSNS server.
1079 1079           */
1080 1080          mutex_exit(&isns_monitor_mutex);
1081      -        delay(drv_usectohz(isns_initial_delay * 1000000));
     1081 +        delay(drv_sectohz(isns_initial_delay));
1082 1082          mutex_enter(&isns_monitor_mutex);
1083 1083  
1084 1084          /* Force an initialization of isns_all_portals */
1085 1085          mutex_enter(&iscsit_isns_mutex);
1086 1086          isns_portals_changed = B_TRUE;
1087 1087          mutex_exit(&iscsit_isns_mutex);
1088 1088  
1089 1089          while (isns_monitor_thr_running) {
1090 1090  
1091 1091                  /* Update servers */
↓ open down ↓ 1775 lines elided ↑ open up ↑
2867 2867                  /* receive the payload */
2868 2868                  payload_len = ntohs(tmp_pdu_hdr.payload_len);
2869 2869                  if (payload_len > ISNST_MAX_MSG_SIZE) {
2870 2870                          goto rcv_error;
2871 2871                  }
2872 2872                  payload = kmem_alloc(payload_len, KM_NOSLEEP);
2873 2873                  if (payload == NULL) {
2874 2874                          goto rcv_error;
2875 2875                  }
2876 2876                  rcv_timer = timeout(isnst_so_timeout, so,
2877      -                    drv_usectohz(ISNS_RCV_TIMER_SECONDS * 1000000));
     2877 +                    drv_sectohz(ISNS_RCV_TIMER_SECONDS));
2878 2878                  if (idm_sorecv(so, payload, payload_len) != 0) {
2879 2879                          (void) untimeout(rcv_timer);
2880 2880                          goto rcv_error;
2881 2881                  }
2882 2882                  (void) untimeout(rcv_timer);
2883 2883  
2884 2884                  /* combine the pdu if it is not the first one */
2885 2885                  if (total_pdu_len > 0) {
2886 2886                          combined_len = total_pdu_len + payload_len;
2887 2887                          combined_pdu = kmem_alloc(combined_len, KM_SLEEP);
↓ open down ↓ 190 lines elided ↑ open up ↑
3078 3078  
3079 3079          while (esi.esi_enabled) {
3080 3080                  /*
3081 3081                   * Create a socket to listen for requests from the iSNS server.
3082 3082                   */
3083 3083                  if ((esi.esi_so = idm_socreate(PF_INET6, SOCK_STREAM, 0)) ==
3084 3084                      NULL) {
3085 3085                          ISNST_LOG(CE_WARN,
3086 3086                              "isnst_esi_thread: Unable to create socket");
3087 3087                          mutex_exit(&esi.esi_mutex);
3088      -                        delay(drv_usectohz(1000000));
     3088 +                        delay(drv_sectohz(1));
3089 3089                          mutex_enter(&esi.esi_mutex);
3090 3090                          continue;
3091 3091                  }
3092 3092  
3093 3093                  /*
3094 3094                   * Set options, bind, and listen until we're told to stop
3095 3095                   */
3096 3096                  bzero(&sin6, sizeof (sin6));
3097 3097                  sin6.sin6_family = AF_INET6;
3098 3098                  sin6.sin6_port = htons(0);
3099 3099                  sin6.sin6_addr = in6addr_any;
3100 3100  
3101 3101                  (void) ksocket_setsockopt(esi.esi_so, SOL_SOCKET,
3102 3102                      SO_REUSEADDR, (char *)&on, sizeof (on), CRED());
3103 3103  
3104 3104                  if (ksocket_bind(esi.esi_so, (struct sockaddr *)&sin6,
3105 3105                      sizeof (sin6), CRED()) != 0) {
3106 3106                          ISNST_LOG(CE_WARN, "Unable to bind socket for ESI");
3107 3107                          idm_sodestroy(esi.esi_so);
3108 3108                          mutex_exit(&esi.esi_mutex);
3109      -                        delay(drv_usectohz(1000000));
     3109 +                        delay(drv_sectohz(1));
3110 3110                          mutex_enter(&esi.esi_mutex);
3111 3111                          continue;
3112 3112                  }
3113 3113  
3114 3114                  /*
3115 3115                   * Get the port (sin6 is meaningless at this point)
3116 3116                   */
3117 3117                  (void) ksocket_getsockname(esi.esi_so,
3118 3118                      (struct sockaddr *)(&sin6), &sin_addrlen, CRED());
3119 3119                  esi.esi_port =
3120 3120                      ntohs(((struct sockaddr_in6 *)(&sin6))->sin6_port);
3121 3121  
3122 3122                  if ((rc = ksocket_listen(esi.esi_so, 5, CRED())) != 0) {
3123 3123                          ISNST_LOG(CE_WARN, "isnst_esi_thread: listen "
3124 3124                              "failure 0x%x", rc);
3125 3125                          idm_sodestroy(esi.esi_so);
3126 3126                          mutex_exit(&esi.esi_mutex);
3127      -                        delay(drv_usectohz(1000000));
     3127 +                        delay(drv_sectohz(1));
3128 3128                          mutex_enter(&esi.esi_mutex);
3129 3129                          continue;
3130 3130                  }
3131 3131  
3132 3132                  ksocket_hold(esi.esi_so);
3133 3133                  esi.esi_valid = B_TRUE;
3134 3134                  while (esi.esi_enabled) {
3135 3135                          mutex_exit(&esi.esi_mutex);
3136 3136  
3137 3137                          DTRACE_PROBE3(iscsit__isns__esi__accept__wait,
↓ open down ↓ 562 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX