5 #ifndef _RTE_TICKETLOCK_H_
6 #define _RTE_TICKETLOCK_H_
43 #define RTE_TICKETLOCK_INITIALIZER { 0 }
55 __atomic_store_n(&tl->tickets, 0, __ATOMIC_RELAXED);
68 uint16_t me = __atomic_fetch_add(&tl->s.next, 1, __ATOMIC_RELAXED);
82 uint16_t i = __atomic_load_n(&tl->s.current, __ATOMIC_RELAXED);
83 __atomic_store_n(&tl->s.current, i + 1, __ATOMIC_RELEASE);
99 old.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
100 new.tickets = old.tickets;
102 if (old.s.next == old.s.current) {
103 if (__atomic_compare_exchange_n(&tl->tickets, &old.tickets,
104 new.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
124 tic.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_ACQUIRE);
125 return (tic.s.current != tic.s.next);
131 #define TICKET_LOCK_INVALID_ID -1
137 } rte_ticketlock_recursive_t;
142 #define RTE_TICKETLOCK_RECURSIVE_INITIALIZER {RTE_TICKETLOCK_INITIALIZER, \
143 TICKET_LOCK_INVALID_ID, 0}
172 if (__atomic_load_n(&tlr->user, __ATOMIC_RELAXED) !=
id) {
174 __atomic_store_n(&tlr->user,
id, __ATOMIC_RELAXED);
189 if (--(tlr->count) == 0) {
210 if (__atomic_load_n(&tlr->user, __ATOMIC_RELAXED) !=
id) {
213 __atomic_store_n(&tlr->user,
id, __ATOMIC_RELAXED);
#define TICKET_LOCK_INVALID_ID
static __rte_experimental void rte_ticketlock_recursive_unlock(rte_ticketlock_recursive_t *tlr)
static __rte_experimental void rte_ticketlock_lock(rte_ticketlock_t *tl)
static __rte_experimental void rte_ticketlock_unlock(rte_ticketlock_t *tl)
static __rte_experimental void rte_ticketlock_recursive_init(rte_ticketlock_recursive_t *tlr)
static __rte_experimental void rte_ticketlock_init(rte_ticketlock_t *tl)
static __rte_experimental int rte_ticketlock_recursive_trylock(rte_ticketlock_recursive_t *tlr)
static __rte_experimental int rte_ticketlock_trylock(rte_ticketlock_t *tl)
static __rte_experimental __rte_always_inline void rte_wait_until_equal_16(volatile uint16_t *addr, uint16_t expected, int memorder)
static __rte_experimental int rte_ticketlock_is_locked(rte_ticketlock_t *tl)
static __rte_experimental void rte_ticketlock_recursive_lock(rte_ticketlock_recursive_t *tlr)
static int rte_gettid(void)