Home | History | Annotate | Download | only in slirp

Lines Matching refs:tp

67 tcp_output(struct tcpcb *tp)
69 register struct socket *so = tp->t_socket;
79 DEBUG_ARG("tp = %lx", (long )tp);
87 idle = (tp->snd_max == tp->snd_una);
88 if (idle && tp->t_idle >= tp->t_rxtcur)
94 tp->snd_cwnd = tp->t_maxseg;
97 off = tp->snd_nxt - tp->snd_una;
98 win = min(tp->snd_wnd, tp->snd_cwnd);
100 flags = tcp_outflags[tp->t_state];
110 if (tp->t_force) {
132 tp->t_timer[TCPT_PERSIST] = 0;
133 tp->t_rxtshift = 0;
152 tp->t_timer[TCPT_REXMT] = 0;
153 tp->snd_nxt = tp->snd_una;
157 if (len > tp->t_maxseg) {
158 len = tp->t_maxseg;
161 if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + so->so_snd.sb_cc))
177 if (len == tp->t_maxseg)
179 if ((1 || idle || tp->t_flags & TF_NODELAY) &&
182 if (tp->t_force)
184 if (len >= tp->max_sndwnd / 2 && tp->max_sndwnd > 0)
186 if (SEQ_LT(tp->snd_nxt, tp->snd_max))
201 * TCP_MAXWIN << tp->rcv_scale.
203 long adv = min(win, (long)TCP_MAXWIN << tp->rcv_scale) -
204 (tp->rcv_adv - tp->rcv_nxt);
206 if (adv >= (long) (2 * tp->t_maxseg))
215 if (tp->t_flags & TF_ACKNOW)
219 if (SEQ_GT(tp->snd_up, tp->snd_una))
227 ((tp->t_flags & TF_SENTFIN) == 0 || tp->snd_nxt == tp->snd_una))
238 * tp->t_timer[TCPT_PERSIST]
240 * tp->t_force
242 * tp->t_timer[TCPT_REXMT]
252 if (so->so_snd.sb_cc && tp->t_timer[TCPT_REXMT] == 0 &&
253 tp->t_timer[TCPT_PERSIST] == 0) {
254 tp->t_rxtshift = 0;
255 tcp_setpersist(tp);
277 tp->snd_nxt = tp->iss;
278 if ((tp->t_flags & TF_NOOPT) == 0) {
283 mss = htons((u_int16_t) tcp_mss(tp, 0));
287 /* if ((tp->t_flags & TF_REQ_SCALE) &&
289 * (tp->t_flags & TF_RCVD_SCALE))) {
294 * tp->request_r_scale);
306 /* if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
309 * (tp->t_flags & TF_RCVD_TSTMP))) {
315 * *lp = htonl(tp->ts_recent);
325 if (len > tp->t_maxseg - optlen) {
326 len = tp->t_maxseg - optlen;
336 if (tp->t_force && len == 1)
338 else if (SEQ_LT(tp->snd_nxt, tp->snd_max)) {
379 if (tp->t_flags & TF_ACKNOW)
383 else if (SEQ_GT(tp->snd_up, tp->snd_una))
400 memcpy((caddr_t)ti, &tp->t_template, sizeof (struct tcpiphdr));
407 if (flags & TH_FIN && tp->t_flags & TF_SENTFIN &&
408 tp->snd_nxt == tp->snd_max)
409 tp->snd_nxt--;
423 if (len || (flags & (TH_SYN|TH_FIN)) || tp->t_timer[TCPT_PERSIST])
424 ti->ti_seq = htonl(tp->snd_nxt);
426 ti->ti_seq = htonl(tp->snd_max);
427 ti->ti_ack = htonl(tp->rcv_nxt);
437 if (win < (long)(so->so_rcv.sb_datalen / 4) && win < (long)tp->t_maxseg)
439 if (win > (long)TCP_MAXWIN << tp->rcv_scale)
440 win = (long)TCP_MAXWIN << tp->rcv_scale;
441 if (win < (long)(tp->rcv_adv - tp->rcv_nxt))
442 win = (long)(tp->rcv_adv - tp->rcv_nxt);
443 ti->ti_win = htons((u_int16_t) (win>>tp->rcv_scale));
445 if (SEQ_GT(tp->snd_up, tp->snd_una)) {
446 ti->ti_urp = htons((u_int16_t)(tp->snd_up - ntohl(ti->ti_seq)));
448 if (SEQ_GT(tp->snd_up, tp->snd_nxt)) {
449 ti->ti_urp = htons((u_int16_t)(tp->snd_up - tp->snd_nxt));
459 tp->snd_up = tp->snd_una; /* drag it along */
474 if (tp->t_force == 0 || tp->t_timer[TCPT_PERSIST] == 0) {
475 tcp_seq startseq = tp->snd_nxt;
482 tp->snd_nxt++;
484 tp->snd_nxt++;
485 tp->t_flags |= TF_SENTFIN;
488 tp->snd_nxt += len;
489 if (SEQ_GT(tp->snd_nxt, tp->snd_max)) {
490 tp->snd_max = tp->snd_nxt;
495 if (tp->t_rtt == 0) {
496 tp->t_rtt = 1;
497 tp->t_rtseq = startseq;
510 if (tp->t_timer[TCPT_REXMT] == 0 &&
511 tp->snd_nxt != tp->snd_una) {
512 tp->t_timer[TCPT_REXMT] = tp->t_rxtcur;
513 if (tp->t_timer[TCPT_PERSIST]) {
514 tp->t_timer[TCPT_PERSIST] = 0;
515 tp->t_rxtshift = 0;
519 if (SEQ_GT(tp->snd_nxt + len, tp->snd_max))
520 tp->snd_max = tp->snd_nxt + len;
539 /* error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
545 * error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route,
553 tp->t_inpcb, 0);
558 * && TCPS_HAVERCVDSYN(tp->t_state)) {
559 * tp->t_softerror = error;
573 if (win > 0 && SEQ_GT(tp->rcv_nxt+win, tp->rcv_adv))
574 tp->rcv_adv = tp->rcv_nxt + win;
575 tp->last_ack_sent = tp->rcv_nxt;
576 tp->t_flags &= ~(TF_ACKNOW|TF_DELACK);
584 tcp_setpersist(struct tcpcb *tp)
586 int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1;
588 /* if (tp->t_timer[TCPT_REXMT])
594 TCPT_RANGESET(tp->t_timer[TCPT_PERSIST],
595 t * tcp_backoff[tp->t_rxtshift],
597 if (tp->t_rxtshift < TCP_MAXRXTSHIFT)
598 tp->t_rxtshift++;