Skip to main content

PathModel

Struct PathModel 

Source
pub struct PathModel { /* private fields */ }
Expand description

Passive BBR path model. Holds the windowed BtlBw / RTprop estimates and exposes them plus the derived BDP. Sized in blocks of block_bytes so the sender can read the BDP directly as a flow-window target.

Implementations§

Source§

impl PathModel

Source

pub fn new(block_bytes: usize) -> Self

New model whose BDP is reported in blocks of block_bytes (the data payload per block: k * item_bytes, excluding parity and headers, so the estimate is goodput, not wire rate).

Source

pub fn on_ack( &mut self, delivered_blocks: u64, now_us: u64, rtt_us: u64, newest_send_us: u64, )

Fold in one ACK: delivered_blocks is the cumulative count the receiver has delivered, now_us the arrival time, rtt_us the round-trip time the just-delivered block measured (0 if none), and newest_send_us the send time of the newest block this ACK delivered.

A delivery-rate sample is emitted only once the window from the anchor spans at least one RTprop (floored at BW_SAMPLE_FLOOR_US); its rate is the delivered bytes over max(ack_window, send_span). Anchoring at the last emitted sample - not the previous ACK - averages a run of coalesced ACKs over the real interval they cover; dividing by the send-span (the spread of send times across the delivered blocks) caps an in-order frontier leap - a retransmit unblocking a buffered backlog - at the rate the blocks were actually sent. Neither can fabricate a peak for the max filter to latch onto. This is BBR’s max(ack_elapsed, send_elapsed) delivery-rate guard, per round trip, on an unpaced sender.

delivered_blocks must be non-decreasing and now_us monotonic.

Source

pub fn btlbw_bps(&self) -> u64

Bottleneck bandwidth estimate in bits per second.

Source

pub fn rtprop_us(&self) -> u64

Round-trip propagation delay estimate in microseconds (0 until the first RTT sample).

Source

pub fn rtt_now_us(&self) -> u64

Smoothed recent round-trip time in microseconds (SRTT, 0 until the first RTT sample) - the “RTT_now” of the standing-queue estimate.

Source

pub fn rtt_mean_us(&self) -> u64

Mean RTT in microseconds across all samples - the sustained latency under load. A bufferbloat pacer is judged by how far this sits below the un-paced mean (the min RTT alone only shows the best moment).

Source

pub fn queue_delay_us(&self) -> u64

Self-induced queue delay in microseconds: RTT_now - RTprop. A sustained value above ~25 ms during our own transfer is bufferbloat we are causing - the signal to pace down rather than blast. 0 before the first RTT sample, and clamped at 0 (the smoothed RTT can dip a hair below the windowed-min RTprop between samples).

Source

pub fn bdp_bytes(&self) -> u64

Bandwidth-delay product in bytes (BtlBw * RTprop).

Source

pub fn bdp_blocks(&self) -> u64

Bandwidth-delay product in blocks - the in-flight window that keeps the bottleneck busy with no standing queue.

Source

pub fn backhaul_hops( &self, nominal_bps: u64, mcs_norm: f32, congestion_fraction: f32, ) -> u8

Estimated number of Wi-Fi backhaul hops (0..=3) behind the first hop.

A single-radio repeater receives then retransmits on the SAME channel; carrier-sense self-interference roughly halves throughput per hop. So with nominal_bps the single-hop PHY rate (the first-hop MCS, item 5) and BtlBw the measured end-to-end bottleneck (item 6), round(log2(nominal / BtlBw)) is the backhaul-hop count - 2x for one hop, 4x for two, 8x for three.

Gated so real congestion does not read as a mesh hop: the first hop must be healthy (mcs_norm high - the local radio is fine, so the reduction is downstream) AND the loss must NOT be congestion-classed (congestion_fraction low). A single-radio repeater’s penalty is a structural bandwidth halving with no extra loss, whereas a congested shared link shows the rising-delay, congestion-classed loss the item-3 classifier flags - so the loss class, not an RTT-inflation proxy, is the discriminator (real repeaters add bandwidth penalty, not latency). This answers what TTL cannot - an L2-bridged repeater does not decrement the IP TTL, but its performance signature is unmistakable.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.