Skip to content

Commit 1be82e6

Browse files
committed
ieee80211: seed the rate control interval timer when a station is first seen
~AarfRateControl and ~OnoeRateControl create the per-receiver State lazily, on the first frame to that peer, but left State::timer at zero. The periodic rate increase tests simTime() - timer >= interval, so for a station first used after one interval had elapsed (50ms by default) the deadline was already in the past when its state was created. The effect in ~AarfRateControl is that the station is bumped a step above initialRate before its first frame goes out, and two datarateChanged values are recorded for it at the same instant -- so the configured starting rate is effectively ignored for every peer. ~OnoeRateControl is milder: computeMode() returns early while the station has no successful transmission yet, but it still divides by zero on the way, leaving avgRetriesPerFrame at NaN. Seeding the timer with the current time at creation makes the interval measure from when the station was first seen, which is what the periodic increase is meant to do. Verified in examples/wireless/hiddennode with ~AarfRateControl, initialRate=2Mbps and traffic starting at t=1s: the per-station vector opened with 2Mbps immediately followed by 5.5Mbps at t=1, and now opens with a single 2Mbps value. Reported by Devin Review.
1 parent 9c5c4d2 commit 1be82e6

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/inet/linklayer/ieee80211/mac/ratecontrol/AarfRateControl.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ AarfRateControl::State& AarfRateControl::stateFor(const MacAddress& receiverAddr
4646
state.address = receiverAddress;
4747
state.mode = getInitialMode();
4848
state.increaseThreshold = par("increaseThreshold");
49+
state.timer = simTime(); // the interval starts when the station is first seen, not at t=0
4950
it = stations.insert({receiverAddress, state}).first;
5051
emitDatarateChangedSignal(state.address, state.mode);
5152
}

src/inet/linklayer/ieee80211/mac/ratecontrol/OnoeRateControl.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ OnoeRateControl::State& OnoeRateControl::stateFor(const MacAddress& receiverAddr
3131
State state;
3232
state.address = receiverAddress;
3333
state.mode = getInitialMode();
34+
state.timer = simTime(); // the interval starts when the station is first seen, not at t=0
3435
it = stations.insert({receiverAddress, state}).first;
3536
emitDatarateChangedSignal(state.address, state.mode);
3637
}

0 commit comments

Comments
 (0)