aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-04-17 09:57:46 -0700
committerDave Barach <openvpp@barachs.net>2019-04-17 18:26:42 +0000
commit317b8e08367c769b90463613231b9fcfad486098 (patch)
tree9780a58b12e287e969ef342d4f39c121e1c8c2c1
parent6407ba56a392f37322001d0ffdca002223b095c0 (diff)
vcl/session: tx notifications for cut-thru sessions
Change-Id: I076c753e419bbb177d2d28609190715e9895b398 Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/vcl/vppcom.c8
-rw-r--r--src/vnet/session/application_local.c14
-rw-r--r--src/vnet/session/session_node.c7
-rw-r--r--src/vnet/session/transport.h11
-rw-r--r--test/test_vcl.py5
5 files changed, 43 insertions, 2 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index b5953872f81..e70aa001772 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1530,6 +1530,14 @@ vppcom_session_read_internal (uint32_t session_handle, void *buf, int n,
if (svm_fifo_is_empty_cons (rx_fifo))
svm_fifo_unset_event (s->rx_fifo);
+ /* Cut-through sessions might request tx notifications on rx fifos */
+ if (PREDICT_FALSE (rx_fifo->want_tx_ntf))
+ {
+ app_send_io_evt_to_vpp (s->vpp_evt_q, s->rx_fifo->master_session_index,
+ SESSION_IO_EVT_RX, SVM_Q_WAIT);
+ svm_fifo_reset_tx_ntf (s->rx_fifo);
+ }
+
VDBG (2, "session %u[0x%llx]: read %d bytes from (%p)", s->session_index,
s->vpp_handle, n_read, rx_fifo);
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 856f7489f38..d2edd54512a 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -475,6 +475,19 @@ ct_custom_tx (void *session)
return ct_session_tx (s);
}
+static int
+ct_app_rx_evt (transport_connection_t * tc)
+{
+ ct_connection_t *ct = (ct_connection_t *) tc, *peer_ct;
+ session_t *ps;
+
+ peer_ct = ct_connection_get (ct->peer_index);
+ if (!peer_ct)
+ return -1;
+ ps = session_get (peer_ct->c_s_index, peer_ct->c_thread_index);
+ return session_dequeue_notify (ps);
+}
+
static u8 *
format_ct_listener (u8 * s, va_list * args)
{
@@ -535,6 +548,7 @@ const static transport_proto_vft_t cut_thru_proto = {
.close = ct_session_close,
.get_connection = ct_session_get,
.custom_tx = ct_custom_tx,
+ .app_rx_evt = ct_app_rx_evt,
.tx_type = TRANSPORT_TX_INTERNAL,
.service_type = TRANSPORT_SERVICE_APP,
.format_listener = format_ct_listener,
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index c894c437cde..605fd584e2d 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -947,6 +947,13 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
continue;
}
break;
+ case SESSION_IO_EVT_RX:
+ s = session_event_get_session (e, thread_index);
+ if (!s)
+ break;
+ transport_app_rx_evt (session_get_transport_proto (s),
+ s->connection_index, s->thread_index);
+ break;
case SESSION_CTRL_EVT_CLOSE:
s = session_get_from_handle_if_valid (e->session_handle);
if (PREDICT_FALSE (!s))
diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h
index e446a3934d1..993b8bd7354 100644
--- a/src/vnet/session/transport.h
+++ b/src/vnet/session/transport.h
@@ -46,6 +46,7 @@ typedef struct _transport_proto_vft
void (*update_time) (f64 time_now, u8 thread_index);
void (*flush_data) (transport_connection_t *tconn);
int (*custom_tx) (void *session);
+ int (*app_rx_evt) (transport_connection_t *tconn);
/*
* Connection retrieval
@@ -111,6 +112,16 @@ transport_custom_tx (transport_proto_t tp, void *s)
return tp_vfts[tp].custom_tx (s);
}
+static inline int
+transport_app_rx_evt (transport_proto_t tp, u32 conn_index, u32 thread_index)
+{
+ transport_connection_t *tc;
+ if (!tp_vfts[tp].app_rx_evt)
+ return 0;
+ tc = transport_get_connection (tp, conn_index, thread_index);
+ return tp_vfts[tp].app_rx_evt (tc);
+}
+
void transport_register_protocol (transport_proto_t transport_proto,
const transport_proto_vft_t * vft,
fib_protocol_t fib_proto, u32 output_node);
diff --git a/test/test_vcl.py b/test/test_vcl.py
index e49c9d800e0..7705fdcfd4d 100644
--- a/test/test_vcl.py
+++ b/test/test_vcl.py
@@ -346,10 +346,11 @@ class VCLCutThruTestCase(VCLTestCase):
self.server_port]
def tearDown(self):
- self.cut_thru_tear_down()
-
super(VCLCutThruTestCase, self).tearDown()
+ def show_commands_at_teardown(self):
+ self.logger.debug(self.vapi.cli("show session verbose 2"))
+
def test_vcl_cut_thru_echo(self):
""" run VCL cut thru echo test """