aboutsummaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-01-06 16:33:06 -0500
committerOle Trøan <otroan@employees.org>2017-01-06 22:55:02 +0000
commitf952692c871b78590fcd6f2d1340a77ce59030a6 (patch)
tree7f9871b0dded8c8c8c471d3c16c9f6db21ec73cd /src/vpp-api/python
parenta1b99dada3190d793555a075aa4eb3560c68fec7 (diff)
python clients can set the API rx message queue length
Change-Id: I7af1493a823747e0f7389ad6c2093e4cec6c2ce9 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vpp-api/python')
-rw-r--r--src/vpp-api/python/pneum/pneum.c5
-rw-r--r--src/vpp-api/python/pneum/pneum.h3
-rw-r--r--src/vpp-api/python/pneum/test_pneum.c2
-rw-r--r--src/vpp-api/python/vpp_papi/pneum_wrap.c7
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_papi.py6
5 files changed, 13 insertions, 10 deletions
diff --git a/src/vpp-api/python/pneum/pneum.c b/src/vpp-api/python/pneum/pneum.c
index b805f04b11e..37c8d8fe5f9 100644
--- a/src/vpp-api/python/pneum/pneum.c
+++ b/src/vpp-api/python/pneum/pneum.c
@@ -126,7 +126,8 @@ pneum_msg_table_size(void)
}
int
-pneum_connect (char * name, char * chroot_prefix, pneum_callback_t cb)
+pneum_connect (char * name, char * chroot_prefix, pneum_callback_t cb,
+ int rx_qlen)
{
int rv = 0;
pneum_main_t *pm = &pneum_main;
@@ -139,7 +140,7 @@ pneum_connect (char * name, char * chroot_prefix, pneum_callback_t cb)
return rv;
}
- if (vl_client_connect(name, 0, 32) < 0) {
+ if (vl_client_connect(name, 0, rx_qlen) < 0) {
vl_client_api_unmap();
return (-1);
}
diff --git a/src/vpp-api/python/pneum/pneum.h b/src/vpp-api/python/pneum/pneum.h
index a347bd25f62..9312eb47817 100644
--- a/src/vpp-api/python/pneum/pneum.h
+++ b/src/vpp-api/python/pneum/pneum.h
@@ -19,7 +19,8 @@
#include <vppinfra/types.h>
typedef void (*pneum_callback_t)(unsigned char * data, int len);
-int pneum_connect(char * name, char * chroot_prefix, pneum_callback_t cb);
+int pneum_connect(char * name, char * chroot_prefix, pneum_callback_t cb,
+ int rx_qlen);
int pneum_disconnect(void);
int pneum_read(char **data, int *l);
int pneum_write(char *data, int len);
diff --git a/src/vpp-api/python/pneum/test_pneum.c b/src/vpp-api/python/pneum/test_pneum.c
index 0d55b8a9b8e..334e58e9362 100644
--- a/src/vpp-api/python/pneum/test_pneum.c
+++ b/src/vpp-api/python/pneum/test_pneum.c
@@ -80,7 +80,7 @@ int main (int argc, char ** argv)
vl_api_show_version_t message;
vl_api_show_version_t *mp;
int async = 1;
- int rv = pneum_connect("pneum_client", NULL, NULL);
+ int rv = pneum_connect("pneum_client", NULL, NULL, 32 /* rx queue-length*/);
if (rv != 0) {
printf("Connect failed: %d\n", rv);
diff --git a/src/vpp-api/python/vpp_papi/pneum_wrap.c b/src/vpp-api/python/vpp_papi/pneum_wrap.c
index 5763707b517..748b96744aa 100644
--- a/src/vpp-api/python/vpp_papi/pneum_wrap.c
+++ b/src/vpp-api/python/vpp_papi/pneum_wrap.c
@@ -45,12 +45,13 @@ static PyObject *
wrap_connect (PyObject *self, PyObject *args)
{
char * name, * chroot_prefix = NULL;
+ int rx_qlen=32; /* default rx queue length */
int rv;
PyObject * temp = NULL;
pneum_callback_t cb = NULL;
- if (!PyArg_ParseTuple(args, "s|Os:wrap_connect",
- &name, &temp, &chroot_prefix))
+ if (!PyArg_ParseTuple(args, "s|Ois:wrap_connect",
+ &name, &temp, &rx_qlen, &chroot_prefix))
return (NULL);
if (temp)
@@ -67,7 +68,7 @@ wrap_connect (PyObject *self, PyObject *args)
cb = wrap_pneum_callback;
}
Py_BEGIN_ALLOW_THREADS
- rv = pneum_connect(name, chroot_prefix, cb);
+ rv = pneum_connect(name, chroot_prefix, cb, rx_qlen);
Py_END_ALLOW_THREADS
return PyLong_FromLong(rv);
}
diff --git a/src/vpp-api/python/vpp_papi/vpp_papi.py b/src/vpp-api/python/vpp_papi/vpp_papi.py
index 6b6b79fd70b..45774723a3e 100644
--- a/src/vpp-api/python/vpp_papi/vpp_papi.py
+++ b/src/vpp-api/python/vpp_papi/vpp_papi.py
@@ -303,12 +303,12 @@ class VPP():
self.vpp_dictionary[name] = { 'id' : i, 'crc' : crc }
self.vpp_dictionary_maxid = max(self.vpp_dictionary_maxid, i)
- def connect(self, name, chroot_prefix = None, async = False):
+ def connect(self, name, chroot_prefix = None, async = False, rx_qlen = 32):
msg_handler = self.msg_handler if not async else self.msg_handler_async
if not chroot_prefix:
- rv = vpp_api.connect(name, msg_handler)
+ rv = vpp_api.connect(name, msg_handler, rx_qlen)
else:
- rv = vpp_api.connect(name, msg_handler, chroot_prefix)
+ rv = vpp_api.connect(name, msg_handler, rx_qlen, chroot_prefix)
if rv != 0:
raise IOError(2, 'Connect failed')