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

Function ng_queue_rw

lib/ff_ng_base.c:2019–2044  ·  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

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