Acquire writer lock on node. If node is busy, queue the packet. */
| 2066 | |
| 2067 | /* Acquire writer lock on node. If node is busy, queue the packet. */ |
| 2068 | static __inline item_p |
| 2069 | ng_acquire_write(node_p node, item_p item) |
| 2070 | { |
| 2071 | KASSERT(node != &ng_deadnode, |
| 2072 | ("%s: working on deadnode", __func__)); |
| 2073 | |
| 2074 | /* Writer needs completely idle node. */ |
| 2075 | if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, 0, |
| 2076 | WRITER_ACTIVE)) { |
| 2077 | /* Successfully grabbed node */ |
| 2078 | CTR4(KTR_NET, "%20s: node [%x] (%p) acquired item %p", |
| 2079 | __func__, node->nd_ID, node, item); |
| 2080 | return (item); |
| 2081 | } |
| 2082 | |
| 2083 | /* Queue the request for later. */ |
| 2084 | ng_queue_rw(node, item, NGQRW_W); |
| 2085 | |
| 2086 | return (NULL); |
| 2087 | } |
| 2088 | |
| 2089 | #if 0 |
| 2090 | static __inline item_p |
no test coverage detected