MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_timer_rexmt

Function tcp_timer_rexmt

freebsd/netinet/tcp_timer.c:609–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607}
608
609void
610tcp_timer_rexmt(void * xtp)
611{
612 struct tcpcb *tp = xtp;
613 CURVNET_SET(tp->t_vnet);
614 int rexmt;
615 struct inpcb *inp;
616 struct epoch_tracker et;
617 bool isipv6;
618#ifdef TCPDEBUG
619 int ostate;
620
621 ostate = tp->t_state;
622#endif
623 inp = tp->t_inpcb;
624 KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL", __func__, tp));
625 INP_WLOCK(inp);
626 if (callout_pending(&tp->t_timers->tt_rexmt) ||
627 !callout_active(&tp->t_timers->tt_rexmt)) {
628 INP_WUNLOCK(inp);
629 CURVNET_RESTORE();
630 return;
631 }
632 callout_deactivate(&tp->t_timers->tt_rexmt);
633 if ((inp->inp_flags & INP_DROPPED) != 0) {
634 INP_WUNLOCK(inp);
635 CURVNET_RESTORE();
636 return;
637 }
638 KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
639 ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
640 tcp_free_sackholes(tp);
641 TCP_LOG_EVENT(tp, NULL, NULL, NULL, TCP_LOG_RTO, 0, 0, NULL, false);
642 if (tp->t_fb->tfb_tcp_rexmit_tmr) {
643 /* The stack has a timer action too. */
644 (*tp->t_fb->tfb_tcp_rexmit_tmr)(tp);
645 }
646 /*
647 * Retransmission timer went off. Message has not
648 * been acked within retransmit interval. Back off
649 * to a longer retransmit interval and retransmit one segment.
650 */
651 if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) {
652 tp->t_rxtshift = TCP_MAXRXTSHIFT;
653 TCPSTAT_INC(tcps_timeoutdrop);
654 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
655 tcp_inpinfo_lock_del(inp, tp);
656 goto out;
657 }
658 NET_EPOCH_ENTER(et);
659 tp = tcp_drop(tp, ETIMEDOUT);
660 NET_EPOCH_EXIT(et);
661 tcp_inpinfo_lock_del(inp, tp);
662 goto out;
663 }
664 if (tp->t_state == TCPS_SYN_SENT) {
665 /*
666 * If the SYN was retransmitted, indicate CWND to be

Callers

nothing calls this directly

Calls 7

tcp_free_sackholesFunction · 0.85
tcp_inpinfo_lock_delFunction · 0.85
tcp_dropFunction · 0.85
in6_losingFunction · 0.85
in_losingFunction · 0.85
cc_cong_signalFunction · 0.85
tcp_traceFunction · 0.85

Tested by

no test coverage detected