diff options
author | Pivo <iwijnand@cisco.com> | 2020-05-04 17:57:33 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-05-04 19:03:25 +0000 |
commit | 6017ff0dd7a27c062d0ad4687bfc70a69747ac55 (patch) | |
tree | ba20b05fdb31074e7e74e5f892328eb99c3b5ffb | |
parent | 9845c20d77ce8e9e66c9a7693c6841cc971bd423 (diff) |
vcl: allow vcl worker index to be set by applications
When using vppcom_session* apis to setup TCP sessions in applications build outside of the VPP repository, it is necessary to set the worker_index explicitly when these apis are called from the none-VCL worker threads. An example is when data is to be sent to the TCP session that is originated from a different thread, like the main program thread or from the bin api thread. This change allows the application to set it.
Type: fix
Signed-off-by: IJsbrand Wijnands <ice@cisco.com>
Change-Id: I37f3654a49ea9a8cf3a0d3d0e672583018c12299
-rw-r--r-- | src/vcl/vppcom.c | 6 | ||||
-rw-r--r-- | src/vcl/vppcom.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 38b85bede3b..6b690e5d1d0 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -3830,6 +3830,12 @@ vppcom_worker_unregister (void) vcl_set_worker_index (~0); } +void +vppcom_worker_index_set (int index) +{ + vcl_set_worker_index (index); +} + int vppcom_worker_index (void) { diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h index d2a5a103f8d..902e9ea5d47 100644 --- a/src/vcl/vppcom.h +++ b/src/vcl/vppcom.h @@ -330,6 +330,11 @@ extern void vppcom_worker_unregister (void); extern int vppcom_worker_index (void); /** + * Set current worker index + */ +extern void vppcom_worker_index_set (int); + +/** * Returns the current worker's message queues epoll fd * * This only works if vcl is configured to do eventfd based message queue |