diff options
author | Florin Coras <fcoras@cisco.com> | 2020-10-23 10:45:48 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-10-23 19:26:18 +0000 |
commit | 55e556c93df001617863494e873498d9c0b7c172 (patch) | |
tree | 23eca5043549640fca6a8042810b0aa379ace1f9 /src | |
parent | eaec00cf87d155511b90df4fb83d7e99cb3f185f (diff) |
tcp: remove snd_una_max
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I03f923053499f219035c9b7b6640fc575568d474
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/unittest/tcp_test.c | 10 | ||||
-rw-r--r-- | src/vnet/tcp/tcp.c | 1 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_cli.c | 11 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_inlines.h | 2 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_input.c | 6 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_output.c | 10 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_timer.h | 2 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_types.h | 5 |
8 files changed, 17 insertions, 30 deletions
diff --git a/src/plugins/unittest/tcp_test.c b/src/plugins/unittest/tcp_test.c index 3e5ba9c6e2e..0d854084339 100644 --- a/src/plugins/unittest/tcp_test.c +++ b/src/plugins/unittest/tcp_test.c @@ -88,7 +88,6 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input) tc->flags |= TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY; tc->snd_una = 0; - tc->snd_una_max = 1000; tc->snd_nxt = 1000; tc->rcv_opts.flags |= TCP_OPTS_FLAG_SACK; tc->snd_mss = 150; @@ -317,7 +316,6 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input) block.end = 1300; vec_add1 (tc->rcv_opts.sacks, block); - tc->snd_una_max = 1500; tc->snd_una = 1000; tc->snd_nxt = 1500; tcp_rcv_sacks (tc, 1000); @@ -366,7 +364,7 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input) */ vec_reset_length (tc->rcv_opts.sacks); tc->snd_una = 1300; - tc->snd_nxt = tc->snd_una_max = 1900; + tc->snd_nxt = 1900; for (i = 0; i < 5; i++) { block.start = i * 100 + 1200; @@ -390,7 +388,6 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input) */ tc->snd_una = 0; - tc->snd_una_max = 1000; tc->snd_nxt = 1000; vec_reset_length (tc->rcv_opts.sacks); for (i = 0; i < 5; i++) @@ -434,7 +431,6 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input) */ tc->snd_una = 0; - tc->snd_una_max = 1000; tc->snd_nxt = 1000; block.start = 100; @@ -472,7 +468,6 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input) */ scoreboard_clear (sb); tc->snd_una = 0; - tc->snd_una_max = 1000; tc->snd_nxt = 1000; block.start = 500; @@ -575,7 +570,7 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input) * snd_una = 1000 and snd_una_max = 1600 */ tc->snd_una = 1000; - tc->snd_nxt = tc->snd_una_max = 1600; + tc->snd_nxt = 1600; vec_reset_length (tc->rcv_opts.sacks); block.start = 1200; block.end = 1500; @@ -609,7 +604,6 @@ tcp_test_sack_rx (vlib_main_t * vm, unformat_input_t * input) tc->flags |= TCP_CONN_FAST_RECOVERY | TCP_CONN_RECOVERY; tc->snd_una = 0; - tc->snd_una_max = 1000; tc->snd_nxt = 1000; sb->high_rxt = 0; diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index b04bbe515eb..407ba9576a8 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -680,7 +680,6 @@ tcp_init_snd_vars (tcp_connection_t * tc) tc->iss = tcp_generate_random_iss (tc); tc->snd_una = tc->iss; tc->snd_nxt = tc->iss + 1; - tc->snd_una_max = tc->snd_nxt; tc->srtt = 0.1 * THZ; /* 100 ms */ if (!tcp_cfg.csum_offload) diff --git a/src/vnet/tcp/tcp_cli.c b/src/vnet/tcp/tcp_cli.c index e2c1396b5fb..21634df69f7 100644 --- a/src/vnet/tcp/tcp_cli.c +++ b/src/vnet/tcp/tcp_cli.c @@ -188,9 +188,8 @@ format_tcp_vars (u8 * s, va_list * args) s = format (s, " index: %u cfg: %U flags: %U timers: %U\n", tc->c_c_index, format_tcp_cfg_flags, tc, format_tcp_connection_flags, tc, format_tcp_timers, tc); - s = format (s, " snd_una %u snd_nxt %u snd_una_max %u", - tc->snd_una - tc->iss, tc->snd_nxt - tc->iss, - tc->snd_una_max - tc->iss); + s = format (s, " snd_una %u snd_nxt %u", tc->snd_una - tc->iss, + tc->snd_nxt - tc->iss); s = format (s, " rcv_nxt %u rcv_las %u\n", tc->rcv_nxt - tc->irs, tc->rcv_las - tc->irs); s = format (s, " snd_wnd %u rcv_wnd %u rcv_wscale %u ", @@ -717,7 +716,7 @@ tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose) if (trace[i].ack != 0) { placeholder_tc->snd_una = trace[i].ack - 1448; - placeholder_tc->snd_una_max = trace[i].ack; + placeholder_tc->snd_nxt = trace[i].ack; } } @@ -733,8 +732,8 @@ tcp_scoreboard_replay (u8 * s, tcp_connection_t * tc, u8 verbose) { if (verbose) s = format (s, "Adding ack %u, snd_una_max %u, segs: ", - trace[left].ack, trace[left].snd_una_max); - placeholder_tc->snd_una_max = trace[left].snd_una_max; + trace[left].ack, trace[left].snd_nxt); + placeholder_tc->snd_nxt = trace[left].snd_nxt; next_ack = trace[left].ack; has_new_ack = 1; } diff --git a/src/vnet/tcp/tcp_inlines.h b/src/vnet/tcp/tcp_inlines.h index cb00ca4a97b..25bf7387c69 100644 --- a/src/vnet/tcp/tcp_inlines.h +++ b/src/vnet/tcp/tcp_inlines.h @@ -182,7 +182,7 @@ tcp_available_cc_snd_space (const tcp_connection_t * tc) always_inline u8 tcp_is_lost_fin (tcp_connection_t * tc) { - if ((tc->flags & TCP_CONN_FINSNT) && (tc->snd_una_max - tc->snd_una == 1)) + if ((tc->flags & TCP_CONN_FINSNT) && (tc->snd_nxt - tc->snd_una == 1)) return 1; return 0; } diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index 91a4fcacfde..ce1c9d5ff10 100644 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -404,7 +404,7 @@ tcp_rcv_ack_no_cc (tcp_connection_t * tc, vlib_buffer_t * b, u32 * error) if (!(seq_leq (tc->snd_una, vnet_buffer (b)->tcp.ack_number) && seq_leq (vnet_buffer (b)->tcp.ack_number, tc->snd_nxt))) { - if (seq_leq (vnet_buffer (b)->tcp.ack_number, tc->snd_una_max) + if (seq_leq (vnet_buffer (b)->tcp.ack_number, tc->snd_nxt) && seq_gt (vnet_buffer (b)->tcp.ack_number, tc->snd_una)) { tc->snd_nxt = vnet_buffer (b)->tcp.ack_number; @@ -580,7 +580,7 @@ tcp_handle_postponed_dequeues (tcp_worker_ctx_t * wrk) /* Dequeue the newly ACKed bytes */ session_tx_fifo_dequeue_drop (&tc->connection, tc->burst_acked); - tcp_validate_txf_size (tc, tc->snd_una_max - tc->snd_una); + tcp_validate_txf_size (tc, tc->snd_nxt - tc->snd_una); if (PREDICT_FALSE (tc->flags & TCP_CONN_PSH_PENDING)) { @@ -999,7 +999,7 @@ tcp_rcv_ack (tcp_worker_ctx_t * wrk, tcp_connection_t * tc, vlib_buffer_t * b, { /* We've probably entered recovery and the peer still has some * of the data we've sent. Update snd_nxt and accept the ack */ - if (seq_leq (vnet_buffer (b)->tcp.ack_number, tc->snd_una_max) + if (seq_leq (vnet_buffer (b)->tcp.ack_number, tc->snd_nxt) && seq_gt (vnet_buffer (b)->tcp.ack_number, tc->snd_una)) { tc->snd_nxt = vnet_buffer (b)->tcp.ack_number; diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 5d8bd80af23..b40cdbeded3 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -902,7 +902,6 @@ tcp_send_fin (tcp_connection_t * tc) { tc->flags |= TCP_CONN_FINSNT; tc->flags &= ~TCP_CONN_FINPNDG; - tc->snd_una_max = seq_max (tc->snd_una_max, tc->snd_nxt); } } @@ -994,8 +993,7 @@ tcp_session_push_header (transport_connection_t * tconn, vlib_buffer_t * b) tcp_push_hdr_i (tc, b, tc->snd_nxt, /* compute opts */ 0, /* burst */ 1, /* update_snd_nxt */ 1); - tc->snd_una_max = seq_max (tc->snd_nxt, tc->snd_una_max); - tcp_validate_txf_size (tc, tc->snd_una_max - tc->snd_una); + tcp_validate_txf_size (tc, tc->snd_nxt - tc->snd_una); /* If not tracking an ACK, start tracking */ if (tc->rtt_ts == 0 && !tcp_in_cong_recovery (tc)) { @@ -1560,7 +1558,7 @@ tcp_timer_persist_handler (tcp_connection_t * tc) max_snd_bytes); b->current_length = n_bytes; ASSERT (n_bytes != 0 && (tcp_timer_is_active (tc, TCP_TIMER_RETRANSMIT) - || tc->snd_nxt == tc->snd_una_max + || tc->snd_una == tc->snd_nxt || tc->rto_boff > 1)); if (tc->cfg_flags & TCP_CFG_F_RATE_SAMPLE) @@ -1571,8 +1569,7 @@ tcp_timer_persist_handler (tcp_connection_t * tc) tcp_push_hdr_i (tc, b, tc->snd_nxt, /* compute opts */ 0, /* burst */ 0, /* update_snd_nxt */ 1); - tc->snd_una_max = seq_max (tc->snd_nxt, tc->snd_una_max); - tcp_validate_txf_size (tc, tc->snd_una_max - tc->snd_una); + tcp_validate_txf_size (tc, tc->snd_nxt - tc->snd_una); tcp_enqueue_to_output (wrk, b, bi, tc->c_is_ip4); /* Just sent new data, enable retransmit */ @@ -1638,7 +1635,6 @@ tcp_transmit_unsent (tcp_worker_ctx_t * wrk, tcp_connection_t * tc, tcp_bt_track_tx (tc, n_written); tc->snd_nxt += n_written; - tc->snd_una_max = seq_max (tc->snd_nxt, tc->snd_una_max); } done: diff --git a/src/vnet/tcp/tcp_timer.h b/src/vnet/tcp/tcp_timer.h index 45cf38263be..4668c79cabf 100644 --- a/src/vnet/tcp/tcp_timer.h +++ b/src/vnet/tcp/tcp_timer.h @@ -54,7 +54,7 @@ tcp_timer_update (tcp_timer_wheel_t * tw, tcp_connection_t * tc, u8 timer_id, always_inline void tcp_retransmit_timer_set (tcp_timer_wheel_t * tw, tcp_connection_t * tc) { - ASSERT (tc->snd_una != tc->snd_una_max); + ASSERT (tc->snd_una != tc->snd_nxt); tcp_timer_set (tw, tc, TCP_TIMER_RETRANSMIT, clib_max (tc->rto * TCP_TO_TIMER_TICK, 1)); } diff --git a/src/vnet/tcp/tcp_types.h b/src/vnet/tcp/tcp_types.h index d1dc717db7c..2575156d7e9 100644 --- a/src/vnet/tcp/tcp_types.h +++ b/src/vnet/tcp/tcp_types.h @@ -156,7 +156,7 @@ typedef struct _scoreboard_trace_elt u32 start; u32 end; u32 ack; - u32 snd_una_max; + u32 snd_nxt; u32 group; } scoreboard_trace_elt_t; @@ -293,7 +293,6 @@ typedef struct _tcp_connection /** Send sequence variables RFC793 */ u32 snd_una; /**< oldest unacknowledged sequence number */ - u32 snd_una_max; /**< newest unacknowledged sequence number + 1*/ u32 snd_wnd; /**< send window */ u32 snd_wl1; /**< seq number used for last snd.wnd update */ u32 snd_wl2; /**< ack number used for last snd.wnd update */ @@ -345,7 +344,7 @@ typedef struct _tcp_connection u32 rxt_delivered; /**< Rxt bytes delivered during current cc event */ u32 rxt_head; /**< snd_una last time we re rxted the head */ u32 tsecr_last_ack; /**< Timestamp echoed to us in last healthy ACK */ - u32 snd_congestion; /**< snd_una_max when congestion is detected */ + u32 snd_congestion; /**< snd_nxt when congestion is detected */ u32 tx_fifo_size; /**< Tx fifo size. Used to constrain cwnd */ tcp_cc_algorithm_t *cc_algo; /**< Congestion control algorithm */ u8 cc_data[TCP_CC_DATA_SZ]; /**< Congestion control algo private data */ |