summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/ssvm
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-05 03:20:25 -0800
committerDave Barach <openvpp@barachs.net>2018-01-09 18:33:08 +0000
commite86a8edd3c14fb41ace2a12efd17bc7772bf623f (patch)
tree480219864cadd743fdb95c21379aeaf88a985e23 /src/vnet/devices/ssvm
parent4363ad6c96b5641fca1b16c5a6ec22e2364adcfd (diff)
api: refactor vlibmemory
- separate client/server code for both memory and socket apis - separate memory api code from generic vlib api code - move unix_shared_memory_fifo to svm and rename to svm_fifo_t - overall declutter Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/devices/ssvm')
-rw-r--r--src/vnet/devices/ssvm/node.c8
-rw-r--r--src/vnet/devices/ssvm/ssvm_eth.c22
-rw-r--r--src/vnet/devices/ssvm/ssvm_eth.h3
3 files changed, 16 insertions, 17 deletions
diff --git a/src/vnet/devices/ssvm/node.c b/src/vnet/devices/ssvm/node.c
index b7a8db0528c..344b357662c 100644
--- a/src/vnet/devices/ssvm/node.c
+++ b/src/vnet/devices/ssvm/node.c
@@ -70,7 +70,7 @@ ssvm_eth_device_input (ssvm_eth_main_t * em,
{
ssvm_shared_header_t *sh = intfc->sh;
vlib_main_t *vm = em->vlib_main;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
ssvm_eth_queue_elt_t *elt, *elts;
u32 elt_index;
u32 my_pid = intfc->my_pid;
@@ -101,9 +101,9 @@ ssvm_eth_device_input (ssvm_eth_main_t * em,
return 0;
if (intfc->i_am_master)
- q = (unix_shared_memory_queue_t *) (sh->opaque[TO_MASTER_Q_INDEX]);
+ q = (svm_queue_t *) (sh->opaque[TO_MASTER_Q_INDEX]);
else
- q = (unix_shared_memory_queue_t *) (sh->opaque[TO_SLAVE_Q_INDEX]);
+ q = (svm_queue_t *) (sh->opaque[TO_SLAVE_Q_INDEX]);
/* Nothing to do? */
if (q->cursize == 0)
@@ -118,7 +118,7 @@ ssvm_eth_device_input (ssvm_eth_main_t * em,
;
while (q->cursize > 0)
{
- unix_shared_memory_queue_sub_raw (q, (u8 *) & elt_index);
+ svm_queue_sub_raw (q, (u8 *) & elt_index);
ASSERT (elt_index < 2048);
vec_add1 (intfc->rx_queue, elt_index);
}
diff --git a/src/vnet/devices/ssvm/ssvm_eth.c b/src/vnet/devices/ssvm/ssvm_eth.c
index db4fafa9a14..8a0cebe29d4 100644
--- a/src/vnet/devices/ssvm/ssvm_eth.c
+++ b/src/vnet/devices/ssvm/ssvm_eth.c
@@ -38,7 +38,7 @@ ssvm_eth_create (ssvm_eth_main_t * em, u8 * name, int is_master)
ssvm_private_t *intfc;
void *oldheap;
clib_error_t *e;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
ssvm_shared_header_t *sh;
ssvm_eth_queue_elt_t *elts;
u32 *elt_indices;
@@ -71,13 +71,13 @@ ssvm_eth_create (ssvm_eth_main_t * em, u8 * name, int is_master)
sh = intfc->sh;
oldheap = ssvm_push_heap (sh);
- q = unix_shared_memory_queue_init (em->queue_elts, sizeof (u32),
- 0 /* consumer pid not interesting */ ,
- 0 /* signal not sent */ );
+ q = svm_queue_init (em->queue_elts, sizeof (u32),
+ 0 /* consumer pid not interesting */ ,
+ 0 /* signal not sent */ );
sh->opaque[TO_MASTER_Q_INDEX] = (void *) q;
- q = unix_shared_memory_queue_init (em->queue_elts, sizeof (u32),
- 0 /* consumer pid not interesting */ ,
- 0 /* signal not sent */ );
+ q = svm_queue_init (em->queue_elts, sizeof (u32),
+ 0 /* consumer pid not interesting */ ,
+ 0 /* signal not sent */ );
sh->opaque[TO_SLAVE_Q_INDEX] = (void *) q;
/*
@@ -246,7 +246,7 @@ ssvm_eth_interface_tx (vlib_main_t * vm,
vnet_interface_output_runtime_t *rd = (void *) node->runtime_data;
ssvm_private_t *intfc = vec_elt_at_index (em->intfcs, rd->dev_instance);
ssvm_shared_header_t *sh = intfc->sh;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
u32 *from;
u32 n_left;
ssvm_eth_queue_elt_t *elts, *elt, *prev_elt;
@@ -265,9 +265,9 @@ ssvm_eth_interface_tx (vlib_main_t * vm,
u32 *elt_indices;
if (i_am_master)
- q = (unix_shared_memory_queue_t *) sh->opaque[TO_SLAVE_Q_INDEX];
+ q = (svm_queue_t *) sh->opaque[TO_SLAVE_Q_INDEX];
else
- q = (unix_shared_memory_queue_t *) sh->opaque[TO_MASTER_Q_INDEX];
+ q = (svm_queue_t *) sh->opaque[TO_MASTER_Q_INDEX];
queue_lock = (u32 *) q;
@@ -366,7 +366,7 @@ ssvm_eth_interface_tx (vlib_main_t * vm,
while (__sync_lock_test_and_set (queue_lock, 1))
;
- unix_shared_memory_queue_add_raw (q, (u8 *) & elt_index);
+ svm_queue_add_raw (q, (u8 *) & elt_index);
CLIB_MEMORY_BARRIER ();
*queue_lock = 0;
diff --git a/src/vnet/devices/ssvm/ssvm_eth.h b/src/vnet/devices/ssvm/ssvm_eth.h
index 7f9aaad3e82..a506b4b7312 100644
--- a/src/vnet/devices/ssvm/ssvm_eth.h
+++ b/src/vnet/devices/ssvm/ssvm_eth.h
@@ -28,9 +28,8 @@
#include <vnet/devices/devices.h>
#include <vnet/ip/ip.h>
#include <vnet/pg/pg.h>
-#include <vlibmemory/unix_shared_memory_queue.h>
-
#include <svm/ssvm.h>
+#include <svm/queue.h>
extern vnet_device_class_t ssvm_eth_device_class;
extern vlib_node_registration_t ssvm_eth_input_node;