Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/fcoe/fcoe.c
          +++ new/usr/src/uts/common/io/fcoe/fcoe.c
↓ open down ↓ 1144 lines elided ↑ open up ↑
1145 1145          return (crc == crc_from_frame ? FCOE_SUCCESS : FCOE_FAILURE);
1146 1146  }
1147 1147  
1148 1148  static void
1149 1149  fcoe_worker_frame(void *arg)
1150 1150  {
1151 1151          fcoe_worker_t   *w = (fcoe_worker_t *)arg;
1152 1152          fcoe_i_frame_t  *fmi;
1153 1153          int             ret;
1154 1154  
1155      -        atomic_add_32(&fcoe_nworkers_running, 1);
     1155 +        atomic_inc_32(&fcoe_nworkers_running);
1156 1156          mutex_enter(&w->worker_lock);
1157 1157          w->worker_flags |= FCOE_WORKER_STARTED | FCOE_WORKER_ACTIVE;
1158 1158          while ((w->worker_flags & FCOE_WORKER_TERMINATE) == 0) {
1159 1159                  /*
1160 1160                   * loop through the frames
1161 1161                   */
1162 1162                  while (fmi = list_head(&w->worker_frm_list)) {
1163 1163                          list_remove(&w->worker_frm_list, fmi);
1164 1164                          mutex_exit(&w->worker_lock);
1165 1165                          /*
↓ open down ↓ 8 lines elided ↑ open up ↑
1174 1174                          }
1175 1175                          mutex_enter(&w->worker_lock);
1176 1176                          w->worker_ntasks--;
1177 1177                  }
1178 1178                  w->worker_flags &= ~FCOE_WORKER_ACTIVE;
1179 1179                  cv_wait(&w->worker_cv, &w->worker_lock);
1180 1180                  w->worker_flags |= FCOE_WORKER_ACTIVE;
1181 1181          }
1182 1182          w->worker_flags &= ~(FCOE_WORKER_STARTED | FCOE_WORKER_ACTIVE);
1183 1183          mutex_exit(&w->worker_lock);
1184      -        atomic_add_32(&fcoe_nworkers_running, -1);
     1184 +        atomic_dec_32(&fcoe_nworkers_running);
1185 1185          list_destroy(&w->worker_frm_list);
1186 1186  }
1187 1187  
1188 1188  void
1189 1189  fcoe_post_frame(fcoe_frame_t *frm)
1190 1190  {
1191 1191          fcoe_worker_t *w;
1192 1192          uint16_t        oxid = FRM_OXID(frm);
1193 1193  
1194 1194          w = &fcoe_workers[oxid % fcoe_nworkers_running];
↓ open down ↓ 115 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX