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

Function bbr_google_measurement

freebsd/netinet/tcp_stacks/bbr.c:6665–6748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6663}
6664
6665static void
6666bbr_google_measurement(struct tcp_bbr *bbr, struct bbr_sendmap *rsm, uint32_t rtt, uint32_t cts)
6667{
6668 if (bbr->rc_in_persist == 0) {
6669 /* We log only when not in persist */
6670 /* Translate to a Bytes Per Second */
6671 uint64_t tim, bw;
6672 uint32_t upper, lower, delivered;
6673 int no_apply = 0;
6674
6675 if (TSTMP_GT(bbr->r_ctl.rc_del_time, rsm->r_del_time))
6676 tim = (uint64_t)(bbr->r_ctl.rc_del_time - rsm->r_del_time);
6677 else
6678 tim = 1;
6679 /*
6680 * Now that we have processed the tim (skipping the sample
6681 * or possibly updating the time, go ahead and
6682 * calculate the cdr.
6683 */
6684 delivered = (bbr->r_ctl.rc_delivered - rsm->r_delivered);
6685 bw = (uint64_t)delivered;
6686 bw *= (uint64_t)USECS_IN_SECOND;
6687 bw /= tim;
6688 if (tim < bbr->r_ctl.rc_lowest_rtt) {
6689 bbr_log_type_bbrupd(bbr, 99, cts, (uint32_t)tim, delivered,
6690 tim, bbr->r_ctl.rc_lowest_rtt, 0, 0, 0, 0);
6691
6692 no_apply = 1;
6693 }
6694 upper = (bw >> 32) & 0x00000000ffffffff;
6695 lower = bw & 0x00000000ffffffff;
6696 /*
6697 * If we are using this b/w shove it in now so we
6698 * can see in the trace viewer if it gets over-ridden.
6699 */
6700 bbr->r_ctl.rc_bbr_cur_del_rate = bw;
6701 /* Gate by the sending rate */
6702 if (rsm->r_first_sent_time &&
6703 TSTMP_GT(rsm->r_tim_lastsent[(rsm->r_rtr_cnt -1)],rsm->r_first_sent_time)) {
6704 uint64_t sbw, sti;
6705 /*
6706 * We use what was in flight at the time of our
6707 * send and the size of this send to figure
6708 * out what we have been sending at (amount).
6709 * For the time we take from the time of
6710 * the send of the first send outstanding
6711 * until this send plus this sends pacing
6712 * time. This gives us a good calculation
6713 * as to the rate we have been sending at.
6714 */
6715
6716 sbw = (uint64_t)(rsm->r_flight_at_send);
6717 sbw *= (uint64_t)USECS_IN_SECOND;
6718 sti = rsm->r_tim_lastsent[(rsm->r_rtr_cnt -1)] - rsm->r_first_sent_time;
6719 sti += rsm->r_pacing_delay;
6720 sbw /= sti;
6721 if (sbw < bw) {
6722 bbr_log_type_bbrupd(bbr, 6, cts,

Callers 1

bbr_update_bbr_infoFunction · 0.85

Calls 3

bbr_log_type_bbrupdFunction · 0.85
get_filter_valueFunction · 0.85
tcp_bbr_commit_bwFunction · 0.85

Tested by

no test coverage detected