Lines Matching refs:ngq
1951 struct ng_queue *ngq = &node->nd_input_queue; in ng_dequeue() local
1954 mtx_assert(&ngq->q_mtx, MA_OWNED); in ng_dequeue()
1957 if (!QUEUE_ACTIVE(ngq)) { in ng_dequeue()
1960 node->nd_ID, node, ngq->q_flags); in ng_dequeue()
1969 if (HEAD_IS_READER(ngq)) { in ng_dequeue()
1971 long t = ngq->q_flags; in ng_dequeue()
1979 if (atomic_cmpset_acq_int(&ngq->q_flags, t, in ng_dequeue()
1986 } else if (atomic_cmpset_acq_int(&ngq->q_flags, OP_PENDING, in ng_dequeue()
1994 ngq->q_flags); in ng_dequeue()
2002 item = STAILQ_FIRST(&ngq->queue); in ng_dequeue()
2003 STAILQ_REMOVE_HEAD(&ngq->queue, el_next); in ng_dequeue()
2004 if (STAILQ_EMPTY(&ngq->queue)) in ng_dequeue()
2005 atomic_clear_int(&ngq->q_flags, OP_PENDING); in ng_dequeue()
2008 "READER", ngq->q_flags); in ng_dequeue()
2019 struct ng_queue *ngq = &node->nd_input_queue; in ng_queue_rw() local
2026 NG_QUEUE_LOCK(ngq); in ng_queue_rw()
2028 atomic_set_int(&ngq->q_flags, OP_PENDING); in ng_queue_rw()
2029 STAILQ_INSERT_TAIL(&ngq->queue, item, el_next); in ng_queue_rw()
2038 if (NEXT_QUEUED_ITEM_CAN_PROCEED(ngq)) in ng_queue_rw()
2040 NG_QUEUE_UNLOCK(ngq); in ng_queue_rw()
2097 struct ng_queue *ngq = &node->nd_input_queue;
2103 NG_QUEUE_LOCK(ngq);
2115 atomic_add_int(&ngq->q_flags, WRITER_ACTIVE - READER_INCREMENT);
2116 if ((ngq->q_flags & (NGQ_WMASK & ~OP_PENDING)) == WRITER_ACTIVE) {
2117 NG_QUEUE_UNLOCK(ngq);
2127 atomic_add_int(&ngq->q_flags, READER_INCREMENT - WRITER_ACTIVE);
2139 if (STAILQ_EMPTY(&ngq->queue)) {
2141 atomic_set_int(&ngq->q_flags, OP_PENDING);
2146 STAILQ_INSERT_HEAD(&ngq->queue, item, el_next);
2151 atomic_add_int(&ngq->q_flags, READER_INCREMENT - WRITER_ACTIVE);
2152 if (QUEUE_ACTIVE(ngq) && NEXT_QUEUED_ITEM_CAN_PROCEED(ngq))
2154 NG_QUEUE_UNLOCK(ngq);
2178 struct ng_queue *ngq = &node->nd_input_queue; in ng_flush_input_queue() local
2181 NG_QUEUE_LOCK(ngq); in ng_flush_input_queue()
2182 while ((item = STAILQ_FIRST(&ngq->queue)) != NULL) { in ng_flush_input_queue()
2183 STAILQ_REMOVE_HEAD(&ngq->queue, el_next); in ng_flush_input_queue()
2184 if (STAILQ_EMPTY(&ngq->queue)) in ng_flush_input_queue()
2185 atomic_clear_int(&ngq->q_flags, OP_PENDING); in ng_flush_input_queue()
2186 NG_QUEUE_UNLOCK(ngq); in ng_flush_input_queue()
2198 NG_QUEUE_LOCK(ngq); in ng_flush_input_queue()
2200 NG_QUEUE_UNLOCK(ngq); in ng_flush_input_queue()
2232 struct ng_queue *ngq; in ng_snd_item() local
2326 ngq = &node->nd_input_queue; in ng_snd_item()
2327 if (QUEUE_ACTIVE(ngq)) { in ng_snd_item()
2328 NG_QUEUE_LOCK(ngq); in ng_snd_item()
2329 if (QUEUE_ACTIVE(ngq) && NEXT_QUEUED_ITEM_CAN_PROCEED(ngq)) in ng_snd_item()
2331 NG_QUEUE_UNLOCK(ngq); in ng_snd_item()