| 2860 | } |
| 2861 | |
| 2862 | static inline void |
| 2863 | bbr_set_pktepoch(struct tcp_bbr *bbr, uint32_t cts, int32_t line) |
| 2864 | { |
| 2865 | uint64_t calclr; |
| 2866 | uint32_t lost, del; |
| 2867 | |
| 2868 | if (bbr->r_ctl.rc_lost > bbr->r_ctl.rc_lost_at_pktepoch) |
| 2869 | lost = bbr->r_ctl.rc_lost - bbr->r_ctl.rc_lost_at_pktepoch; |
| 2870 | else |
| 2871 | lost = 0; |
| 2872 | del = bbr->r_ctl.rc_delivered - bbr->r_ctl.rc_pkt_epoch_del; |
| 2873 | if (lost == 0) { |
| 2874 | calclr = 0; |
| 2875 | } else if (del) { |
| 2876 | calclr = lost; |
| 2877 | calclr *= (uint64_t)1000; |
| 2878 | calclr /= (uint64_t)del; |
| 2879 | } else { |
| 2880 | /* Nothing delivered? 100.0% loss */ |
| 2881 | calclr = 1000; |
| 2882 | } |
| 2883 | bbr->r_ctl.rc_pkt_epoch_loss_rate = (uint32_t)calclr; |
| 2884 | if (IN_RECOVERY(bbr->rc_tp->t_flags)) |
| 2885 | bbr->r_ctl.recovery_lr += (uint32_t)calclr; |
| 2886 | bbr->r_ctl.rc_pkt_epoch++; |
| 2887 | if (bbr->rc_no_pacing && |
| 2888 | (bbr->r_ctl.rc_pkt_epoch >= bbr->no_pacing_until)) { |
| 2889 | bbr->rc_no_pacing = 0; |
| 2890 | tcp_bbr_tso_size_check(bbr, cts); |
| 2891 | } |
| 2892 | bbr->r_ctl.rc_pkt_epoch_rtt = bbr_calc_time(cts, bbr->r_ctl.rc_pkt_epoch_time); |
| 2893 | bbr->r_ctl.rc_pkt_epoch_time = cts; |
| 2894 | /* What was our loss rate */ |
| 2895 | bbr_log_pkt_epoch(bbr, cts, line, lost, del); |
| 2896 | bbr->r_ctl.rc_pkt_epoch_del = bbr->r_ctl.rc_delivered; |
| 2897 | bbr->r_ctl.rc_lost_at_pktepoch = bbr->r_ctl.rc_lost; |
| 2898 | } |
| 2899 | |
| 2900 | static inline void |
| 2901 | bbr_set_epoch(struct tcp_bbr *bbr, uint32_t cts, int32_t line) |
no test coverage detected