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/session/session_node.c | |
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/session/session_node.c')
-rw-r--r-- | src/vnet/session/session_node.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index 08baa447864..e9cfc7be8aa 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -16,8 +16,8 @@ #include <math.h> #include <vlib/vlib.h> #include <vnet/vnet.h> -#include <vnet/tcp/tcp.h> #include <vppinfra/elog.h> +#include <vnet/session/transport.h> #include <vnet/session/application.h> #include <vnet/session/session_debug.h> #include <vlibmemory/unix_shared_memory_queue.h> @@ -64,13 +64,6 @@ static char *session_queue_error_strings[] = { #undef _ }; -static u32 session_type_to_next[] = { - SESSION_QUEUE_NEXT_TCP_IP4_OUTPUT, - SESSION_QUEUE_NEXT_IP4_LOOKUP, - SESSION_QUEUE_NEXT_TCP_IP6_OUTPUT, - SESSION_QUEUE_NEXT_IP6_LOOKUP, -}; - always_inline void session_tx_fifo_chain_tail (session_manager_main_t * smm, vlib_main_t * vm, u8 thread_index, svm_fifo_t * fifo, @@ -143,6 +136,7 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node, u32 n_bufs_per_evt, n_frames_per_evt, n_bufs_per_frame; transport_connection_t *tc0; transport_proto_vft_t *transport_vft; + transport_proto_t tp; u32 next_index, next0, *to_next, n_left_to_next, bi0; vlib_buffer_t *b0; u32 tx_offset = 0, max_dequeue0, n_bytes_per_seg, left_for_seg; @@ -152,9 +146,10 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node, u32 n_bytes_per_buf, deq_per_buf, deq_per_first_buf; u32 buffers_allocated, buffers_allocated_this_call; - next_index = next0 = session_type_to_next[s0->session_type]; + next_index = next0 = smm->session_type_to_next[s0->session_type]; - transport_vft = transport_protocol_get_vft (s0->session_type); + tp = session_get_transport_proto (s0); + transport_vft = transport_protocol_get_vft (tp); tc0 = transport_vft->get_connection (s0->connection_index, thread_index); /* Make sure we have space to send and there's something to dequeue */ @@ -325,7 +320,6 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node, /* *INDENT-ON* */ VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0); - tcp_trajectory_add_start (b0, 3); if (PREDICT_FALSE (n_trace > 0)) { @@ -550,9 +544,9 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, SESSION_EVT_DBG (SESSION_EVT_POLL_GAP_TRACK, smm, my_thread_index); /* - * Update TCP time + * Update transport time */ - tcp_update_time (now, my_thread_index); + transport_update_time (now, my_thread_index); /* * Get vpp queue events @@ -695,16 +689,7 @@ VLIB_REGISTER_NODE (session_queue_node) = .type = VLIB_NODE_TYPE_INPUT, .n_errors = ARRAY_LEN (session_queue_error_strings), .error_strings = session_queue_error_strings, - .n_next_nodes = SESSION_QUEUE_N_NEXT, .state = VLIB_NODE_STATE_DISABLED, - .next_nodes = - { - [SESSION_QUEUE_NEXT_DROP] = "error-drop", - [SESSION_QUEUE_NEXT_IP4_LOOKUP] = "ip4-lookup", - [SESSION_QUEUE_NEXT_IP6_LOOKUP] = "ip6-lookup", - [SESSION_QUEUE_NEXT_TCP_IP4_OUTPUT] = "tcp4-output", - [SESSION_QUEUE_NEXT_TCP_IP6_OUTPUT] = "tcp6-output", - }, }; /* *INDENT-ON* */ |