Lines Matching +full:wake +full:- +full:up

31  * ------------------------------------------------
34 * -----------
36 * This is a general purpose high-performance serialization mechanism
55 * --------------------------
70 * -----------------
96 * --------------
101 * (or TCP Rx ring - to be implemented in future). As part of this
105 * processing so that queue backlog doesn't build up and packet processing
159 ASSERT(MUTEX_HELD(&(sqp)->sq_lock)); \
161 if ((sqp)->sq_last != NULL) \
162 (sqp)->sq_last->b_next = (mp); \
164 (sqp)->sq_first = (mp); \
165 (sqp)->sq_last = (tail); \
166 (sqp)->sq_count += (cnt); \
167 ASSERT((sqp)->sq_count > 0); \
175 * blanked, the soft ring will not send any more packets up.
177 * ring sending packets up. In that case, SQS_POLLING will not be
181 ASSERT(MUTEX_HELD(&(sqp)->sq_lock)); \
184 ASSERT(sqp->sq_state & SQS_POLL_CAPAB); \
185 if (!(sqp->sq_state & SQS_POLLING)) { \
186 if (rx_ring->rr_intr_disable(rx_ring->rr_intr_handle)) \
187 sqp->sq_state |= SQS_POLLING; \
193 ASSERT(MUTEX_HELD(&(sqp)->sq_lock)); \
196 ASSERT(sqp->sq_state & SQS_POLL_CAPAB); \
197 if (sqp->sq_state & SQS_POLLING) { \
198 sqp->sq_state &= ~SQS_POLLING; \
199 rx_ring->rr_intr_enable(rx_ring->rr_intr_handle); \
206 ASSERT(MUTEX_HELD(&(sqp)->sq_lock)); \
207 if (sqp->sq_state & SQS_POLLING) { \
208 ASSERT(sqp->sq_state & SQS_POLL_CAPAB); \
209 if (!(sqp->sq_state & SQS_GET_PKTS)) { \
210 sqp->sq_state |= SQS_GET_PKTS; \
211 cv_signal(&sqp->sq_poll_cv); \
218 (sqp)->sq_curmp = (mp); \
219 (sqp)->sq_curproc = (proc); \
220 (sqp)->sq_connp = (connp); \
221 (mp)->b_tag = (sqp)->sq_tag = (tag); \
225 (sqp)->sq_curmp = NULL; \
226 (sqp)->sq_curproc = NULL; \
227 (sqp)->sq_connp = NULL; \
249 sqp->sq_bind = PBIND_NONE; in squeue_create()
250 sqp->sq_priority = pri; in squeue_create()
251 sqp->sq_worker = thread_create(NULL, 0, squeue_worker, in squeue_create()
254 sqp->sq_poll_thr = thread_create(NULL, 0, squeue_polling_thread, in squeue_create()
257 sqp->sq_enter = squeue_enter; in squeue_create()
258 sqp->sq_drain = squeue_drain; in squeue_create()
265 * If the CPU id value is -1, bind the worker thread to the value
273 mutex_enter(&sqp->sq_lock); in squeue_bind()
274 ASSERT(sqp->sq_bind != PBIND_NONE || bind != PBIND_NONE); in squeue_bind()
277 if (sqp->sq_state & SQS_BOUND) { in squeue_bind()
278 if (sqp->sq_bind == bind) { in squeue_bind()
279 mutex_exit(&sqp->sq_lock); in squeue_bind()
282 thread_affinity_clear(sqp->sq_worker); in squeue_bind()
284 sqp->sq_state |= SQS_BOUND; in squeue_bind()
288 sqp->sq_bind = bind; in squeue_bind()
290 thread_affinity_set(sqp->sq_worker, sqp->sq_bind); in squeue_bind()
291 mutex_exit(&sqp->sq_lock); in squeue_bind()
297 mutex_enter(&sqp->sq_lock); in squeue_unbind()
298 if (!(sqp->sq_state & SQS_BOUND)) { in squeue_unbind()
299 mutex_exit(&sqp->sq_lock); in squeue_unbind()
303 sqp->sq_state &= ~SQS_BOUND; in squeue_unbind()
304 thread_affinity_clear(sqp->sq_worker); in squeue_unbind()
305 mutex_exit(&sqp->sq_lock); in squeue_unbind()
309 * squeue_enter() - enter squeue sqp with mblk mp (which can be
341 ASSERT(MUTEX_NOT_HELD(&sqp->sq_lock)); in squeue_enter()
344 mutex_enter(&sqp->sq_lock); in squeue_enter()
351 if (!(sqp->sq_state & SQS_PROC) && ((process_flag == SQ_PROCESS) || in squeue_enter()
352 (process_flag == SQ_NODRAIN && sqp->sq_first == NULL))) { in squeue_enter()
358 if (sqp->sq_first == NULL && cnt == 1) { in squeue_enter()
360 * Fast-path, ok to process and nothing queued. in squeue_enter()
362 sqp->sq_state |= (SQS_PROC|SQS_FAST); in squeue_enter()
363 sqp->sq_run = curthread; in squeue_enter()
364 mutex_exit(&sqp->sq_lock); in squeue_enter()
370 ASSERT(mp->b_prev != NULL); in squeue_enter()
371 ASSERT(mp->b_queue != NULL); in squeue_enter()
372 connp = (conn_t *)mp->b_prev; in squeue_enter()
373 mp->b_prev = NULL; in squeue_enter()
374 proc = (sqproc_t)mp->b_queue; in squeue_enter()
375 mp->b_queue = NULL; in squeue_enter()
377 ASSERT(mp->b_next == NULL); in squeue_enter()
383 if (connp->conn_sqp == sqp) { in squeue_enter()
386 connp->conn_on_sqp = B_TRUE; in squeue_enter()
392 connp->conn_on_sqp = B_FALSE; in squeue_enter()
396 SQUEUE_ENTER_ONE(connp->conn_sqp, mp, proc, in squeue_enter()
399 ASSERT(MUTEX_NOT_HELD(&sqp->sq_lock)); in squeue_enter()
400 mutex_enter(&sqp->sq_lock); in squeue_enter()
401 sqp->sq_state &= ~(SQS_PROC|SQS_FAST); in squeue_enter()
402 sqp->sq_run = NULL; in squeue_enter()
403 if (sqp->sq_first == NULL || in squeue_enter()
410 if (sqp->sq_first != NULL) { in squeue_enter()
415 * If work or control actions are pending, wake in squeue_enter()
416 * up the worker thread. in squeue_enter()
418 if (sqp->sq_first != NULL || in squeue_enter()
419 sqp->sq_state & SQS_WORKER_THR_CONTROL) { in squeue_enter()
422 mutex_exit(&sqp->sq_lock); in squeue_enter()
432 mutex_exit(&sqp->sq_lock); in squeue_enter()
437 mp->b_prev = mp->b_next = NULL; in squeue_enter()
441 ASSERT(attrmp->b_cont == NULL); in squeue_enter()
442 attrmp->b_cont = mp; in squeue_enter()
444 attrmp->b_queue = mp->b_queue; in squeue_enter()
445 mp->b_queue = NULL; in squeue_enter()
446 attrmp->b_prev = mp->b_prev; in squeue_enter()
447 mp->b_prev = NULL; in squeue_enter()
455 mp->b_tag = tag; in squeue_enter()
465 ASSERT(MUTEX_HELD(&sqp->sq_lock)); in squeue_enter()
466 ASSERT(sqp->sq_first != NULL); in squeue_enter()
468 sqp->sq_run = curthread; in squeue_enter()
469 sqp->sq_drain(sqp, SQS_ENTER, now + squeue_drain_ns); in squeue_enter()
474 * In case any control actions are pending, wake in squeue_enter()
475 * up the worker. in squeue_enter()
477 sqp->sq_run = NULL; in squeue_enter()
478 if (sqp->sq_state & SQS_WORKER_THR_CONTROL) { in squeue_enter()
485 * where a SYN-ACK-ACK that triggers the conn_ind in squeue_enter()
495 connp = (conn_t *)mp->b_prev; in squeue_enter()
496 if (!(sqp->sq_state & SQS_REENTER) && in squeue_enter()
497 (process_flag != SQ_FILL) && (sqp->sq_first == NULL) && in squeue_enter()
498 (sqp->sq_run == curthread) && (cnt == 1) && in squeue_enter()
499 (connp->conn_on_sqp == B_FALSE)) { in squeue_enter()
500 sqp->sq_state |= SQS_REENTER; in squeue_enter()
501 mutex_exit(&sqp->sq_lock); in squeue_enter()
503 ASSERT(mp->b_prev != NULL); in squeue_enter()
504 ASSERT(mp->b_queue != NULL); in squeue_enter()
506 mp->b_prev = NULL; in squeue_enter()
507 proc = (sqproc_t)mp->b_queue; in squeue_enter()
508 mp->b_queue = NULL; in squeue_enter()
514 if (connp->conn_sqp == sqp) { in squeue_enter()
515 connp->conn_on_sqp = B_TRUE; in squeue_enter()
521 connp->conn_on_sqp = B_FALSE; in squeue_enter()
524 SQUEUE_ENTER_ONE(connp->conn_sqp, mp, proc, in squeue_enter()
528 mutex_enter(&sqp->sq_lock); in squeue_enter()
529 sqp->sq_state &= ~SQS_REENTER; in squeue_enter()
530 mutex_exit(&sqp->sq_lock); in squeue_enter()
541 mp->b_tag = tag; in squeue_enter()
549 mutex_exit(&sqp->sq_lock); in squeue_enter()
553 mp->b_prev = mp->b_next = NULL; in squeue_enter()
557 ASSERT(attrmp->b_cont == NULL); in squeue_enter()
558 attrmp->b_cont = mp; in squeue_enter()
560 attrmp->b_queue = mp->b_queue; in squeue_enter()
561 mp->b_queue = NULL; in squeue_enter()
562 attrmp->b_prev = mp->b_prev; in squeue_enter()
563 mp->b_prev = NULL; in squeue_enter()
571 * wake it it up now. in squeue_enter()
573 if ((sqp->sq_state & SQS_PROC) == 0 || in squeue_enter()
574 (sqp->sq_state & SQS_WORKER_THR_CONTROL) != 0) { in squeue_enter()
578 mutex_exit(&sqp->sq_lock); in squeue_enter()
587 * Wake up worker thread for squeue to process queued work.
592 ASSERT(MUTEX_HELD(&(sqp)->sq_lock)); in squeue_worker_wakeup()
594 cv_signal(&sqp->sq_worker_cv); in squeue_worker_wakeup()
595 sqp->sq_awoken = gethrtime(); in squeue_worker_wakeup()
605 ill_rx_ring_t *sq_rx_ring = sqp->sq_rx_ring; in squeue_drain()
615 if (proc_type != SQS_WORKER && STACK_BIAS + (uintptr_t)getfp() - in squeue_drain()
616 (uintptr_t)curthread->t_stkbase < squeue_drain_stack_needed) { in squeue_drain()
617 ASSERT(mutex_owned(&sqp->sq_lock)); in squeue_drain()
623 sq_poll_capable = (sqp->sq_state & SQS_POLL_CAPAB) != 0; in squeue_drain()
625 ASSERT(mutex_owned(&sqp->sq_lock)); in squeue_drain()
626 ASSERT(!(sqp->sq_state & (SQS_POLL_THR_QUIESCED | in squeue_drain()
629 head = sqp->sq_first; in squeue_drain()
630 sqp->sq_first = NULL; in squeue_drain()
631 sqp->sq_last = NULL; in squeue_drain()
632 sqp->sq_count = 0; in squeue_drain()
634 sqp->sq_state |= SQS_PROC | proc_type; in squeue_drain()
637 * We have backlog built up. Switch to polling mode if the in squeue_drain()
648 mutex_exit(&sqp->sq_lock); in squeue_drain()
652 head = mp->b_next; in squeue_drain()
653 mp->b_next = NULL; in squeue_drain()
655 proc = (sqproc_t)mp->b_queue; in squeue_drain()
656 mp->b_queue = NULL; in squeue_drain()
657 connp = (conn_t *)mp->b_prev; in squeue_drain()
658 mp->b_prev = NULL; in squeue_drain()
664 ASSERT(attrmp->b_cont != NULL); in squeue_drain()
666 mp = attrmp->b_cont; in squeue_drain()
667 attrmp->b_cont = NULL; in squeue_drain()
668 ASSERT(mp->b_queue == NULL); in squeue_drain()
669 ASSERT(mp->b_prev == NULL); in squeue_drain()
689 if (connp->conn_sqp == sqp) { in squeue_drain()
691 mp->b_tag); in squeue_drain()
692 connp->conn_on_sqp = B_TRUE; in squeue_drain()
698 connp->conn_on_sqp = B_FALSE; in squeue_drain()
701 SQUEUE_ENTER_ONE(connp->conn_sqp, mp, proc, connp, ira, in squeue_drain()
710 mutex_enter(&sqp->sq_lock); in squeue_drain()
718 * signal the worker thread to take up the work if processing time in squeue_drain()
721 if (sqp->sq_first != NULL) { in squeue_drain()
740 * SQS_POLL_RING() will not wake up poll thread in squeue_drain()
756 if (sqp->sq_state & SQS_GET_PKTS) { in squeue_drain()
757 ASSERT(!(sqp->sq_state & (SQS_POLL_THR_QUIESCED | in squeue_drain()
759 sqp->sq_state &= ~proc_type; in squeue_drain()
769 if ((proc_type == SQS_WORKER) && (sqp->sq_state & SQS_POLLING)) { in squeue_drain()
778 * up empty handed, it can not safely turn polling off in squeue_drain()
782 * up in a race for turning polling on/off and more in squeue_drain()
789 ASSERT(!(sqp->sq_state & (SQS_POLL_THR_QUIESCED | in squeue_drain()
792 sqp->sq_state &= ~proc_type; in squeue_drain()
803 ASSERT(!(sqp->sq_state & (SQS_POLL_THR_QUIESCED | in squeue_drain()
806 sqp->sq_state &= ~(SQS_PROC | proc_type); in squeue_drain()
809 * event, wake up the worker in squeue_drain()
812 (sqp->sq_state & SQS_WORKER_THR_CONTROL)) { in squeue_drain()
841 if (sqp->sq_state & SQS_POLL_THR_RESTART) { in squeue_poll_thr_control()
843 ASSERT(sqp->sq_state & SQS_POLL_THR_QUIESCED); in squeue_poll_thr_control()
844 sqp->sq_state &= ~(SQS_POLL_THR_QUIESCED | in squeue_poll_thr_control()
846 sqp->sq_state |= SQS_POLL_CAPAB; in squeue_poll_thr_control()
847 cv_signal(&sqp->sq_worker_cv); in squeue_poll_thr_control()
851 if (sqp->sq_state & SQS_POLL_THR_QUIESCE) { in squeue_poll_thr_control()
852 sqp->sq_state |= SQS_POLL_THR_QUIESCED; in squeue_poll_thr_control()
853 sqp->sq_state &= ~SQS_POLL_THR_QUIESCE; in squeue_poll_thr_control()
854 cv_signal(&sqp->sq_worker_cv); in squeue_poll_thr_control()
907 kmutex_t *lock = &sqp->sq_lock; in squeue_polling_thread()
908 kcondvar_t *async = &sqp->sq_poll_cv; in squeue_polling_thread()
928 ctl_state = sqp->sq_state & (SQS_POLL_THR_CONTROL | in squeue_polling_thread()
946 if (!(sqp->sq_state & SQS_POLL_CAPAB)) in squeue_polling_thread()
949 ASSERT((sqp->sq_state & in squeue_polling_thread()
954 sq_rx_ring = sqp->sq_rx_ring; in squeue_polling_thread()
955 sq_get_pkts = sq_rx_ring->rr_rx; in squeue_polling_thread()
956 sq_mac_handle = sq_rx_ring->rr_rx_handle; in squeue_polling_thread()
957 ip_accept = sq_rx_ring->rr_ip_accept; in squeue_polling_thread()
958 sq_ill = sq_rx_ring->rr_ill; in squeue_polling_thread()
983 ASSERT((sqp->sq_state & in squeue_polling_thread()
987 if (sqp->sq_first != NULL && !(sqp->sq_state & SQS_WORKER)) { in squeue_polling_thread()
992 * picked up some packets from the NIC otherwise in squeue_polling_thread()
999 sqp->sq_run = curthread; in squeue_polling_thread()
1000 sqp->sq_drain(sqp, SQS_POLL_PROC, now + in squeue_polling_thread()
1002 sqp->sq_run = NULL; in squeue_polling_thread()
1004 if (sqp->sq_first == NULL) in squeue_polling_thread()
1027 sqp->sq_state |= SQS_PROC_HELD; in squeue_polling_thread()
1028 sqp->sq_state &= ~SQS_GET_PKTS; in squeue_polling_thread()
1030 } else if (sqp->sq_first == NULL && in squeue_polling_thread()
1031 !(sqp->sq_state & SQS_WORKER)) { in squeue_polling_thread()
1040 sqp->sq_state &= ~(SQS_PROC|SQS_GET_PKTS); in squeue_polling_thread()
1046 * wake up the worker, since it is currently in squeue_polling_thread()
1049 if (sqp->sq_state & SQS_WORKER_THR_CONTROL) { in squeue_polling_thread()
1057 sqp->sq_state &= ~SQS_GET_PKTS; in squeue_polling_thread()
1059 if (sqp->sq_state & SQS_POLL_THR_CONTROL) { in squeue_polling_thread()
1073 * wakes up the requestor when the request is completed.
1081 ASSERT(MUTEX_HELD(&sqp->sq_lock)); in squeue_worker_thr_control()
1083 if (sqp->sq_state & SQS_POLL_RESTART) { in squeue_worker_thr_control()
1085 ASSERT((sqp->sq_state & (SQS_PROC_HELD | in squeue_worker_thr_control()
1092 sqp->sq_state &= ~SQS_POLL_QUIESCE_DONE; in squeue_worker_thr_control()
1093 sqp->sq_state |= SQS_POLL_THR_RESTART; in squeue_worker_thr_control()
1094 cv_signal(&sqp->sq_poll_cv); in squeue_worker_thr_control()
1095 while (sqp->sq_state & SQS_POLL_THR_QUIESCED) in squeue_worker_thr_control()
1096 cv_wait(&sqp->sq_worker_cv, &sqp->sq_lock); in squeue_worker_thr_control()
1097 sqp->sq_state &= ~(SQS_POLL_RESTART | SQS_PROC | in squeue_worker_thr_control()
1103 sqp->sq_state |= SQS_POLL_RESTART_DONE; in squeue_worker_thr_control()
1104 cv_signal(&sqp->sq_ctrlop_done_cv); in squeue_worker_thr_control()
1108 if (sqp->sq_state & SQS_PROC_HELD) { in squeue_worker_thr_control()
1110 ASSERT(sqp->sq_state & SQS_PROC); in squeue_worker_thr_control()
1118 sqp->sq_state |= (SQS_PROC | SQS_WORKER); in squeue_worker_thr_control()
1121 if (!(sqp->sq_state & SQS_POLL_THR_QUIESCED)) { in squeue_worker_thr_control()
1122 sqp->sq_state |= SQS_POLL_THR_QUIESCE; in squeue_worker_thr_control()
1123 cv_signal(&sqp->sq_poll_cv); in squeue_worker_thr_control()
1124 while (!(sqp->sq_state & SQS_POLL_THR_QUIESCED)) in squeue_worker_thr_control()
1125 cv_wait(&sqp->sq_worker_cv, &sqp->sq_lock); in squeue_worker_thr_control()
1128 rx_ring = sqp->sq_rx_ring; in squeue_worker_thr_control()
1129 ill = rx_ring->rr_ill; in squeue_worker_thr_control()
1132 * cpu_lock -> ill_lock -> sqset_lock -> sq_lock in squeue_worker_thr_control()
1134 mutex_exit(&sqp->sq_lock); in squeue_worker_thr_control()
1135 mutex_enter(&ill->ill_lock); in squeue_worker_thr_control()
1136 mutex_enter(&sqp->sq_lock); in squeue_worker_thr_control()
1138 SQS_POLLING_OFF(sqp, (sqp->sq_state & SQS_POLL_CAPAB) != 0, in squeue_worker_thr_control()
1139 sqp->sq_rx_ring); in squeue_worker_thr_control()
1140 sqp->sq_state &= ~(SQS_POLL_CAPAB | SQS_GET_PKTS | SQS_PROC_HELD); in squeue_worker_thr_control()
1141 if (sqp->sq_state & SQS_POLL_CLEANUP) { in squeue_worker_thr_control()
1149 ASSERT(!(sqp->sq_state & SQS_DEFAULT)); in squeue_worker_thr_control()
1151 sqp->sq_rx_ring = NULL; in squeue_worker_thr_control()
1152 rx_ring->rr_sqp = NULL; in squeue_worker_thr_control()
1154 sqp->sq_state &= ~(SQS_POLL_CLEANUP | SQS_POLL_THR_QUIESCED | in squeue_worker_thr_control()
1156 sqp->sq_ill = NULL; in squeue_worker_thr_control()
1158 rx_ring->rr_rx_handle = NULL; in squeue_worker_thr_control()
1159 rx_ring->rr_intr_handle = NULL; in squeue_worker_thr_control()
1160 rx_ring->rr_intr_enable = NULL; in squeue_worker_thr_control()
1161 rx_ring->rr_intr_disable = NULL; in squeue_worker_thr_control()
1162 sqp->sq_state |= SQS_POLL_CLEANUP_DONE; in squeue_worker_thr_control()
1164 sqp->sq_state &= ~SQS_POLL_QUIESCE; in squeue_worker_thr_control()
1165 sqp->sq_state |= SQS_POLL_QUIESCE_DONE; in squeue_worker_thr_control()
1172 cv_signal(&sqp->sq_ctrlop_done_cv); in squeue_worker_thr_control()
1173 mutex_exit(&ill->ill_lock); in squeue_worker_thr_control()
1174 if (sqp->sq_state & SQS_POLL_CLEANUP_DONE) { in squeue_worker_thr_control()
1175 cv_wait(&sqp->sq_worker_cv, &sqp->sq_lock); in squeue_worker_thr_control()
1176 sqp->sq_state &= ~(SQS_PROC | SQS_WORKER); in squeue_worker_thr_control()
1183 kmutex_t *lock = &sqp->sq_lock; in squeue_worker()
1184 kcondvar_t *async = &sqp->sq_worker_cv; in squeue_worker()
1197 if (sqp->sq_state & SQS_PROC_HELD) in squeue_worker()
1205 if (!(sqp->sq_state & SQS_PROC) && in squeue_worker()
1206 ((sqp->sq_state & SQS_WORKER_THR_CONTROL) || in squeue_worker()
1207 (sqp->sq_first != NULL))) in squeue_worker()
1216 if ((sqp->sq_state & SQS_WORKER_THR_CONTROL) && in squeue_worker()
1217 (sqp->sq_state & SQS_WORKER)) in squeue_worker()
1224 if (sqp->sq_state & SQS_WORKER_THR_CONTROL) { in squeue_worker()
1228 ASSERT(!(sqp->sq_state & (SQS_POLL_THR_QUIESCED | in squeue_worker()
1232 if (sqp->sq_state & SQS_PROC_HELD) in squeue_worker()
1233 sqp->sq_state &= ~SQS_PROC_HELD; in squeue_worker()
1236 sqp->sq_run = curthread; in squeue_worker()
1237 sqp->sq_drain(sqp, SQS_WORKER, now + squeue_drain_ns); in squeue_worker()
1238 sqp->sq_run = NULL; in squeue_worker()
1247 return (&sqp->sq_private[p]); in squeue_getprivate()
1255 squeue_t *sqp = connp->conn_sqp; in squeue_wakeup_conn()
1258 * Mark the squeue as paused before waking up the thread stuck in squeue_wakeup_conn()
1261 mutex_enter(&sqp->sq_lock); in squeue_wakeup_conn()
1262 sqp->sq_state |= SQS_PAUSE; in squeue_wakeup_conn()
1268 ASSERT(mp->b_flag & MSGWAITSYNC); in squeue_wakeup_conn()
1269 mp->b_flag &= ~MSGWAITSYNC; in squeue_wakeup_conn()
1270 cv_broadcast(&connp->conn_sq_cv); in squeue_wakeup_conn()
1276 while (sqp->sq_state & SQS_PAUSE) { in squeue_wakeup_conn()
1277 cv_wait(&sqp->sq_synch_cv, &sqp->sq_lock); in squeue_wakeup_conn()
1279 mutex_exit(&sqp->sq_lock); in squeue_wakeup_conn()
1288 sqp = connp->conn_sqp; in squeue_synch_enter()
1290 mutex_enter(&sqp->sq_lock); in squeue_synch_enter()
1291 if (sqp->sq_first == NULL && !(sqp->sq_state & SQS_PROC)) { in squeue_synch_enter()
1299 ASSERT(sqp->sq_run == NULL); in squeue_synch_enter()
1301 sqp->sq_state |= SQS_PROC; in squeue_synch_enter()
1302 sqp->sq_run = curthread; in squeue_synch_enter()
1303 mutex_exit(&sqp->sq_lock); in squeue_synch_enter()
1311 if (sqp != connp->conn_sqp) { in squeue_synch_enter()
1312 mutex_enter(&sqp->sq_lock); in squeue_synch_enter()
1313 sqp->sq_state &= ~SQS_PROC; in squeue_synch_enter()
1314 sqp->sq_run = NULL; in squeue_synch_enter()
1315 mutex_exit(&sqp->sq_lock); in squeue_synch_enter()
1319 sqp->sq_curmp = NULL; in squeue_synch_enter()
1320 sqp->sq_curproc = NULL; in squeue_synch_enter()
1321 sqp->sq_connp = connp; in squeue_synch_enter()
1323 connp->conn_on_sqp = B_TRUE; in squeue_synch_enter()
1330 mutex_exit(&sqp->sq_lock); in squeue_synch_enter()
1340 mp->b_flag |= MSGWAITSYNC; in squeue_synch_enter()
1346 ASSERT(sqp->sq_run != curthread); in squeue_synch_enter()
1349 while (mp->b_flag & MSGWAITSYNC) in squeue_synch_enter()
1350 cv_wait(&connp->conn_sq_cv, &sqp->sq_lock); in squeue_synch_enter()
1351 mutex_exit(&sqp->sq_lock); in squeue_synch_enter()
1363 * squeue worker thread wake-ups during local TCP connect() or close()
1369 mblk_t *next, *mp = sqp->sq_first; in squeue_try_drain_one()
1371 sqproc_t proc = (sqproc_t)mp->b_queue; in squeue_try_drain_one()
1374 ASSERT(MUTEX_HELD(&sqp->sq_lock)); in squeue_try_drain_one()
1375 ASSERT((sqp->sq_state & SQS_PROC) == 0); in squeue_try_drain_one()
1376 ASSERT(sqp->sq_run == NULL); in squeue_try_drain_one()
1384 connp = (conn_t *)mp->b_prev; in squeue_try_drain_one()
1389 next = mp->b_next; in squeue_try_drain_one()
1390 proc = (sqproc_t)mp->b_queue; in squeue_try_drain_one()
1393 ASSERT(sqp->sq_count > 0); in squeue_try_drain_one()
1397 sqp->sq_first = NULL; in squeue_try_drain_one()
1398 sqp->sq_last = NULL; in squeue_try_drain_one()
1400 sqp->sq_first = next; in squeue_try_drain_one()
1402 sqp->sq_count--; in squeue_try_drain_one()
1404 sqp->sq_state |= SQS_PROC; in squeue_try_drain_one()
1405 sqp->sq_run = curthread; in squeue_try_drain_one()
1406 mutex_exit(&sqp->sq_lock); in squeue_try_drain_one()
1409 mp->b_prev = NULL; in squeue_try_drain_one()
1410 mp->b_queue = NULL; in squeue_try_drain_one()
1411 mp->b_next = NULL; in squeue_try_drain_one()
1415 ASSERT(attrmp->b_cont != NULL); in squeue_try_drain_one()
1417 mp = attrmp->b_cont; in squeue_try_drain_one()
1418 attrmp->b_cont = NULL; in squeue_try_drain_one()
1420 ASSERT(mp->b_queue == NULL); in squeue_try_drain_one()
1421 ASSERT(mp->b_prev == NULL); in squeue_try_drain_one()
1433 SQUEUE_DBG_SET(sqp, mp, proc, connp, mp->b_tag); in squeue_try_drain_one()
1434 connp->conn_on_sqp = B_TRUE; in squeue_try_drain_one()
1439 connp->conn_on_sqp = B_FALSE; in squeue_try_drain_one()
1447 mutex_enter(&sqp->sq_lock); in squeue_try_drain_one()
1448 sqp->sq_state &= ~(SQS_PROC); in squeue_try_drain_one()
1449 sqp->sq_run = NULL; in squeue_try_drain_one()
1455 squeue_t *sqp = connp->conn_sqp; in squeue_synch_exit()
1459 mutex_enter(&sqp->sq_lock); in squeue_synch_exit()
1460 if (sqp->sq_run != curthread) { in squeue_synch_exit()
1463 * and wake up the squeue owner, such that owner can continue in squeue_synch_exit()
1466 ASSERT(sqp->sq_state & SQS_PAUSE); in squeue_synch_exit()
1467 sqp->sq_state &= ~SQS_PAUSE; in squeue_synch_exit()
1470 cv_signal(&sqp->sq_synch_cv); in squeue_synch_exit()
1471 mutex_exit(&sqp->sq_lock); in squeue_synch_exit()
1475 ASSERT(sqp->sq_state & SQS_PROC); in squeue_synch_exit()
1477 sqp->sq_state &= ~SQS_PROC; in squeue_synch_exit()
1478 sqp->sq_run = NULL; in squeue_synch_exit()
1479 connp->conn_on_sqp = B_FALSE; in squeue_synch_exit()
1482 if (flag == SQ_PROCESS && sqp->sq_first != NULL) { in squeue_synch_exit()
1486 /* Wake up the worker if further requests are pending. */ in squeue_synch_exit()
1487 if (sqp->sq_first != NULL) { in squeue_synch_exit()
1490 mutex_exit(&sqp->sq_lock); in squeue_synch_exit()