From fd2474430e280e9d1448a4f1a0b177c3e947b75a Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Tue, 12 Mar 2019 16:56:26 -0700 Subject: tcp: avoid computing flags in push hdr inline Change-Id: I579eef6d70b94b20e22b7b116ac63b2d7af49b22 Signed-off-by: Florin Coras --- src/vnet/tcp/tcp_output.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 5a5c7fe4b8b..ce7b50ac3e6 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -1087,38 +1087,16 @@ tcp_send_fin (tcp_connection_t * tc) } } -always_inline u8 -tcp_make_state_flags (tcp_connection_t * tc, tcp_state_t next_state) -{ - switch (next_state) - { - case TCP_STATE_ESTABLISHED: - case TCP_STATE_CLOSE_WAIT: - case TCP_STATE_TIME_WAIT: - case TCP_STATE_FIN_WAIT_2: - case TCP_STATE_CLOSING: - case TCP_STATE_LAST_ACK: - case TCP_STATE_FIN_WAIT_1: - return TCP_FLAG_ACK; - case TCP_STATE_SYN_RCVD: - return TCP_FLAG_SYN | TCP_FLAG_ACK; - case TCP_STATE_SYN_SENT: - return TCP_FLAG_SYN; - default: - clib_warning ("Shouldn't be here!"); - } - return 0; -} - /** - * Push TCP header and update connection variables + * Push TCP header and update connection variables. Should only be called + * for segments with data, not for 'control' packets. */ always_inline void tcp_push_hdr_i (tcp_connection_t * tc, vlib_buffer_t * b, tcp_state_t next_state, u8 compute_opts, u8 maybe_burst) { + u8 tcp_hdr_opts_len, flags = TCP_FLAG_ACK; u32 advertise_wnd, data_len; - u8 tcp_hdr_opts_len, flags; tcp_main_t *tm = &tcp_main; tcp_header_t *th; @@ -1139,7 +1117,6 @@ tcp_push_hdr_i (tcp_connection_t * tc, vlib_buffer_t * b, else advertise_wnd = tcp_window_to_advertise (tc, next_state); - flags = tcp_make_state_flags (tc, next_state); if (PREDICT_FALSE (tc->flags & TCP_CONN_PSH_PENDING)) { if (seq_geq (tc->psh_seq, tc->snd_nxt) -- cgit 1.2.3-korg