diff options
author | Aloys Augustin <aloaugus@cisco.com> | 2019-05-14 14:13:51 +0200 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2019-05-14 19:52:29 +0000 |
commit | ba123e152bc16197654c8ac85550a6b1f7b8a791 (patch) | |
tree | 22df80a7d7f2e1c2232a8dde30d6e09a01b91594 /src/tests/vnet/session | |
parent | f9d4ab42724b260d5c242f7291d05f74cd725d7d (diff) |
QUIC multi thread update
* Add support for multiple threads
* Replace quicly buffers with fifos
* Fix cleanup of sessions
* Update quicly release version
Change-Id: I551f936bbec05a15703f043ee85c8e1ba0ab9723
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/tests/vnet/session')
-rw-r--r-- | src/tests/vnet/session/quic_echo.c | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/src/tests/vnet/session/quic_echo.c b/src/tests/vnet/session/quic_echo.c index af6666193f6..a0bd9690246 100644 --- a/src/tests/vnet/session/quic_echo.c +++ b/src/tests/vnet/session/quic_echo.c @@ -38,7 +38,7 @@ #include <vpp/api/vpe_all_api_h.h> #undef vl_printfun -#define QUIC_ECHO_DBG 0 +#define QUIC_ECHO_DBG 1 #define DBG(_fmt, _args...) \ if (QUIC_ECHO_DBG) \ clib_warning (_fmt, ##_args) @@ -93,8 +93,8 @@ typedef struct uword *session_index_by_vpp_handles; /* Hash table for shared segment_names */ - uword *shared_segment_names; - clib_spinlock_t segment_names_lock; + uword *shared_segment_handles; + clib_spinlock_t segment_handles_lock; /* intermediate rx buffer */ u8 *rx_buf; @@ -211,18 +211,18 @@ wait_for_segment_allocation (u64 segment_handle) f64 timeout; timeout = clib_time_now (&em->clib_time) + TIMEOUT; uword *segment_present; - DBG ("ASKING for %lu", segment_handle); + DBG ("Waiting for segment %lx...", segment_handle); while (clib_time_now (&em->clib_time) < timeout) { - clib_spinlock_lock (&em->segment_names_lock); - segment_present = hash_get (em->shared_segment_names, segment_handle); - clib_spinlock_unlock (&em->segment_names_lock); + clib_spinlock_lock (&em->segment_handles_lock); + segment_present = hash_get (em->shared_segment_handles, segment_handle); + clib_spinlock_unlock (&em->segment_handles_lock); if (segment_present != 0) return 0; if (em->time_to_stop == 1) return 0; } - DBG ("timeout waiting for segment_allocation %lu", segment_handle); + DBG ("timeout waiting for segment_allocation %lx", segment_handle); return -1; } @@ -422,10 +422,10 @@ vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t * -1)) goto failed; } - DBG ("SETTING for %lu", segment_handle); - clib_spinlock_lock (&em->segment_names_lock); - hash_set (em->shared_segment_names, segment_handle, 1); - clib_spinlock_unlock (&em->segment_names_lock); + clib_spinlock_lock (&em->segment_handles_lock); + hash_set (em->shared_segment_handles, segment_handle, 1); + clib_spinlock_unlock (&em->segment_handles_lock); + DBG ("Mapped new segment %lx", segment_handle); em->state = STATE_ATTACHED; return; @@ -524,6 +524,8 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp) echo_main_t *em = &echo_main; int rv; int *fds = 0; + u64 segment_handle; + segment_handle = clib_net_to_host_u64 (mp->segment_handle); if (mp->fd_flags & SESSION_FD_F_MEMFD_SEGMENT) { @@ -534,11 +536,11 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp) clib_warning ("svm_fifo_segment_attach ('%s') failed on SSVM_SEGMENT_MEMFD", mp->segment_name); - DBG ("SETTING for %lu", mp->segment_name); - clib_spinlock_lock (&em->segment_names_lock); - hash_set (em->shared_segment_names, mp->segment_name, 1); - clib_spinlock_unlock (&em->segment_names_lock); + clib_spinlock_lock (&em->segment_handles_lock); + hash_set (em->shared_segment_handles, segment_handle, 1); + clib_spinlock_unlock (&em->segment_handles_lock); vec_free (fds); + DBG ("Mapped new segment %lx", segment_handle); return; } @@ -553,11 +555,11 @@ vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp) mp->segment_name); return; } + clib_spinlock_lock (&em->segment_handles_lock); + hash_set (em->shared_segment_handles, mp->segment_name, 1); + clib_spinlock_unlock (&em->segment_handles_lock); clib_warning ("Mapped new segment '%s' size %d", mp->segment_name, mp->segment_size); - clib_spinlock_lock (&em->segment_names_lock); - hash_set (em->shared_segment_names, mp->segment_name, 1); - clib_spinlock_unlock (&em->segment_names_lock); } static void @@ -703,6 +705,7 @@ client_send_disconnect (echo_main_t * em, echo_session_t * s) dmp->_vl_msg_id = ntohs (VL_API_DISCONNECT_SESSION); dmp->client_index = em->my_client_index; dmp->handle = s->vpp_session_handle; + DBG ("Sending Session disonnect handle %lu", dmp->handle); vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & dmp); } @@ -766,7 +769,6 @@ session_accepted_handler (session_accepted_msg_t * mp) /* Allocate local session and set it up */ pool_get (em->sessions, session); session_index = session - em->sessions; - DBG ("Setting session_index %lu", session_index); if (wait_for_segment_allocation (segment_handle)) { @@ -786,6 +788,7 @@ session_accepted_handler (session_accepted_msg_t * mp) svm_msg_q_t *); /* Add it to lookup table */ + DBG ("Accepted session handle %lx, idx %lu", mp->handle, session_index); hash_set (em->session_index_by_vpp_handles, mp->handle, session_index); /* @@ -873,6 +876,7 @@ session_connected_handler (session_connected_msg_t * mp) session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address, svm_msg_q_t *); + DBG ("Connected session handle %lx, idx %lu", mp->handle, session_index); hash_set (em->session_index_by_vpp_handles, mp->handle, session_index); if (mp->context == QUIC_SESSION_TYPE_QUIC) @@ -908,8 +912,7 @@ session_disconnected_handler (session_disconnected_msg_t * mp) echo_session_t *session = 0; uword *p; int rv = 0; - DBG ("Got a SESSION_CTRL_EVT_DISCONNECTED for session %lu", mp->handle); - + DBG ("Disonnected session handle %lx", mp->handle); p = hash_get (em->session_index_by_vpp_handles, mp->handle); if (!p) { @@ -943,6 +946,7 @@ session_reset_handler (session_reset_msg_t * mp) uword *p; int rv = 0; + DBG ("Reset session handle %lx", mp->handle); p = hash_get (em->session_index_by_vpp_handles, mp->handle); if (p) @@ -1379,7 +1383,7 @@ vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t * { echo_main_t *em = &echo_main; uword *p; - DBG ("Got disonnected reply for session %lu", mp->handle); + DBG ("Got disonnected reply for session handle %lu", mp->handle); if (mp->retval) { @@ -1460,8 +1464,8 @@ main (int argc, char **argv) clib_memset (em, 0, sizeof (*em)); em->session_index_by_vpp_handles = hash_create (0, sizeof (uword)); - em->shared_segment_names = hash_create (0, sizeof (uword)); - clib_spinlock_init (&em->segment_names_lock); + em->shared_segment_handles = hash_create (0, sizeof (uword)); + clib_spinlock_init (&em->segment_handles_lock); em->my_pid = getpid (); em->socket_name = 0; em->use_sock_api = 1; |