summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices
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
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')
-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
-rw-r--r--src/vnet/devices/tap/tapv2_api.c11
-rw-r--r--src/vnet/devices/virtio/vhost_user_api.c10
5 files changed, 25 insertions, 29 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;
diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c
index 841d21e2d25..e161ed6c397 100644
--- a/src/vnet/devices/tap/tapv2_api.c
+++ b/src/vnet/devices/tap/tapv2_api.c
@@ -54,7 +54,7 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
{
vlib_main_t *vm = vlib_get_main ();
vl_api_tap_create_v2_reply_t *rmp;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
tap_create_if_args_t _a, *ap = &_a;
memset (ap, 0, sizeof (*ap));
@@ -113,8 +113,7 @@ vl_api_tap_create_v2_t_handler (vl_api_tap_create_v2_t * mp)
static void
tap_send_sw_interface_event_deleted (vpe_api_main_t * am,
- unix_shared_memory_queue_t * q,
- u32 sw_if_index)
+ svm_queue_t * q, u32 sw_if_index)
{
vl_api_sw_interface_event_t *mp;
@@ -136,7 +135,7 @@ vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp)
int rv;
vpe_api_main_t *vam = &vpe_api_main;
vl_api_tap_delete_v2_reply_t *rmp;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
u32 sw_if_index = ntohl (mp->sw_if_index);
rv = tap_delete_if (vm, sw_if_index);
@@ -158,7 +157,7 @@ vl_api_tap_delete_v2_t_handler (vl_api_tap_delete_v2_t * mp)
static void
tap_send_sw_interface_details (vpe_api_main_t * am,
- unix_shared_memory_queue_t * q,
+ svm_queue_t * q,
tap_interface_details_t * tap_if, u32 context)
{
vl_api_sw_interface_tap_v2_details_t *mp;
@@ -199,7 +198,7 @@ vl_api_sw_interface_tap_v2_dump_t_handler (vl_api_sw_interface_tap_v2_dump_t *
{
int rv;
vpe_api_main_t *am = &vpe_api_main;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
tap_interface_details_t *tapifs = NULL;
tap_interface_details_t *tap_if = NULL;
diff --git a/src/vnet/devices/virtio/vhost_user_api.c b/src/vnet/devices/virtio/vhost_user_api.c
index 78599241d3e..9ddd3387a72 100644
--- a/src/vnet/devices/virtio/vhost_user_api.c
+++ b/src/vnet/devices/virtio/vhost_user_api.c
@@ -53,8 +53,7 @@ _(SW_INTERFACE_VHOST_USER_DUMP, sw_interface_vhost_user_dump)
*/
static void
send_sw_interface_event_deleted (vpe_api_main_t * am,
- unix_shared_memory_queue_t * q,
- u32 sw_if_index)
+ svm_queue_t * q, u32 sw_if_index)
{
vl_api_sw_interface_event_t *mp;
@@ -137,8 +136,7 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp)
REPLY_MACRO (VL_API_DELETE_VHOST_USER_IF_REPLY);
if (!rv)
{
- unix_shared_memory_queue_t *q =
- vl_api_client_index_to_input_queue (mp->client_index);
+ svm_queue_t *q = vl_api_client_index_to_input_queue (mp->client_index);
if (!q)
return;
@@ -149,7 +147,7 @@ vl_api_delete_vhost_user_if_t_handler (vl_api_delete_vhost_user_if_t * mp)
static void
send_sw_interface_vhost_user_details (vpe_api_main_t * am,
- unix_shared_memory_queue_t * q,
+ svm_queue_t * q,
vhost_user_intf_details_t * vui,
u32 context)
{
@@ -184,7 +182,7 @@ static void
vlib_main_t *vm = vlib_get_main ();
vhost_user_intf_details_t *ifaces = NULL;
vhost_user_intf_details_t *vuid = NULL;
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
q = vl_api_client_index_to_input_queue (mp->client_index);
if (q == 0)