aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-06 10:44:38 -0800
committerDave Barach <openvpp@barachs.net>2019-03-07 00:47:42 +0000
commitf940f8a40fc41d66a9ab5ea15c574120c49eb92b (patch)
treeaa36c02d567a60d62e6255f872dc736aff2a7515 /src/vnet/session
parentfe97da3203c64461f752e854faa97c69b8d225f4 (diff)
session: use transport custom tx for app transports
Change-Id: I675f7090fa6b2ffdfb4ee748df858bfb7e39ce5a Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application_local.c10
-rwxr-xr-xsrc/vnet/session/session_api.c9
-rw-r--r--src/vnet/session/session_node.c4
-rw-r--r--src/vnet/session/transport.h7
4 files changed, 18 insertions, 12 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 745b202f580..5a3f738dd82 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -464,6 +464,15 @@ format_ct_connection_id (u8 * s, va_list * args)
return s;
}
+static int
+ct_custom_tx (void *session)
+{
+ session_t *s = (session_t *) session;
+ if (session_has_transport (s))
+ return 0;
+ return ct_session_tx (s);
+}
+
static u8 *
format_ct_listener (u8 * s, va_list * args)
{
@@ -523,6 +532,7 @@ const static transport_proto_vft_t cut_thru_proto = {
.connect = ct_session_connect,
.close = ct_session_close,
.get_connection = ct_session_get,
+ .custom_tx = ct_custom_tx,
.tx_type = TRANSPORT_TX_INTERNAL,
.service_type = TRANSPORT_SERVICE_APP,
.format_listener = format_ct_listener,
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 525f63799be..780c765cca5 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -445,20 +445,11 @@ done:
return 0;
}
-static int
-mq_app_tx_callback (session_t * s)
-{
- if (session_has_transport (s))
- return 0;
- return ct_session_tx (s);
-}
-
static session_cb_vft_t session_mq_cb_vft = {
.session_accept_callback = mq_send_session_accepted_cb,
.session_disconnect_callback = mq_send_session_disconnected_cb,
.session_connected_callback = mq_send_session_connected_cb,
.session_reset_callback = mq_send_session_reset_cb,
- .builtin_app_tx_callback = mq_app_tx_callback,
.add_segment_callback = send_add_segment_callback,
.del_segment_callback = send_del_segment_callback,
};
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 7cbd0d9ab04..fb53846afdc 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -819,13 +819,11 @@ session_tx_fifo_dequeue_internal (vlib_main_t * vm,
session_event_t * e, int *n_tx_pkts)
{
session_t *s = wrk->ctx.s;
- application_t *app;
if (PREDICT_FALSE (s->session_state >= SESSION_STATE_TRANSPORT_CLOSED))
return 0;
- app = application_get (s->t_app_index);
svm_fifo_unset_event (s->tx_fifo);
- return app->cb_fns.builtin_app_tx_callback (s);
+ return transport_custom_tx (session_get_transport_proto (s), s);
}
always_inline session_t *
diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h
index 8500e9d2445..e446a3934d1 100644
--- a/src/vnet/session/transport.h
+++ b/src/vnet/session/transport.h
@@ -45,6 +45,7 @@ typedef struct _transport_proto_vft
u32 (*tx_fifo_offset) (transport_connection_t * tc);
void (*update_time) (f64 time_now, u8 thread_index);
void (*flush_data) (transport_connection_t *tconn);
+ int (*custom_tx) (void *session);
/*
* Connection retrieval
@@ -104,6 +105,12 @@ transport_get_half_open (transport_proto_t tp, u32 conn_index)
return tp_vfts[tp].get_half_open (conn_index);
}
+static inline int
+transport_custom_tx (transport_proto_t tp, void *s)
+{
+ return tp_vfts[tp].custom_tx (s);
+}
+
void transport_register_protocol (transport_proto_t transport_proto,
const transport_proto_vft_t * vft,
fib_protocol_t fib_proto, u32 output_node);