aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-11-18 19:02:17 -0800
committerFlorin Coras <florin.coras@gmail.com>2020-11-19 22:14:39 +0000
commit52dd29ff5107b7db9f3ee892d1827ff76f5d017f (patch)
tree91e50b1842153d57e6cd0708b200a614b1de1c1f /src
parent8b276df32f0c833b31f8a5c8408855afbbde1307 (diff)
vcl: stop tracking vpp event queues and thread index
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Icbee02a39650bc792532adc714bcf4f47f3fbe59
Diffstat (limited to 'src')
-rw-r--r--src/vcl/vcl_bapi.c2
-rw-r--r--src/vcl/vcl_locked.c1
-rw-r--r--src/vcl/vcl_private.h10
-rw-r--r--src/vcl/vcl_sapi.c2
-rw-r--r--src/vcl/vppcom.c66
5 files changed, 21 insertions, 60 deletions
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index 06947c620b8..e245c4dc865 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -79,8 +79,6 @@ vl_api_app_attach_reply_t_handler (vl_api_app_attach_reply_t * mp)
wrk->app_event_queue = uword_to_pointer (mp->app_mq, svm_msg_q_t *);
ctrl_mq = uword_to_pointer (mp->vpp_ctrl_mq, svm_msg_q_t *);
- vec_validate (wrk->vpp_event_queues, mp->vpp_ctrl_mq_thread);
- wrk->vpp_event_queues[mp->vpp_ctrl_mq_thread] = ctrl_mq;
vcm->ctrl_mq = wrk->ctrl_mq = ctrl_mq;
segment_handle = clib_net_to_host_u64 (mp->segment_handle);
if (segment_handle == VCL_INVALID_SEGMENT_HANDLE)
diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c
index ce94d7500a4..35061e7d86e 100644
--- a/src/vcl/vcl_locked.c
+++ b/src/vcl/vcl_locked.c
@@ -760,7 +760,6 @@ vls_worker_copy_on_fork (vcl_worker_t * parent_wrk)
/*
* init vcl worker
*/
- wrk->vpp_event_queues = vec_dup (parent_wrk->vpp_event_queues);
wrk->sessions = pool_dup (parent_wrk->sessions);
wrk->session_index_by_vpp_handles =
hash_dup (parent_wrk->session_index_by_vpp_handles);
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 2dd41645147..0d26e64917c 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -154,7 +154,6 @@ typedef struct vcl_session_
vcl_session_msg_t *accept_evts_fifo;
u64 vpp_handle;
- u32 vpp_thread_index;
u32 listener_index; /**< index of parent listener (if any) */
int n_accepted_sessions; /**< sessions accepted by this listener */
u32 attributes; /**< see @ref vppcom_session_attr_t */
@@ -263,9 +262,6 @@ typedef struct vcl_worker_
/** Our event message queue */
svm_msg_q_t *app_event_queue;
- /** VPP workers event message queues */
- svm_msg_q_t **vpp_event_queues;
-
/** For deadman timers */
clib_time_t clib_time;
@@ -674,12 +670,6 @@ vcl_n_workers (void)
return pool_elts (vcm->workers);
}
-static inline svm_msg_q_t *
-vcl_session_vpp_evt_q (vcl_worker_t * wrk, vcl_session_t * s)
-{
- return wrk->vpp_event_queues[s->vpp_thread_index];
-}
-
static inline u64
vcl_vpp_worker_segment_handle (u32 wrk_index)
{
diff --git a/src/vcl/vcl_sapi.c b/src/vcl/vcl_sapi.c
index 9258f7927a0..7651b3531fb 100644
--- a/src/vcl/vcl_sapi.c
+++ b/src/vcl/vcl_sapi.c
@@ -59,8 +59,6 @@ vcl_api_attach_reply_handler (app_sapi_attach_reply_msg_t * mp, int *fds)
wrk->api_client_handle = mp->api_client_handle;
wrk->app_event_queue = uword_to_pointer (mp->app_mq, svm_msg_q_t *);
ctrl_mq = uword_to_pointer (mp->vpp_ctrl_mq, svm_msg_q_t *);
- vec_validate (wrk->vpp_event_queues, mp->vpp_ctrl_mq_thread);
- wrk->vpp_event_queues[mp->vpp_ctrl_mq_thread] = ctrl_mq;
vcm->ctrl_mq = wrk->ctrl_mq = ctrl_mq;
segment_handle = mp->segment_handle;
if (segment_handle == VCL_INVALID_SEGMENT_HANDLE)
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index fd866155b4d..da7693fa08f 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -293,32 +293,33 @@ vcl_send_session_accepted_reply (svm_msg_q_t * mq, u32 context,
}
static void
-vcl_send_session_disconnected_reply (svm_msg_q_t * mq, u32 context,
- session_handle_t handle, int retval)
+vcl_send_session_disconnected_reply (vcl_worker_t * wrk, vcl_session_t * s,
+ int retval)
{
app_session_evt_t _app_evt, *app_evt = &_app_evt;
session_disconnected_reply_msg_t *rmp;
- app_alloc_ctrl_evt_to_vpp (mq, app_evt,
+ app_alloc_ctrl_evt_to_vpp (s->vpp_evt_q, app_evt,
SESSION_CTRL_EVT_DISCONNECTED_REPLY);
rmp = (session_disconnected_reply_msg_t *) app_evt->evt->data;
- rmp->handle = handle;
- rmp->context = context;
+ rmp->handle = s->vpp_handle;
+ rmp->context = wrk->api_client_handle;
rmp->retval = retval;
- app_send_ctrl_evt_to_vpp (mq, app_evt);
+ app_send_ctrl_evt_to_vpp (s->vpp_evt_q, app_evt);
}
static void
-vcl_send_session_reset_reply (svm_msg_q_t * mq, u32 context,
- session_handle_t handle, int retval)
+vcl_send_session_reset_reply (vcl_worker_t * wrk, vcl_session_t * s,
+ int retval)
{
app_session_evt_t _app_evt, *app_evt = &_app_evt;
session_reset_reply_msg_t *rmp;
- app_alloc_ctrl_evt_to_vpp (mq, app_evt, SESSION_CTRL_EVT_RESET_REPLY);
+ app_alloc_ctrl_evt_to_vpp (s->vpp_evt_q, app_evt,
+ SESSION_CTRL_EVT_RESET_REPLY);
rmp = (session_reset_reply_msg_t *) app_evt->evt->data;
- rmp->handle = handle;
- rmp->context = context;
+ rmp->handle = s->vpp_handle;
+ rmp->context = wrk->api_client_handle;
rmp->retval = retval;
- app_send_ctrl_evt_to_vpp (mq, app_evt);
+ app_send_ctrl_evt_to_vpp (s->vpp_evt_q, app_evt);
}
void
@@ -327,16 +328,15 @@ vcl_send_session_worker_update (vcl_worker_t * wrk, vcl_session_t * s,
{
app_session_evt_t _app_evt, *app_evt = &_app_evt;
session_worker_update_msg_t *mp;
- svm_msg_q_t *mq;
- mq = vcl_session_vpp_evt_q (wrk, s);
- app_alloc_ctrl_evt_to_vpp (mq, app_evt, SESSION_CTRL_EVT_WORKER_UPDATE);
+ app_alloc_ctrl_evt_to_vpp (s->vpp_evt_q, app_evt,
+ SESSION_CTRL_EVT_WORKER_UPDATE);
mp = (session_worker_update_msg_t *) app_evt->evt->data;
mp->client_index = wrk->api_client_handle;
mp->handle = s->vpp_handle;
mp->req_wrk_index = wrk->vpp_wrk_index;
mp->wrk_index = wrk_index;
- app_send_ctrl_evt_to_vpp (mq, app_evt);
+ app_send_ctrl_evt_to_vpp (s->vpp_evt_q, app_evt);
}
int
@@ -378,7 +378,6 @@ vcl_session_accepted_handler (vcl_worker_t * wrk, session_accepted_msg_t * mp,
{
vcl_session_t *session, *listen_session;
svm_fifo_t *rx_fifo, *tx_fifo;
- u32 vpp_wrk_index;
svm_msg_q_t *evt_q;
session = vcl_session_alloc (wrk);
@@ -406,12 +405,8 @@ vcl_session_accepted_handler (vcl_worker_t * wrk, session_accepted_msg_t * mp,
tx_fifo->client_session_index = session->session_index;
rx_fifo->client_thread_index = vcl_get_worker_index ();
tx_fifo->client_thread_index = vcl_get_worker_index ();
- vpp_wrk_index = tx_fifo->master_thread_index;
- vec_validate (wrk->vpp_event_queues, vpp_wrk_index);
- wrk->vpp_event_queues[vpp_wrk_index] = session->vpp_evt_q;
session->vpp_handle = mp->handle;
- session->vpp_thread_index = rx_fifo->master_thread_index;
session->rx_fifo = rx_fifo;
session->tx_fifo = tx_fifo;
@@ -453,9 +448,9 @@ static u32
vcl_session_connected_handler (vcl_worker_t * wrk,
session_connected_msg_t * mp)
{
- u32 session_index, vpp_wrk_index;
svm_fifo_t *rx_fifo, *tx_fifo;
vcl_session_t *session = 0;
+ u32 session_index;
session_index = mp->context;
session = vcl_session_get (wrk, session_index);
@@ -493,10 +488,6 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
rx_fifo->client_thread_index = vcl_get_worker_index ();
tx_fifo->client_thread_index = vcl_get_worker_index ();
- vpp_wrk_index = tx_fifo->master_thread_index;
- vec_validate (wrk->vpp_event_queues, vpp_wrk_index);
- wrk->vpp_event_queues[vpp_wrk_index] = session->vpp_evt_q;
-
if (mp->ct_rx_fifo)
{
session->ct_rx_fifo = uword_to_pointer (mp->ct_rx_fifo, svm_fifo_t *);
@@ -513,7 +504,6 @@ vcl_session_connected_handler (vcl_worker_t * wrk,
session->rx_fifo = rx_fifo;
session->tx_fifo = tx_fifo;
- session->vpp_thread_index = rx_fifo->master_thread_index;
session->transport.is_ip4 = mp->lcl.is_ip4;
clib_memcpy_fast (&session->transport.lcl_ip, &mp->lcl.ip,
sizeof (session->transport.lcl_ip));
@@ -617,10 +607,7 @@ vcl_session_bound_handler (vcl_worker_t * wrk, session_bound_msg_t * mp)
session->transport.lcl_port = mp->lcl_port;
vcl_session_table_add_listener (wrk, mp->handle, sid);
session->session_state = VCL_STATE_LISTEN;
-
session->vpp_evt_q = uword_to_pointer (mp->vpp_evt_q, svm_msg_q_t *);
- vec_validate (wrk->vpp_event_queues, 0);
- wrk->vpp_event_queues[0] = session->vpp_evt_q;
if (vcl_session_is_cl (session))
{
@@ -685,13 +672,9 @@ vcl_session_migrated_handler (vcl_worker_t * wrk, void *data)
return;
}
- s->vpp_thread_index = mp->vpp_thread_index;
s->vpp_handle = mp->new_handle;
s->vpp_evt_q = uword_to_pointer (mp->vpp_evt_q, svm_msg_q_t *);
- vec_validate (wrk->vpp_event_queues, s->vpp_thread_index);
- wrk->vpp_event_queues[s->vpp_thread_index] = s->vpp_evt_q;
-
vcl_session_table_del_vpp_handle (wrk, mp->handle);
vcl_session_table_add_vpp_handle (wrk, mp->new_handle, s->session_index);
@@ -701,7 +684,7 @@ vcl_session_migrated_handler (vcl_worker_t * wrk, void *data)
SESSION_IO_EVT_TX, SVM_Q_WAIT);
VDBG (0, "Migrated 0x%lx to thread %u 0x%lx", mp->handle,
- s->vpp_thread_index, mp->new_handle);
+ mp->vpp_thread_index, mp->new_handle);
}
static vcl_session_t *
@@ -769,7 +752,6 @@ static int
vppcom_session_disconnect (u32 session_handle)
{
vcl_worker_t *wrk = vcl_worker_get_current ();
- svm_msg_q_t *vpp_evt_q;
vcl_session_t *session, *listen_session;
vcl_session_state_t state;
u64 vpp_handle;
@@ -792,9 +774,7 @@ vppcom_session_disconnect (u32 session_handle)
if (state == VCL_STATE_VPP_CLOSING)
{
- vpp_evt_q = vcl_session_vpp_evt_q (wrk, session);
- vcl_send_session_disconnected_reply (vpp_evt_q, wrk->api_client_handle,
- vpp_handle, 0);
+ vcl_send_session_disconnected_reply (wrk, session, 0);
VDBG (1, "session %u [0x%llx]: sending disconnect REPLY...",
session->session_index, vpp_handle);
}
@@ -854,9 +834,7 @@ vcl_session_cleanup_handler (vcl_worker_t * wrk, void *data)
}
else if (session->session_state == VCL_STATE_DISCONNECT)
{
- vcl_send_session_reset_reply (vcl_session_vpp_evt_q (wrk, session),
- wrk->api_client_handle,
- session->vpp_handle, 0);
+ vcl_send_session_reset_reply (wrk, session, 0);
session->session_state = VCL_STATE_UPDATED;
}
return;
@@ -1410,9 +1388,7 @@ vcl_session_cleanup (vcl_worker_t * wrk, vcl_session_t * s,
}
else if (s->session_state == VCL_STATE_DISCONNECT)
{
- svm_msg_q_t *mq = vcl_session_vpp_evt_q (wrk, s);
- vcl_send_session_reset_reply (mq, wrk->api_client_handle,
- s->vpp_handle, 0);
+ vcl_send_session_reset_reply (wrk, s, 0);
}
else if (s->session_state == VCL_STATE_DETACHED)
{