diff options
author | Florin Coras <fcoras@cisco.com> | 2017-12-09 10:19:43 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-12-11 21:07:22 +0000 |
commit | 561af9b441c7392cf391dd46399b0b16b876a08a (patch) | |
tree | d5aa49c73728b6f7cb55071a5398ee9cdba53808 /src/vnet/tcp | |
parent | d78349109fdb98fa0ba5f5aff779be700ff78357 (diff) |
session: generalize handling of network transports
- compute session type out of transport and network protos
- make session, session lookup and session queue code network protocol
agnostic
This does not update the session layer to support non-ip network layer
protocols
Change-Id: Ifc2f92845e158b649d59462eb7d51c12af536691
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp')
-rw-r--r-- | src/vnet/tcp/tcp.c | 21 | ||||
-rw-r--r-- | src/vnet/tcp/tcp.h | 9 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_output.c | 1 |
3 files changed, 18 insertions, 13 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index aee18d997e0..8d222e3c684 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -1009,8 +1009,18 @@ tcp_session_tx_fifo_offset (transport_connection_t * trans_conn) return (tc->snd_nxt - tc->snd_una); } +void +tcp_update_time (f64 now, u8 thread_index) +{ + tcp_set_time_now (thread_index); + tw_timer_expire_timers_16t_2w_512sl (&tcp_main.timer_wheels[thread_index], + now); + tcp_flush_frames_to_output (thread_index); +} + /* *INDENT-OFF* */ const static transport_proto_vft_t tcp_proto = { + .enable = vnet_tcp_enable_disable, .bind = tcp_session_bind, .unbind = tcp_session_unbind, .push_header = tcp_push_header, @@ -1022,6 +1032,7 @@ const static transport_proto_vft_t tcp_proto = { .cleanup = tcp_session_cleanup, .send_mss = tcp_session_send_mss, .send_space = tcp_session_send_space, + .update_time = tcp_update_time, .tx_fifo_offset = tcp_session_tx_fifo_offset, .format_connection = format_tcp_session, .format_listener = format_tcp_listener_session, @@ -1173,10 +1184,6 @@ tcp_main_enable (vlib_main_t * vm) ip4_register_protocol (IP_PROTOCOL_TCP, tcp4_input_node.index); ip6_register_protocol (IP_PROTOCOL_TCP, tcp6_input_node.index); - /* Register as transport with session layer */ - transport_register_protocol (TRANSPORT_PROTO_TCP, 1, &tcp_proto); - transport_register_protocol (TRANSPORT_PROTO_TCP, 0, &tcp_proto); - /* * Initialize data structures */ @@ -1287,6 +1294,12 @@ tcp_init (vlib_main_t * vm) pi->format_header = format_tcp_header; pi->unformat_pg_edit = unformat_pg_tcp_header; + /* Register as transport with session layer */ + transport_register_protocol (TRANSPORT_PROTO_TCP, &tcp_proto, + FIB_PROTOCOL_IP4, tcp4_output_node.index); + transport_register_protocol (TRANSPORT_PROTO_TCP, &tcp_proto, + FIB_PROTOCOL_IP6, tcp6_output_node.index); + tcp_api_reference (); return 0; } diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index a7ae74e06ed..9606a0e1d15 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -665,15 +665,6 @@ tcp_set_time_now (u32 thread_index) return tcp_main.time_now[thread_index]; } -always_inline void -tcp_update_time (f64 now, u32 thread_index) -{ - tcp_set_time_now (thread_index); - tw_timer_expire_timers_16t_2w_512sl (&tcp_main.timer_wheels[thread_index], - now); - tcp_flush_frames_to_output (thread_index); -} - u32 tcp_push_header (transport_connection_t * tconn, vlib_buffer_t * b); u32 diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index dd5b384b0c9..0eef942da83 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -1973,6 +1973,7 @@ tcp_push_header (transport_connection_t * tconn, vlib_buffer_t * b) tc->rtt_ts = tcp_time_now (); tc->rtt_seq = tc->snd_nxt; } + tcp_trajectory_add_start (b0, 3); return 0; } |