X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Ftcp%2Ftcp_output.c;h=d33cbdd4ad4d27903a2928010979401d99ac3d9d;hb=6080e0d15e152e38811b01306eef6719a682c007;hp=69b34cc595f26f358d47f9262a843db56de69a7c;hpb=360336fa56ae913ceb17a8e0b010e96bed78cfc3;p=vpp.git diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 69b34cc595f..d33cbdd4ad4 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -972,32 +972,6 @@ tcp_send_synack (tcp_connection_t * tc) TCP_EVT (TCP_EVT_SYNACK_SENT, tc); } -/** - * Flush ip lookup tx frames populated by timer pops - */ -static void -tcp_flush_frame_to_ip_lookup (tcp_worker_ctx_t * wrk, u8 is_ip4) -{ - if (wrk->ip_lookup_tx_frames[!is_ip4]) - { - u32 next_index; - next_index = is_ip4 ? ip4_lookup_node.index : ip6_lookup_node.index; - vlib_put_frame_to_node (wrk->vm, next_index, - wrk->ip_lookup_tx_frames[!is_ip4]); - wrk->ip_lookup_tx_frames[!is_ip4] = 0; - } -} - -/** - * Flush v4 and v6 tcp and ip-lookup tx frames for thread index - */ -void -tcp_flush_frames_to_output (tcp_worker_ctx_t * wrk) -{ - tcp_flush_frame_to_ip_lookup (wrk, 1); - tcp_flush_frame_to_ip_lookup (wrk, 0); -} - /** * Send FIN */ @@ -1208,11 +1182,8 @@ tcp_program_retransmit (tcp_connection_t * tc) * Sends delayed ACK when timer expires */ void -tcp_timer_delack_handler (u32 index, u32 thread_index) +tcp_timer_delack_handler (tcp_connection_t * tc) { - tcp_connection_t *tc; - - tc = tcp_connection_get (index, thread_index); tcp_send_ack (tc); } @@ -1443,19 +1414,17 @@ tcp_cc_init_rxt_timeout (tcp_connection_t * tc) } void -tcp_timer_retransmit_handler (u32 tc_index, u32 thread_index) +tcp_timer_retransmit_handler (tcp_connection_t * tc) { - tcp_worker_ctx_t *wrk = tcp_get_worker (thread_index); + tcp_worker_ctx_t *wrk = tcp_get_worker (tc->c_thread_index); vlib_main_t *vm = wrk->vm; - tcp_connection_t *tc; vlib_buffer_t *b = 0; u32 bi, n_bytes; tcp_workerp_stats_inc (wrk, tr_events, 1); - tc = tcp_connection_get (tc_index, thread_index); - /* Note: the connection may have been closed and pool_put */ - if (PREDICT_FALSE (tc == 0 || tc->state == TCP_STATE_SYN_SENT)) + /* Should be handled by a different handler */ + if (PREDICT_FALSE (tc->state == TCP_STATE_SYN_SENT)) return; /* Wait-close and retransmit could pop at the same time */ @@ -1504,7 +1473,7 @@ tcp_timer_retransmit_handler (u32 tc_index, u32 thread_index) session_transport_closing_notify (&tc->connection); session_transport_closed_notify (&tc->connection); tcp_connection_timers_reset (tc); - tcp_timer_update (tc, TCP_TIMER_WAITCLOSE, tcp_cfg.closewait_time); + tcp_program_cleanup (wrk, tc); tcp_workerp_stats_inc (wrk, tr_abort, 1); return; } @@ -1556,7 +1525,7 @@ tcp_timer_retransmit_handler (u32 tc_index, u32 thread_index) { tcp_connection_set_state (tc, TCP_STATE_CLOSED); tcp_connection_timers_reset (tc); - tcp_timer_update (tc, TCP_TIMER_WAITCLOSE, tcp_cfg.cleanup_time); + tcp_program_cleanup (wrk, tc); tcp_workerp_stats_inc (wrk, tr_abort, 1); return; } @@ -1592,18 +1561,15 @@ tcp_timer_retransmit_handler (u32 tc_index, u32 thread_index) * SYN retransmit timer handler. Active open only. */ void -tcp_timer_retransmit_syn_handler (u32 tc_index, u32 thread_index) +tcp_timer_retransmit_syn_handler (tcp_connection_t * tc) { - tcp_worker_ctx_t *wrk = tcp_get_worker (thread_index); + tcp_worker_ctx_t *wrk = tcp_get_worker (tc->c_thread_index); vlib_main_t *vm = wrk->vm; - tcp_connection_t *tc; vlib_buffer_t *b = 0; u32 bi; - tc = tcp_half_open_connection_get (tc_index); - /* Note: the connection may have transitioned to ESTABLISHED... */ - if (PREDICT_FALSE (tc == 0 || tc->state != TCP_STATE_SYN_SENT)) + if (PREDICT_FALSE (tc->state != TCP_STATE_SYN_SENT)) return; /* Half-open connection actually moved to established but we were @@ -1658,25 +1624,20 @@ tcp_timer_retransmit_syn_handler (u32 tc_index, u32 thread_index) * */ void -tcp_timer_persist_handler (u32 index, u32 thread_index) +tcp_timer_persist_handler (tcp_connection_t * tc) { - tcp_worker_ctx_t *wrk = tcp_get_worker (thread_index); + tcp_worker_ctx_t *wrk = tcp_get_worker (tc->c_thread_index); u32 bi, max_snd_bytes, available_bytes, offset; tcp_main_t *tm = vnet_get_tcp_main (); vlib_main_t *vm = wrk->vm; - tcp_connection_t *tc; vlib_buffer_t *b; int n_bytes = 0; u8 *data; - tc = tcp_connection_get_if_valid (index, thread_index); - if (!tc) - return; - /* Problem already solved or worse */ if (tc->state == TCP_STATE_CLOSED || tc->snd_wnd > tc->snd_mss || (tc->flags & TCP_CONN_FINSNT)) - return; + goto update_scheduler; available_bytes = transport_max_tx_dequeue (&tc->connection); offset = tc->snd_nxt - tc->snd_una; @@ -1690,7 +1651,7 @@ tcp_timer_persist_handler (u32 index, u32 thread_index) } if (available_bytes <= offset) - return; + goto update_scheduler; /* Increment RTO backoff */ tc->rto_boff += 1; @@ -1704,6 +1665,7 @@ tcp_timer_persist_handler (u32 index, u32 thread_index) tcp_persist_timer_set (tc); return; } + b = vlib_get_buffer (vm, bi); data = tcp_init_buffer (vm, b); @@ -1732,6 +1694,13 @@ tcp_timer_persist_handler (u32 index, u32 thread_index) /* Just sent new data, enable retransmit */ tcp_retransmit_timer_update (tc); + + return; + +update_scheduler: + + if (tcp_is_descheduled (tc)) + transport_connection_reschedule (&tc->connection); } /** @@ -2103,6 +2072,7 @@ tcp_send_acks (tcp_connection_t * tc, u32 max_burst_size) if (!vec_len (tc->snd_sacks)) { tcp_send_ack (tc); + tc->dupacks_out += 1; tc->pending_dupacks = 0; return 1; }