#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>
#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,
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;
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 */
/* *INDENT-ON* */
VLIB_BUFFER_TRACE_TRAJECTORY_INIT (b0);
- if (VLIB_BUFFER_TRACE_TRAJECTORY)
- b0->pre_data[1] = 3;
if (PREDICT_FALSE (n_trace > 0))
{
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
/* Can retransmit for closed sessions but can't do anything if
* session is not ready or closed */
if (PREDICT_FALSE (s0->session_state < SESSION_STATE_READY))
- continue;
+ {
+ vec_add1 (smm->pending_event_vector[my_thread_index], *e0);
+ continue;
+ }
/* Spray packets in per session type frames, since they go to
* different nodes */
rv = (smm->session_tx_fns[s0->session_type]) (vm, node, smm, e0, s0,
.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* */
+static clib_error_t *
+session_queue_exit (vlib_main_t * vm)
+{
+ if (vec_len (vlib_mains) < 2)
+ return 0;
+
+ /*
+ * Shut off (especially) worker-thread session nodes.
+ * Otherwise, vpp can crash as the main thread unmaps the
+ * API segment.
+ */
+ vlib_worker_thread_barrier_sync (vm);
+ session_node_enable_disable (0 /* is_enable */ );
+ vlib_worker_thread_barrier_release (vm);
+ return 0;
+}
+
+VLIB_MAIN_LOOP_EXIT_FUNCTION (session_queue_exit);
+
/*
* fd.io coding-style-patch-verification: ON
*