| 5253 | } |
| 5254 | |
| 5255 | static void |
| 5256 | bbr_timer_cancel(struct tcp_bbr *bbr, int32_t line, uint32_t cts) |
| 5257 | { |
| 5258 | if (bbr->r_ctl.rc_hpts_flags & PACE_TMR_MASK) { |
| 5259 | uint8_t hpts_removed = 0; |
| 5260 | |
| 5261 | if (bbr->rc_inp->inp_in_hpts && |
| 5262 | (bbr->rc_timer_first == 1)) { |
| 5263 | /* |
| 5264 | * If we are canceling timer's when we have the |
| 5265 | * timer ahead of the output being paced. We also |
| 5266 | * must remove ourselves from the hpts. |
| 5267 | */ |
| 5268 | hpts_removed = 1; |
| 5269 | tcp_hpts_remove(bbr->rc_inp, HPTS_REMOVE_OUTPUT); |
| 5270 | if (bbr->r_ctl.rc_last_delay_val) { |
| 5271 | /* Update the last hptsi delay too */ |
| 5272 | uint32_t time_since_send; |
| 5273 | |
| 5274 | if (TSTMP_GT(cts, bbr->rc_pacer_started)) |
| 5275 | time_since_send = cts - bbr->rc_pacer_started; |
| 5276 | else |
| 5277 | time_since_send = 0; |
| 5278 | if (bbr->r_ctl.rc_last_delay_val > time_since_send) { |
| 5279 | /* Cut down our slot time */ |
| 5280 | bbr->r_ctl.rc_last_delay_val -= time_since_send; |
| 5281 | } else { |
| 5282 | bbr->r_ctl.rc_last_delay_val = 0; |
| 5283 | } |
| 5284 | bbr->rc_pacer_started = cts; |
| 5285 | } |
| 5286 | } |
| 5287 | bbr->rc_timer_first = 0; |
| 5288 | bbr_log_to_cancel(bbr, line, cts, hpts_removed); |
| 5289 | bbr->rc_tmr_stopped = bbr->r_ctl.rc_hpts_flags & PACE_TMR_MASK; |
| 5290 | bbr->r_ctl.rc_hpts_flags &= ~(PACE_TMR_MASK); |
| 5291 | } |
| 5292 | } |
| 5293 | |
| 5294 | static void |
| 5295 | bbr_timer_stop(struct tcpcb *tp, uint32_t timer_type) |
no test coverage detected