Lines Matching defs:bbr
53 * https://groups.google.com/forum/#!forum/bbr-dev
87 struct bbr {
207 const struct bbr *bbr = inet_csk_ca(sk);
209 return bbr->full_bw_reached;
215 struct bbr *bbr = inet_csk_ca(sk);
217 return minmax_get(&bbr->bw);
223 struct bbr *bbr = inet_csk_ca(sk);
225 return bbr->lt_use_bw ? bbr->lt_bw : bbr_max_bw(sk);
233 struct bbr *bbr = inet_csk_ca(sk);
235 return max(bbr->extra_acked[0], bbr->extra_acked[1]);
267 struct bbr *bbr = inet_csk_ca(sk);
273 bbr->has_seen_rtt = 1;
286 struct bbr *bbr = inet_csk_ca(sk);
289 if (unlikely(!bbr->has_seen_rtt && tp->srtt_us))
321 struct bbr *bbr = inet_csk_ca(sk);
323 if (bbr->prev_ca_state < TCP_CA_Recovery && bbr->mode != BBR_PROBE_RTT)
324 bbr->prior_cwnd = tp->snd_cwnd; /* this cwnd is good enough */
326 bbr->prior_cwnd = max(bbr->prior_cwnd, tp->snd_cwnd);
332 struct bbr *bbr = inet_csk_ca(sk);
335 bbr->idle_restart = 1;
336 bbr->ack_epoch_mstamp = tp->tcp_mstamp;
337 bbr->ack_epoch_acked = 0;
341 if (bbr->mode == BBR_PROBE_BW)
343 else if (bbr->mode == BBR_PROBE_RTT)
359 struct bbr *bbr = inet_csk_ca(sk);
369 if (unlikely(bbr->min_rtt_us == ~0U)) /* no valid RTT samples yet? */
372 w = (u64)bw * bbr->min_rtt_us;
394 struct bbr *bbr = inet_csk_ca(sk);
403 if (bbr->mode == BBR_PROBE_BW && bbr->cycle_idx == 0)
437 struct bbr *bbr = inet_csk_ca(sk);
446 if (bbr->pacing_gain > BBR_UNIT) /* increasing inflight */
481 struct bbr *bbr = inet_csk_ca(sk);
482 u8 prev_state = bbr->prev_ca_state, state = inet_csk(sk)->icsk_ca_state;
494 bbr->packet_conservation = 1;
495 bbr->next_rtt_delivered = tp->delivered; /* start round now */
500 cwnd = max(cwnd, bbr->prior_cwnd);
501 bbr->packet_conservation = 0;
503 bbr->prev_ca_state = state;
505 if (bbr->packet_conservation) {
520 struct bbr *bbr = inet_csk_ca(sk);
546 if (bbr->mode == BBR_PROBE_RTT) /* drain queue, refresh min_rtt */
555 struct bbr *bbr = inet_csk_ca(sk);
557 tcp_stamp_us_delta(tp->delivered_mstamp, bbr->cycle_mstamp) >
558 bbr->min_rtt_us;
564 if (bbr->pacing_gain == BBR_UNIT)
575 if (bbr->pacing_gain > BBR_UNIT)
578 inflight >= bbr_inflight(sk, bw, bbr->pacing_gain));
591 struct bbr *bbr = inet_csk_ca(sk);
593 bbr->cycle_idx = (bbr->cycle_idx + 1) & (CYCLE_LEN - 1);
594 bbr->cycle_mstamp = tp->delivered_mstamp;
601 struct bbr *bbr = inet_csk_ca(sk);
603 if (bbr->mode == BBR_PROBE_BW && bbr_is_next_cycle_phase(sk, rs))
609 struct bbr *bbr = inet_csk_ca(sk);
611 bbr->mode = BBR_STARTUP;
616 struct bbr *bbr = inet_csk_ca(sk);
618 bbr->mode = BBR_PROBE_BW;
619 bbr->cycle_idx = CYCLE_LEN - 1 - prandom_u32_max(bbr_cycle_rand);
635 struct bbr *bbr = inet_csk_ca(sk);
637 bbr->lt_last_stamp = div_u64(tp->delivered_mstamp, USEC_PER_MSEC);
638 bbr->lt_last_delivered = tp->delivered;
639 bbr->lt_last_lost = tp->lost;
640 bbr->lt_rtt_cnt = 0;
646 struct bbr *bbr = inet_csk_ca(sk);
648 bbr->lt_bw = 0;
649 bbr->lt_use_bw = 0;
650 bbr->lt_is_sampling = false;
657 struct bbr *bbr = inet_csk_ca(sk);
660 if (bbr->lt_bw) { /* do we have bw from a previous interval? */
662 diff = abs(bw - bbr->lt_bw);
663 if ((diff * BBR_UNIT <= bbr_lt_bw_ratio * bbr->lt_bw) ||
667 bbr->lt_bw = (bw + bbr->lt_bw) >> 1; /* avg 2 intvls */
668 bbr->lt_use_bw = 1;
669 bbr->pacing_gain = BBR_UNIT; /* try to avoid drops */
670 bbr->lt_rtt_cnt = 0;
674 bbr->lt_bw = bw;
688 struct bbr *bbr = inet_csk_ca(sk);
693 if (bbr->lt_use_bw) { /* already using long-term rate, lt_bw? */
694 if (bbr->mode == BBR_PROBE_BW && bbr->round_start &&
695 ++bbr->lt_rtt_cnt >= bbr_lt_bw_max_rtts) {
706 if (!bbr->lt_is_sampling) {
710 bbr->lt_is_sampling = true;
719 if (bbr->round_start)
720 bbr->lt_rtt_cnt++; /* count round trips in this interval */
721 if (bbr->lt_rtt_cnt < bbr_lt_intvl_min_rtts)
723 if (bbr->lt_rtt_cnt > 4 * bbr_lt_intvl_min_rtts) {
736 lost = tp->lost - bbr->lt_last_lost;
737 delivered = tp->delivered - bbr->lt_last_delivered;
743 t = div_u64(tp->delivered_mstamp, USEC_PER_MSEC) - bbr->lt_last_stamp;
761 struct bbr *bbr = inet_csk_ca(sk);
764 bbr->round_start = 0;
769 if (!before(rs->prior_delivered, bbr->next_rtt_delivered)) {
770 bbr->next_rtt_delivered = tp->delivered;
771 bbr->rtt_cnt++;
772 bbr->round_start = 1;
773 bbr->packet_conservation = 0;
797 minmax_running_max(&bbr->bw, bbr_bw_rtts, bbr->rtt_cnt, bw);
818 struct bbr *bbr = inet_csk_ca(sk);
825 if (bbr->round_start) {
826 bbr->extra_acked_win_rtts = min(0x1F,
827 bbr->extra_acked_win_rtts + 1);
828 if (bbr->extra_acked_win_rtts >= bbr_extra_acked_win_rtts) {
829 bbr->extra_acked_win_rtts = 0;
830 bbr->extra_acked_win_idx = bbr->extra_acked_win_idx ?
832 bbr->extra_acked[bbr->extra_acked_win_idx] = 0;
838 bbr->ack_epoch_mstamp);
845 if (bbr->ack_epoch_acked <= expected_acked ||
846 (bbr->ack_epoch_acked + rs->acked_sacked >=
848 bbr->ack_epoch_acked = 0;
849 bbr->ack_epoch_mstamp = tp->delivered_mstamp;
854 bbr->ack_epoch_acked = min_t(u32, 0xFFFFF,
855 bbr->ack_epoch_acked + rs->acked_sacked);
856 extra_acked = bbr->ack_epoch_acked - expected_acked;
858 if (extra_acked > bbr->extra_acked[bbr->extra_acked_win_idx])
859 bbr->extra_acked[bbr->extra_acked_win_idx] = extra_acked;
873 struct bbr *bbr = inet_csk_ca(sk);
876 if (bbr_full_bw_reached(sk) || !bbr->round_start || rs->is_app_limited)
879 bw_thresh = (u64)bbr->full_bw * bbr_full_bw_thresh >> BBR_SCALE;
881 bbr->full_bw = bbr_max_bw(sk);
882 bbr->full_bw_cnt = 0;
885 ++bbr->full_bw_cnt;
886 bbr->full_bw_reached = bbr->full_bw_cnt >= bbr_full_bw_cnt;
892 struct bbr *bbr = inet_csk_ca(sk);
894 if (bbr->mode == BBR_STARTUP && bbr_full_bw_reached(sk)) {
895 bbr->mode = BBR_DRAIN; /* drain queue we created */
899 if (bbr->mode == BBR_DRAIN &&
908 struct bbr *bbr = inet_csk_ca(sk);
910 if (!(bbr->probe_rtt_done_stamp &&
911 after(tcp_jiffies32, bbr->probe_rtt_done_stamp)))
914 bbr->min_rtt_stamp = tcp_jiffies32; /* wait a while until PROBE_RTT */
915 tp->snd_cwnd = max(tp->snd_cwnd, bbr->prior_cwnd);
941 struct bbr *bbr = inet_csk_ca(sk);
946 bbr->min_rtt_stamp + bbr_min_rtt_win_sec * HZ);
948 (rs->rtt_us < bbr->min_rtt_us ||
950 bbr->min_rtt_us = rs->rtt_us;
951 bbr->min_rtt_stamp = tcp_jiffies32;
955 !bbr->idle_restart && bbr->mode != BBR_PROBE_RTT) {
956 bbr->mode = BBR_PROBE_RTT; /* dip, drain queue */
958 bbr->probe_rtt_done_stamp = 0;
961 if (bbr->mode == BBR_PROBE_RTT) {
966 if (!bbr->probe_rtt_done_stamp &&
968 bbr->probe_rtt_done_stamp = tcp_jiffies32 +
970 bbr->probe_rtt_round_done = 0;
971 bbr->next_rtt_delivered = tp->delivered;
972 } else if (bbr->probe_rtt_done_stamp) {
973 if (bbr->round_start)
974 bbr->probe_rtt_round_done = 1;
975 if (bbr->probe_rtt_round_done)
981 bbr->idle_restart = 0;
986 struct bbr *bbr = inet_csk_ca(sk);
988 switch (bbr->mode) {
990 bbr->pacing_gain = bbr_high_gain;
991 bbr->cwnd_gain = bbr_high_gain;
994 bbr->pacing_gain = bbr_drain_gain; /* slow, to drain */
995 bbr->cwnd_gain = bbr_high_gain; /* keep cwnd */
998 bbr->pacing_gain = (bbr->lt_use_bw ?
1000 bbr_pacing_gain[bbr->cycle_idx]);
1001 bbr->cwnd_gain = bbr_cwnd_gain;
1004 bbr->pacing_gain = BBR_UNIT;
1005 bbr->cwnd_gain = BBR_UNIT;
1008 WARN_ONCE(1, "BBR bad mode: %u\n", bbr->mode);
1026 struct bbr *bbr = inet_csk_ca(sk);
1032 bbr_set_pacing_rate(sk, bw, bbr->pacing_gain);
1033 bbr_set_cwnd(sk, rs, rs->acked_sacked, bw, bbr->cwnd_gain);
1039 struct bbr *bbr = inet_csk_ca(sk);
1041 bbr->prior_cwnd = 0;
1043 bbr->rtt_cnt = 0;
1044 bbr->next_rtt_delivered = tp->delivered;
1045 bbr->prev_ca_state = TCP_CA_Open;
1046 bbr->packet_conservation = 0;
1048 bbr->probe_rtt_done_stamp = 0;
1049 bbr->probe_rtt_round_done = 0;
1050 bbr->min_rtt_us = tcp_min_rtt(tp);
1051 bbr->min_rtt_stamp = tcp_jiffies32;
1053 minmax_reset(&bbr->bw, bbr->rtt_cnt, 0); /* init max bw to 0 */
1055 bbr->has_seen_rtt = 0;
1058 bbr->round_start = 0;
1059 bbr->idle_restart = 0;
1060 bbr->full_bw_reached = 0;
1061 bbr->full_bw = 0;
1062 bbr->full_bw_cnt = 0;
1063 bbr->cycle_mstamp = 0;
1064 bbr->cycle_idx = 0;
1068 bbr->ack_epoch_mstamp = tp->tcp_mstamp;
1069 bbr->ack_epoch_acked = 0;
1070 bbr->extra_acked_win_rtts = 0;
1071 bbr->extra_acked_win_idx = 0;
1072 bbr->extra_acked[0] = 0;
1073 bbr->extra_acked[1] = 0;
1089 struct bbr *bbr = inet_csk_ca(sk);
1091 bbr->full_bw = 0; /* spurious slow-down; reset full pipe detection */
1092 bbr->full_bw_cnt = 0;
1110 struct bbr *bbr = inet_csk_ca(sk);
1114 memset(&info->bbr, 0, sizeof(info->bbr));
1115 info->bbr.bbr_bw_lo = (u32)bw;
1116 info->bbr.bbr_bw_hi = (u32)(bw >> 32);
1117 info->bbr.bbr_min_rtt = bbr->min_rtt_us;
1118 info->bbr.bbr_pacing_gain = bbr->pacing_gain;
1119 info->bbr.bbr_cwnd_gain = bbr->cwnd_gain;
1121 return sizeof(info->bbr);
1128 struct bbr *bbr = inet_csk_ca(sk);
1133 bbr->prev_ca_state = TCP_CA_Loss;
1134 bbr->full_bw = 0;
1135 bbr->round_start = 1; /* treat RTO like end of a round */
1142 .name = "bbr",
1157 BUILD_BUG_ON(sizeof(struct bbr) > ICSK_CA_PRIV_SIZE);