26 #ifndef MCA_BTL_VADER_FIFO_H
27 #define MCA_BTL_VADER_FIFO_H
31 #include "btl_vader_frag.h"
33 #define VADER_FIFO_FREE ((intptr_t)-2)
51 volatile intptr_t fifo_head;
52 volatile intptr_t fifo_tail;
53 char pad[VADER_CACHE_LINE_PAD - 2 *
sizeof (intptr_t)];
58 fifo->fifo_head = fifo->fifo_tail = VADER_FIFO_FREE;
66 intptr_t prev, value = VIRTUAL2RELATIVE(hdr);
68 hdr->next = VADER_FIFO_FREE;
71 prev = opal_atomic_swap_ptr (&fifo->fifo_tail, value);
74 if (OPAL_LIKELY(VADER_FIFO_FREE != prev)) {
78 fifo->fifo_head = value;
91 value = opal_atomic_swap_ptr (&fifo->fifo_head, VADER_FIFO_FREE);
92 if (VADER_FIFO_FREE == value) {
99 if (OPAL_UNLIKELY(VADER_FIFO_FREE == hdr->next)) {
102 if (!opal_atomic_cmpset_ptr (&fifo->fifo_tail, (
void *)value,
103 (
void *)VADER_FIFO_FREE)) {
104 while (VADER_FIFO_FREE == hdr->next) {
108 fifo->fifo_head = hdr->next;
111 fifo->fifo_head = hdr->next;
void opal_atomic_rmb(void)
Read memory barrier.
Definition: btl_vader_frag.h:33
struct vader_fifo_t ** fifo
cached copy of the pointer to the 2D fifo array.
Definition: btl_vader.h:106
void opal_atomic_wmb(void)
Write memory barrier.
Definition: btl_vader_fifo.h:50