summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/java/jvpp-registry
diff options
context:
space:
mode:
authorMatej Perina <mperina@cisco.com>2017-09-14 16:14:14 +0200
committerDave Wallace <dwallacelf@gmail.com>2017-09-15 20:19:03 +0000
commit3e233678f13bc175e652ac0ea4a038054771ee97 (patch)
treef8641793e9016b1ddb5518527e5803263029119e /src/vpp-api/java/jvpp-registry
parent01914ce45729833cec88c65689de9a0336cd40cc (diff)
jvpp: add vpe_pid to ConnectionInfo
ConnectionInfo now contains pid of vpp process pid is aquired through initial control ping during connection creation Change-Id: I68457770e07792d11c47bc7d8cbd0d2fd722d9b4 Signed-off-by: Matej Perina <mperina@cisco.com>
Diffstat (limited to 'src/vpp-api/java/jvpp-registry')
-rw-r--r--src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/VppJNIConnection.java4
-rw-r--r--src/vpp-api/java/jvpp-registry/jvpp_registry.c15
2 files changed, 11 insertions, 8 deletions
diff --git a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/VppJNIConnection.java b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/VppJNIConnection.java
index 53eaa790778..6a414f36b88 100644
--- a/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/VppJNIConnection.java
+++ b/src/vpp-api/java/jvpp-registry/io/fd/vpp/jvpp/VppJNIConnection.java
@@ -135,11 +135,13 @@ public final class VppJNIConnection implements VppConnection {
public final long queueAddress;
public final int clientIndex;
public final int status; // FIXME throw exception instead
+ public final int pid;
- public ConnectionInfo(long queueAddress, int clientIndex, int status) {
+ public ConnectionInfo(long queueAddress, int clientIndex, int status, int pid) {
this.queueAddress = queueAddress;
this.clientIndex = clientIndex;
this.status = status;
+ this.pid = pid;
}
}
diff --git a/src/vpp-api/java/jvpp-registry/jvpp_registry.c b/src/vpp-api/java/jvpp-registry/jvpp_registry.c
index 1e2c0176db9..e8264cbfca3 100644
--- a/src/vpp-api/java/jvpp-registry/jvpp_registry.c
+++ b/src/vpp-api/java/jvpp-registry/jvpp_registry.c
@@ -73,6 +73,7 @@ typedef struct {
/* Connected indication */
volatile u8 is_connected;
+ u32 vpe_pid;
} jvpp_registry_main_t;
jvpp_registry_main_t jvpp_registry_main __attribute__((aligned (64)));
@@ -170,7 +171,8 @@ static void vl_api_control_ping_reply_t_handler(
}
}
- out: rm->control_ping_result_ready = 1;
+ out: rm->vpe_pid = clib_net_to_host_u32(mp->vpe_pid);
+ rm->control_ping_result_ready = 1;
}
static int find_ping_id() {
@@ -239,7 +241,6 @@ static int send_initial_control_ping() {
if (rv != 0) {
clib_warning("first control ping failed: %d", rv);
}
-
return rv;
}
@@ -283,12 +284,12 @@ JNIEXPORT jobject JNICALL Java_io_fd_vpp_jvpp_VppJNIConnection_clientConnect(
jclass connectionInfoClass = (*env)->FindClass(env,
"io/fd/vpp/jvpp/VppJNIConnection$ConnectionInfo");
jmethodID connectionInfoConstructor = (*env)->GetMethodID(env,
- connectionInfoClass, "<init>", "(JII)V");
+ connectionInfoClass, "<init>", "(JIII)V");
if (rm->is_connected) {
return (*env)->NewObject(env, connectionInfoClass,
connectionInfoConstructor, 0, 0,
- VNET_API_ERROR_ALREADY_CONNECTED);
+ VNET_API_ERROR_ALREADY_CONNECTED, 0);
}
client_name = (*env)->GetStringUTFChars(env, clientName, 0);
@@ -296,12 +297,12 @@ JNIEXPORT jobject JNICALL Java_io_fd_vpp_jvpp_VppJNIConnection_clientConnect(
if (!client_name) {
return (*env)->NewObject(env, connectionInfoClass,
- connectionInfoConstructor, 0, 0, VNET_API_ERROR_INVALID_VALUE, shmPrefix);
+ connectionInfoConstructor, 0, 0, VNET_API_ERROR_INVALID_VALUE, 0, shmPrefix);
}
if (!shm_prefix) {
return (*env)->NewObject(env, connectionInfoClass,
- connectionInfoConstructor, 0, 0, VNET_API_ERROR_INVALID_VALUE, shmPrefix);
+ connectionInfoConstructor, 0, 0, VNET_API_ERROR_INVALID_VALUE, 0, shmPrefix);
}
rv = connect_to_vpe((char *) shm_prefix, (char *) client_name);
@@ -314,7 +315,7 @@ JNIEXPORT jobject JNICALL Java_io_fd_vpp_jvpp_VppJNIConnection_clientConnect(
return (*env)->NewObject(env, connectionInfoClass,
connectionInfoConstructor, (jlong) pointer_to_uword (jm->vl_input_queue),
- (jint) jm->my_client_index, (jint) rv);
+ (jint) jm->my_client_index, (jint) rv, (jint) rm->vpe_pid);
}
JNIEXPORT jint JNICALL Java_io_fd_vpp_jvpp_JVppRegistryImpl_controlPing0(