View | Details | Raw Unified | Return to bug 256280
Collapse All | Expand All

(-)sys/netinet/tcp_stacks/bbr.c (-12 / +5 lines)
Lines 7876-7883 bbr_process_ack(struct mbuf *m, struct tcphdr *th, str Link Here
7876
	acked_amount = min(acked, (int)sbavail(&so->so_snd));
7876
	acked_amount = min(acked, (int)sbavail(&so->so_snd));
7877
	tp->snd_wnd -= acked_amount;
7877
	tp->snd_wnd -= acked_amount;
7878
	mfree = sbcut_locked(&so->so_snd, acked_amount);
7878
	mfree = sbcut_locked(&so->so_snd, acked_amount);
7879
	SOCKBUF_UNLOCK(&so->so_snd);
7879
	sowwakeup_locked(so);
7880
	tp->t_flags |= TF_WAKESOW;
7881
	m_freem(mfree);
7880
	m_freem(mfree);
7882
	if (SEQ_GT(th->th_ack, tp->snd_una)) {
7881
	if (SEQ_GT(th->th_ack, tp->snd_una)) {
7883
		bbr_collapse_rtt(tp, bbr, TCP_REXMTVAL(tp));
7882
		bbr_collapse_rtt(tp, bbr, TCP_REXMTVAL(tp));
Lines 8353-8360 bbr_process_data(struct mbuf *m, struct tcphdr *th, st Link Here
8353
				appended =
8352
				appended =
8354
#endif
8353
#endif
8355
					sbappendstream_locked(&so->so_rcv, m, 0);
8354
					sbappendstream_locked(&so->so_rcv, m, 0);
8356
			SOCKBUF_UNLOCK(&so->so_rcv);
8355
			sorwakeup_locked(so);
8357
			tp->t_flags |= TF_WAKESOR;
8358
#ifdef NETFLIX_SB_LIMITS
8356
#ifdef NETFLIX_SB_LIMITS
8359
			if (so->so_rcv.sb_shlim && appended != mcnt)
8357
			if (so->so_rcv.sb_shlim && appended != mcnt)
8360
				counter_fo_release(so->so_rcv.sb_shlim,
8358
				counter_fo_release(so->so_rcv.sb_shlim,
Lines 8414-8421 bbr_process_data(struct mbuf *m, struct tcphdr *th, st Link Here
8414
	if (thflags & TH_FIN) {
8412
	if (thflags & TH_FIN) {
8415
		if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
8413
		if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
8416
			socantrcvmore(so);
8414
			socantrcvmore(so);
8417
			/* The socket upcall is handled by socantrcvmore. */
8418
			tp->t_flags &= ~TF_WAKESOR;
8419
			/*
8415
			/*
8420
			 * If connection is half-synchronized (ie NEEDSYN
8416
			 * If connection is half-synchronized (ie NEEDSYN
8421
			 * flag on) then delay ACK, so it may be piggybacked
8417
			 * flag on) then delay ACK, so it may be piggybacked
Lines 8606-8613 bbr_do_fastnewdata(struct mbuf *m, struct tcphdr *th, Link Here
8606
			sbappendstream_locked(&so->so_rcv, m, 0);
8602
			sbappendstream_locked(&so->so_rcv, m, 0);
8607
		ctf_calc_rwin(so, tp);
8603
		ctf_calc_rwin(so, tp);
8608
	}
8604
	}
8609
	SOCKBUF_UNLOCK(&so->so_rcv);
8605
	sorwakeup_locked(so);
8610
	tp->t_flags |= TF_WAKESOR;
8611
#ifdef NETFLIX_SB_LIMITS
8606
#ifdef NETFLIX_SB_LIMITS
8612
	if (so->so_rcv.sb_shlim && mcnt != appended)
8607
	if (so->so_rcv.sb_shlim && mcnt != appended)
8613
		counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended);
8608
		counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended);
Lines 8798-8804 bbr_fastack(struct mbuf *m, struct tcphdr *th, struct Link Here
8798
		    &tcp_savetcp, 0);
8793
		    &tcp_savetcp, 0);
8799
#endif
8794
#endif
8800
	/* Wake up the socket if we have room to write more */
8795
	/* Wake up the socket if we have room to write more */
8801
	tp->t_flags |= TF_WAKESOW;
8796
	sowwakeup(so);
8802
	if (tp->snd_una == tp->snd_max) {
8797
	if (tp->snd_una == tp->snd_max) {
8803
		/* Nothing left outstanding */
8798
		/* Nothing left outstanding */
8804
		bbr_log_progress_event(bbr, tp, ticks, PROGRESS_CLEAR, __LINE__);
8799
		bbr_log_progress_event(bbr, tp, ticks, PROGRESS_CLEAR, __LINE__);
Lines 11754-11763 bbr_do_segment(struct mbuf *m, struct tcphdr *th, stru Link Here
11754
	}
11749
	}
11755
	retval = bbr_do_segment_nounlock(m, th, so, tp,
11750
	retval = bbr_do_segment_nounlock(m, th, so, tp,
11756
					 drop_hdrlen, tlen, iptos, 0, &tv);
11751
					 drop_hdrlen, tlen, iptos, 0, &tv);
11757
	if (retval == 0) {
11752
	if (retval == 0)
11758
		tcp_handle_wakeup(tp, so);
11759
		INP_WUNLOCK(tp->t_inpcb);
11753
		INP_WUNLOCK(tp->t_inpcb);
11760
	}
11761
}
11754
}
11762
11755
11763
/*
11756
/*
(-)sys/netinet/tcp_stacks/rack.c (-12 / +5 lines)
Lines 8344-8351 rack_process_ack(struct mbuf *m, struct tcphdr *th, st Link Here
8344
		 */
8344
		 */
8345
		ourfinisacked = 1;
8345
		ourfinisacked = 1;
8346
	}
8346
	}
8347
	SOCKBUF_UNLOCK(&so->so_snd);
8347
	sowwakeup_locked(so);
8348
	tp->t_flags |= TF_WAKESOW;
8349
	m_freem(mfree);
8348
	m_freem(mfree);
8350
	if (rack->r_ctl.rc_early_recovery == 0) {
8349
	if (rack->r_ctl.rc_early_recovery == 0) {
8351
		if (IN_RECOVERY(tp->t_flags)) {
8350
		if (IN_RECOVERY(tp->t_flags)) {
Lines 8665-8672 rack_process_data(struct mbuf *m, struct tcphdr *th, s Link Here
8665
				appended =
8664
				appended =
8666
#endif
8665
#endif
8667
					sbappendstream_locked(&so->so_rcv, m, 0);
8666
					sbappendstream_locked(&so->so_rcv, m, 0);
8668
			SOCKBUF_UNLOCK(&so->so_rcv);
8667
			sorwakeup_locked(so);
8669
			tp->t_flags |= TF_WAKESOR;
8670
#ifdef NETFLIX_SB_LIMITS
8668
#ifdef NETFLIX_SB_LIMITS
8671
			if (so->so_rcv.sb_shlim && appended != mcnt)
8669
			if (so->so_rcv.sb_shlim && appended != mcnt)
8672
				counter_fo_release(so->so_rcv.sb_shlim,
8670
				counter_fo_release(so->so_rcv.sb_shlim,
Lines 8731-8738 rack_process_data(struct mbuf *m, struct tcphdr *th, s Link Here
8731
	if (thflags & TH_FIN) {
8729
	if (thflags & TH_FIN) {
8732
		if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
8730
		if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
8733
			socantrcvmore(so);
8731
			socantrcvmore(so);
8734
			/* The socket upcall is handled by socantrcvmore. */
8735
			tp->t_flags &= ~TF_WAKESOR;
8736
			/*
8732
			/*
8737
			 * If connection is half-synchronized (ie NEEDSYN
8733
			 * If connection is half-synchronized (ie NEEDSYN
8738
			 * flag on) then delay ACK, so it may be piggybacked
8734
			 * flag on) then delay ACK, so it may be piggybacked
Lines 8924-8931 rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, Link Here
8924
			sbappendstream_locked(&so->so_rcv, m, 0);
8920
			sbappendstream_locked(&so->so_rcv, m, 0);
8925
		ctf_calc_rwin(so, tp);
8921
		ctf_calc_rwin(so, tp);
8926
	}
8922
	}
8927
	SOCKBUF_UNLOCK(&so->so_rcv);
8923
	sorwakeup_locked(so);
8928
	tp->t_flags |= TF_WAKESOR;
8929
#ifdef NETFLIX_SB_LIMITS
8924
#ifdef NETFLIX_SB_LIMITS
8930
	if (so->so_rcv.sb_shlim && mcnt != appended)
8925
	if (so->so_rcv.sb_shlim && mcnt != appended)
8931
		counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended);
8926
		counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended);
Lines 9142-9148 rack_fastack(struct mbuf *m, struct tcphdr *th, struct Link Here
9142
		rack_timer_cancel(tp, rack, rack->r_ctl.rc_rcvtime, __LINE__);
9137
		rack_timer_cancel(tp, rack, rack->r_ctl.rc_rcvtime, __LINE__);
9143
	}
9138
	}
9144
	/* Wake up the socket if we have room to write more */
9139
	/* Wake up the socket if we have room to write more */
9145
	tp->t_flags |= TF_WAKESOW;
9140
	sowwakeup(so);
9146
	if (sbavail(&so->so_snd)) {
9141
	if (sbavail(&so->so_snd)) {
9147
		rack->r_wanted_output = 1;
9142
		rack->r_wanted_output = 1;
9148
	}
9143
	}
Lines 11205-11214 rack_do_segment(struct mbuf *m, struct tcphdr *th, str Link Here
11205
		tcp_get_usecs(&tv);
11200
		tcp_get_usecs(&tv);
11206
	}
11201
	}
11207
	if(rack_do_segment_nounlock(m, th, so, tp,
11202
	if(rack_do_segment_nounlock(m, th, so, tp,
11208
				    drop_hdrlen, tlen, iptos, 0, &tv) == 0) {
11203
				    drop_hdrlen, tlen, iptos, 0, &tv) == 0)
11209
		tcp_handle_wakeup(tp, so);
11210
		INP_WUNLOCK(tp->t_inpcb);
11204
		INP_WUNLOCK(tp->t_inpcb);
11211
	}
11212
}
11205
}
11213
11206
11214
struct rack_sendmap *
11207
struct rack_sendmap *
(-)sys/netinet/tcp_stacks/rack_bbr_common.c (-1 lines)
Lines 458-464 ctf_do_queued_segments(struct socket *so, struct tcpcb Link Here
458
			/* We lost the tcpcb (maybe a RST came in)? */
458
			/* We lost the tcpcb (maybe a RST came in)? */
459
			return(1);
459
			return(1);
460
		}
460
		}
461
		tcp_handle_wakeup(tp, so);
462
	}
461
	}
463
	return (0);
462
	return (0);
464
}
463
}
(-)sys/netinet/tcp_input.c (-38 / +8 lines)
Lines 1472-1500 tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, stru Link Here
1472
}
1472
}
1473
1473
1474
void
1474
void
1475
tcp_handle_wakeup(struct tcpcb *tp, struct socket *so)
1476
{
1477
	/*
1478
	 * Since tp might be gone if the session entered
1479
	 * the TIME_WAIT state before coming here, we need
1480
	 * to check if the socket is still connected.
1481
	 */
1482
	if ((so->so_state & SS_ISCONNECTED) == 0)
1483
		return;
1484
	INP_LOCK_ASSERT(tp->t_inpcb);
1485
	if (tp->t_flags & TF_WAKESOR) {
1486
		tp->t_flags &= ~TF_WAKESOR;
1487
		SOCKBUF_UNLOCK_ASSERT(&so->so_rcv);
1488
		sorwakeup(so);
1489
	}
1490
	if (tp->t_flags & TF_WAKESOW) {
1491
		tp->t_flags &= ~TF_WAKESOW;
1492
		SOCKBUF_UNLOCK_ASSERT(&so->so_snd);
1493
		sowwakeup(so);
1494
	}
1495
}
1496
1497
void
1498
tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
1475
tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
1499
    struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos)
1476
    struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos)
1500
{
1477
{
Lines 1863-1869 tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru Link Here
1863
				else if (!tcp_timer_active(tp, TT_PERSIST))
1840
				else if (!tcp_timer_active(tp, TT_PERSIST))
1864
					tcp_timer_activate(tp, TT_REXMT,
1841
					tcp_timer_activate(tp, TT_REXMT,
1865
						      tp->t_rxtcur);
1842
						      tp->t_rxtcur);
1866
				tp->t_flags |= TF_WAKESOW;
1843
				sowwakeup(so);
1867
				if (sbavail(&so->so_snd))
1844
				if (sbavail(&so->so_snd))
1868
					(void) tp->t_fb->tfb_tcp_output(tp);
1845
					(void) tp->t_fb->tfb_tcp_output(tp);
1869
				goto check_delack;
1846
				goto check_delack;
Lines 1928-1935 tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru Link Here
1928
				m_adj(m, drop_hdrlen);	/* delayed header drop */
1905
				m_adj(m, drop_hdrlen);	/* delayed header drop */
1929
				sbappendstream_locked(&so->so_rcv, m, 0);
1906
				sbappendstream_locked(&so->so_rcv, m, 0);
1930
			}
1907
			}
1931
			SOCKBUF_UNLOCK(&so->so_rcv);
1908
			/* NB: sorwakeup_locked() does an implicit unlock. */
1932
			tp->t_flags |= TF_WAKESOR;
1909
			sorwakeup_locked(so);
1933
			if (DELAY_ACK(tp, tlen)) {
1910
			if (DELAY_ACK(tp, tlen)) {
1934
				tp->t_flags |= TF_DELACK;
1911
				tp->t_flags |= TF_DELACK;
1935
			} else {
1912
			} else {
Lines 2925-2932 process_ACK: Link Here
2925
				tp->snd_wnd = 0;
2902
				tp->snd_wnd = 0;
2926
			ourfinisacked = 0;
2903
			ourfinisacked = 0;
2927
		}
2904
		}
2928
		SOCKBUF_UNLOCK(&so->so_snd);
2905
		/* NB: sowwakeup_locked() does an implicit unlock. */
2929
		tp->t_flags |= TF_WAKESOW;
2906
		sowwakeup_locked(so);
2930
		m_freem(mfree);
2907
		m_freem(mfree);
2931
		/* Detect una wraparound. */
2908
		/* Detect una wraparound. */
2932
		if (!IN_RECOVERY(tp->t_flags) &&
2909
		if (!IN_RECOVERY(tp->t_flags) &&
Lines 3147-3154 dodata: /* XXX */ Link Here
3147
				m_freem(m);
3124
				m_freem(m);
3148
			else
3125
			else
3149
				sbappendstream_locked(&so->so_rcv, m, 0);
3126
				sbappendstream_locked(&so->so_rcv, m, 0);
3150
			SOCKBUF_UNLOCK(&so->so_rcv);
3127
			/* NB: sorwakeup_locked() does an implicit unlock. */
3151
			tp->t_flags |= TF_WAKESOR;
3128
			sorwakeup_locked(so);
3152
		} else {
3129
		} else {
3153
			/*
3130
			/*
3154
			 * XXX: Due to the header drop above "th" is
3131
			 * XXX: Due to the header drop above "th" is
Lines 3215-3222 dodata: /* XXX */ Link Here
3215
	if (thflags & TH_FIN) {
3192
	if (thflags & TH_FIN) {
3216
		if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
3193
		if (TCPS_HAVERCVDFIN(tp->t_state) == 0) {
3217
			socantrcvmore(so);
3194
			socantrcvmore(so);
3218
			/* The socket upcall is handled by socantrcvmore. */
3219
			tp->t_flags &= ~TF_WAKESOR;
3220
			/*
3195
			/*
3221
			 * If connection is half-synchronized
3196
			 * If connection is half-synchronized
3222
			 * (ie NEEDSYN flag on) then delay ACK,
3197
			 * (ie NEEDSYN flag on) then delay ACK,
Lines 3280-3286 check_delack: Link Here
3280
		tp->t_flags &= ~TF_DELACK;
3255
		tp->t_flags &= ~TF_DELACK;
3281
		tcp_timer_activate(tp, TT_DELACK, tcp_delacktime);
3256
		tcp_timer_activate(tp, TT_DELACK, tcp_delacktime);
3282
	}
3257
	}
3283
	tcp_handle_wakeup(tp, so);
3284
	INP_WUNLOCK(tp->t_inpcb);
3258
	INP_WUNLOCK(tp->t_inpcb);
3285
	return;
3259
	return;
3286
3260
Lines 3314-3320 dropafterack: Link Here
3314
	TCP_PROBE3(debug__input, tp, th, m);
3288
	TCP_PROBE3(debug__input, tp, th, m);
3315
	tp->t_flags |= TF_ACKNOW;
3289
	tp->t_flags |= TF_ACKNOW;
3316
	(void) tp->t_fb->tfb_tcp_output(tp);
3290
	(void) tp->t_fb->tfb_tcp_output(tp);
3317
	tcp_handle_wakeup(tp, so);
3318
	INP_WUNLOCK(tp->t_inpcb);
3291
	INP_WUNLOCK(tp->t_inpcb);
3319
	m_freem(m);
3292
	m_freem(m);
3320
	return;
3293
	return;
Lines 3322-3328 dropafterack: Link Here
3322
dropwithreset:
3295
dropwithreset:
3323
	if (tp != NULL) {
3296
	if (tp != NULL) {
3324
		tcp_dropwithreset(m, th, tp, tlen, rstreason);
3297
		tcp_dropwithreset(m, th, tp, tlen, rstreason);
3325
		tcp_handle_wakeup(tp, so);
3326
		INP_WUNLOCK(tp->t_inpcb);
3298
		INP_WUNLOCK(tp->t_inpcb);
3327
	} else
3299
	} else
3328
		tcp_dropwithreset(m, th, NULL, tlen, rstreason);
3300
		tcp_dropwithreset(m, th, NULL, tlen, rstreason);
Lines 3338-3347 drop: Link Here
3338
			  &tcp_savetcp, 0);
3310
			  &tcp_savetcp, 0);
3339
#endif
3311
#endif
3340
	TCP_PROBE3(debug__input, tp, th, m);
3312
	TCP_PROBE3(debug__input, tp, th, m);
3341
	if (tp != NULL) {
3313
	if (tp != NULL)
3342
		tcp_handle_wakeup(tp, so);
3343
		INP_WUNLOCK(tp->t_inpcb);
3314
		INP_WUNLOCK(tp->t_inpcb);
3344
	}
3345
	m_freem(m);
3315
	m_freem(m);
3346
}
3316
}
3347
3317
(-)sys/netinet/tcp_reass.c (-4 / +2 lines)
Lines 959-966 new_entry: Link Here
959
		} else {
959
		} else {
960
			sbappendstream_locked(&so->so_rcv, m, 0);
960
			sbappendstream_locked(&so->so_rcv, m, 0);
961
		}
961
		}
962
		SOCKBUF_UNLOCK(&so->so_rcv);
962
		sorwakeup_locked(so);
963
		tp->t_flags |= TF_WAKESOR;
964
		return (flags);
963
		return (flags);
965
	}
964
	}
966
	if (tcp_new_limits) {
965
	if (tcp_new_limits) {
Lines 1108-1114 present: Link Here
1108
#ifdef TCP_REASS_LOGGING
1107
#ifdef TCP_REASS_LOGGING
1109
	tcp_reass_log_dump(tp);
1108
	tcp_reass_log_dump(tp);
1110
#endif
1109
#endif
1111
	SOCKBUF_UNLOCK(&so->so_rcv);
1110
	sorwakeup_locked(so);
1112
	tp->t_flags |= TF_WAKESOR;
1113
	return (flags);
1111
	return (flags);
1114
}
1112
}

Return to bug 256280