3329 while (iscsit_rxpdu_queue_monitor_thr_running) {
3330 ISCSIT_GLOBAL_LOCK(RW_READER);
3331 for (tgt = avl_first(&iscsit_global.global_target_list);
3332 tgt != NULL;
3333 tgt = AVL_NEXT(&iscsit_global.global_target_list, tgt)) {
3334 mutex_enter(&tgt->target_mutex);
3335 for (ist = avl_first(&tgt->target_sess_list);
3336 ist != NULL;
3337 ist = AVL_NEXT(&tgt->target_sess_list, ist)) {
3338
3339 iscsit_rxpdu_queue_monitor_session(ist);
3340 }
3341 mutex_exit(&tgt->target_mutex);
3342 }
3343 ISCSIT_GLOBAL_UNLOCK();
3344 if (iscsit_rxpdu_queue_monitor_thr_running == B_FALSE) {
3345 break;
3346 }
3347 (void) cv_reltimedwait(&iscsit_rxpdu_queue_monitor_cv,
3348 &iscsit_rxpdu_queue_monitor_mutex,
3349 ISCSIT_RXPDU_QUEUE_MONITOR_INTERVAL * drv_usectohz(1000000),
3350 TR_CLOCK_TICK);
3351 }
3352 mutex_exit(&iscsit_rxpdu_queue_monitor_mutex);
3353 thread_exit();
3354 }
3355
3356 static void
3357 iscsit_rxpdu_queue_monitor_session(iscsit_sess_t *ist)
3358 {
3359 iscsit_cbuf_t *cbuf = ist->ist_rxpdu_queue;
3360 idm_pdu_t *next_pdu = NULL;
3361 uint32_t index, next_cmdsn, i;
3362
3363 /*
3364 * Assume that all PDUs in the staging queue have a cmdsn >= expcmdsn.
3365 * Starting with the expcmdsn, iterate over the staged PDUs to find
3366 * the next PDU with a wait time greater than the threshold. If found
3367 * advance the staged PDU to the SCSI layer, skipping over the missing
3368 * PDU(s) to get past the hole in the command sequence. It is up to
3369 * the initiator to note that the target has not acknowledged a cmdsn
|
3329 while (iscsit_rxpdu_queue_monitor_thr_running) {
3330 ISCSIT_GLOBAL_LOCK(RW_READER);
3331 for (tgt = avl_first(&iscsit_global.global_target_list);
3332 tgt != NULL;
3333 tgt = AVL_NEXT(&iscsit_global.global_target_list, tgt)) {
3334 mutex_enter(&tgt->target_mutex);
3335 for (ist = avl_first(&tgt->target_sess_list);
3336 ist != NULL;
3337 ist = AVL_NEXT(&tgt->target_sess_list, ist)) {
3338
3339 iscsit_rxpdu_queue_monitor_session(ist);
3340 }
3341 mutex_exit(&tgt->target_mutex);
3342 }
3343 ISCSIT_GLOBAL_UNLOCK();
3344 if (iscsit_rxpdu_queue_monitor_thr_running == B_FALSE) {
3345 break;
3346 }
3347 (void) cv_reltimedwait(&iscsit_rxpdu_queue_monitor_cv,
3348 &iscsit_rxpdu_queue_monitor_mutex,
3349 drv_sectohz(ISCSIT_RXPDU_QUEUE_MONITOR_INTERVAL),
3350 TR_CLOCK_TICK);
3351 }
3352 mutex_exit(&iscsit_rxpdu_queue_monitor_mutex);
3353 thread_exit();
3354 }
3355
3356 static void
3357 iscsit_rxpdu_queue_monitor_session(iscsit_sess_t *ist)
3358 {
3359 iscsit_cbuf_t *cbuf = ist->ist_rxpdu_queue;
3360 idm_pdu_t *next_pdu = NULL;
3361 uint32_t index, next_cmdsn, i;
3362
3363 /*
3364 * Assume that all PDUs in the staging queue have a cmdsn >= expcmdsn.
3365 * Starting with the expcmdsn, iterate over the staged PDUs to find
3366 * the next PDU with a wait time greater than the threshold. If found
3367 * advance the staged PDU to the SCSI layer, skipping over the missing
3368 * PDU(s) to get past the hole in the command sequence. It is up to
3369 * the initiator to note that the target has not acknowledged a cmdsn
|