From a26349da47d9a05d9fe9725343aa85e9640ab1ea Mon Sep 17 00:00:00 2001 From: Nathan Skrzypczak Date: Wed, 26 Jun 2019 13:53:08 +0200 Subject: session: add half_open_has_fifos for UDPC Type: fix Change-Id: Iede83a4e72b88fd55bf56ec0ca71c9196ce743cd Signed-off-by: Nathan Skrzypczak --- src/vnet/session/session.c | 29 +++++++++++++++++++++++------ src/vnet/session/transport.c | 6 ++++++ src/vnet/session/transport.h | 1 + src/vnet/session/transport_types.h | 1 + src/vnet/udp/udp.c | 1 + 5 files changed, 32 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 0e5fb8edb1a..3a6d7e29e45 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -601,8 +601,9 @@ session_main_flush_all_enqueue_events (u8 transport_proto) 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; @@ -645,6 +646,10 @@ session_stream_connect_notify (transport_connection_t * tc, u8 is_fail) 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); @@ -652,13 +657,23 @@ session_stream_connect_notify (transport_connection_t * tc, u8 is_fail) 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; @@ -966,6 +981,8 @@ session_open_vc (u32 app_wrk_index, session_endpoint_t * rmt, u32 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; } diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index f971288f90c..bb4c6817345 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -288,6 +288,12 @@ transport_protocol_get_vft (transport_proto_t transport_proto) return &tp_vfts[transport_proto]; } +u8 +transport_half_open_has_fifos (transport_proto_t tp) +{ + return tp_vfts[tp].transport_options.half_open_has_fifos; +} + transport_service_type_t transport_protocol_service_type (transport_proto_t tp) { diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h index 978e3f072b1..6e2feb02ba4 100644 --- a/src/vnet/session/transport.h +++ b/src/vnet/session/transport.h @@ -23,6 +23,7 @@ typedef struct _transport_options_t { transport_tx_fn_type_t tx_type; transport_service_type_t service_type; + u8 half_open_has_fifos; } transport_options_t; /* diff --git a/src/vnet/session/transport_types.h b/src/vnet/session/transport_types.h index e262ddad583..87daa76005e 100644 --- a/src/vnet/session/transport_types.h +++ b/src/vnet/session/transport_types.h @@ -184,6 +184,7 @@ transport_endpoint_fib_proto (transport_endpoint_t * tep) } u8 transport_protocol_is_cl (transport_proto_t tp); +u8 transport_half_open_has_fifos (transport_proto_t tp); transport_service_type_t transport_protocol_service_type (transport_proto_t); transport_tx_fn_type_t transport_protocol_tx_fn_type (transport_proto_t tp); diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index d0c515a9d06..1fb7a507544 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -393,6 +393,7 @@ static const transport_proto_vft_t udpc_proto = { .transport_options = { .tx_type = TRANSPORT_TX_DGRAM, .service_type = TRANSPORT_SERVICE_VC, + .half_open_has_fifos = 1 }, }; /* *INDENT-ON* */ -- cgit 1.2.3-korg