aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm/svm_fifo.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/svm/svm_fifo.h')
-rw-r--r--src/svm/svm_fifo.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h
index 39556173e4d..80e5b0f2d39 100644
--- a/src/svm/svm_fifo.h
+++ b/src/svm/svm_fifo.h
@@ -44,14 +44,16 @@ typedef struct
typedef struct
{
+ volatile u32 cursize; /**< current fifo size */
+ u32 nitems;
+ CLIB_CACHE_LINE_ALIGN_MARK (end_cursize);
+
pthread_mutex_t mutex; /* 8 bytes */
pthread_cond_t condvar; /* 8 bytes */
svm_lock_tag_t tag;
- volatile u32 cursize; /**< current fifo size */
volatile u8 has_event; /**< non-zero if deq event exists */
u32 owner_pid;
- u32 nitems;
/* Backpointers */
u32 server_session_index;
@@ -105,7 +107,7 @@ svm_fifo_max_dequeue (svm_fifo_t * f)
static inline u32
svm_fifo_max_enqueue (svm_fifo_t * f)
{
- return f->nitems - f->cursize;
+ return f->nitems - svm_fifo_max_dequeue (f);
}
static inline u8