Deleted Added
full compact
tcp_timer.c (290805) tcp_timer.c (292309)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)tcp_timer.c 8.2 (Berkeley) 5/24/95
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_timer.c 290805 2015-11-13 22:51:35Z rrs $");
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_timer.c 292309 2015-12-16 00:56:45Z rrs $");
34
35#include "opt_inet.h"
36#include "opt_inet6.h"
37#include "opt_tcpdebug.h"
38#include "opt_rss.h"
39
40#include <sys/param.h>
41#include <sys/kernel.h>

--- 245 unchanged lines hidden (view full) ---

287 }
288 KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
289 ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
290 KASSERT((tp->t_timers->tt_flags & TT_DELACK) != 0,
291 ("%s: tp %p delack callout should be running", __func__, tp));
292
293 tp->t_flags |= TF_ACKNOW;
294 TCPSTAT_INC(tcps_delack);
34
35#include "opt_inet.h"
36#include "opt_inet6.h"
37#include "opt_tcpdebug.h"
38#include "opt_rss.h"
39
40#include <sys/param.h>
41#include <sys/kernel.h>

--- 245 unchanged lines hidden (view full) ---

287 }
288 KASSERT((tp->t_timers->tt_flags & TT_STOPPED) == 0,
289 ("%s: tp %p tcpcb can't be stopped here", __func__, tp));
290 KASSERT((tp->t_timers->tt_flags & TT_DELACK) != 0,
291 ("%s: tp %p delack callout should be running", __func__, tp));
292
293 tp->t_flags |= TF_ACKNOW;
294 TCPSTAT_INC(tcps_delack);
295 (void) tcp_output(tp);
295 (void) tp->t_fb->tfb_tcp_output(tp);
296 INP_WUNLOCK(inp);
297 CURVNET_RESTORE();
298}
299
300void
301tcp_timer_2msl(void *xtp)
302{
303 struct tcpcb *tp = xtp;

--- 234 unchanged lines hidden (view full) ---

538 if (tp->t_state > TCPS_CLOSE_WAIT &&
539 (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) {
540 TCPSTAT_INC(tcps_persistdrop);
541 tp = tcp_drop(tp, ETIMEDOUT);
542 goto out;
543 }
544 tcp_setpersist(tp);
545 tp->t_flags |= TF_FORCEDATA;
296 INP_WUNLOCK(inp);
297 CURVNET_RESTORE();
298}
299
300void
301tcp_timer_2msl(void *xtp)
302{
303 struct tcpcb *tp = xtp;

--- 234 unchanged lines hidden (view full) ---

538 if (tp->t_state > TCPS_CLOSE_WAIT &&
539 (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) {
540 TCPSTAT_INC(tcps_persistdrop);
541 tp = tcp_drop(tp, ETIMEDOUT);
542 goto out;
543 }
544 tcp_setpersist(tp);
545 tp->t_flags |= TF_FORCEDATA;
546 (void) tcp_output(tp);
546 (void) tp->t_fb->tfb_tcp_output(tp);
547 tp->t_flags &= ~TF_FORCEDATA;
548
549out:
550#ifdef TCPDEBUG
551 if (tp != NULL && tp->t_inpcb->inp_socket->so_options & SO_DEBUG)
552 tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO);
553#endif
554 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);

--- 238 unchanged lines hidden (view full) ---

793 tp->t_flags |= TF_ACKNOW;
794 /*
795 * If timing a segment in this window, stop the timer.
796 */
797 tp->t_rtttime = 0;
798
799 cc_cong_signal(tp, NULL, CC_RTO);
800
547 tp->t_flags &= ~TF_FORCEDATA;
548
549out:
550#ifdef TCPDEBUG
551 if (tp != NULL && tp->t_inpcb->inp_socket->so_options & SO_DEBUG)
552 tcp_trace(TA_USER, ostate, tp, NULL, NULL, PRU_SLOWTIMO);
553#endif
554 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);

--- 238 unchanged lines hidden (view full) ---

793 tp->t_flags |= TF_ACKNOW;
794 /*
795 * If timing a segment in this window, stop the timer.
796 */
797 tp->t_rtttime = 0;
798
799 cc_cong_signal(tp, NULL, CC_RTO);
800
801 (void) tcp_output(tp);
801 (void) tp->t_fb->tfb_tcp_output(tp);
802
803out:
804#ifdef TCPDEBUG
805 if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
806 tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
807 PRU_SLOWTIMO);
808#endif
809 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);

--- 43 unchanged lines hidden (view full) ---

853 f_reset = TT_KEEP_RST;
854 break;
855 case TT_2MSL:
856 t_callout = &tp->t_timers->tt_2msl;
857 f_callout = tcp_timer_2msl;
858 f_reset = TT_2MSL_RST;
859 break;
860 default:
802
803out:
804#ifdef TCPDEBUG
805 if (tp != NULL && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
806 tcp_trace(TA_USER, ostate, tp, (void *)0, (struct tcphdr *)0,
807 PRU_SLOWTIMO);
808#endif
809 TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO);

--- 43 unchanged lines hidden (view full) ---

853 f_reset = TT_KEEP_RST;
854 break;
855 case TT_2MSL:
856 t_callout = &tp->t_timers->tt_2msl;
857 f_callout = tcp_timer_2msl;
858 f_reset = TT_2MSL_RST;
859 break;
860 default:
861 if (tp->t_fb->tfb_tcp_timer_activate) {
862 tp->t_fb->tfb_tcp_timer_activate(tp, timer_type, delta);
863 return;
864 }
861 panic("tp %p bad timer_type %#x", tp, timer_type);
862 }
863 if (delta == 0) {
864 if ((tp->t_timers->tt_flags & timer_type) &&
865 (callout_stop(t_callout) > 0) &&
866 (tp->t_timers->tt_flags & f_reset)) {
867 tp->t_timers->tt_flags &= ~(timer_type | f_reset);
868 }

--- 30 unchanged lines hidden (view full) ---

899 break;
900 case TT_KEEP:
901 t_callout = &tp->t_timers->tt_keep;
902 break;
903 case TT_2MSL:
904 t_callout = &tp->t_timers->tt_2msl;
905 break;
906 default:
865 panic("tp %p bad timer_type %#x", tp, timer_type);
866 }
867 if (delta == 0) {
868 if ((tp->t_timers->tt_flags & timer_type) &&
869 (callout_stop(t_callout) > 0) &&
870 (tp->t_timers->tt_flags & f_reset)) {
871 tp->t_timers->tt_flags &= ~(timer_type | f_reset);
872 }

--- 30 unchanged lines hidden (view full) ---

903 break;
904 case TT_KEEP:
905 t_callout = &tp->t_timers->tt_keep;
906 break;
907 case TT_2MSL:
908 t_callout = &tp->t_timers->tt_2msl;
909 break;
910 default:
911 if (tp->t_fb->tfb_tcp_timer_active) {
912 return(tp->t_fb->tfb_tcp_timer_active(tp, timer_type));
913 }
907 panic("tp %p bad timer_type %#x", tp, timer_type);
908 }
909 return callout_active(t_callout);
910}
911
912void
913tcp_timer_stop(struct tcpcb *tp, uint32_t timer_type)
914{

--- 25 unchanged lines hidden (view full) ---

940 f_reset = TT_KEEP_RST;
941 break;
942 case TT_2MSL:
943 t_callout = &tp->t_timers->tt_2msl;
944 f_callout = tcp_timer_2msl_discard;
945 f_reset = TT_2MSL_RST;
946 break;
947 default:
914 panic("tp %p bad timer_type %#x", tp, timer_type);
915 }
916 return callout_active(t_callout);
917}
918
919void
920tcp_timer_stop(struct tcpcb *tp, uint32_t timer_type)
921{

--- 25 unchanged lines hidden (view full) ---

947 f_reset = TT_KEEP_RST;
948 break;
949 case TT_2MSL:
950 t_callout = &tp->t_timers->tt_2msl;
951 f_callout = tcp_timer_2msl_discard;
952 f_reset = TT_2MSL_RST;
953 break;
954 default:
955 if (tp->t_fb->tfb_tcp_timer_stop) {
956 /*
957 * XXXrrs we need to look at this with the
958 * stop case below (flags).
959 */
960 tp->t_fb->tfb_tcp_timer_stop(tp, timer_type);
961 return;
962 }
948 panic("tp %p bad timer_type %#x", tp, timer_type);
949 }
950
951 if (tp->t_timers->tt_flags & timer_type) {
952 if ((callout_stop(t_callout) > 0) &&
953 (tp->t_timers->tt_flags & f_reset)) {
954 tp->t_timers->tt_flags &= ~(timer_type | f_reset);
955 } else {

--- 39 unchanged lines hidden ---
963 panic("tp %p bad timer_type %#x", tp, timer_type);
964 }
965
966 if (tp->t_timers->tt_flags & timer_type) {
967 if ((callout_stop(t_callout) > 0) &&
968 (tp->t_timers->tt_flags & f_reset)) {
969 tp->t_timers->tt_flags &= ~(timer_type | f_reset);
970 } else {

--- 39 unchanged lines hidden ---