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>
This commit is contained in:
committed by
Dave Wallace
parent
f9d4ab4272
commit
ba123e152b
4
build/external/packages/quicly.mk
vendored
4
build/external/packages/quicly.mk
vendored
@@ -11,9 +11,9 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
quicly_version := 0.0.1-vpp
|
||||
quicly_version := 0.0.2-vpp
|
||||
quicly_tarball := quicly_$(quicly_version).tar.gz
|
||||
quicly_tarball_md5sum := 60367171ece669c620a12ad0ba65edd5
|
||||
quicly_tarball_md5sum := f370bdb69c607c0e863a8abd57adbe75
|
||||
quicly_tarball_strip_dirs := 1
|
||||
quicly_url := https://github.com/vpp-quic/quicly/releases/download/v$(quicly_version)/quicly_$(quicly_version).tar.gz
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,9 +23,15 @@
|
||||
#include <vppinfra/bihash_16_8.h>
|
||||
|
||||
#include <quicly.h>
|
||||
#include <quicly/streambuf.h>
|
||||
|
||||
#define QUIC_DEBUG 0
|
||||
/* QUIC log levels
|
||||
* 1 - errors
|
||||
* 2 - connection/stream events
|
||||
* 3 - packet events
|
||||
* 4 - timer events
|
||||
**/
|
||||
|
||||
#define QUIC_DEBUG 2
|
||||
#define QUIC_DEBUG_LEVEL_CLIENT 0
|
||||
#define QUIC_DEBUG_LEVEL_SERVER 0
|
||||
|
||||
@@ -53,14 +59,12 @@ typedef CLIB_PACKED (struct quic_ctx_id_
|
||||
u32 parent_app_id;
|
||||
union {
|
||||
CLIB_PACKED (struct {
|
||||
session_handle_t quic_session_handle; /* TODO: remove */
|
||||
session_handle_t udp_session_handle;
|
||||
quicly_conn_t *conn;
|
||||
u32 listener_ctx_id;
|
||||
u8 udp_is_ip4;
|
||||
});
|
||||
CLIB_PACKED (struct {
|
||||
session_handle_t stream_session_handle; /* TODO: remove */
|
||||
quicly_stream_t *stream;
|
||||
u32 quic_connection_ctx_id;
|
||||
});
|
||||
@@ -89,8 +93,8 @@ typedef struct quic_ctx_
|
||||
|
||||
typedef struct quic_stream_data_
|
||||
{
|
||||
quicly_streambuf_t streambuf;
|
||||
u32 ctx_id;
|
||||
u32 thread_index;
|
||||
} quic_stream_data_t;
|
||||
|
||||
typedef struct quic_worker_ctx_
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -78,7 +78,7 @@ unformat_vnet_uri (unformat_input_t * input, va_list * args)
|
||||
sep->is_ip4 = 0;
|
||||
return 1;
|
||||
}
|
||||
else if (unformat (input, "%U://session/%u", unformat_transport_proto,
|
||||
else if (unformat (input, "%U://session/%lu", unformat_transport_proto,
|
||||
&transport_proto, &sep->transport_opts))
|
||||
{
|
||||
sep->transport_proto = transport_proto;
|
||||
|
||||
Reference in New Issue
Block a user