Lines Matching defs:bbr
53 * https://groups.google.com/forum/#!forum/bbr-dev
89 struct bbr {
209 const struct bbr *bbr = inet_csk_ca(sk);
211 return bbr->full_bw_reached;
217 struct bbr *bbr = inet_csk_ca(sk);
219 return minmax_get(&bbr->bw);
225 struct bbr *bbr = inet_csk_ca(sk);
227 return bbr->lt_use_bw ? bbr->lt_bw : bbr_max_bw(sk);
235 struct bbr *bbr = inet_csk_ca(sk);
237 return max(bbr->extra_acked[0], bbr->extra_acked[1]);
269 struct bbr *bbr = inet_csk_ca(sk);
275 bbr->has_seen_rtt = 1;
288 struct bbr *bbr = inet_csk_ca(sk);
291 if (unlikely(!bbr->has_seen_rtt && tp->srtt_us))
323 struct bbr *bbr = inet_csk_ca(sk);
325 if (bbr->prev_ca_state < TCP_CA_Recovery && bbr->mode != BBR_PROBE_RTT)
326 bbr->prior_cwnd = tcp_snd_cwnd(tp); /* this cwnd is good enough */
328 bbr->prior_cwnd = max(bbr->prior_cwnd, tcp_snd_cwnd(tp));
334 struct bbr *bbr = inet_csk_ca(sk);
337 bbr->idle_restart = 1;
338 bbr->ack_epoch_mstamp = tp->tcp_mstamp;
339 bbr->ack_epoch_acked = 0;
343 if (bbr->mode == BBR_PROBE_BW)
345 else if (bbr->mode == BBR_PROBE_RTT)
361 struct bbr *bbr = inet_csk_ca(sk);
371 if (unlikely(bbr->min_rtt_us == ~0U)) /* no valid RTT samples yet? */
374 w = (u64)bw * bbr->min_rtt_us;
396 struct bbr *bbr = inet_csk_ca(sk);
405 if (bbr->mode == BBR_PROBE_BW && bbr->cycle_idx == 0)
439 struct bbr *bbr = inet_csk_ca(sk);
448 if (bbr->pacing_gain > BBR_UNIT) /* increasing inflight */
483 struct bbr *bbr = inet_csk_ca(sk);
484 u8 prev_state = bbr->prev_ca_state, state = inet_csk(sk)->icsk_ca_state;
496 bbr->packet_conservation = 1;
497 bbr->next_rtt_delivered = tp->delivered; /* start round now */
502 cwnd = max(cwnd, bbr->prior_cwnd);
503 bbr->packet_conservation = 0;
505 bbr->prev_ca_state = state;
507 if (bbr->packet_conservation) {
522 struct bbr *bbr = inet_csk_ca(sk);
548 if (bbr->mode == BBR_PROBE_RTT) /* drain queue, refresh min_rtt */
557 struct bbr *bbr = inet_csk_ca(sk);
559 tcp_stamp_us_delta(tp->delivered_mstamp, bbr->cycle_mstamp) >
560 bbr->min_rtt_us;
566 if (bbr->pacing_gain == BBR_UNIT)
577 if (bbr->pacing_gain > BBR_UNIT)
580 inflight >= bbr_inflight(sk, bw, bbr->pacing_gain));
593 struct bbr *bbr = inet_csk_ca(sk);
595 bbr->cycle_idx = (bbr->cycle_idx + 1) & (CYCLE_LEN - 1);
596 bbr->cycle_mstamp = tp->delivered_mstamp;
603 struct bbr *bbr = inet_csk_ca(sk);
605 if (bbr->mode == BBR_PROBE_BW && bbr_is_next_cycle_phase(sk, rs))
611 struct bbr *bbr = inet_csk_ca(sk);
613 bbr->mode = BBR_STARTUP;
618 struct bbr *bbr = inet_csk_ca(sk);
620 bbr->mode = BBR_PROBE_BW;
621 bbr->cycle_idx = CYCLE_LEN - 1 - get_random_u32_below(bbr_cycle_rand);
637 struct bbr *bbr = inet_csk_ca(sk);
639 bbr->lt_last_stamp = div_u64(tp->delivered_mstamp, USEC_PER_MSEC);
640 bbr->lt_last_delivered = tp->delivered;
641 bbr->lt_last_lost = tp->lost;
642 bbr->lt_rtt_cnt = 0;
648 struct bbr *bbr = inet_csk_ca(sk);
650 bbr->lt_bw = 0;
651 bbr->lt_use_bw = 0;
652 bbr->lt_is_sampling = false;
659 struct bbr *bbr = inet_csk_ca(sk);
662 if (bbr->lt_bw) { /* do we have bw from a previous interval? */
664 diff = abs(bw - bbr->lt_bw);
665 if ((diff * BBR_UNIT <= bbr_lt_bw_ratio * bbr->lt_bw) ||
669 bbr->lt_bw = (bw + bbr->lt_bw) >> 1; /* avg 2 intvls */
670 bbr->lt_use_bw = 1;
671 bbr->pacing_gain = BBR_UNIT; /* try to avoid drops */
672 bbr->lt_rtt_cnt = 0;
676 bbr->lt_bw = bw;
690 struct bbr *bbr = inet_csk_ca(sk);
695 if (bbr->lt_use_bw) { /* already using long-term rate, lt_bw? */
696 if (bbr->mode == BBR_PROBE_BW && bbr->round_start &&
697 ++bbr->lt_rtt_cnt >= bbr_lt_bw_max_rtts) {
708 if (!bbr->lt_is_sampling) {
712 bbr->lt_is_sampling = true;
721 if (bbr->round_start)
722 bbr->lt_rtt_cnt++; /* count round trips in this interval */
723 if (bbr->lt_rtt_cnt < bbr_lt_intvl_min_rtts)
725 if (bbr->lt_rtt_cnt > 4 * bbr_lt_intvl_min_rtts) {
738 lost = tp->lost - bbr->lt_last_lost;
739 delivered = tp->delivered - bbr->lt_last_delivered;
745 t = div_u64(tp->delivered_mstamp, USEC_PER_MSEC) - bbr->lt_last_stamp;
763 struct bbr *bbr = inet_csk_ca(sk);
766 bbr->round_start = 0;
771 if (!before(rs->prior_delivered, bbr->next_rtt_delivered)) {
772 bbr->next_rtt_delivered = tp->delivered;
773 bbr->rtt_cnt++;
774 bbr->round_start = 1;
775 bbr->packet_conservation = 0;
799 minmax_running_max(&bbr->bw, bbr_bw_rtts, bbr->rtt_cnt, bw);
820 struct bbr *bbr = inet_csk_ca(sk);
827 if (bbr->round_start) {
828 bbr->extra_acked_win_rtts = min(0x1F,
829 bbr->extra_acked_win_rtts + 1);
830 if (bbr->extra_acked_win_rtts >= bbr_extra_acked_win_rtts) {
831 bbr->extra_acked_win_rtts = 0;
832 bbr->extra_acked_win_idx = bbr->extra_acked_win_idx ?
834 bbr->extra_acked[bbr->extra_acked_win_idx] = 0;
840 bbr->ack_epoch_mstamp);
847 if (bbr->ack_epoch_acked <= expected_acked ||
848 (bbr->ack_epoch_acked + rs->acked_sacked >=
850 bbr->ack_epoch_acked = 0;
851 bbr->ack_epoch_mstamp = tp->delivered_mstamp;
856 bbr->ack_epoch_acked = min_t(u32, 0xFFFFF,
857 bbr->ack_epoch_acked + rs->acked_sacked);
858 extra_acked = bbr->ack_epoch_acked - expected_acked;
860 if (extra_acked > bbr->extra_acked[bbr->extra_acked_win_idx])
861 bbr->extra_acked[bbr->extra_acked_win_idx] = extra_acked;
875 struct bbr *bbr = inet_csk_ca(sk);
878 if (bbr_full_bw_reached(sk) || !bbr->round_start || rs->is_app_limited)
881 bw_thresh = (u64)bbr->full_bw * bbr_full_bw_thresh >> BBR_SCALE;
883 bbr->full_bw = bbr_max_bw(sk);
884 bbr->full_bw_cnt = 0;
887 ++bbr->full_bw_cnt;
888 bbr->full_bw_reached = bbr->full_bw_cnt >= bbr_full_bw_cnt;
894 struct bbr *bbr = inet_csk_ca(sk);
896 if (bbr->mode == BBR_STARTUP && bbr_full_bw_reached(sk)) {
897 bbr->mode = BBR_DRAIN; /* drain queue we created */
901 if (bbr->mode == BBR_DRAIN &&
910 struct bbr *bbr = inet_csk_ca(sk);
912 if (!(bbr->probe_rtt_done_stamp &&
913 after(tcp_jiffies32, bbr->probe_rtt_done_stamp)))
916 bbr->min_rtt_stamp = tcp_jiffies32; /* wait a while until PROBE_RTT */
917 tcp_snd_cwnd_set(tp, max(tcp_snd_cwnd(tp), bbr->prior_cwnd));
943 struct bbr *bbr = inet_csk_ca(sk);
948 bbr->min_rtt_stamp + bbr_min_rtt_win_sec * HZ);
950 (rs->rtt_us < bbr->min_rtt_us ||
952 bbr->min_rtt_us = rs->rtt_us;
953 bbr->min_rtt_stamp = tcp_jiffies32;
957 !bbr->idle_restart && bbr->mode != BBR_PROBE_RTT) {
958 bbr->mode = BBR_PROBE_RTT; /* dip, drain queue */
960 bbr->probe_rtt_done_stamp = 0;
963 if (bbr->mode == BBR_PROBE_RTT) {
968 if (!bbr->probe_rtt_done_stamp &&
970 bbr->probe_rtt_done_stamp = tcp_jiffies32 +
972 bbr->probe_rtt_round_done = 0;
973 bbr->next_rtt_delivered = tp->delivered;
974 } else if (bbr->probe_rtt_done_stamp) {
975 if (bbr->round_start)
976 bbr->probe_rtt_round_done = 1;
977 if (bbr->probe_rtt_round_done)
983 bbr->idle_restart = 0;
988 struct bbr *bbr = inet_csk_ca(sk);
990 switch (bbr->mode) {
992 bbr->pacing_gain = bbr_high_gain;
993 bbr->cwnd_gain = bbr_high_gain;
996 bbr->pacing_gain = bbr_drain_gain; /* slow, to drain */
997 bbr->cwnd_gain = bbr_high_gain; /* keep cwnd */
1000 bbr->pacing_gain = (bbr->lt_use_bw ?
1002 bbr_pacing_gain[bbr->cycle_idx]);
1003 bbr->cwnd_gain = bbr_cwnd_gain;
1006 bbr->pacing_gain = BBR_UNIT;
1007 bbr->cwnd_gain = BBR_UNIT;
1010 WARN_ONCE(1, "BBR bad mode: %u\n", bbr->mode);
1028 struct bbr *bbr = inet_csk_ca(sk);
1034 bbr_set_pacing_rate(sk, bw, bbr->pacing_gain);
1035 bbr_set_cwnd(sk, rs, rs->acked_sacked, bw, bbr->cwnd_gain);
1041 struct bbr *bbr = inet_csk_ca(sk);
1043 bbr->prior_cwnd = 0;
1045 bbr->rtt_cnt = 0;
1046 bbr->next_rtt_delivered = tp->delivered;
1047 bbr->prev_ca_state = TCP_CA_Open;
1048 bbr->packet_conservation = 0;
1050 bbr->probe_rtt_done_stamp = 0;
1051 bbr->probe_rtt_round_done = 0;
1052 bbr->min_rtt_us = tcp_min_rtt(tp);
1053 bbr->min_rtt_stamp = tcp_jiffies32;
1055 minmax_reset(&bbr->bw, bbr->rtt_cnt, 0); /* init max bw to 0 */
1057 bbr->has_seen_rtt = 0;
1060 bbr->round_start = 0;
1061 bbr->idle_restart = 0;
1062 bbr->full_bw_reached = 0;
1063 bbr->full_bw = 0;
1064 bbr->full_bw_cnt = 0;
1065 bbr->cycle_mstamp = 0;
1066 bbr->cycle_idx = 0;
1070 bbr->ack_epoch_mstamp = tp->tcp_mstamp;
1071 bbr->ack_epoch_acked = 0;
1072 bbr->extra_acked_win_rtts = 0;
1073 bbr->extra_acked_win_idx = 0;
1074 bbr->extra_acked[0] = 0;
1075 bbr->extra_acked[1] = 0;
1091 struct bbr *bbr = inet_csk_ca(sk);
1093 bbr->full_bw = 0; /* spurious slow-down; reset full pipe detection */
1094 bbr->full_bw_cnt = 0;
1112 struct bbr *bbr = inet_csk_ca(sk);
1116 memset(&info->bbr, 0, sizeof(info->bbr));
1117 info->bbr.bbr_bw_lo = (u32)bw;
1118 info->bbr.bbr_bw_hi = (u32)(bw >> 32);
1119 info->bbr.bbr_min_rtt = bbr->min_rtt_us;
1120 info->bbr.bbr_pacing_gain = bbr->pacing_gain;
1121 info->bbr.bbr_cwnd_gain = bbr->cwnd_gain;
1123 return sizeof(info->bbr);
1130 struct bbr *bbr = inet_csk_ca(sk);
1135 bbr->prev_ca_state = TCP_CA_Loss;
1136 bbr->full_bw = 0;
1137 bbr->round_start = 1; /* treat RTO like end of a round */
1144 .name = "bbr",
1181 BUILD_BUG_ON(sizeof(struct bbr) > ICSK_CA_PRIV_SIZE);