From 257fd2079e48ad7f0e9af1704fbbf1973e0914b8 Mon Sep 17 00:00:00 2001 From: Timo Bingmann Date: Tue, 24 Feb 2009 14:33:17 +0100 Subject: [PATCH] bug 509: backoff CW growth is invalid --- src/devices/wifi/dcf-manager.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/devices/wifi/dcf-manager.cc b/src/devices/wifi/dcf-manager.cc index f9179290d..c2dbc9e63 100644 --- a/src/devices/wifi/dcf-manager.cc +++ b/src/devices/wifi/dcf-manager.cc @@ -74,10 +74,8 @@ DcfState::ResetCw (void) void DcfState::UpdateFailedCw (void) { - uint32_t cw = m_cw; - cw *= 2; - cw = std::min (m_cwMax, cw); - m_cw = cw; + // see 802.11-2007, section 9.9.1.5 + m_cw = std::min ( 2 * (m_cw + 1) - 1, m_cwMax); } void DcfState::UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound)