* Take a pflock for read. * * @param pf * A pointer to a pflock structure. */
| 100 | * A pointer to a pflock structure. |
| 101 | */ |
| 102 | static inline void |
| 103 | rte_pflock_read_lock(rte_pflock_t *pf) |
| 104 | { |
| 105 | uint16_t w; |
| 106 | |
| 107 | /* |
| 108 | * If no writer is present, then the operation has completed |
| 109 | * successfully. |
| 110 | */ |
| 111 | w = rte_atomic_fetch_add_explicit(&pf->rd.in, RTE_PFLOCK_RINC, rte_memory_order_acquire) |
| 112 | & RTE_PFLOCK_WBITS; |
| 113 | if (w == 0) |
| 114 | return; |
| 115 | |
| 116 | /* Wait for current write phase to complete. */ |
| 117 | RTE_WAIT_UNTIL_MASKED(&pf->rd.in, RTE_PFLOCK_WBITS, !=, w, rte_memory_order_acquire); |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Release a pflock locked for reading. |
no outgoing calls