summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-03-12 16:56:26 -0700
committerDamjan Marion <dmarion@me.com>2019-03-13 08:23:55 +0000
commitfd2474430e280e9d1448a4f1a0b177c3e947b75a (patch)
treed9b95e2e9957de982fd9a7328b238083ac4f8dc6 /src
parent485710e0b7b81e7ee511cc227a8bbca19b1ecf80 (diff)
tcp: avoid computing flags in push hdr inline
Change-Id: I579eef6d70b94b20e22b7b116ac63b2d7af49b22 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/tcp/tcp_output.c29
1 files 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)