Changeset 4098

Show
Ignore:
Timestamp:
09/19/09 06:09:09 (2 years ago)
Author:
proski
Message:

Fix contention window calculation in sample and minstrel code

The contention window is supposed to be a power of two minus one, i.e.
15, 31, 63, 127... Due to a wrong formula, the actual sequence was 15,
32, 66, 134...

Bug reported by Dan Halperin <dhalperi@cs.washington.edu>

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/branches/madwifi-0.9.4/ath_rate/minstrel/minstrel.c

    r4096 r4098  
    280280                                                rix, AH_TRUE); 
    281281        for (x = 0; x <= short_retries + long_retries; x++) { 
    282                 cw = MIN(WIFI_CW_MAX, (cw + 1) * 2); 
     282                cw = MIN(WIFI_CW_MAX, (cw << 1) | 1); 
    283283                tt += (t_slot * cw / 2); 
    284284        } 
  • madwifi/branches/madwifi-0.9.4/ath_rate/sample/sample.c

    r4096 r4098  
    247247                                                rix, AH_TRUE); 
    248248        for (x = 0; x <= short_retries + long_retries; x++) { 
    249                 cw = MIN(WIFI_CW_MAX, (cw + 1) * 2); 
     249                cw = MIN(WIFI_CW_MAX, (cw << 1) | 1); 
    250250                tt += (t_slot * cw / 2); 
    251251        }