Lines Matching refs:tp

92 tcp_output(PNATState pData, register struct tcpcb *tp)
94 register struct socket *so = tp->t_socket;
104 LogFlowFunc(("ENTER: tcp_output: tp = %R[tcpcb793]\n", tp));
112 idle = (tp->snd_max == tp->snd_una);
113 if (idle && tp->t_idle >= tp->t_rxtcur)
119 tp->snd_cwnd = tp->t_maxseg;
123 off = tp->snd_nxt - tp->snd_una;
124 win = min(tp->snd_wnd, tp->snd_cwnd);
126 flags = tcp_outflags[tp->t_state];
136 if (tp->t_force)
162 tp->t_timer[TCPT_PERSIST] = 0;
163 tp->t_rxtshift = 0;
183 tp->t_timer[TCPT_REXMT] = 0;
184 tp->snd_nxt = tp->snd_una;
187 if (len > tp->t_maxseg)
189 len = tp->t_maxseg;
192 if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + SBUF_LEN(&so->so_snd)))
209 if (len == tp->t_maxseg)
211 if ((1 || idle || tp->t_flags & TF_NODELAY) &&
214 if (tp->t_force)
216 if (len >= tp->max_sndwnd / 2 && tp->max_sndwnd > 0)
218 if (SEQ_LT(tp->snd_nxt, tp->snd_max))
234 * TCP_MAXWIN << tp->rcv_scale.
236 long adv = min(win, (long)TCP_MAXWIN << tp->rcv_scale);
237 if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt))
238 adv -= tp->rcv_adv - tp->rcv_nxt;
240 if (adv >= (long) (2 * tp->t_maxseg))
249 if (tp->t_flags & TF_ACKNOW)
253 if (SEQ_GT(tp->snd_up, tp->snd_una))
261 && ((tp->t_flags & TF_SENTFIN) == 0 || tp->snd_nxt == tp->snd_una))
272 * tp->t_timer[TCPT_PERSIST]
274 * tp->t_force
276 * tp->t_timer[TCPT_REXMT]
287 && tp->t_timer[TCPT_REXMT] == 0
288 && tp->t_timer[TCPT_PERSIST] == 0)
290 tp->t_rxtshift = 0;
291 tcp_setpersist(tp);
316 tp->snd_nxt = tp->iss;
317 if ((tp->t_flags & TF_NOOPT) == 0)
323 mss = RT_H2N_U16((u_int16_t) tcp_mss(pData, tp, 0));
328 if ( (tp->t_flags & TF_REQ_SCALE)
330 || (tp->t_flags & TF_RCVD_SCALE)))
335 | tp->request_r_scale);
348 if ( (tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP
351 || (tp->t_flags & TF_RCVD_TSTMP)))
358 *lp = RT_H2N_U32(tp->ts_recent);
368 if (len > tp->t_maxseg - optlen)
370 len = tp->t_maxseg - optlen;
381 if (tp->t_force && len == 1)
383 else if (SEQ_LT(tp->snd_nxt, tp->snd_max))
447 if (tp->t_flags & TF_ACKNOW)
451 else if (SEQ_GT(tp->snd_up, tp->snd_una))
490 fUninitiolizedTemplate = RT_BOOL(( tp->t_template.ti_src.s_addr == INADDR_ANY
491 || tp->t_template.ti_dst.s_addr == INADDR_ANY));
496 tcp_template(tp);
510 memcpy((caddr_t)ti, &tp->t_template, sizeof (struct tcpiphdr));
518 && tp->t_flags & TF_SENTFIN
519 && tp->snd_nxt == tp->snd_max)
520 tp->snd_nxt--;
534 if (len || (flags & (TH_SYN|TH_FIN)) || tp->t_timer[TCPT_PERSIST])
535 ti->ti_seq = RT_H2N_U32(tp->snd_nxt);
537 ti->ti_seq = RT_H2N_U32(tp->snd_max);
538 ti->ti_ack = RT_H2N_U32(tp->rcv_nxt);
549 if (win < (long)(SBUF_SIZE(&so->so_rcv) / 4) && win < (long)tp->t_maxseg)
551 if (win > (long)TCP_MAXWIN << tp->rcv_scale)
552 win = (long)TCP_MAXWIN << tp->rcv_scale;
553 if (win < (long)(int32_t)(tp->rcv_adv - tp->rcv_nxt))
554 win = (long)(int32_t)(tp->rcv_adv - tp->rcv_nxt);
555 ti->ti_win = RT_H2N_U16((u_int16_t) (win>>tp->rcv_scale));
558 if (SEQ_GT(tp->snd_up, tp->snd_nxt))
560 ti->ti_urp = RT_H2N_U16((u_int16_t)(tp->snd_up - tp->snd_nxt));
562 if (SEQ_GT(tp->snd_up, tp->snd_una))
564 ti->ti_urp = RT_H2N_U16((u_int16_t)(tp->snd_up - RT_N2H_U32(ti->ti_seq)));
575 tp->snd_up = tp->snd_una; /* drag it along */
590 if (tp->t_force == 0 || tp->t_timer[TCPT_PERSIST] == 0)
592 tcp_seq startseq = tp->snd_nxt;
600 tp->snd_nxt++;
603 tp->snd_nxt++;
604 tp->t_flags |= TF_SENTFIN;
607 tp->snd_nxt += len;
608 if (SEQ_GT(tp->snd_nxt, tp->snd_max))
610 tp->snd_max = tp->snd_nxt;
615 if (tp->t_rtt == 0)
617 tp->t_rtt = 1;
618 tp->t_rtseq = startseq;
631 if ( tp->t_timer[TCPT_REXMT] == 0
632 && tp->snd_nxt != tp->snd_una)
634 tp->t_timer[TCPT_REXMT] = tp->t_rxtcur;
635 if (tp->t_timer[TCPT_PERSIST])
637 tp->t_timer[TCPT_PERSIST] = 0;
638 tp->t_rxtshift = 0;
643 if (SEQ_GT(tp->snd_nxt + len, tp->snd_max))
644 tp->snd_max = tp->snd_nxt + len;
664 error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
671 error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route,
682 tcp_quench(tp->t_inpcb, 0);
688 && TCPS_HAVERCVDSYN(tp->t_state))
690 tp->t_softerror = error;
706 if (win > 0 && SEQ_GT(tp->rcv_nxt+win, tp->rcv_adv))
707 tp->rcv_adv = tp->rcv_nxt + win;
708 tp->last_ack_sent = tp->rcv_nxt;
709 tp->t_flags &= ~(TF_ACKNOW|TF_DELACK);
717 tcp_setpersist(struct tcpcb *tp)
719 int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
722 if (tp->t_timer[TCPT_REXMT])
728 TCPT_RANGESET(tp->t_timer[TCPT_PERSIST],
729 t * tcp_backoff[tp->t_rxtshift],
731 if (tp->t_rxtshift < TCP_MAXRXTSHIFT)
732 tp->t_rxtshift++;