Lines Matching refs:tp

221 extern uint32_t get_base_rtt(struct tcpcb *tp);
222 static struct mbuf* tcp_send_lroacks(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th);
266 tcp_output(struct tcpcb *tp)
268 struct socket *so = tp->t_inpcb->inp_socket;
294 struct mbuf *tp_inp_options = tp->t_inpcb->inp_depend4.inp4_options;
296 int isipv6 = tp->t_inpcb->inp_vflag & INP_IPV6 ;
303 u_int32_t lro_ackmore = (tp->t_lropktlen != 0) ? 1 : 0;
313 idle = (tp->t_flags & TF_LASTIDLE) || (tp->snd_max == tp->snd_una);
318 idle_time = tcp_now - tp->t_rcvtime;
319 if (idle && idle_time >= TCP_IDLETIMEOUT(tp)) {
320 if (CC_ALGO(tp)->after_idle != NULL)
321 CC_ALGO(tp)->after_idle(tp);
322 DTRACE_TCP5(cc, void, NULL, struct inpcb *, tp->t_inpcb,
323 struct tcpcb *, tp, struct tcphdr *, NULL,
326 tp->t_flags &= ~TF_LASTIDLE;
328 if (tp->t_flags & TF_MORETOCOME) {
329 tp->t_flags |= TF_LASTIDLE;
339 ((tp->t_inpcb->inp_fport << 16) | tp->t_inpcb->inp_lport),
340 (((tp->t_inpcb->in6p_laddr.s6_addr16[0] & 0xffff) << 16) |
341 (tp->t_inpcb->in6p_faddr.s6_addr16[0] & 0xffff)),
348 ((tp->t_inpcb->inp_fport << 16) | tp->t_inpcb->inp_lport),
349 (((tp->t_inpcb->inp_laddr.s_addr & 0xffff) << 16) |
350 (tp->t_inpcb->inp_faddr.s_addr & 0xffff)),
359 rt = tp->t_inpcb->inp_route.ro_rt;
371 tp->t_flags &= ~TF_TSO;
374 ia6 = ifa_foraddr6(&tp->t_inpcb->in6p_laddr);
378 ia = ifa_foraddr(tp->t_inpcb->inp_laddr.s_addr);
389 if (tp->t_state >= TCPS_CLOSE_WAIT) {
390 tcp_drop(tp, EADDRNOTAVAIL);
399 if (!tp->t_timer[TCPT_REXMT]) {
400 tp->t_timer[TCPT_REXMT] = OFFSET_FROM_START(tp, tp->t_rxtcur);
401 if (tp->t_timer[TCPT_PERSIST]) {
402 tp->t_timer[TCPT_PERSIST] = 0;
403 tp->t_rxtshift = 0;
404 tp->t_persist_stop = 0;
405 tp->rxt_start = 0;
409 if (tp->t_pktlist_head != NULL)
410 m_freem_list(tp->t_pktlist_head);
411 TCP_PKTLIST_CLEAR(tp);
415 tcp_drop(tp, EADDRNOTAVAIL);
419 tcp_check_timer_state(tp);
436 tcp_set_tso(tp, ifp);
450 tp->t_flags &= ~TF_PMTUD;
452 tp->t_flags |= TF_PMTUD;
462 if (tp->sack_enable && SEQ_LT(tp->snd_nxt, tp->snd_max))
463 tcp_sack_adjust(tp);
465 off = tp->snd_nxt - tp->snd_una;
466 sendwin = min(tp->snd_wnd, tp->snd_cwnd);
468 if (tp->t_flags & TF_SLOWLINK && slowlink_wsize > 0)
471 flags = tcp_outflags[tp->t_state];
486 if (tp->sack_enable && IN_FASTRECOVERY(tp) &&
487 (p = tcp_sack_output(tp, &sack_bytes_rxmt))) {
490 cwin = min(tp->snd_wnd, tp->snd_cwnd) - sack_bytes_rxmt;
494 if (SEQ_GT(p->end, tp->snd_recover)) {
500 if (SEQ_GEQ(p->rxmit, tp->snd_recover)) {
512 tp->snd_recover - p->rxmit));
517 off = p->rxmit - tp->snd_una; /* update off only if we really transmit SACK data */
522 min(len, tp->t_maxseg);
524 nstat_route_tx(tp->t_inpcb->inp_route.ro_rt, 1,
525 min(len, tp->t_maxseg), NSTAT_TX_FLAG_RETRANSMIT);
526 locked_add_64(&tp->t_inpcb->inp_stat->txpackets, 1);
527 locked_add_64(&tp->t_inpcb->inp_stat->txbytes,
528 min(len, tp->t_maxseg));
529 tp->t_stat.txretransmitbytes += min(len, tp->t_maxseg);
540 if (tp->t_flags & TF_NEEDFIN)
542 if (tp->t_flags & TF_NEEDSYN)
551 if (tp->t_force) {
573 tp->t_timer[TCPT_PERSIST] = 0;
574 tp->t_rxtshift = 0;
575 tp->rxt_start = 0;
576 tp->t_persist_stop = 0;
606 len = min(so->so_snd.sb_cc, tp->snd_wnd)
617 cwin = tp->snd_cwnd -
618 (tp->snd_nxt - tp->sack_newdata) -
634 if ((flags & TH_SYN) && SEQ_GT(tp->snd_nxt, tp->snd_una)) {
637 if (len > 0 && tp->t_state == TCPS_SYN_SENT) {
638 while (tp->t_inpcb->inp_sndinprog_cnt == 0 &&
639 tp->t_pktlist_head != NULL) {
640 packetlist = tp->t_pktlist_head;
641 packchain_listadd = tp->t_lastchain;
643 TCP_PKTLIST_CLEAR(tp);
645 error = tcp_ip_output(so, tp, packetlist,
661 if (tp->t_inpcb->inp_sndinprog_cnt == 0 &&
662 (tp->t_flags & TF_CLOSING)) {
663 tp->t_flags &= ~TF_CLOSING;
664 (void) tcp_close(tp);
666 tcp_check_timer_state(tp);
679 if ((flags & TH_SYN) && (tp->t_flags & TF_NOOPT)) {
702 tp->t_timer[TCPT_REXMT] = 0;
703 tp->t_rxtshift = 0;
704 tp->rxt_start = 0;
705 tp->snd_nxt = tp->snd_una;
706 if (tp->t_timer[TCPT_PERSIST] == 0)
707 tcp_setpersist(tp);
719 basertt = get_base_rtt(tp);
721 !INP_WAIT_FOR_IF_FEEDBACK(tp->t_inpcb) && !IN_FASTRECOVERY(tp) &&
724 if ((tp->snd_wnd / 4 * 5) >= so->so_snd.sb_hiwat &&
727 (tp->snd_nxt - tp->snd_una))) {
735 if (tp->t_rttcur <=
773 ipsec_optlen = ipsec_hdrsiz_tcp(tp);
776 if (len > tp->t_maxseg) {
777 if ((tp->t_flags & TF_TSO) && tcp_do_tso &&
782 tp->rcv_numsacks == 0 && sack_rxmit == 0 && sack_bytes_rxmt == 0 &&
783 tp->t_inpcb->inp_options == NULL &&
784 tp->t_inpcb->in6p_options == NULL
795 len = tp->t_maxseg;
801 if (SEQ_LT(p->rxmit + len, tp->snd_una + so->so_snd.sb_cc))
804 if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + so->so_snd.sb_cc))
808 recwin = tcp_sbspace(tp);
823 if (tp->t_force) {
824 tp->t_flags &= ~TF_MAXSEGSNT;
827 if (SEQ_LT(tp->snd_nxt, tp->snd_max)) {
828 if (len >= tp->t_maxseg)
829 tp->t_flags |= TF_MAXSEGSNT;
831 tp->t_flags &= ~TF_MAXSEGSNT;
841 if (!INP_WAIT_FOR_IF_FEEDBACK(tp->t_inpcb) ||
842 tp->t_state != TCPS_ESTABLISHED) {
843 if (len >= tp->t_maxseg) {
844 tp->t_flags |= TF_MAXSEGSNT;
847 if (!(tp->t_flags & TF_MORETOCOME) &&
848 (idle || tp->t_flags & TF_NODELAY || tp->t_flags & TF_MAXSEGSNT) &&
849 (tp->t_flags & TF_NOPUSH) == 0 &&
851 tp->t_flags &= ~TF_MAXSEGSNT;
854 if (len >= tp->max_sndwnd / 2 && tp->max_sndwnd > 0) {
855 tp->t_flags &= ~TF_MAXSEGSNT;
871 if (recwin > 0 && !(tp->t_flags & TF_NEEDSYN)) {
875 * TCP_MAXWIN << tp->rcv_scale.
877 int32_t adv = imin(recwin, (int)TCP_MAXWIN << tp->rcv_scale) -
878 (tp->rcv_adv - tp->rcv_nxt);
880 if (adv >= (int32_t) (2 * tp->t_maxseg)) {
889 if ((tp->t_flags & TF_STRETCHACK) == 0 &&
890 (tp->last_ack_sent != tp->rcv_nxt ||
891 ((recwin + adv) >> tp->rcv_scale) > recwin)) {
899 if ((tp->t_flags & TF_STRETCHACK) != 0 &&
900 (tp->t_flags & TF_DELACK) == 0) {
901 tp->t_flags |= TF_DELACK;
902 tp->t_timer[TCPT_DELACK] = OFFSET_FROM_START(tp, tcp_delack);
913 if (tp->t_flags & TF_ACKNOW)
916 ((flags & TH_SYN) && (tp->t_flags & TF_NEEDSYN) == 0))
918 if (SEQ_GT(tp->snd_up, tp->snd_una))
925 ((tp->t_flags & TF_SENTFIN) == 0 || tp->snd_nxt == tp->snd_una))
932 if (tp->sack_enable && (tp->t_state >= TCPS_ESTABLISHED) &&
933 SEQ_GT(tp->snd_max, tp->snd_una) &&
934 tp->t_timer[TCPT_REXMT] == 0 &&
935 tp->t_timer[TCPT_PERSIST] == 0) {
936 tp->t_timer[TCPT_REXMT] = OFFSET_FROM_START(tp, tp->t_rxtcur);
947 * tp->t_timer[TCPT_PERSIST]
949 * tp->t_force
951 * tp->t_timer[TCPT_REXMT]
961 if (so->so_snd.sb_cc && tp->t_timer[TCPT_REXMT] == 0 &&
962 tp->t_timer[TCPT_PERSIST] == 0) {
963 tp->t_rxtshift = 0;
964 tp->rxt_start = 0;
965 tcp_setpersist(tp);
972 while (tp->t_inpcb->inp_sndinprog_cnt == 0 &&
973 tp->t_pktlist_head != NULL) {
974 packetlist = tp->t_pktlist_head;
975 packchain_listadd = tp->t_lastchain;
977 TCP_PKTLIST_CLEAR(tp);
979 error = tcp_ip_output(so, tp, packetlist, packchain_listadd,
989 if (tp->t_inpcb->inp_sndinprog_cnt == 0 &&
990 (tp->t_flags & TF_CLOSING)) {
991 tp->t_flags &= ~TF_CLOSING;
992 (void) tcp_close(tp);
994 tcp_check_timer_state(tp);
1016 tp->snd_nxt = tp->iss;
1017 if ((tp->t_flags & TF_NOOPT) == 0) {
1022 mss = htons((u_short) tcp_mssopt(tp));
1026 if ((tp->t_flags & TF_REQ_SCALE) &&
1028 (tp->t_flags & TF_RCVD_SCALE))) {
1033 tp->request_r_scale);
1058 if ((tp->ecn_flags & TE_SETUPRECEIVED) != 0) {
1059 if ((tp->ecn_flags & TE_SETUPSENT) == 0) {
1067 tp->ecn_flags |= (TE_SETUPSENT | TE_SENDIPECT);
1077 tp->ecn_flags &= ~TE_SETUPRECEIVED;
1082 if ((tp->ecn_flags & TE_SETUPSENT) == 0) {
1090 tp->ecn_flags |= (TE_SETUPSENT | TE_SENDIPECT);
1098 tp->ecn_flags &= ~TE_SENDIPECT;
1109 if ((tp->ecn_flags & TE_SENDCWR) != 0 && len != 0 &&
1110 !SEQ_LT(tp->snd_nxt, tp->snd_max) && !sack_rxmit) {
1112 tp->ecn_flags &= ~TE_SENDCWR;
1118 if ((tp->ecn_flags & TE_SENDECE) != 0 && len == 0) {
1127 if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
1130 (tp->t_flags & TF_RCVD_TSTMP))) {
1136 *lp = htonl(tp->ts_recent);
1141 if (tp->rfbuf_ts == 0 && (so->so_rcv.sb_flags & SB_AUTOSIZE))
1142 tp->rfbuf_ts = tcp_now;
1144 if (tp->sack_enable && ((tp->t_flags & TF_NOOPT) == 0)) {
1160 (!(flags & TH_ACK) || (tp->t_flags & TF_SACK_PERMIT))) {
1182 if (TCPS_HAVEESTABLISHED(tp->t_state) &&
1183 (tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0 &&
1190 nsack = min(nsack, tp->rcv_numsacks);
1208 struct sackblk sack = tp->sackblks[i];
1232 ipoptlen = ip6_optlen(tp->t_inpcb);
1259 if (len + optlen + ipoptlen > tp->t_maxopd) {
1267 tso_maxlen = tp->tso_max_segment_size ? tp->tso_max_segment_size : TCP_MAXWIN;
1271 len = len - (len % (tp->t_maxopd - optlen));
1273 } else if (tp->t_flags & TF_NEEDFIN)
1276 len = tp->t_maxopd - optlen - ipoptlen;
1287 if ((tp->t_flagsext & TF_MEASURESNDBW) != 0 &&
1288 (tp->t_bwmeas != NULL) &&
1289 (tp->t_flagsext & TF_BWMEAS_INPROGRESS) == 0 &&
1290 (so->so_snd.sb_cc - (tp->snd_max - tp->snd_una)) >=
1291 tp->t_bwmeas->bw_minsize) {
1292 tp->t_bwmeas->bw_size = min((so->so_snd.sb_cc - (tp->snd_max - tp->snd_una)),
1293 tp->t_bwmeas->bw_maxsize);
1294 tp->t_flagsext |= TF_BWMEAS_INPROGRESS;
1295 tp->t_bwmeas->bw_start = tp->snd_max;
1296 tp->t_bwmeas->bw_ts = tcp_now;
1299 VERIFY(tp->t_inpcb->inp_flowhash != 0);
1307 if (tp->t_force && len == 1)
1309 else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) {
1313 nstat_route_tx(tp->t_inpcb->inp_route.ro_rt, 1,
1315 locked_add_64(&tp->t_inpcb->inp_stat->txpackets, 1);
1316 locked_add_64(&tp->t_inpcb->inp_stat->txbytes, len);
1317 tp->t_stat.txretransmitbytes += len;
1323 locked_add_64(&tp->t_inpcb->inp_stat->txpackets, 1);
1324 locked_add_64(&tp->t_inpcb->inp_stat->txbytes, len);
1430 if (tp->t_flags & TF_ACKNOW)
1434 else if (SEQ_GT(tp->snd_up, tp->snd_una))
1457 mac_mbuf_label_associate_inpcb(tp->t_inpcb, m);
1463 tcp_fillheaders(tp, ip6, th);
1464 if ((tp->ecn_flags & TE_SENDIPECT) != 0 && len &&
1465 !SEQ_LT(tp->snd_nxt, tp->snd_max) && !sack_rxmit) {
1476 tcp_fillheaders(tp, ip, th);
1477 if ((tp->ecn_flags & TE_SENDIPECT) != 0 && len &&
1478 !SEQ_LT(tp->snd_nxt, tp->snd_max) && !sack_rxmit) {
1488 if (flags & TH_FIN && (tp->t_flags & TF_SENTFIN) &&
1489 tp->snd_nxt == tp->snd_max)
1490 tp->snd_nxt--;
1505 if (len || (flags & (TH_SYN|TH_FIN)) || tp->t_timer[TCPT_PERSIST])
1506 th->th_seq = htonl(tp->snd_nxt);
1508 th->th_seq = htonl(tp->snd_max);
1512 tp->sackhint.sack_bytes_rexmit += len;
1514 th->th_ack = htonl(tp->rcv_nxt);
1515 tp->last_ack_sent = tp->rcv_nxt;
1526 if (recwin < (int32_t)(so->so_rcv.sb_hiwat / 4) && recwin < (int)tp->t_maxseg)
1528 if (recwin < (int32_t)(tp->rcv_adv - tp->rcv_nxt))
1529 recwin = (int32_t)(tp->rcv_adv - tp->rcv_nxt);
1530 if (tp->t_flags & TF_SLOWLINK && slowlink_wsize > 0) {
1537 if (tp->acc_iaj > tcp_acc_iaj_react_limit) {
1538 uint32_t min_iaj_win = tcp_min_iaj_win * tp->t_maxseg;
1539 if (tp->iaj_rwintop == 0 ||
1540 SEQ_LT(tp->iaj_rwintop, tp->rcv_adv))
1541 tp->iaj_rwintop = tp->rcv_adv;
1542 if (SEQ_LT(tp->iaj_rwintop, tp->rcv_nxt + min_iaj_win))
1543 tp->iaj_rwintop = tp->rcv_nxt + min_iaj_win;
1544 recwin = min(tp->iaj_rwintop - tp->rcv_nxt, recwin);
1549 if (recwin > (int32_t)(TCP_MAXWIN << tp->rcv_scale))
1550 recwin = (int32_t)(TCP_MAXWIN << tp->rcv_scale);
1551 th->th_win = htons((u_short) (recwin>>tp->rcv_scale));
1562 tp->t_flags |= TF_RXWIN0SENT;
1564 tp->t_flags &= ~TF_RXWIN0SENT;
1565 if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
1566 th->th_urp = htons((u_short)(tp->snd_up - tp->snd_nxt));
1575 tp->snd_up = tp->snd_una; /* drag it along */
1616 m->m_pkthdr.tso_segsz = tp->t_maxopd - optlen;
1625 if (tp->t_force == 0 || tp->t_timer[TCPT_PERSIST] == 0) {
1626 tcp_seq startseq = tp->snd_nxt;
1633 tp->snd_nxt++;
1635 tp->snd_nxt++;
1636 tp->t_flags |= TF_SENTFIN;
1641 tp->snd_nxt += len;
1642 if (SEQ_GT(tp->snd_nxt, tp->snd_max)) {
1643 tp->snd_max = tp->snd_nxt;
1648 if (tp->t_rtttime == 0) {
1649 tp->t_rtttime = tcp_now;
1650 tp->t_rtseq = startseq;
1664 if (tp->t_timer[TCPT_REXMT] == 0 &&
1665 ((sack_rxmit && tp->snd_nxt != tp->snd_max) ||
1666 tp->snd_nxt != tp->snd_una)) {
1667 if (tp->t_timer[TCPT_PERSIST]) {
1668 tp->t_timer[TCPT_PERSIST] = 0;
1669 tp->t_rxtshift = 0;
1670 tp->rxt_start = 0;
1671 tp->t_persist_stop = 0;
1673 tp->t_timer[TCPT_REXMT] = OFFSET_FROM_START(tp, tp->t_rxtcur);
1685 tp->t_flags |= TF_SENTFIN;
1687 if (SEQ_GT(tp->snd_nxt + xlen, tp->snd_max))
1688 tp->snd_max = tp->snd_nxt + len;
1696 tcp_trace(TA_OUTPUT, tp->t_state, tp, mtod(m, void *), th, 0);
1717 ip6->ip6_hlim = in6_selecthlim(tp->t_inpcb,
1718 tp->t_inpcb->in6p_route.ro_rt ?
1719 tp->t_inpcb->in6p_route.ro_rt->rt_ifp
1724 ((tp->t_inpcb->inp_fport << 16) | tp->t_inpcb->inp_lport),
1725 (((tp->t_inpcb->in6p_laddr.s6_addr16[0] & 0xffff) << 16) |
1726 (tp->t_inpcb->in6p_faddr.s6_addr16[0] & 0xffff)),
1732 ip->ip_ttl = tp->t_inpcb->inp_ip_ttl; /* XXX */
1733 ip->ip_tos |= (tp->t_inpcb->inp_ip_tos & ~IPTOS_ECN_MASK);/* XXX */
1735 ((tp->t_inpcb->inp_fport << 16) | tp->t_inpcb->inp_lport),
1736 (((tp->t_inpcb->inp_laddr.s_addr & 0xffff) << 16) |
1737 (tp->t_inpcb->inp_faddr.s_addr & 0xffff)),
1753 if (path_mtu_discovery && (tp->t_flags & TF_PMTUD))
1771 m->m_pkthdr.m_flowhash = tp->t_inpcb->inp_flowhash;
1777 if (tp->t_inpcb->inp_last_outifp != NULL &&
1778 tp->t_inpcb->inp_last_outifp != lo_ifp) {
1787 (tp->t_inpcb->inp_last_outifp->if_eflags &
1789 th->th_flags == TH_ACK && tp->snd_una == tp->snd_max &&
1790 tp->t_timer[TCPT_REXMT] == 0) {
1796 tp->t_pktlist_sentlen += len;
1797 tp->t_lastchain++;
1801 DTRACE_TCP5(send, struct mbuf *, m, struct inpcb *, tp->t_inpcb,
1802 struct ip6 *, ip6, struct tcpcb *, tp, struct tcphdr *,
1807 DTRACE_TCP5(send, struct mbuf *, m, struct inpcb *, tp->t_inpcb,
1808 struct ip *, ip, struct tcpcb *, tp, struct tcphdr *, th);
1811 if (tp->t_pktlist_head != NULL) {
1812 tp->t_pktlist_tail->m_nextpkt = m;
1813 tp->t_pktlist_tail = m;
1816 tp->t_pktlist_head = tp->t_pktlist_tail = m;
1819 if ((lro_ackmore) && (!sackoptlen) && (!tp->t_timer[TCPT_PERSIST]) &&
1821 (tp->t_state == TCPS_ESTABLISHED)) {
1823 mnext = tcp_send_lroacks(tp, m, th);
1825 tp->t_pktlist_tail->m_nextpkt = mnext;
1827 tp->t_pktlist_tail = mnext;
1828 tp->t_lastchain++;
1836 tp->t_lastchain++;
1838 tp->t_pktlist_tail = next;
1843 if (sendalot == 0 || (tp->t_state != TCPS_ESTABLISHED) ||
1844 (tp->snd_cwnd <= (tp->snd_wnd / 8)) ||
1845 (tp->t_flags & (TH_PUSH | TF_ACKNOW)) || tp->t_force != 0 ||
1846 tp->t_lastchain >= tcp_packet_chaining) {
1848 while (tp->t_inpcb->inp_sndinprog_cnt == 0 &&
1849 tp->t_pktlist_head != NULL) {
1850 packetlist = tp->t_pktlist_head;
1851 packchain_listadd = tp->t_lastchain;
1853 lost = tp->t_pktlist_sentlen;
1854 TCP_PKTLIST_CLEAR(tp);
1856 error = tcp_ip_output(so, tp, packetlist,
1873 lost += tp->t_pktlist_sentlen;
1880 if (tp->t_inpcb->inp_sndinprog_cnt == 0 &&
1881 (tp->t_flags & TF_CLOSING)) {
1882 tp->t_flags &= ~TF_CLOSING;
1883 (void) tcp_close(tp);
1901 if (tp->t_force == 0 || tp->t_timer[TCPT_PERSIST] == 0) {
1909 tp->sackhint.sack_bytes_rexmit -= lost;
1911 tp->snd_nxt -= lost;
1915 if (tp->t_pktlist_head != NULL)
1916 m_freem_list(tp->t_pktlist_head);
1917 TCP_PKTLIST_CLEAR(tp);
1920 if (!tp->t_timer[TCPT_REXMT] &&
1921 !tp->t_timer[TCPT_PERSIST])
1922 tp->t_timer[TCPT_REXMT] =
1923 OFFSET_FROM_START(tp, tp->t_rxtcur);
1925 tp->snd_cwnd = tp->t_maxseg;
1926 tp->t_bytes_acked = 0;
1928 tcp_check_timer_state(tp);
1931 DTRACE_TCP5(cc, void, NULL, struct inpcb *, tp->t_inpcb,
1932 struct tcpcb *, tp, struct tcphdr *, NULL,
1950 tp->t_flags &= ~TF_TSO;
1952 tcp_mtudisc(tp->t_inpcb, 0);
1953 tcp_check_timer_state(tp);
1959 && TCPS_HAVERCVDSYN(tp->t_state)) {
1960 tp->t_softerror = error;
1961 tcp_check_timer_state(tp);
1965 tcp_check_timer_state(tp);
1976 tcp_check_timer_state(tp);
1981 tcp_ip_output(struct socket *so, struct tcpcb *tp, struct mbuf *pkt,
1988 struct inpcb *inp = tp->t_inpcb;
2047 if (recwin > 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv))
2048 tp->rcv_adv = tp->rcv_nxt + recwin;
2049 tp->last_ack_sent = tp->rcv_nxt;
2050 tp->t_flags &= ~(TF_ACKNOW | TF_DELACK);
2051 tp->t_timer[TCPT_DELACK] = 0;
2052 tp->t_unacksegs = 0;
2067 (tp->t_state == TCPS_ESTABLISHED) && (sack_in_progress == 0) &&
2068 ((tp->t_flags & TF_FASTRECOVERY) == 0)) {
2142 if (((adv->code == FADV_FLOW_CONTROLLED && !IN_FASTRECOVERY(tp)) ||
2144 !(tp->t_flags & TF_CLOSING) &&
2145 tp->t_state == TCPS_ESTABLISHED) {
2151 struct tcpcb *, tp, struct tcphdr *, NULL,
2192 if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift == 0 &&
2193 tp->t_inpcb->inp_route.ro_rt != NULL) {
2197 tcp_getrt_rtt(tp, tp->t_inpcb->in6p_route.ro_rt);
2198 tp->t_timer[TCPT_REXMT] = OFFSET_FROM_START(tp, tp->t_rxtcur);
2204 tcp_setpersist(tp)
2205 register struct tcpcb *tp;
2207 int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
2215 if ((tp->t_persist_timeout != 0) &&
2216 (tp->t_timer[TCPT_PERSIST] == 0) &&
2217 (tp->t_persist_stop == 0)) {
2218 tp->t_persist_stop = tcp_now + tp->t_persist_timeout;
2224 TCPT_RANGESET(tp->t_timer[TCPT_PERSIST],
2225 t * tcp_backoff[tp->t_rxtshift],
2227 tp->t_timer[TCPT_PERSIST] = OFFSET_FROM_START(tp, tp->t_timer[TCPT_PERSIST]);
2229 if (tp->t_rxtshift < TCP_MAXRXTSHIFT)
2230 tp->t_rxtshift++;
2238 tcp_send_lroacks(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th)
2245 int ack_size = (tp->t_flags & TF_STRETCHACK) ?
2246 (maxseg_unacked * tp->t_maxseg) : (tp->t_maxseg << 1);
2247 int segs_acked = (tp->t_flags & TF_STRETCHACK) ? maxseg_unacked : 2;
2249 struct socket *so = tp->t_inpcb->inp_socket;
2251 count = tp->t_lropktlen/tp->t_maxseg;
2253 prev_ack = (org_ack - tp->t_lropktlen) + ack_size;
2268 tp->t_lropktlen = 0;
2296 __func__, tp->t_lropktlen, count,
2307 tp->t_lropktlen = 0;