aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-04 14:19:39 -0800
committerFlorin Coras <florin.coras@gmail.com>2019-03-06 18:41:28 +0000
commitc0737e962ca913763e4cc3aa516a2dfffe46659e (patch)
tree195ab85ca0d12e6b2f8b9a73f7f8c5a46bd3bb13 /src/tests/vnet
parent2c49ffeb251d4eb11368ca8f866020e317ac09fb (diff)
session: use session index instead of fifo for evt
Avoids derefrencing fifo pointers whose segments could have been unmapped. Change-Id: Ifb0b7399e424f145f3f94b769391a6f4e31bb4e6 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/tests/vnet')
-rw-r--r--src/tests/vnet/session/tcp_echo.c49
-rw-r--r--src/tests/vnet/session/udp_echo.c5
2 files changed, 5 insertions, 49 deletions
diff --git a/src/tests/vnet/session/tcp_echo.c b/src/tests/vnet/session/tcp_echo.c
index 435a414d097..3531a5307a5 100644
--- a/src/tests/vnet/session/tcp_echo.c
+++ b/src/tests/vnet/session/tcp_echo.c
@@ -532,15 +532,6 @@ recv_data_chunk (echo_main_t * em, echo_session_t * s, u8 * rx_buf)
while (n_to_read > 0);
}
-void
-client_handle_rx (echo_main_t * em, session_event_t * e, u8 * rx_buf)
-{
- echo_session_t *s;
-
- s = pool_elt_at_index (em->sessions, e->fifo->client_session_index);
- recv_data_chunk (em, s, rx_buf);
-}
-
static void
send_data_chunk (echo_main_t * em, echo_session_t * s)
{
@@ -596,42 +587,6 @@ client_thread_fn (void *arg)
pthread_exit (0);
}
-/*
- * Rx thread that handles all connections.
- *
- * Not used.
- */
-void *
-client_rx_thread_fn (void *arg)
-{
- session_event_t _e, *e = &_e;
- echo_main_t *em = &echo_main;
- static u8 *rx_buf = 0;
- svm_msg_q_msg_t msg;
-
- vec_validate (rx_buf, 1 << 20);
-
- while (!em->time_to_stop && em->state != STATE_READY)
- ;
-
- while (!em->time_to_stop)
- {
- svm_msg_q_sub (em->our_event_queue, &msg, SVM_Q_WAIT, 0);
- e = svm_msg_q_msg_data (em->our_event_queue, &msg);
- switch (e->event_type)
- {
- case FIFO_EVENT_APP_RX:
- client_handle_rx (em, e, rx_buf);
- break;
- default:
- clib_warning ("unknown event type %d", e->event_type);
- break;
- }
- svm_msg_q_free_msg (em->our_event_queue, &msg);
- }
- pthread_exit (0);
-}
-
void
client_send_connect (echo_main_t * em)
{
@@ -1101,7 +1056,7 @@ server_handle_rx (echo_main_t * em, session_event_t * e)
u32 offset, to_dequeue;
echo_session_t *s;
- s = pool_elt_at_index (em->sessions, e->fifo->client_session_index);
+ s = pool_elt_at_index (em->sessions, e->session_index);
/* Clear event only once. Otherwise, if we do it in the loop by calling
* app_recv_stream, we may end up with a lot of unhandled rx events on the
@@ -1161,7 +1116,7 @@ server_handle_mq (echo_main_t * em)
e = svm_msg_q_msg_data (em->our_event_queue, &msg);
switch (e->event_type)
{
- case FIFO_EVENT_APP_RX:
+ case SESSION_IO_EVT_RX:
server_handle_rx (em, e);
break;
default:
diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c
index 9fda73d1307..4fd6c8635a8 100644
--- a/src/tests/vnet/session/udp_echo.c
+++ b/src/tests/vnet/session/udp_echo.c
@@ -1014,7 +1014,8 @@ server_handle_fifo_event_rx (udp_echo_main_t * utm, u32 session_index)
/* If event wasn't set, add one */
if (svm_fifo_set_event (tx_fifo))
- app_send_io_evt_to_vpp (session->vpp_evt_q, tx_fifo,
+ app_send_io_evt_to_vpp (session->vpp_evt_q,
+ tx_fifo->master_session_index,
SESSION_IO_EVT_TX, SVM_Q_WAIT);
}
}
@@ -1043,7 +1044,7 @@ server_handle_event_queue (udp_echo_main_t * utm)
switch (e->event_type)
{
case SESSION_IO_EVT_RX:
- server_handle_fifo_event_rx (utm, e->fifo->client_session_index);
+ server_handle_fifo_event_rx (utm, e->session_index);
break;
default: