aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api
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/vpp-api
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/vpp-api')
-rw-r--r--src/vpp-api/client/client.c14
-rw-r--r--src/vpp-api/java/jvpp-acl/jvpp_acl.c2
-rw-r--r--src/vpp-api/java/jvpp-acl/jvpp_acl.h2
-rw-r--r--src/vpp-api/java/jvpp-common/jvpp_common.h2
-rw-r--r--src/vpp-api/java/jvpp-core/jvpp_core.c4
-rw-r--r--src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.c2
-rw-r--r--src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.h2
-rw-r--r--src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.c2
-rw-r--r--src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.h2
-rw-r--r--src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.c2
-rw-r--r--src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.h2
-rw-r--r--src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.c2
-rw-r--r--src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.h2
-rw-r--r--src/vpp-api/java/jvpp-nat/jvpp_nat.c2
-rw-r--r--src/vpp-api/java/jvpp-nat/jvpp_nat.h2
-rw-r--r--src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.c2
-rw-r--r--src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.h2
-rw-r--r--src/vpp-api/vapi/vapi.c22
18 files changed, 34 insertions, 36 deletions
diff --git a/src/vpp-api/client/client.c b/src/vpp-api/client/client.c
index 668461aad6c..f1372230195 100644
--- a/src/vpp-api/client/client.c
+++ b/src/vpp-api/client/client.c
@@ -132,7 +132,7 @@ vac_api_handler (void *msg)
static void *
vac_rx_thread_fn (void *arg)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
vl_api_memclnt_keepalive_t *mp;
vl_api_memclnt_keepalive_reply_t *rmp;
vac_main_t *pm = &vac_main;
@@ -143,7 +143,7 @@ vac_rx_thread_fn (void *arg)
q = am->vl_input_queue;
while (1)
- while (!unix_shared_memory_queue_sub(q, (u8 *)&msg, 0))
+ while (!svm_queue_sub(q, (u8 *)&msg, 0))
{
u16 id = ntohs(*((u16 *)msg));
switch (id) {
@@ -381,7 +381,7 @@ unset_timeout (void)
int
vac_read (char **p, int *l, u16 timeout)
{
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
api_main_t *am = &api_main;
vac_main_t *pm = &vac_main;
vl_api_memclnt_keepalive_t *mp;
@@ -404,7 +404,7 @@ vac_read (char **p, int *l, u16 timeout)
q = am->vl_input_queue;
again:
- rv = unix_shared_memory_queue_sub(q, (u8 *)&msg, 0);
+ rv = svm_queue_sub(q, (u8 *)&msg, 0);
if (rv == 0) {
u16 msg_id = ntohs(*((u16 *)msg));
switch (msg_id) {
@@ -478,7 +478,7 @@ vac_write (char *p, int l)
int rv = -1;
api_main_t *am = &api_main;
vl_api_header_t *mp = vl_msg_api_alloc(l);
- unix_shared_memory_queue_t *q;
+ svm_queue_t *q;
vac_main_t *pm = &vac_main;
if (!pm->connected_to_vlib) return -1;
@@ -487,7 +487,7 @@ vac_write (char *p, int l)
memcpy(mp, p, l);
mp->client_index = vac_client_index();
q = am->shmem_hdr->vl_input_queue;
- rv = unix_shared_memory_queue_add(q, (u8 *)&mp, 0);
+ rv = svm_queue_add(q, (u8 *)&mp, 0);
if (rv != 0) {
clib_warning("vpe_api_write fails: %d\n", rv);
/* Clear message */
@@ -499,7 +499,7 @@ vac_write (char *p, int l)
int
vac_get_msg_index (unsigned char * name)
{
- return vl_api_get_msg_index (name);
+ return vl_msg_api_get_msg_index (name);
}
int
diff --git a/src/vpp-api/java/jvpp-acl/jvpp_acl.c b/src/vpp-api/java/jvpp-acl/jvpp_acl.c
index 82719aafbc8..22e44f1db5a 100644
--- a/src/vpp-api/java/jvpp-acl/jvpp_acl.c
+++ b/src/vpp-api/java/jvpp-acl/jvpp_acl.c
@@ -47,7 +47,7 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_acl_JVppAclImpl_init0
clib_warning ("Java_io_fd_vpp_jvpp_acl_JVppAclImpl_init0");
plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = uword_to_pointer (queue_address, unix_shared_memory_queue_t *);
+ plugin_main->vl_input_queue = uword_to_pointer (queue_address, svm_queue_t *);
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
diff --git a/src/vpp-api/java/jvpp-acl/jvpp_acl.h b/src/vpp-api/java/jvpp-acl/jvpp_acl.h
index 726f7298221..d1ec78feb19 100644
--- a/src/vpp-api/java/jvpp-acl/jvpp_acl.h
+++ b/src/vpp-api/java/jvpp-acl/jvpp_acl.h
@@ -25,7 +25,7 @@
/* Global state for JVPP-acl */
typedef struct {
/* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
/* VPP api client index */
u32 my_client_index;
diff --git a/src/vpp-api/java/jvpp-common/jvpp_common.h b/src/vpp-api/java/jvpp-common/jvpp_common.h
index 34502d04ab8..14027a96f78 100644
--- a/src/vpp-api/java/jvpp-common/jvpp_common.h
+++ b/src/vpp-api/java/jvpp-common/jvpp_common.h
@@ -35,7 +35,7 @@ typedef struct {
JavaVM *jvm;
/* Convenience */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
u32 my_client_index;
uword *messages_hash;
} jvpp_main_t;
diff --git a/src/vpp-api/java/jvpp-core/jvpp_core.c b/src/vpp-api/java/jvpp-core/jvpp_core.c
index b12f63af16f..09d753026d7 100644
--- a/src/vpp-api/java/jvpp-core/jvpp_core.c
+++ b/src/vpp-api/java/jvpp-core/jvpp_core.c
@@ -30,7 +30,7 @@
// TODO: generate jvpp_plugin_name.c files (or at least reuse plugin's main structure)
typedef struct {
/* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
/* VPP api client index */
u32 my_client_index;
@@ -50,7 +50,7 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_core_JVppCoreImpl_init0
(JNIEnv * env, jclass clazz, jobject callback, jlong queue_address, jint my_client_index) {
core_main_t * plugin_main = &core_main;
plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = uword_to_pointer (queue_address, unix_shared_memory_queue_t *);
+ plugin_main->vl_input_queue = uword_to_pointer (queue_address, svm_queue_t *);
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
diff --git a/src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.c b/src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.c
index 286a9ceccbe..8e523caa9f8 100644
--- a/src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.c
+++ b/src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.c
@@ -47,7 +47,7 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_gtpu_JVppGtpuImpl_init0
clib_warning ("Java_io_fd_vpp_jvpp_gtpu_JVppGtpuImpl_init0");
plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = (unix_shared_memory_queue_t *)queue_address;
+ plugin_main->vl_input_queue = (svm_queue_t *)queue_address;
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
diff --git a/src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.h b/src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.h
index 447776ce0b8..fa7c8b7c53b 100644
--- a/src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.h
+++ b/src/vpp-api/java/jvpp-gtpu/jvpp_gtpu.h
@@ -25,7 +25,7 @@
/* Global state for JVPP-gtpu */
typedef struct {
/* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
/* VPP api client index */
u32 my_client_index;
diff --git a/src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.c b/src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.c
index 8d486134cfa..74ae438e136 100644
--- a/src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.c
+++ b/src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.c
@@ -47,7 +47,7 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl_init0
clib_warning ("Java_io_fd_vpp_jvpp_ioamexport_JVppIoamexportImpl_init0");
plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = uword_to_pointer (queue_address, unix_shared_memory_queue_t *);
+ plugin_main->vl_input_queue = uword_to_pointer (queue_address, svm_queue_t *);
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
diff --git a/src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.h b/src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.h
index 8b243def8e8..596a05400e9 100644
--- a/src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.h
+++ b/src/vpp-api/java/jvpp-ioamexport/jvpp_ioam_export.h
@@ -25,7 +25,7 @@
/* Global state for JVPP-IOAM-EXPORT */
typedef struct {
/* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
/* VPP api client index */
u32 my_client_index;
diff --git a/src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.c b/src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.c
index 4b9d1a58932..ce1da6979e7 100644
--- a/src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.c
+++ b/src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.c
@@ -47,7 +47,7 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_ioampot_JVppIoampotImpl_init0
clib_warning ("Java_io_fd_vpp_jvpp_ioampot_JVppIoampotImpl_init0");
plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = uword_to_pointer (queue_address, unix_shared_memory_queue_t *);
+ plugin_main->vl_input_queue = uword_to_pointer (queue_address, svm_queue_t *);
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
diff --git a/src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.h b/src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.h
index 81e2a1bbbb6..51db3da83b5 100644
--- a/src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.h
+++ b/src/vpp-api/java/jvpp-ioampot/jvpp_ioam_pot.h
@@ -25,7 +25,7 @@
/* Global state for JVPP-IOAM-POT */
typedef struct {
/* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
/* VPP api client index */
u32 my_client_index;
diff --git a/src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.c b/src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.c
index f917d1c684e..3532d91e3a4 100644
--- a/src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.c
+++ b/src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.c
@@ -47,7 +47,7 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl_init0
clib_warning ("Java_io_fd_vpp_jvpp_ioamtrace_JVppIoamtraceImpl_init0");
plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = uword_to_pointer (queue_address, unix_shared_memory_queue_t *);
+ plugin_main->vl_input_queue = uword_to_pointer (queue_address, svm_queue_t *);
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
diff --git a/src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.h b/src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.h
index cb0b27e199c..752b599f4b8 100644
--- a/src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.h
+++ b/src/vpp-api/java/jvpp-ioamtrace/jvpp_ioam_trace.h
@@ -25,7 +25,7 @@
/* Global state for JVPP-IOAM-TRACE */
typedef struct {
/* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
/* VPP api client index */
u32 my_client_index;
diff --git a/src/vpp-api/java/jvpp-nat/jvpp_nat.c b/src/vpp-api/java/jvpp-nat/jvpp_nat.c
index 56c74d21141..bdae1e64913 100644
--- a/src/vpp-api/java/jvpp-nat/jvpp_nat.c
+++ b/src/vpp-api/java/jvpp-nat/jvpp_nat.c
@@ -47,7 +47,7 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_nat_JVppNatImpl_init0
clib_warning ("Java_io_fd_vpp_jvpp_nat_JVppNatImpl_init0");
plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = uword_to_pointer (queue_address, unix_shared_memory_queue_t *);
+ plugin_main->vl_input_queue = uword_to_pointer (queue_address, svm_queue_t *);
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
diff --git a/src/vpp-api/java/jvpp-nat/jvpp_nat.h b/src/vpp-api/java/jvpp-nat/jvpp_nat.h
index c8f6b683fea..9bff974a976 100644
--- a/src/vpp-api/java/jvpp-nat/jvpp_nat.h
+++ b/src/vpp-api/java/jvpp-nat/jvpp_nat.h
@@ -25,7 +25,7 @@
/* Global state for JVPP-NAT */
typedef struct {
/* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
/* VPP api client index */
u32 my_client_index;
diff --git a/src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.c b/src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.c
index d339700ea22..02bd20e6bb4 100644
--- a/src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.c
+++ b/src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.c
@@ -47,7 +47,7 @@ JNIEXPORT void JNICALL Java_io_fd_vpp_jvpp_pppoe_JVppPppoeImpl_init0
clib_warning ("Java_io_fd_vpp_jvpp_pppoe_JVppPppoeImpl_init0");
plugin_main->my_client_index = my_client_index;
- plugin_main->vl_input_queue = (unix_shared_memory_queue_t *)queue_address;
+ plugin_main->vl_input_queue = (svm_queue_t *)queue_address;
plugin_main->callbackObject = (*env)->NewGlobalRef(env, callback);
plugin_main->callbackClass = (jclass)(*env)->NewGlobalRef(env, (*env)->GetObjectClass(env, callback));
diff --git a/src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.h b/src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.h
index 4523ba9cd96..7606a7ef86e 100644
--- a/src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.h
+++ b/src/vpp-api/java/jvpp-pppoe/jvpp_pppoe.h
@@ -25,7 +25,7 @@
/* Global state for JVPP-pppoe */
typedef struct {
/* Pointer to shared memory queue */
- unix_shared_memory_queue_t * vl_input_queue;
+ svm_queue_t * vl_input_queue;
/* VPP api client index */
u32 my_client_index;
diff --git a/src/vpp-api/vapi/vapi.c b/src/vpp-api/vapi/vapi.c
index 658fd7e584c..7aa346bf083 100644
--- a/src/vpp-api/vapi/vapi.c
+++ b/src/vpp-api/vapi/vapi.c
@@ -29,7 +29,7 @@
#include <vppinfra/pool.h>
#include <vlib/vlib.h>
#include <vlibapi/api_common.h>
-#include <vlibmemory/api_common.h>
+#include <vlibmemory/memory_client.h>
/* we need to use control pings for some stuff and because we're forced to put
* the code in headers, we need a way to be able to grab the ids of these
@@ -336,7 +336,7 @@ vapi_connect (vapi_ctx_t ctx, const char *name,
vapi_message_desc_t *m = __vapi_metadata.msgs[i];
u8 scratch[m->name_with_crc_len + 1];
memcpy (scratch, m->name_with_crc, m->name_with_crc_len + 1);
- u32 id = vl_api_get_msg_index (scratch);
+ u32 id = vl_msg_api_get_msg_index (scratch);
if (INVALID_MSG_ID != id)
{
if (id > UINT16_MAX)
@@ -425,7 +425,7 @@ vapi_send (vapi_ctx_t ctx, void *msg)
goto out;
}
int tmp;
- unix_shared_memory_queue_t *q = api_main.shmem_hdr->vl_input_queue;
+ svm_queue_t *q = api_main.shmem_hdr->vl_input_queue;
#if VAPI_DEBUG
unsigned msgid = be16toh (*(u16 *) msg);
if (msgid <= ctx->vl_msg_id_max)
@@ -446,9 +446,8 @@ vapi_send (vapi_ctx_t ctx, void *msg)
VAPI_DBG ("send msg@%p:%u[UNKNOWN]", msg, msgid);
}
#endif
- tmp = unix_shared_memory_queue_add (q, (u8 *) & msg,
- VAPI_MODE_BLOCKING ==
- ctx->mode ? 0 : 1);
+ tmp = svm_queue_add (q, (u8 *) & msg,
+ VAPI_MODE_BLOCKING == ctx->mode ? 0 : 1);
if (tmp < 0)
{
rv = VAPI_EAGAIN;
@@ -467,7 +466,7 @@ vapi_send2 (vapi_ctx_t ctx, void *msg1, void *msg2)
rv = VAPI_EINVAL;
goto out;
}
- unix_shared_memory_queue_t *q = api_main.shmem_hdr->vl_input_queue;
+ svm_queue_t *q = api_main.shmem_hdr->vl_input_queue;
#if VAPI_DEBUG
unsigned msgid1 = be16toh (*(u16 *) msg1);
unsigned msgid2 = be16toh (*(u16 *) msg2);
@@ -491,9 +490,8 @@ vapi_send2 (vapi_ctx_t ctx, void *msg1, void *msg2)
}
VAPI_DBG ("send two: %u[%s], %u[%s]", msgid1, name1, msgid2, name2);
#endif
- int tmp = unix_shared_memory_queue_add2 (q, (u8 *) & msg1, (u8 *) & msg2,
- VAPI_MODE_BLOCKING ==
- ctx->mode ? 0 : 1);
+ int tmp = svm_queue_add2 (q, (u8 *) & msg1, (u8 *) & msg2,
+ VAPI_MODE_BLOCKING == ctx->mode ? 0 : 1);
if (tmp < 0)
{
rv = VAPI_EAGAIN;
@@ -519,9 +517,9 @@ vapi_recv (vapi_ctx_t ctx, void **msg, size_t * msg_size)
return VAPI_EINVAL;
}
- unix_shared_memory_queue_t *q = am->vl_input_queue;
+ svm_queue_t *q = am->vl_input_queue;
VAPI_DBG ("doing shm queue sub");
- int tmp = unix_shared_memory_queue_sub (q, (u8 *) & data, 0);
+ int tmp = svm_queue_sub (q, (u8 *) & data, 0);
if (tmp == 0)
{
#if VAPI_DEBUG_ALLOC