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

Function rack_timer_start

freebsd/netinet/tcp_stacks/rack.c:4429–4614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4427}
4428
4429static uint32_t
4430rack_timer_start(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, int sup_rack)
4431{
4432 /*
4433 * Start the FR timer, we do this based on getting the first one in
4434 * the rc_tmap. Note that if its NULL we must stop the timer. in all
4435 * events we need to stop the running timer (if its running) before
4436 * starting the new one.
4437 */
4438 uint32_t thresh, exp, to, srtt, time_since_sent, tstmp_touse;
4439 uint32_t srtt_cur;
4440 int32_t idx;
4441 int32_t is_tlp_timer = 0;
4442 struct rack_sendmap *rsm;
4443
4444 if (rack->t_timers_stopped) {
4445 /* All timers have been stopped none are to run */
4446 return (0);
4447 }
4448 if (rack->rc_in_persist) {
4449 /* We can't start any timer in persists */
4450 return (rack_get_persists_timer_val(tp, rack));
4451 }
4452 rack->rc_on_min_to = 0;
4453 if ((tp->t_state < TCPS_ESTABLISHED) ||
4454 ((tp->t_flags & TF_SACK_PERMIT) == 0))
4455 goto activate_rxt;
4456 rsm = TAILQ_FIRST(&rack->r_ctl.rc_tmap);
4457 if ((rsm == NULL) || sup_rack) {
4458 /* Nothing on the send map */
4459activate_rxt:
4460 time_since_sent = 0;
4461 rsm = TAILQ_FIRST(&rack->r_ctl.rc_tmap);
4462 if (rsm) {
4463 idx = rsm->r_rtr_cnt - 1;
4464 if (TSTMP_GEQ(rsm->r_tim_lastsent[idx], rack->r_ctl.rc_tlp_rxt_last_time))
4465 tstmp_touse = rsm->r_tim_lastsent[idx];
4466 else
4467 tstmp_touse = rack->r_ctl.rc_tlp_rxt_last_time;
4468 if (TSTMP_GT(cts, tstmp_touse))
4469 time_since_sent = cts - tstmp_touse;
4470 }
4471 if (SEQ_LT(tp->snd_una, tp->snd_max) || sbavail(&(tp->t_inpcb->inp_socket->so_snd))) {
4472 rack->r_ctl.rc_hpts_flags |= PACE_TMR_RXT;
4473 to = TICKS_2_MSEC(tp->t_rxtcur);
4474 if (to > time_since_sent)
4475 to -= time_since_sent;
4476 else
4477 to = rack->r_ctl.rc_min_to;
4478 if (to == 0)
4479 to = 1;
4480 return (to);
4481 }
4482 return (0);
4483 }
4484 if (rsm->r_flags & RACK_ACKED) {
4485 rsm = rack_find_lowest_rsm(rack);
4486 if (rsm == NULL) {

Callers 1

rack_start_hpts_timerFunction · 0.85

Calls 8

rack_find_lowest_rsmFunction · 0.85
ctf_fixed_maxsegFunction · 0.85
rack_grab_rttFunction · 0.85
rack_calc_thresh_rackFunction · 0.85
rack_calc_thresh_tlpFunction · 0.85
sbavailFunction · 0.50

Tested by

no test coverage detected