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

Function bbr_process_ack

freebsd/netinet/tcp_stacks/bbr.c:7787–7949  ·  view source on GitHub ↗

* Return value of 1, we do not need to call bbr_process_data(). * return value of 0, bbr_process_data can be called. * For ret_val if its 0 the TCB is locked and valid, if its non-zero * its unlocked and probably unsafe to touch the TCB. */

Source from the content-addressed store, hash-verified

7785 * its unlocked and probably unsafe to touch the TCB.
7786 */
7787static int
7788bbr_process_ack(struct mbuf *m, struct tcphdr *th, struct socket *so,
7789 struct tcpcb *tp, struct tcpopt *to,
7790 uint32_t tiwin, int32_t tlen,
7791 int32_t * ofia, int32_t thflags, int32_t * ret_val)
7792{
7793 int32_t ourfinisacked = 0;
7794 int32_t acked_amount;
7795 uint16_t nsegs;
7796 int32_t acked;
7797 uint32_t lost, sack_changed = 0;
7798 struct mbuf *mfree;
7799 struct tcp_bbr *bbr;
7800 uint32_t prev_acked = 0;
7801
7802 bbr = (struct tcp_bbr *)tp->t_fb_ptr;
7803 lost = bbr->r_ctl.rc_lost;
7804 nsegs = max(1, m->m_pkthdr.lro_nsegs);
7805 if (SEQ_GT(th->th_ack, tp->snd_max)) {
7806 ctf_do_dropafterack(m, tp, th, thflags, tlen, ret_val);
7807 bbr->r_wanted_output = 1;
7808 return (1);
7809 }
7810 if (SEQ_GEQ(th->th_ack, tp->snd_una) || to->to_nsacks) {
7811 /* Process the ack */
7812 if (bbr->rc_in_persist)
7813 tp->t_rxtshift = 0;
7814 if ((th->th_ack == tp->snd_una) && (tiwin == tp->snd_wnd))
7815 bbr_strike_dupack(bbr);
7816 sack_changed = bbr_log_ack(tp, to, th, &prev_acked);
7817 }
7818 bbr_lt_bw_sampling(bbr, bbr->r_ctl.rc_rcvtime, (bbr->r_ctl.rc_lost > lost));
7819 if (__predict_false(SEQ_LEQ(th->th_ack, tp->snd_una))) {
7820 /*
7821 * Old ack, behind the last one rcv'd or a duplicate ack
7822 * with SACK info.
7823 */
7824 if (th->th_ack == tp->snd_una) {
7825 bbr_ack_received(tp, bbr, th, 0, sack_changed, prev_acked, __LINE__, 0);
7826 if (bbr->r_state == TCPS_SYN_SENT) {
7827 /*
7828 * Special case on where we sent SYN. When
7829 * the SYN-ACK is processed in syn_sent
7830 * state it bumps the snd_una. This causes
7831 * us to hit here even though we did ack 1
7832 * byte.
7833 *
7834 * Go through the nothing left case so we
7835 * send data.
7836 */
7837 goto nothing_left;
7838 }
7839 }
7840 return (0);
7841 }
7842 /*
7843 * If we reach this point, ACK is not a duplicate, i.e., it ACKs
7844 * something we sent.

Callers 8

bbr_do_syn_sentFunction · 0.85
bbr_do_syn_recvFunction · 0.85
bbr_do_establishedFunction · 0.85
bbr_do_close_waitFunction · 0.85
bbr_do_fin_wait_1Function · 0.85
bbr_do_closingFunction · 0.85
bbr_do_lastackFunction · 0.85
bbr_do_fin_wait_2Function · 0.85

Calls 15

maxFunction · 0.85
ctf_do_dropafterackFunction · 0.85
bbr_strike_dupackFunction · 0.85
bbr_log_ackFunction · 0.85
bbr_lt_bw_samplingFunction · 0.85
bbr_ack_receivedFunction · 0.85
bbr_cong_signalFunction · 0.85
minFunction · 0.85
sbcut_lockedFunction · 0.85
bbr_collapse_rttFunction · 0.85
tcp_bbr_partialackFunction · 0.85
bbr_post_recoveryFunction · 0.85

Tested by

no test coverage detected