summaryrefslogtreecommitdiffstats
path: root/src/svm/svm_fifo.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-04-04 23:08:23 -0700
committerFlorin Coras <fcoras@cisco.com>2017-04-13 18:35:50 -0700
commit6cf30adc2cd3aa818e5d97cf71ea8b2fc2aaefa7 (patch)
tree3c4afef26295500b243f3655d96071565c2d2464 /src/svm/svm_fifo.h
parent0f7d2ff58a63fdc671c1c0954ffe7c6ff0501daa (diff)
Session layer refactoring
Major refactoring of the session layer api - Add attatch api for application binding to the the session layer - Simplify listen/connect calls - Update application CLI - Add transport endpoint to accept callback - Associate segment manager to application and allow for multiple binds/connects per app Additional: - svm fifo cleanup - add fifo free, format fns - add fifo offset enqueue unit test Change-Id: Id93a65047de61afc2bf3d58c9b544339c02065af Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/svm/svm_fifo.h')
-rw-r--r--src/svm/svm_fifo.h32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h
index 80e5b0f2d39..9beb63f5e46 100644
--- a/src/svm/svm_fifo.h
+++ b/src/svm/svm_fifo.h
@@ -48,10 +48,6 @@ typedef struct
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 u8 has_event; /**< non-zero if deq event exists */
u32 owner_pid;
@@ -60,6 +56,7 @@ typedef struct
u32 client_session_index;
u8 server_thread_index;
u8 client_thread_index;
+ u32 segment_manager;
CLIB_CACHE_LINE_ALIGN_MARK (end_shared);
u32 head;
CLIB_CACHE_LINE_ALIGN_MARK (end_consumer);
@@ -74,30 +71,6 @@ typedef struct
CLIB_CACHE_LINE_ALIGN_MARK (data);
} svm_fifo_t;
-static inline int
-svm_fifo_lock (svm_fifo_t * f, u32 pid, u32 tag, int nowait)
-{
- if (PREDICT_TRUE (nowait == 0))
- pthread_mutex_lock (&f->mutex);
- else
- {
- if (pthread_mutex_trylock (&f->mutex))
- return -1;
- }
- f->owner_pid = pid;
- f->tag = tag;
- return 0;
-}
-
-static inline void
-svm_fifo_unlock (svm_fifo_t * f)
-{
- f->owner_pid = 0;
- f->tag = 0;
- CLIB_MEMORY_BARRIER ();
- pthread_mutex_unlock (&f->mutex);
-}
-
static inline u32
svm_fifo_max_dequeue (svm_fifo_t * f)
{
@@ -139,6 +112,7 @@ svm_fifo_unset_event (svm_fifo_t * f)
}
svm_fifo_t *svm_fifo_create (u32 data_size_in_bytes);
+void svm_fifo_free (svm_fifo_t * f);
int svm_fifo_enqueue_nowait (svm_fifo_t * f, int pid, u32 max_bytes,
u8 * copy_from_here);
@@ -154,6 +128,8 @@ int svm_fifo_peek (svm_fifo_t * f, int pid, u32 offset, u32 max_bytes,
u8 * copy_here);
int svm_fifo_dequeue_drop (svm_fifo_t * f, int pid, u32 max_bytes);
+format_function_t format_svm_fifo;
+
always_inline ooo_segment_t *
svm_fifo_newest_ooo_segment (svm_fifo_t * f)
{