aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp_output.c
diff options
context:
space:
mode:
authorVladimir Kropylev <vladimir.kropylev@enea.com>2019-06-25 00:06:52 +0300
committerFlorin Coras <florin.coras@gmail.com>2019-06-25 21:51:42 +0000
commit398afbd889f7751088b9e4bfc487b221719b80a5 (patch)
tree5e010739d0ad363b1a0e082a663e94aea949487d /src/vnet/tcp/tcp_output.c
parent217c62a53e5621bb8790a242a57dc7e9f8eef3a8 (diff)
tcp: window update ack
Type: feature Provide interface for sending Window Update ACK, ensuring it will be sent only once, if RWND became non-zero, after zero RWND has been advertised before. Change-Id: I7f0d8af76d7763208625df68ab4ac3727fdaf449 Signed-off-by: Vladimir Kropylev <vladimir.kropylev@enea.com>
Diffstat (limited to 'src/vnet/tcp/tcp_output.c')
-rw-r--r--src/vnet/tcp/tcp_output.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index d3c4ca4a314..7cf85c3bdce 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -505,6 +505,11 @@ tcp_make_ack_i (tcp_connection_t * tc, vlib_buffer_t * b, tcp_state_t state,
tcp_options_write ((u8 *) (th + 1), snd_opts);
vnet_buffer (b)->tcp.connection_index = tc->c_c_index;
+
+ if (wnd == 0)
+ tcp_zero_rwnd_sent_on (tc);
+ else
+ tcp_zero_rwnd_sent_off (tc);
}
/**
@@ -1266,6 +1271,28 @@ tcp_timer_delack_handler (u32 index)
}
/**
+ * Send Window Update ACK,
+ * ensuring that it will be sent once, if RWND became non-zero,
+ * after zero RWND has been advertised in ACK before
+ */
+void
+tcp_send_window_update_ack (tcp_connection_t * tc)
+{
+ tcp_worker_ctx_t *wrk = tcp_get_worker (tc->c_thread_index);
+ u32 win;
+
+ if (tcp_zero_rwnd_sent (tc))
+ {
+ win = tcp_window_to_advertise (tc, tc->state);
+ if (win > 0)
+ {
+ tcp_zero_rwnd_sent_off (tc);
+ tcp_program_ack (wrk, tc);
+ }
+ }
+}
+
+/**
* Allocate a new buffer and build a new tcp segment
*
* @param wrk tcp worker