* 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. */
| 7785 | * its unlocked and probably unsafe to touch the TCB. |
| 7786 | */ |
| 7787 | static int |
| 7788 | bbr_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. |
no test coverage detected