Changeset 4096
- Timestamp:
- 09/03/09 23:10:20 (3 years ago)
- Files:
-
- madwifi/branches/madwifi-0.9.4/ath_rate/amrr/amrr.c (modified) (3 diffs)
- madwifi/branches/madwifi-0.9.4/ath_rate/minstrel/minstrel.c (modified) (2 diffs)
- madwifi/branches/madwifi-0.9.4/ath_rate/onoe/onoe.c (modified) (3 diffs)
- madwifi/branches/madwifi-0.9.4/ath_rate/sample/sample.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
madwifi/branches/madwifi-0.9.4/ath_rate/amrr/amrr.c
r3907 r4096 79 79 #define DPRINTF(sc, _fmt, ...) 80 80 #endif 81 82 #include "release.h" 83 static char *version = "0.1 (" RELEASE_VERSION ")"; 84 static char *dev_info = "ath_rate_amrr"; 81 85 82 86 static int ath_rateinterval = 1000; /* rate ctl interval (ms) */ … … 268 272 269 273 KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates")); 270 if (vap->iv_fixed_rate == -1) { 274 275 if (vap->iv_fixed_rate != IEEE80211_FIXED_RATE_NONE) { 271 276 /* 272 * No fixed rate is requested. For 11b start with 273 * the highest negotiated rate; otherwise, for 11g 274 * and 11a, we start "in the middle" at 24Mb or 36Mb. 277 * A fixed rate is to be used. Find the corresponding 278 * index in the rate table. 275 279 */ 276 srate = ni->ni_rates.rs_nrates - 1; 277 if (sc->sc_curmode != IEEE80211_MODE_11B) { 278 /* 279 * Scan the negotiated rate set to find the 280 * closest rate. 281 */ 282 /* NB: the rate set is assumed sorted */ 283 for (; srate >= 0 && RATE(srate) > 72; srate--); 284 KASSERT(srate >= 0, ("bogus rate set")); 285 } 286 } else { 280 for (srate = 0; srate < ni->ni_rates.rs_nrates; srate++) 281 if (vap->iv_fixed_rate == 282 (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL)) { 283 ath_rate_update(sc, ni, srate); 284 return; 285 } 286 287 printk(KERN_WARNING "%s: %s: fixed rate %u%sMbps is not " 288 "available and will be ignored\n", vap->iv_dev->name, 289 dev_info, vap->iv_fixed_rate / 2, 290 (vap->iv_fixed_rate & 1) ? ".5" : ""); 291 } 292 293 /* 294 * No fixed rate is requested. For 11b start with 295 * the highest negotiated rate; otherwise, for 11g 296 * and 11a, we start "in the middle" at 24Mb or 36Mb. 297 */ 298 srate = ni->ni_rates.rs_nrates - 1; 299 if (sc->sc_curmode != IEEE80211_MODE_11B) { 287 300 /* 288 * A fixed rate is to be used; ic_fixed_rate is an 289 * index into the supported rate set. Convert this 290 * to the index into the negotiated rate set for 291 * the node. We know the rate is there because the 292 * rate set is checked when the station associates. 301 * Scan the negotiated rate set to find the 302 * closest rate. 293 303 */ 294 srate = ni->ni_rates.rs_nrates - 1;295 for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--);296 KASSERT(srate >= 0, 297 ("fixed rate %d not in rate set", vap->iv_fixed_rate));298 } 304 /* NB: the rate set is assumed sorted */ 305 for (; srate >= 0 && RATE(srate) > 72; srate--); 306 KASSERT(srate >= 0, ("bogus rate set")); 307 } 308 299 309 ath_rate_update(sc, ni, srate); 300 310 #undef RATE … … 553 563 }; 554 564 555 #include "release.h"556 static char *version = "0.1 (" RELEASE_VERSION ")";557 static char *dev_info = "ath_rate_amrr";558 559 565 MODULE_AUTHOR("INRIA, Mathieu Lacage"); 560 566 MODULE_DESCRIPTION("AMRR Rate control algorithm"); madwifi/branches/madwifi-0.9.4/ath_rate/minstrel/minstrel.c
r4025 r4096 611 611 unsigned int x; 612 612 int retry_index, tx_time; 613 int srate;614 613 int ndx = 0; 615 614 … … 672 671 673 672 if (vap->iv_fixed_rate != IEEE80211_FIXED_RATE_NONE) { 674 srate = sn->num_rates - 1; 675 676 /* A fixed rate is to be used; ic_fixed_rate is an 677 * index into the supported rate set. Convert this 678 * to the index into the negotiated rate set for 679 * the node. We know the rate is there because the 680 * rate set is checked when the station associates. */ 681 /* NB: the rate set is assumed sorted */ 682 for (; srate >= 0 && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--); 683 684 KASSERT(srate >= 0, 685 ("fixed rate %d not in rate set", vap->iv_fixed_rate)); 686 687 sn->static_rate_ndx = srate; 688 ni->ni_txrate = srate; 689 DPRINTF(sc, "%s: %s %s fixed rate %d%sMbps\n", 690 dev_info, __func__, ether_sprintf(ni->ni_macaddr), 691 sn->rates[srate].rate / 2, 692 (sn->rates[srate].rate % 0x1) ? ".5" : " "); 693 return; 694 } 695 673 int srate; 674 675 /* 676 * A fixed rate is to be used. Find the corresponding 677 * index in the rate table. 678 */ 679 for (srate = 0; srate < sn->num_rates; srate++) 680 if (vap->iv_fixed_rate == 681 (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL)) { 682 sn->static_rate_ndx = srate; 683 ni->ni_txrate = srate; 684 return; 685 } 686 687 printk(KERN_WARNING "%s: %s: fixed rate %u%sMbps is not " 688 "available and will be ignored\n", vap->iv_dev->name, 689 dev_info, vap->iv_fixed_rate / 2, 690 (vap->iv_fixed_rate & 1) ? ".5" : ""); 691 } 692 696 693 for (x = 0; x < ni->ni_rates.rs_nrates; x++) { 697 694 sn->rs_rateattempts [x] = 0; madwifi/branches/madwifi-0.9.4/ath_rate/onoe/onoe.c
r3907 r4096 78 78 #define DPRINTF(sc, _fmt, ...) 79 79 #endif 80 81 #include "release.h" 82 static char *version = "1.0 (" RELEASE_VERSION ")"; 83 static char *dev_info = "ath_rate_onoe"; 80 84 81 85 /* … … 253 257 254 258 KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates")); 255 if (vap->iv_fixed_rate == IEEE80211_FIXED_RATE_NONE) { 259 260 if (vap->iv_fixed_rate != IEEE80211_FIXED_RATE_NONE) { 256 261 /* 257 * No fixed rate is requested. For 11b start with 258 * the highest negotiated rate; otherwise, for 11g 259 * and 11a, we start "in the middle" at 24Mb or 36Mb. 262 * A fixed rate is to be used. Find the corresponding 263 * index in the rate table. 260 264 */ 261 srate = ni->ni_rates.rs_nrates - 1; 262 if (sc->sc_curmode != IEEE80211_MODE_11B) { 263 /* 264 * Scan the negotiated rate set to find the 265 * closest rate. 266 */ 267 /* NB: the rate set is assumed sorted */ 268 for (; srate >= 0 && RATE(srate) > 72; srate--); 269 KASSERT(srate >= 0, ("bogus rate set")); 270 } 271 } else { 265 for (srate = 0; srate < ni->ni_rates.rs_nrates; srate++) 266 if (vap->iv_fixed_rate == 267 (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL)) { 268 ath_rate_update(sc, ni, srate); 269 return; 270 } 271 272 printk(KERN_WARNING "%s: %s: fixed rate %u%sMbps is not " 273 "available and will be ignored\n", vap->iv_dev->name, 274 dev_info, vap->iv_fixed_rate / 2, 275 (vap->iv_fixed_rate & 1) ? ".5" : ""); 276 } 277 278 /* 279 * No fixed rate is requested. For 11b start with 280 * the highest negotiated rate; otherwise, for 11g 281 * and 11a, we start "in the middle" at 24Mb or 36Mb. 282 */ 283 srate = ni->ni_rates.rs_nrates - 1; 284 if (sc->sc_curmode != IEEE80211_MODE_11B) { 272 285 /* 273 * A fixed rate is to be used; iv_fixed_rate is the 274 * 802.11 rate code. Convert this to the index into 275 * the negotiated rate set for the node. We know the 276 * rate is there because the rate set is checked when 277 * the station associates. 286 * Scan the negotiated rate set to find the 287 * closest rate. 278 288 */ 279 289 /* NB: the rate set is assumed sorted */ 280 srate = ni->ni_rates.rs_nrates - 1; 281 for (; srate >= 0 && RATE(srate) != vap->iv_fixed_rate; srate--); 282 KASSERT(srate >= 0, 283 ("fixed rate %d not in rate set", vap->iv_fixed_rate)); 284 } 290 for (; srate >= 0 && RATE(srate) > 72; srate--); 291 KASSERT(srate >= 0, ("bogus rate set")); 292 } 293 285 294 ath_rate_update(sc, ni, srate); 286 295 #undef RATE … … 499 508 }; 500 509 501 #include "release.h"502 static char *version = "1.0 (" RELEASE_VERSION ")";503 static char *dev_info = "ath_rate_onoe";504 505 510 MODULE_AUTHOR("Errno Consulting, Sam Leffler"); 506 511 MODULE_DESCRIPTION("Atsushi Onoe's rate control algorithm for Atheros devices"); madwifi/branches/madwifi-0.9.4/ath_rate/sample/sample.c
r3907 r4096 777 777 const HAL_RATE_TABLE *rt = sc->sc_currates; 778 778 unsigned int x, y; 779 unsigned int srate;780 779 sn->num_rates = 0; 781 780 … … 812 811 } 813 812 814 if (vap->iv_fixed_rate != -1) {815 srate = sn->num_rates - 1;813 if (vap->iv_fixed_rate != IEEE80211_FIXED_RATE_NONE) { 814 int srate; 816 815 817 816 /* 818 * A fixed rate is to be used; ic_fixed_rate is an 819 * index into the supported rate set. Convert this 820 * to the index into the negotiated rate set for 821 * the node. We know the rate is there because the 822 * rate set is checked when the station associates. 817 * A fixed rate is to be used. Find the corresponding 818 * index in the rate table. 823 819 */ 824 /* NB: the rate set is assumed sorted */ 825 for (; srate >= 0 && (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL) != vap->iv_fixed_rate; srate--); 826 827 KASSERT(srate >= 0, 828 ("fixed rate %u not in rate set", vap->iv_fixed_rate)); 829 830 sn->static_rate_ndx = srate; 831 ni->ni_txrate = srate; 832 DPRINTF(sc, "%s: %s %s fixed rate %u%sMbps\n", 833 dev_info, __func__, ether_sprintf(ni->ni_macaddr), 834 sn->rates[srate].rate / 2, 835 (sn->rates[srate].rate % 0x1) ? ".5" : " "); 836 return; 837 } 838 820 for (srate = 0; srate < sn->num_rates; srate++) 821 if (vap->iv_fixed_rate == 822 (ni->ni_rates.rs_rates[srate] & IEEE80211_RATE_VAL)) { 823 sn->static_rate_ndx = srate; 824 ni->ni_txrate = srate; 825 return; 826 } 827 828 printk(KERN_WARNING "%s: %s: fixed rate %u%sMbps is not " 829 "available and will be ignored\n", vap->iv_dev->name, 830 dev_info, vap->iv_fixed_rate / 2, 831 (vap->iv_fixed_rate & 1) ? ".5" : ""); 832 } 839 833 840 834 for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) {
