X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fvnet%2Fsession%2Fsession.h;h=2bbc380282cc88c6bd547dd6ee909aa4d9577698;hb=ad9d528314a049971b1fb9a42562b00e07cf93f4;hp=131652a8c6efd8827ed7e2194cc1c6ef86042918;hpb=5f56d736cbd752216357357b8de6a120a41c08eb;p=vpp.git diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index 131652a8c6e..2bbc380282c 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -36,6 +36,7 @@ typedef enum SESSION_IO_EVT_CT_RX, FIFO_EVENT_APP_TX, SESSION_IO_EVT_CT_TX, + SESSION_IO_EVT_TX_FLUSH, FIFO_EVENT_DISCONNECT, FIFO_EVENT_BUILTIN_RX, FIFO_EVENT_BUILTIN_TX, @@ -48,7 +49,10 @@ typedef enum SESSION_CTRL_EVT_DISCONNECTED, SESSION_CTRL_EVT_DISCONNECTED_REPLY, SESSION_CTRL_EVT_RESET, - SESSION_CTRL_EVT_RESET_REPLY + SESSION_CTRL_EVT_RESET_REPLY, + SESSION_CTRL_EVT_REQ_WORKER_UPDATE, + SESSION_CTRL_EVT_WORKER_UPDATE, + SESSION_CTRL_EVT_WORKER_UPDATE_REPLY, } session_evt_type_t; static inline const char * @@ -172,20 +176,6 @@ typedef struct session_tx_context_ session_dgram_hdr_t hdr; } session_tx_context_t; -/* Forward definition */ -typedef struct _session_manager_main session_manager_main_t; - -typedef int - (session_fifo_rx_fn) (vlib_main_t * vm, vlib_node_runtime_t * node, - session_event_t * e0, stream_session_t * s0, - int *n_tx_pkts); - -extern session_fifo_rx_fn session_tx_fifo_peek_and_snd; -extern session_fifo_rx_fn session_tx_fifo_dequeue_and_snd; -extern session_fifo_rx_fn session_tx_fifo_dequeue_internal; - -u8 session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e); - typedef struct session_manager_worker_ { CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); @@ -229,9 +219,22 @@ typedef struct session_manager_worker_ /** Peekers rw lock */ clib_rwlock_t peekers_rw_locks; + u32 last_tx_packets; + } session_manager_worker_t; -struct _session_manager_main +typedef int (session_fifo_rx_fn) (vlib_main_t * vm, + vlib_node_runtime_t * node, + session_manager_worker_t * wrk, + session_event_t * e, int *n_tx_pkts); + +extern session_fifo_rx_fn session_tx_fifo_peek_and_snd; +extern session_fifo_rx_fn session_tx_fifo_dequeue_and_snd; +extern session_fifo_rx_fn session_tx_fifo_dequeue_internal; + +u8 session_node_lookup_fifo_event (svm_fifo_t * f, session_event_t * e); + +typedef struct session_manager_main_ { /** Worker contexts */ session_manager_worker_t *wrk; @@ -291,7 +294,7 @@ struct _session_manager_main f64 *last_event_poll_by_thread; #endif -}; +} session_manager_main_t; extern session_manager_main_t session_manager_main; extern vlib_node_registration_t session_queue_node; @@ -439,6 +442,14 @@ session_type_from_proto_and_ip (transport_proto_t proto, u8 is_ip4) return (proto << 1 | is_ip4); } +always_inline u64 +session_segment_handle (stream_session_t * s) +{ + svm_fifo_t *f = s->server_rx_fifo; + return segment_manager_make_segment_handle (f->segment_manager, + f->segment_index); +} + always_inline u8 session_has_transport (stream_session_t * s) { @@ -508,6 +519,13 @@ transport_max_rx_enqueue (transport_connection_t * tc) return svm_fifo_max_enqueue (s->server_rx_fifo); } +always_inline u32 +transport_max_tx_dequeue (transport_connection_t * tc) +{ + stream_session_t *s = session_get (tc->s_index, tc->thread_index); + return svm_fifo_max_dequeue (s->server_tx_fifo); +} + always_inline u32 transport_rx_fifo_size (transport_connection_t * tc) { @@ -522,6 +540,13 @@ transport_tx_fifo_size (transport_connection_t * tc) return s->server_tx_fifo->nitems; } +always_inline u8 +transport_rx_fifo_has_ooo_data (transport_connection_t * tc) +{ + stream_session_t *s = session_get (tc->c_index, tc->thread_index); + return svm_fifo_has_ooo_data (s->server_rx_fifo); +} + always_inline f64 transport_dispatch_period (u32 thread_index) { @@ -554,7 +579,7 @@ session_clone_safe (u32 session_index, u32 thread_index) session_pool_add_peeker (thread_index); new_s = session_alloc (current_thread_index); old_s = session_manager_main.wrk[thread_index].sessions + session_index; - clib_memcpy (new_s, old_s, sizeof (*new_s)); + clib_memcpy_fast (new_s, old_s, sizeof (*new_s)); session_pool_remove_peeker (thread_index); new_s->thread_index = current_thread_index; new_s->session_index = session_get_index (new_s); @@ -585,18 +610,19 @@ int session_dequeue_notify (stream_session_t * s); void stream_session_init_fifos_pointers (transport_connection_t * tc, u32 rx_pointer, u32 tx_pointer); -void stream_session_accept_notify (transport_connection_t * tc); -void stream_session_disconnect_notify (transport_connection_t * tc); -void stream_session_delete_notify (transport_connection_t * tc); -void stream_session_reset_notify (transport_connection_t * tc); +int stream_session_accept_notify (transport_connection_t * tc); +void session_transport_closing_notify (transport_connection_t * tc); +void session_transport_delete_notify (transport_connection_t * tc); +void session_transport_closed_notify (transport_connection_t * tc); +void session_transport_reset_notify (transport_connection_t * tc); int stream_session_accept (transport_connection_t * tc, u32 listener_index, u8 notify); int session_open (u32 app_index, session_endpoint_t * tep, u32 opaque); int session_listen (stream_session_t * s, session_endpoint_cfg_t * sep); int session_stop_listen (stream_session_t * s); -void stream_session_disconnect (stream_session_t * s); -void stream_session_disconnect_transport (stream_session_t * s); -void stream_session_cleanup (stream_session_t * s); +void session_close (stream_session_t * s); +void session_transport_close (stream_session_t * s); +void session_transport_cleanup (stream_session_t * s); int session_send_io_evt_to_thread (svm_fifo_t * f, session_evt_type_t evt_type); int session_send_io_evt_to_thread_custom (void *data, u32 thread_index,