Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_stacks/rack.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 8,447 Lines • ▼ Show 20 Lines | if ((sbused(&so->so_snd) == 0) && | ||||
/* | /* | ||||
* We must be sure our fin | * We must be sure our fin | ||||
* was sent and acked (we can be | * was sent and acked (we can be | ||||
* in FIN_WAIT_1 without having | * in FIN_WAIT_1 without having | ||||
* sent the fin). | * sent the fin). | ||||
*/ | */ | ||||
ourfinisacked = 1; | ourfinisacked = 1; | ||||
} | } | ||||
/* NB: sowwakeup_locked() does an implicit unlock. */ | SOCKBUF_UNLOCK(&so->so_snd); | ||||
sowwakeup_locked(so); | tp->t_flags |= TF_WAKESOW; | ||||
m_freem(mfree); | m_freem(mfree); | ||||
if (rack->r_ctl.rc_early_recovery == 0) { | if (rack->r_ctl.rc_early_recovery == 0) { | ||||
if (IN_RECOVERY(tp->t_flags)) { | if (IN_RECOVERY(tp->t_flags)) { | ||||
if (SEQ_LT(th->th_ack, tp->snd_recover) && | if (SEQ_LT(th->th_ack, tp->snd_recover) && | ||||
(SEQ_LT(th->th_ack, tp->snd_max))) { | (SEQ_LT(th->th_ack, tp->snd_max))) { | ||||
tcp_rack_partialack(tp, th); | tcp_rack_partialack(tp, th); | ||||
} else { | } else { | ||||
rack_post_recovery(tp, th); | rack_post_recovery(tp, th); | ||||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | #endif | ||||
SOCKBUF_LOCK(&so->so_rcv); | SOCKBUF_LOCK(&so->so_rcv); | ||||
if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { | if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { | ||||
m_freem(m); | m_freem(m); | ||||
} else | } else | ||||
#ifdef NETFLIX_SB_LIMITS | #ifdef NETFLIX_SB_LIMITS | ||||
appended = | appended = | ||||
#endif | #endif | ||||
sbappendstream_locked(&so->so_rcv, m, 0); | sbappendstream_locked(&so->so_rcv, m, 0); | ||||
/* NB: sorwakeup_locked() does an implicit unlock. */ | SOCKBUF_UNLOCK(&so->so_rcv); | ||||
sorwakeup_locked(so); | tp->t_flags |= TF_WAKESOR; | ||||
#ifdef NETFLIX_SB_LIMITS | #ifdef NETFLIX_SB_LIMITS | ||||
if (so->so_rcv.sb_shlim && appended != mcnt) | if (so->so_rcv.sb_shlim && appended != mcnt) | ||||
counter_fo_release(so->so_rcv.sb_shlim, | counter_fo_release(so->so_rcv.sb_shlim, | ||||
mcnt - appended); | mcnt - appended); | ||||
#endif | #endif | ||||
} else { | } else { | ||||
/* | /* | ||||
* XXX: Due to the header drop above "th" is | * XXX: Due to the header drop above "th" is | ||||
▲ Show 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | if (newsize) | ||||
so->so_rcv.sb_flags &= ~SB_AUTOSIZE; | so->so_rcv.sb_flags &= ~SB_AUTOSIZE; | ||||
m_adj(m, drop_hdrlen); /* delayed header drop */ | m_adj(m, drop_hdrlen); /* delayed header drop */ | ||||
#ifdef NETFLIX_SB_LIMITS | #ifdef NETFLIX_SB_LIMITS | ||||
appended = | appended = | ||||
#endif | #endif | ||||
sbappendstream_locked(&so->so_rcv, m, 0); | sbappendstream_locked(&so->so_rcv, m, 0); | ||||
ctf_calc_rwin(so, tp); | ctf_calc_rwin(so, tp); | ||||
} | } | ||||
/* NB: sorwakeup_locked() does an implicit unlock. */ | SOCKBUF_UNLOCK(&so->so_rcv); | ||||
sorwakeup_locked(so); | tp->t_flags |= TF_WAKESOR; | ||||
#ifdef NETFLIX_SB_LIMITS | #ifdef NETFLIX_SB_LIMITS | ||||
if (so->so_rcv.sb_shlim && mcnt != appended) | if (so->so_rcv.sb_shlim && mcnt != appended) | ||||
counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended); | counter_fo_release(so->so_rcv.sb_shlim, mcnt - appended); | ||||
#endif | #endif | ||||
rack_handle_delayed_ack(tp, rack, tlen, 0); | rack_handle_delayed_ack(tp, rack, tlen, 0); | ||||
if (tp->snd_una == tp->snd_max) | if (tp->snd_una == tp->snd_max) | ||||
sack_filter_clear(&rack->r_ctl.rack_sf, tp->snd_una); | sack_filter_clear(&rack->r_ctl.rack_sf, tp->snd_una); | ||||
return (1); | return (1); | ||||
▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | if (tp->snd_una == tp->snd_max) { | ||||
if (rack->r_ctl.rc_went_idle_time == 0) | if (rack->r_ctl.rc_went_idle_time == 0) | ||||
rack->r_ctl.rc_went_idle_time = 1; | rack->r_ctl.rc_went_idle_time = 1; | ||||
rack_log_progress_event(rack, tp, 0, PROGRESS_CLEAR, __LINE__); | rack_log_progress_event(rack, tp, 0, PROGRESS_CLEAR, __LINE__); | ||||
if (sbavail(&tp->t_inpcb->inp_socket->so_snd) == 0) | if (sbavail(&tp->t_inpcb->inp_socket->so_snd) == 0) | ||||
tp->t_acktime = 0; | tp->t_acktime = 0; | ||||
rack_timer_cancel(tp, rack, rack->r_ctl.rc_rcvtime, __LINE__); | rack_timer_cancel(tp, rack, rack->r_ctl.rc_rcvtime, __LINE__); | ||||
} | } | ||||
/* Wake up the socket if we have room to write more */ | /* Wake up the socket if we have room to write more */ | ||||
sowwakeup(so); | tp->t_flags |= TF_WAKESOW; | ||||
if (sbavail(&so->so_snd)) { | if (sbavail(&so->so_snd)) { | ||||
rack->r_wanted_output = 1; | rack->r_wanted_output = 1; | ||||
} | } | ||||
return (1); | return (1); | ||||
} | } | ||||
/* | /* | ||||
* Return value of 1, the TCB is unlocked and most | * Return value of 1, the TCB is unlocked and most | ||||
▲ Show 20 Lines • Show All 2,040 Lines • ▼ Show 20 Lines | rack_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, | ||||
if (m->m_flags & M_TSTMP_LRO) { | if (m->m_flags & M_TSTMP_LRO) { | ||||
tv.tv_sec = m->m_pkthdr.rcv_tstmp /1000000000; | tv.tv_sec = m->m_pkthdr.rcv_tstmp /1000000000; | ||||
tv.tv_usec = (m->m_pkthdr.rcv_tstmp % 1000000000)/1000; | tv.tv_usec = (m->m_pkthdr.rcv_tstmp % 1000000000)/1000; | ||||
} else { | } else { | ||||
/* Should not be should we kassert instead? */ | /* Should not be should we kassert instead? */ | ||||
tcp_get_usecs(&tv); | tcp_get_usecs(&tv); | ||||
} | } | ||||
if(rack_do_segment_nounlock(m, th, so, tp, | if(rack_do_segment_nounlock(m, th, so, tp, | ||||
drop_hdrlen, tlen, iptos, 0, &tv) == 0) | drop_hdrlen, tlen, iptos, 0, &tv) == 0) { | ||||
INP_WUNLOCK(tp->t_inpcb); | INP_WUNLOCK(tp->t_inpcb); | ||||
tcp_handle_wakeup(tp, so); | |||||
} | |||||
} | } | ||||
struct rack_sendmap * | struct rack_sendmap * | ||||
tcp_rack_output(struct tcpcb *tp, struct tcp_rack *rack, uint32_t tsused) | tcp_rack_output(struct tcpcb *tp, struct tcp_rack *rack, uint32_t tsused) | ||||
{ | { | ||||
struct rack_sendmap *rsm = NULL; | struct rack_sendmap *rsm = NULL; | ||||
int32_t idx; | int32_t idx; | ||||
uint32_t srtt = 0, thresh = 0, ts_low = 0; | uint32_t srtt = 0, thresh = 0, ts_low = 0; | ||||
▲ Show 20 Lines • Show All 3,782 Lines • Show Last 20 Lines |