session_event_t *evt;
svm_msg_q_msg_t msg;
svm_msg_q_t *mq;
- u32 tries = 0, max_tries;
mq = session_main_get_vpp_event_queue (thread_index);
- while (svm_msg_q_try_lock (mq))
- {
- max_tries = vlib_get_current_process (vlib_get_main ())? 1e6 : 3;
- if (tries++ == max_tries)
- {
- SESSION_DBG ("failed to enqueue evt");
- return -1;
- }
- }
+ if (PREDICT_FALSE (svm_msg_q_lock (mq)))
+ return -1;
if (PREDICT_FALSE (svm_msg_q_ring_is_full (mq, SESSION_MQ_IO_EVT_RING)))
{
svm_msg_q_unlock (mq);
evt->rpc_args.fp = data;
evt->rpc_args.arg = args;
break;
+ case SESSION_IO_EVT_RX:
case SESSION_IO_EVT_TX:
case SESSION_IO_EVT_TX_FLUSH:
case SESSION_IO_EVT_BUILTIN_RX:
session_tx_fifo_dequeue_drop (transport_connection_t * tc, u32 max_bytes)
{
session_t *s = session_get (tc->s_index, tc->thread_index);
+ u32 rv;
+
+ rv = svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
- if (svm_fifo_needs_tx_ntf (s->tx_fifo, max_bytes))
+ if (svm_fifo_needs_deq_ntf (s->tx_fifo, max_bytes))
session_dequeue_notify (s);
- return svm_fifo_dequeue_drop (s->tx_fifo, max_bytes);
+ return rv;
}
static inline int
return session_notify_subscribers (app_wrk->app_index, s,
s->tx_fifo, SESSION_IO_EVT_TX);
- svm_fifo_clear_tx_ntf (s->tx_fifo);
+ svm_fifo_clear_deq_ntf (s->tx_fifo);
return 0;
}
return errors;
}
-int
-session_stream_connect_notify (transport_connection_t * tc, u8 is_fail)
+static inline int
+session_stream_connect_notify_inline (transport_connection_t * tc, u8 is_fail,
+ session_state_t opened_state)
{
u32 opaque = 0, new_ti, new_si;
app_worker_t *app_wrk;
return -1;
}
+ s = session_get (new_si, new_ti);
+ s->session_state = opened_state;
+ session_lookup_add_connection (tc, session_handle (s));
+
if (app_worker_connect_notify (app_wrk, s, opaque))
{
s = session_get (new_si, new_ti);
return -1;
}
- s = session_get (new_si, new_ti);
- s->session_state = SESSION_STATE_READY;
- session_lookup_add_connection (tc, session_handle (s));
-
return 0;
}
+int
+session_stream_connect_notify (transport_connection_t * tc, u8 is_fail)
+{
+ return session_stream_connect_notify_inline (tc, is_fail,
+ SESSION_STATE_READY);
+}
+
+int
+session_ho_stream_connect_notify (transport_connection_t * tc, u8 is_fail)
+{
+ return session_stream_connect_notify_inline (tc, is_fail,
+ SESSION_STATE_OPENED);
+}
+
typedef struct _session_switch_pool_args
{
u32 session_index;
sh = session_handle (s);
session_lookup_add_connection (tc, sh);
-
return app_worker_connect_notify (app_wrk, s, opaque);
}
* thing but better than allocating a separate half-open pool.
*/
tc->s_index = opaque;
+ if (transport_half_open_has_fifos (rmt->transport_proto))
+ return session_ho_stream_connect_notify (tc, 0 /* is_fail */ );
return 0;
}
if (!tc)
return VNET_API_ERROR_ADDRESS_NOT_IN_USE;
- session_lookup_del_connection (tc);
+ if (!(tc->flags & TRANSPORT_CONNECTION_F_NO_LOOKUP))
+ session_lookup_del_connection (tc);
transport_stop_listen (tp, s->connection_index);
return 0;
}
/* *INDENT-ON* */
smm->session_type_to_next[session_type] = next_index;
- smm->session_tx_fns[session_type] = session_tx_fns[vft->tx_type];
+ smm->session_tx_fns[session_type] =
+ session_tx_fns[vft->transport_options.tx_type];
}
transport_connection_t *