aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-02-28 15:15:56 -0500
committerDamjan Marion <dmarion.lists@gmail.com>2017-03-01 20:25:48 +0000
commit68b0fb0c620c7451ef1a6380c43c39de6614db51 (patch)
treef4188fa09723152f3ebfcebbbe4cacad903e0cf1 /src/vlibmemory
parentf869028740aaebeb0375077d4d84fa07a17fff1a (diff)
VPP-598: tcp stack initial commit
Change-Id: I49e5ce0aae6e4ff634024387ceaf7dbc432a0351 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vlibmemory')
-rw-r--r--src/vlibmemory/unix_shared_memory_queue.c12
-rw-r--r--src/vlibmemory/unix_shared_memory_queue.h2
2 files changed, 5 insertions, 9 deletions
diff --git a/src/vlibmemory/unix_shared_memory_queue.c b/src/vlibmemory/unix_shared_memory_queue.c
index 25d28910706..e86edec3c65 100644
--- a/src/vlibmemory/unix_shared_memory_queue.c
+++ b/src/vlibmemory/unix_shared_memory_queue.c
@@ -33,18 +33,13 @@
* nels = number of elements on the queue
* elsize = element size, presumably 4 and cacheline-size will
* be popular choices.
- * coid = consumer coid, from ChannelCreate
* pid = consumer pid
- * pulse_code = pulse code consumer expects
- * pulse_value = pulse value consumer expects
- * consumer_prio = consumer's priority, so pulses won't change
- * the consumer's priority.
*
* The idea is to call this function in the queue consumer,
* and e-mail the queue pointer to the producer(s).
*
- * The spp process / main thread allocates one of these
- * at startup; its main input queue. The spp main input queue
+ * The vpp process / main thread allocates one of these
+ * at startup; its main input queue. The vpp main input queue
* has a pointer to it in the shared memory segment header.
*
* You probably want to be on an svm data heap before calling this
@@ -70,7 +65,7 @@ unix_shared_memory_queue_init (int nels,
q->signal_when_queue_non_empty = signal_when_queue_non_empty;
memset (&attr, 0, sizeof (attr));
- memset (&cattr, 0, sizeof (attr));
+ memset (&cattr, 0, sizeof (cattr));
if (pthread_mutexattr_init (&attr))
clib_unix_warning ("mutexattr_init");
@@ -277,6 +272,7 @@ unix_shared_memory_queue_sub (unix_shared_memory_queue_t * q,
clib_memcpy (elem, headp, q->elsize);
q->head++;
+ /* $$$$ JFC shouldn't this be == 0? */
if (q->cursize == q->maxsize)
need_broadcast = 1;
diff --git a/src/vlibmemory/unix_shared_memory_queue.h b/src/vlibmemory/unix_shared_memory_queue.h
index f758f17c856..13800065beb 100644
--- a/src/vlibmemory/unix_shared_memory_queue.h
+++ b/src/vlibmemory/unix_shared_memory_queue.h
@@ -29,7 +29,7 @@ typedef struct _unix_shared_memory_queue
pthread_cond_t condvar; /* 8 bytes */
int head;
int tail;
- int cursize;
+ volatile int cursize;
int maxsize;
int elsize;
int consumer_pid;