MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_queue_rw

Function ng_queue_rw

freebsd/netgraph/ng_base.c:2012–2037  ·  view source on GitHub ↗

* Queue a packet to be picked up later by someone else. * If the queue could be run now, add node to the queue handler's worklist. */

Source from the content-addressed store, hash-verified

2010 * If the queue could be run now, add node to the queue handler's worklist.
2011 */
2012static __inline void
2013ng_queue_rw(node_p node, item_p item, int rw)
2014{
2015 struct ng_queue *ngq = &node->nd_input_queue;
2016 if (rw == NGQRW_W)
2017 NGI_SET_WRITER(item);
2018 else
2019 NGI_SET_READER(item);
2020 item->depth = 1;
2021
2022 NG_QUEUE_LOCK(ngq);
2023 /* Set OP_PENDING flag and enqueue the item. */
2024 atomic_set_int(&ngq->q_flags, OP_PENDING);
2025 STAILQ_INSERT_TAIL(&ngq->queue, item, el_next);
2026
2027 CTR5(KTR_NET, "%20s: node [%x] (%p) queued item %p as %s", __func__,
2028 node->nd_ID, node, item, rw ? "WRITER" : "READER" );
2029
2030 /*
2031 * We can take the worklist lock with the node locked
2032 * BUT NOT THE REVERSE!
2033 */
2034 if (NEXT_QUEUED_ITEM_CAN_PROCEED(ngq))
2035 ng_worklist_add(node);
2036 NG_QUEUE_UNLOCK(ngq);
2037}
2038
2039/* Acquire reader lock on node. If node is busy, queue the packet. */
2040static __inline item_p

Callers 3

ng_acquire_readFunction · 0.70
ng_acquire_writeFunction · 0.70
ng_snd_itemFunction · 0.70

Calls 1

ng_worklist_addFunction · 0.70

Tested by

no test coverage detected