Lines Matching refs:ngq
1954 struct ng_queue *ngq = &node->nd_input_queue; in ng_dequeue() local
1957 mtx_assert(&ngq->q_mtx, MA_OWNED); in ng_dequeue()
1960 if (!QUEUE_ACTIVE(ngq)) { in ng_dequeue()
1963 node->nd_ID, node, ngq->q_flags); in ng_dequeue()
1972 if (HEAD_IS_READER(ngq)) { in ng_dequeue()
1974 long t = ngq->q_flags; in ng_dequeue()
1982 if (atomic_cmpset_acq_int(&ngq->q_flags, t, in ng_dequeue()
1989 } else if (atomic_cmpset_acq_int(&ngq->q_flags, OP_PENDING, in ng_dequeue()
1997 ngq->q_flags); in ng_dequeue()
2005 item = STAILQ_FIRST(&ngq->queue); in ng_dequeue()
2006 STAILQ_REMOVE_HEAD(&ngq->queue, el_next); in ng_dequeue()
2007 if (STAILQ_EMPTY(&ngq->queue)) in ng_dequeue()
2008 atomic_clear_int(&ngq->q_flags, OP_PENDING); in ng_dequeue()
2011 "READER", ngq->q_flags); in ng_dequeue()
2022 struct ng_queue *ngq = &node->nd_input_queue; in ng_queue_rw() local
2029 NG_QUEUE_LOCK(ngq); in ng_queue_rw()
2031 atomic_set_int(&ngq->q_flags, OP_PENDING); in ng_queue_rw()
2032 STAILQ_INSERT_TAIL(&ngq->queue, item, el_next); in ng_queue_rw()
2041 if (NEXT_QUEUED_ITEM_CAN_PROCEED(ngq)) in ng_queue_rw()
2043 NG_QUEUE_UNLOCK(ngq); in ng_queue_rw()
2100 struct ng_queue *ngq = &node->nd_input_queue;
2106 NG_QUEUE_LOCK(ngq);
2118 atomic_add_int(&ngq->q_flags, WRITER_ACTIVE - READER_INCREMENT);
2119 if ((ngq->q_flags & (NGQ_WMASK & ~OP_PENDING)) == WRITER_ACTIVE) {
2120 NG_QUEUE_UNLOCK(ngq);
2130 atomic_add_int(&ngq->q_flags, READER_INCREMENT - WRITER_ACTIVE);
2142 if (STAILQ_EMPTY(&ngq->queue)) {
2144 atomic_set_int(&ngq->q_flags, OP_PENDING);
2149 STAILQ_INSERT_HEAD(&ngq->queue, item, el_next);
2154 atomic_add_int(&ngq->q_flags, READER_INCREMENT - WRITER_ACTIVE);
2155 if (QUEUE_ACTIVE(ngq) && NEXT_QUEUED_ITEM_CAN_PROCEED(ngq))
2157 NG_QUEUE_UNLOCK(ngq);
2181 struct ng_queue *ngq = &node->nd_input_queue; in ng_flush_input_queue() local
2184 NG_QUEUE_LOCK(ngq); in ng_flush_input_queue()
2185 while ((item = STAILQ_FIRST(&ngq->queue)) != NULL) { in ng_flush_input_queue()
2186 STAILQ_REMOVE_HEAD(&ngq->queue, el_next); in ng_flush_input_queue()
2187 if (STAILQ_EMPTY(&ngq->queue)) in ng_flush_input_queue()
2188 atomic_clear_int(&ngq->q_flags, OP_PENDING); in ng_flush_input_queue()
2189 NG_QUEUE_UNLOCK(ngq); in ng_flush_input_queue()
2201 NG_QUEUE_LOCK(ngq); in ng_flush_input_queue()
2203 NG_QUEUE_UNLOCK(ngq); in ng_flush_input_queue()
2237 struct ng_queue *ngq; in ng_snd_item() local
2340 ngq = &node->nd_input_queue; in ng_snd_item()
2341 if (QUEUE_ACTIVE(ngq)) { in ng_snd_item()
2342 NG_QUEUE_LOCK(ngq); in ng_snd_item()
2343 if (QUEUE_ACTIVE(ngq) && NEXT_QUEUED_ITEM_CAN_PROCEED(ngq)) in ng_snd_item()
2345 NG_QUEUE_UNLOCK(ngq); in ng_snd_item()