Re: [Madwifi-devel] r3013 - 0-valued rates

 Re: [Madwifi-devel] r3013 - 0-valued rates From: Matthew 'mentor' Bell - 2007-12-29 15:49:40 Attachments: Message as HTML ```On Sat, 2007-12-29 at 13:11 +0900, bruno randolf wrote: > On Saturday 29 December 2007 12:30:50 Matthew 'mentor' Bell wrote: > > > okrate =3D=3D 0 is very different from !okrate > > > > I'm afraid you will have to explain to me why this is so, as I cannot > > see it. >=20 > ok. sorry, my mistake. it's the same. but still there's something wrong i= n: >=20 > > - if (okrate =3D=3D 0 || error !=3D 0 || > > + if (!okrate || !error || >=20 > error !=3D 0 is the opposite of !error. ARRGGGG. > > > i think it's a good idea to move that into a function, but having the > > > if (i > IEEE80211_RATE_MAXSIZE) inside the for loop is quite unnecess= ary > > > and ineffcient. i'd rather do it like it was done in the code you > > > deleted: > > > > My apologies, a misplaced variable; it is fixed now, the purpose should > > be clear. Perhaps you are thinking too close to the code. >=20 > i will test it after next week (as i'm on holidays now). >=20 > bruno >=20 > > > > Index: net80211/ieee80211_node.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- net80211/ieee80211_node.c (revision 3089) > > +++ net80211/ieee80211_node.c (working copy) > > @@ -1470,7 +1470,9 @@ > > ieee80211_saveath(ni, sp->ath); > > > > /* NB: must be after ni_chan is setup */ > > - ieee80211_setup_rates(ni, sp->rates, sp->xrates, IEEE80211_F_DOSORT)= ; > > + ieee80211_setup_rates(ni, sp->rates, sp->xrates, > > + IEEE80211_F_DOSORT | IEEE80211_F_DONEGO | > > + IEEE80211_F_DOFRATE | IEEE80211_F_DODEL); > > > > if (ic->ic_newassoc !=3D NULL) > > ic->ic_newassoc(ni, 1); > > Index: net80211/ieee80211_beacon.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- net80211/ieee80211_beacon.c (revision 3089) > > +++ net80211/ieee80211_beacon.c (working copy) > > @@ -201,7 +201,6 @@ > > struct sk_buff *skb; > > int pktlen; > > u_int8_t *frm; > > - struct ieee80211_rateset *rs; > > > > /* > > * beacon frame format > > @@ -224,7 +223,6 @@ > > * XXX Vendor-specific OIDs (e.g. Atheros) > > * NB: we allocate the max space required for the TIM bitmap. > > */ > > - rs =3D &ni->ni_rates; > > pktlen =3D 8 /* time stamp */ > > + sizeof(u_int16_t) /* beacon interval */ > > + sizeof(u_int16_t) /* capability information */ > > Index: net80211/ieee80211_input.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- net80211/ieee80211_input.c (revision 3089) > > +++ net80211/ieee80211_input.c (working copy) > > @@ -2995,8 +2995,9 @@ > > ieee80211_saveath(ni, scan.ath); > > > > /* NB: must be after ni_chan is setup */ > > - ieee80211_setup_rates(ni, scan.rates, > > - scan.xrates, IEEE80211_F_DOSORT); > > + ieee80211_setup_rates(ni, scan.rates, > > + scan.xrates, > > + IEEE80211_F_DOSORT | IEEE80211_F_DODEL); > > } > > if (ni !=3D NULL) { > > ni->ni_rssi =3D rssi; > > Index: net80211/ieee80211_proto.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- net80211/ieee80211_proto.c (revision 3089) > > +++ net80211/ieee80211_proto.c (working copy) > > @@ -428,13 +428,8 @@ > > * remove 0 rates > > * they don't make sense and can lead to trouble later > > */ > > - if (r =3D=3D 0) { > > - nrs->rs_nrates--; > > - for (j =3D i; j < nrs->rs_nrates; j++) > > - nrs->rs_rates[j] =3D nrs->rs_rates[j + 1]; > > - nrs->rs_rates[j] =3D 0; > > - continue; > > - } > > + if (r =3D=3D 0) > > + ignore++; > > > > /* > > * Check for fixed rate. > > @@ -479,9 +474,9 @@ > > */ > > if (ignore) { > > nrs->rs_nrates--; > > - for (j =3D i; j < nrs->rs_nrates; j++) > > - nrs->rs_rates[j] =3D nrs->rs_rates[j + 1]; > > - nrs->rs_rates[j] =3D 0; > > + memmove(nrs->rs_rates[i], nrs->rs_rates[i + 1], > > + (nrs->rs_nrates - i) * sizeof(nrs->rs_rates[0])); > > + nrs->rs_rates[nrs->rs_nrates + 1] =3D 0; > > continue; > > } > > } > > @@ -489,8 +484,8 @@ > > okrate =3D nrs->rs_rates[i]; > > i++; > > } > > - if (okrate =3D=3D 0 || error !=3D 0 || > > - ((flags & IEEE80211_F_DOFRATE) && fixedrate !=3D vap->iv_fixed_ra= te)) > > + if (!okrate || !error || > > + ((flags & IEEE80211_F_DOFRATE) && (fixedrate !=3D vap->iv_fixed_r= ate))) > > return badrate | IEEE80211_RATE_BASIC; > > else > > return RV(okrate); > > Index: ath/if_ath.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- ath/if_ath.c (revision 3089) > > +++ ath/if_ath.c (working copy) > > @@ -9270,7 +9259,24 @@ > > ath_hal_settxpowlimit(ah, clamped_txpow); > > } > > > > +void ath_rs_add_rates(struct ieee80211_rateset *rs, const HAL_RATE_TAB= LE > > *rt) { + unsigned int i, j; > > > > + for (i =3D 0, j =3D 0; i < rt->rateCount; i++) { > > + if (j > IEEE80211_RATE_MAXSIZE) { > > + DPRINTF(sc, ATH_DEBUG_ANY, "%s: rate table too small" > > + " (%u > %u)\n", __func__, > > + rt->rateCount, IEEE80211_RATE_MAXSIZE); > > + break; > > + } else if (rt->info[i].dot11Rate & IEEE80211_RATE_VAL) { > > + rs->rs_rates[j] =3D rt->info[i].dot11Rate; > > + j++; > > + } > > + } > > + > > + rs->rs_nrates =3D j; > > +} > > + > > #ifdef ATH_SUPERG_XR > > static int > > ath_xr_rate_setup(struct net_device *dev) > > @@ -9279,24 +9285,14 @@ > > struct ath_hal *ah =3D sc->sc_ah; > > struct ieee80211com *ic =3D &sc->sc_ic; > > const HAL_RATE_TABLE *rt; > > - struct ieee80211_rateset *rs; > > - unsigned int i, maxrates; > > + > > sc->sc_xr_rates =3D ath_hal_getratetable(ah, HAL_MODE_XR); > > - rt =3D sc->sc_xr_rates; > > - if (rt =3D=3D NULL) > > + if (sc->sc_xr_rates =3D=3D NULL) > > return 0; > > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > > - DPRINTF(sc, ATH_DEBUG_ANY, > > - "%s: rate table too small (%u > %u)\n", > > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > > - maxrates =3D IEEE80211_RATE_MAXSIZE; > > - } else > > - maxrates =3D rt->rateCount; > > - rs =3D &ic->ic_sup_xr_rates; > > - for (i =3D 0; i < maxrates; i++) > > - rs->rs_rates[i] =3D rt->info[i].dot11Rate; > > - rs->rs_nrates =3D maxrates; > > - return 1; > > + else { > > + ath_rs_add_rates(&ic->ic_sup_xr_rates, rt); > > + return 1; > > + } > > } > > #endif > > > > @@ -9308,40 +9304,17 @@ > > struct ath_hal *ah =3D sc->sc_ah; > > struct ieee80211com *ic =3D &sc->sc_ic; > > const HAL_RATE_TABLE *rt; > > - struct ieee80211_rateset *rs; > > unsigned int i, maxrates; > > > > sc->sc_half_rates =3D ath_hal_getratetable(ah, HAL_MODE_11A_HALF_RATE= ); > > rt =3D sc->sc_half_rates; > > - if (rt !=3D NULL) { > > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > > - DPRINTF(sc, ATH_DEBUG_ANY, > > - "%s: rate table too small (%u > %u)\n", > > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > > - maxrates =3D IEEE80211_RATE_MAXSIZE; > > - } else > > - maxrates =3D rt->rateCount; > > - rs =3D &ic->ic_sup_half_rates; > > - for (i =3D 0; i < maxrates; i++) > > - rs->rs_rates[i] =3D rt->info[i].dot11Rate; > > - rs->rs_nrates =3D maxrates; > > - } > > + if (rt !=3D NULL) > > + ath_rs_add_rates(&ic->ic_sup_half_rates, rt); > > > > sc->sc_quarter_rates =3D ath_hal_getratetable(ah, > > HAL_MODE_11A_QUARTER_RATE); rt =3D sc->sc_quarter_rates; > > - if (rt !=3D NULL) { > > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > > - DPRINTF(sc, ATH_DEBUG_ANY, > > - "%s: rate table too small (%u > %u)\n", > > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > > - maxrates =3D IEEE80211_RATE_MAXSIZE; > > - } else > > - maxrates =3D rt->rateCount; > > - rs =3D &ic->ic_sup_quarter_rates; > > - for (i =3D 0; i < maxrates; i++) > > - rs->rs_rates[i] =3D rt->info[i].dot11Rate; > > - rs->rs_nrates =3D maxrates; > > - } > > + if (rt !=3D NULL) > > + ath_rs_add_rates(&ic->ic_sup_quarter_rates, rt); > > } > > > > static int > > @@ -9351,7 +9324,6 @@ > > struct ath_hal *ah =3D sc->sc_ah; > > struct ieee80211com *ic =3D &sc->sc_ic; > > const HAL_RATE_TABLE *rt; > > - struct ieee80211_rateset *rs; > > unsigned int i, maxrates; > > > > switch (mode) { > > @@ -9375,21 +9347,14 @@ > > __func__, mode); > > return 0; > > } > > + > > rt =3D sc->sc_rates[mode]; > > if (rt =3D=3D NULL) > > return 0; > > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > > - DPRINTF(sc, ATH_DEBUG_ANY, > > - "%s: rate table too small (%u > %u)\n", > > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > > - maxrates =3D IEEE80211_RATE_MAXSIZE; > > - } else > > - maxrates =3D rt->rateCount; > > - rs =3D &ic->ic_sup_rates[mode]; > > - for (i =3D 0; i < maxrates; i++) > > - rs->rs_rates[i] =3D rt->info[i].dot11Rate; > > - rs->rs_nrates =3D maxrates; > > - return 1; > > + else { > > + ath_rs_add_rates(&ic->ic_sup_rates[mode], rt); > > + return 1; > > + } > > } > > > > static void >=20 >=20 ```

Thread view

 [Madwifi-devel] r3013 - 0-valued rates From: Matthew 'mentor' Bell - 2007-12-10 19:22:23 Attachments: Message as HTML     Message as HTML
 Re: [Madwifi-devel] r3013 - 0-valued rates From: bruno randolf - 2007-12-11 03:59:56 ```On Tuesday 11 December 2007 04:21:54 Matthew 'mentor' Bell wrote: > Hi bruno, > I've looked at your patch and I don't quite understand it; I attach a > patch with some improvements, but I particularly don't understand the > changes to ieee80211_fix_rate. Firstly, I think your code breaks the API > of that function (there is an explicit flag if the caller wants to > delete unacceptable rates), and, also, by comparison with the later in > the function, I don't think your code works properly. I'd also not > encourage, copy-paste coding, especially inside the same function. hi mathew! your changes to ieee80211_fix_rate() don't work in this case. they leave the 0 rates in the list, because it is not always called with _F_DODEL. i think "breaking the API" is exaggerated, as it's not about deleting rates which are incomatible with our supported rates (which is what _F_DODEL means) - it's about deleting rates which should not be in there in the first place and which can cause serious trouble later. with your patch applied i still see with "athdebug +xmit": --- wifi0: ath_tx_start: skb c2904e00 [data c34c3bf0 len 24] skbaddr 34c3bf0 NODS 06:05:4e:4e:2e:9f->00:11:11:11:11:11(01:01:01:01:01:01) data 54M 48 00 2c 00 00 11 11 11 11 11 06 05 4e 4e 2e 9f 01 01 01 01 01 01 00 00 wifi0: ath_tx_start: set up txdesc: pktlen 28 hdrlen 24 atype 0 txpower 34 txrate 12 try0 2 keyix 5 ant 0 flags 1 ctsrate 0 ctsdur 0 icvlen 0 ivlen 0 comp 3 wifi0: ath_tx_start: set up multi rate/retry 1:0/0 2:0/0 3:0/0 ^^^^^^^^^^^^^^^ --> the retries have been set to zero by our safeguard code in if_ath.c but the rates are still 0. while with my version i see: --- wifi0: ath_tx_start: skb c3b9ace0 [data c34c3bf0 len 24] skbaddr 34c3bf0 NODS 06:05:4e:4e:2e:9f->00:11:11:11:11:11(01:01:01:01:01:01) data 54M 48 00 2c 00 00 11 11 11 11 11 06 05 4e 4e 2e 9f 01 01 01 01 01 01 00 00 wifi0: ath_tx_start: set up txdesc: pktlen 28 hdrlen 24 atype 0 txpower 34 txrate 12 try0 2 keyix 4 ant 0 flags 1 ctsrate 0 ctsdur 0 icvlen 0 ivlen 0 comp 3 wifi0: ath_tx_start: set up multi rate/retry 1:15/3 2:15/3 3:0/0 ^^^^^^^^^^^ --> rate control was able to select correct retry rates. Index: net80211/ieee80211_proto.c =================================================================== --- net80211/ieee80211_proto.c (revision 3013) +++ net80211/ieee80211_proto.c (working copy) @@ -426,18 +426,9 @@ r = nrs->rs_rates[i] & IEEE80211_RATE_VAL; badrate = r; - /* - * remove 0 rates - * they don't make sense and can lead to trouble later - */ - if (r == 0) { - nrs->rs_nrates--; - nrs->rs_nrates--; - for (j = i; j < nrs->rs_nrates; j++) - nrs->rs_rates[j] = nrs->rs_rates[j + 1]; - nrs->rs_rates[j] = 0; - continue; - } + /* Ignore 0-valued rates. */ + if (r == 0) + ignore++; NACK, as explained above. - /* should be ok, but just to be sure */ - if (txrate == 0) + if (txrate == 0) { + printk("%s: invlaid TX rate %u (%s: %u)\n", DEV_NAME(dev), + txrate, __func__, __LINE__); return -EIO; + } ACK - /* - * if rate module fucks up and gives us 0 rates we disable the - * multi rate retries. this is important since 0 rates can lead - * to a card continously sending noise (in A band at least) - */ + /* Explicitly disable retries, if the retry rate is 0. + * Otherwise this may lead to the continuous transmission of + * noise (in the .11a band at least). */ ACK. thanks for the style improvement :) bruno ```
 Re: [Madwifi-devel] r3013 - 0-valued rates From: Matthew 'mentor' Bell - 2007-12-24 00:45:25 Attachments: Message as HTML     Message as HTML
 Re: [Madwifi-devel] r3013 - 0-valued rates From: bruno randolf - 2007-12-25 03:07:03 ```T24gTW9uZGF5IDI0IERlY2VtYmVyIDIwMDcgMDk6NDQ6NDQgTWF0dGhldyAnbWVudG9yJyBCZWxs IHdyb3RlOgo+ID4gaGkgbWF0aGV3IQo+Cj4gTWF0dGhldy4gKHNvcnJ5KQoKaSdtIHNvcnJ5LCBt YXR0aGV3LgoKYmVmb3JlIGkgZ2V0IGludG8gdGhlIGRldGFpbHMgb2YgeW91ciBwYXRjaCwgbGV0 IG1lIHNheSB0aGF0IGJhc2ljYWxseSB0aGUgMCAKcmF0ZXMgc2hvdWxkIG5ldmVyIGdldCBpbnRv IHRoZSByYXRlc2V0IGFueXdheXMsIHNvIG1heWJlIGluc3RlYWQgb2YgCmRpc2N1c3NpbmcgYWJv dXQgdGhlIHJpZ2h0IHdheSB0byBnZXQgdGhlbSBvdXQgb2YgdGhlIHJhdGVzZXQsIHRoZSBiZXR0 ZXIgCnNvbHV0aW9uIHdvdWxkIGJlIHRvIGZpbmQgYSB3YXkgdGhleSBkb24ndCBnZXQgaW4gdGhl cmUgaW4gdGhlIGZpcnN0IHBsYWNlLgoKaWVlZTgwMjExX2ZpeF9yYXRlKCkgd2FzIHRoZSBlYXNp ZXN0IGFuZ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gwqDCoMKgwqDCoMKgwqDCoMKgbWF4cmF0ZXMgPSBydC0+cmF0ZUNvdW50 Owo+IC3CoMKgwqDCoMKgwqDCoHJzID0gJmljLT5pY19zdXBfeHJfcmF0ZXM7Cj4gLcKgwqDCoMKg wqDCoMKgZm9yIChpID0gMDsgaSA8IG1heHJhdGVzOyBpKyspCj4gLcKgwqDCoMKgwqDCoMKgwqDC oMKgwqDCoMKgwqDCoHJzLT5yc19yYXRlc1tpXSA9IHJ0LT5pbmZvW2ldLmRvdDExUmF0ZTsKPiAt wqDCoMKgwqDCoMKgwqBycy0+cnNfbnJhdGVzID0gbWF4cmF0ZXM7Cgp0aGF0J3MgbW9yZSBlZmZp Y2llbnQgYW5kIGVhc2llciB0byB1bmRlcnN0YW5kLgoKaWYgeW91IHNlbmQgbWUgeW91ciBwYXRj aCBpbiBhIHdheSB0aGF0IGkgY2FuIGNvbXBpbGUgaXQgaSB3aWxsIHRlc3QgaXQgaWYgaXQgCnNv bHZlcyB0aGUgb3JpZ2luYWwgMHJhdGVzIGJ1Zy4KCmJydW5vCg== ```
 Re: [Madwifi-devel] r3013 - 0-valued rates From: Matthew 'mentor' Bell - 2007-12-29 03:31:05 Attachments: Message as HTML ```On Tue, 2007-12-25 at 12:06 +0900, bruno randolf wrote: > On Monday 24 December 2007 09:44:44 Matthew 'mentor' Bell wrote: > i'm sorry, matthew. No, 'Matthew'. It has a capital as it is a proper noun. Pedantry, I know. The patch is intended to catch process the rates at all points where they are added to a rateset, and also has the added affect of adding processing flags in IBSS mode, but they can be omitted. > okrate =3D=3D 0 is very different from !okrate I'm afraid you will have to explain to me why this is so, as I cannot see it. > i think it's a good idea to move that into a function, but having the=20 > if (i > IEEE80211_RATE_MAXSIZE) inside the for loop is quite unnecessary = and=20 > ineffcient. i'd rather do it like it was done in the code you deleted: My apologies, a misplaced variable; it is fixed now, the purpose should be clear. Perhaps you are thinking too close to the code.=20 > bruno Matthew --- Index: net80211/ieee80211_node.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- net80211/ieee80211_node.c (revision 3089) +++ net80211/ieee80211_node.c (working copy) @@ -1470,7 +1470,9 @@ ieee80211_saveath(ni, sp->ath); =20 /* NB: must be after ni_chan is setup */ - ieee80211_setup_rates(ni, sp->rates, sp->xrates, IEEE80211_F_DOSORT); + ieee80211_setup_rates(ni, sp->rates, sp->xrates,=20 + IEEE80211_F_DOSORT | IEEE80211_F_DONEGO |=20 + IEEE80211_F_DOFRATE | IEEE80211_F_DODEL); =20 if (ic->ic_newassoc !=3D NULL) ic->ic_newassoc(ni, 1); Index: net80211/ieee80211_beacon.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- net80211/ieee80211_beacon.c (revision 3089) +++ net80211/ieee80211_beacon.c (working copy) @@ -201,7 +201,6 @@ struct sk_buff *skb; int pktlen; u_int8_t *frm; - struct ieee80211_rateset *rs; =20 /* * beacon frame format @@ -224,7 +223,6 @@ * XXX Vendor-specific OIDs (e.g. Atheros) * NB: we allocate the max space required for the TIM bitmap. */ - rs =3D &ni->ni_rates; pktlen =3D 8 /* time stamp */ + sizeof(u_int16_t) /* beacon interval */ + sizeof(u_int16_t) /* capability information */ Index: net80211/ieee80211_input.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- net80211/ieee80211_input.c (revision 3089) +++ net80211/ieee80211_input.c (working copy) @@ -2995,8 +2995,9 @@ ieee80211_saveath(ni, scan.ath); =20 /* NB: must be after ni_chan is setup */ - ieee80211_setup_rates(ni, scan.rates, - scan.xrates, IEEE80211_F_DOSORT); + ieee80211_setup_rates(ni, scan.rates,=20 + scan.xrates,=20 + IEEE80211_F_DOSORT | IEEE80211_F_DODEL); } if (ni !=3D NULL) { ni->ni_rssi =3D rssi; Index: net80211/ieee80211_proto.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- net80211/ieee80211_proto.c (revision 3089) +++ net80211/ieee80211_proto.c (working copy) @@ -428,13 +428,8 @@ * remove 0 rates * they don't make sense and can lead to trouble later */ - if (r =3D=3D 0) { - nrs->rs_nrates--; - for (j =3D i; j < nrs->rs_nrates; j++) - nrs->rs_rates[j] =3D nrs->rs_rates[j + 1]; - nrs->rs_rates[j] =3D 0; - continue; - } + if (r =3D=3D 0) + ignore++; =20 /* * Check for fixed rate.=20 @@ -479,9 +474,9 @@ */ if (ignore) { nrs->rs_nrates--; - for (j =3D i; j < nrs->rs_nrates; j++) - nrs->rs_rates[j] =3D nrs->rs_rates[j + 1]; - nrs->rs_rates[j] =3D 0; + memmove(nrs->rs_rates[i], nrs->rs_rates[i + 1],=20 + (nrs->rs_nrates - i) * sizeof(nrs->rs_rates[0])); + nrs->rs_rates[nrs->rs_nrates + 1] =3D 0; continue; } } @@ -489,8 +484,8 @@ okrate =3D nrs->rs_rates[i]; i++; } - if (okrate =3D=3D 0 || error !=3D 0 || - ((flags & IEEE80211_F_DOFRATE) && fixedrate !=3D vap->iv_fixed_rate)) + if (!okrate || !error || + ((flags & IEEE80211_F_DOFRATE) && (fixedrate !=3D vap->iv_fixed_rate)= )) return badrate | IEEE80211_RATE_BASIC; else return RV(okrate); Index: ath/if_ath.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- ath/if_ath.c (revision 3089) +++ ath/if_ath.c (working copy) @@ -9270,7 +9259,24 @@ ath_hal_settxpowlimit(ah, clamped_txpow); } =20 +void ath_rs_add_rates(struct ieee80211_rateset *rs, const HAL_RATE_TABLE *= rt) { + unsigned int i, j; =20 + for (i =3D 0, j =3D 0; i < rt->rateCount; i++) { + if (j > IEEE80211_RATE_MAXSIZE) { + DPRINTF(sc, ATH_DEBUG_ANY, "%s: rate table too small" + " (%u > %u)\n", __func__,=20 + rt->rateCount, IEEE80211_RATE_MAXSIZE); + break; + } else if (rt->info[i].dot11Rate & IEEE80211_RATE_VAL) { + rs->rs_rates[j] =3D rt->info[i].dot11Rate; + j++; + } + } + + rs->rs_nrates =3D j; +} + #ifdef ATH_SUPERG_XR static int ath_xr_rate_setup(struct net_device *dev) @@ -9279,24 +9285,14 @@ struct ath_hal *ah =3D sc->sc_ah; struct ieee80211com *ic =3D &sc->sc_ic; const HAL_RATE_TABLE *rt; - struct ieee80211_rateset *rs; - unsigned int i, maxrates; + sc->sc_xr_rates =3D ath_hal_getratetable(ah, HAL_MODE_XR); - rt =3D sc->sc_xr_rates; - if (rt =3D=3D NULL) + if (sc->sc_xr_rates =3D=3D NULL) return 0; - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { - DPRINTF(sc, ATH_DEBUG_ANY, - "%s: rate table too small (%u > %u)\n", - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); - maxrates =3D IEEE80211_RATE_MAXSIZE; - } else - maxrates =3D rt->rateCount; - rs =3D &ic->ic_sup_xr_rates; - for (i =3D 0; i < maxrates; i++) - rs->rs_rates[i] =3D rt->info[i].dot11Rate; - rs->rs_nrates =3D maxrates; - return 1; + else { + ath_rs_add_rates(&ic->ic_sup_xr_rates, rt); + return 1; + } } #endif =20 @@ -9308,40 +9304,17 @@ struct ath_hal *ah =3D sc->sc_ah; struct ieee80211com *ic =3D &sc->sc_ic; const HAL_RATE_TABLE *rt; - struct ieee80211_rateset *rs; unsigned int i, maxrates; =20 sc->sc_half_rates =3D ath_hal_getratetable(ah, HAL_MODE_11A_HALF_RATE); rt =3D sc->sc_half_rates; - if (rt !=3D NULL) { - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { - DPRINTF(sc, ATH_DEBUG_ANY, - "%s: rate table too small (%u > %u)\n", - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); - maxrates =3D IEEE80211_RATE_MAXSIZE; - } else - maxrates =3D rt->rateCount; - rs =3D &ic->ic_sup_half_rates; - for (i =3D 0; i < maxrates; i++) - rs->rs_rates[i] =3D rt->info[i].dot11Rate; - rs->rs_nrates =3D maxrates; - } + if (rt !=3D NULL) + ath_rs_add_rates(&ic->ic_sup_half_rates, rt); =20 sc->sc_quarter_rates =3D ath_hal_getratetable(ah, HAL_MODE_11A_QUARTER_RA= TE); rt =3D sc->sc_quarter_rates; - if (rt !=3D NULL) { - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { - DPRINTF(sc, ATH_DEBUG_ANY, - "%s: rate table too small (%u > %u)\n", - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); - maxrates =3D IEEE80211_RATE_MAXSIZE; - } else - maxrates =3D rt->rateCount; - rs =3D &ic->ic_sup_quarter_rates; - for (i =3D 0; i < maxrates; i++) - rs->rs_rates[i] =3D rt->info[i].dot11Rate; - rs->rs_nrates =3D maxrates; - } + if (rt !=3D NULL) + ath_rs_add_rates(&ic->ic_sup_quarter_rates, rt); } =20 static int @@ -9351,7 +9324,6 @@ struct ath_hal *ah =3D sc->sc_ah; struct ieee80211com *ic =3D &sc->sc_ic; const HAL_RATE_TABLE *rt; - struct ieee80211_rateset *rs; unsigned int i, maxrates; =20 switch (mode) { @@ -9375,21 +9347,14 @@ __func__, mode); return 0; } + rt =3D sc->sc_rates[mode]; if (rt =3D=3D NULL) return 0; - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { - DPRINTF(sc, ATH_DEBUG_ANY, - "%s: rate table too small (%u > %u)\n", - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); - maxrates =3D IEEE80211_RATE_MAXSIZE; - } else - maxrates =3D rt->rateCount; - rs =3D &ic->ic_sup_rates[mode]; - for (i =3D 0; i < maxrates; i++) - rs->rs_rates[i] =3D rt->info[i].dot11Rate; - rs->rs_nrates =3D maxrates; - return 1; + else { + ath_rs_add_rates(&ic->ic_sup_rates[mode], rt); + return 1; + } } =20 static void ```
 Re: [Madwifi-devel] r3013 - 0-valued rates From: bruno randolf - 2007-12-29 04:20:17 ```On Saturday 29 December 2007 12:30:50 Matthew 'mentor' Bell wrote: > > okrate == 0 is very different from !okrate > > I'm afraid you will have to explain to me why this is so, as I cannot > see it. ok. sorry, my mistake. it's the same. but still there's something wrong in: > - if (okrate == 0 || error != 0 || > + if (!okrate || !error || error != 0 is the opposite of !error. > > i think it's a good idea to move that into a function, but having the > > if (i > IEEE80211_RATE_MAXSIZE) inside the for loop is quite unnecessary > > and ineffcient. i'd rather do it like it was done in the code you > > deleted: > > My apologies, a misplaced variable; it is fixed now, the purpose should > be clear. Perhaps you are thinking too close to the code. i will test it after next week (as i'm on holidays now). bruno > > Index: net80211/ieee80211_node.c > =================================================================== > --- net80211/ieee80211_node.c (revision 3089) > +++ net80211/ieee80211_node.c (working copy) > @@ -1470,7 +1470,9 @@ > ieee80211_saveath(ni, sp->ath); > > /* NB: must be after ni_chan is setup */ > - ieee80211_setup_rates(ni, sp->rates, sp->xrates, IEEE80211_F_DOSORT); > + ieee80211_setup_rates(ni, sp->rates, sp->xrates, > + IEEE80211_F_DOSORT | IEEE80211_F_DONEGO | > + IEEE80211_F_DOFRATE | IEEE80211_F_DODEL); > > if (ic->ic_newassoc != NULL) > ic->ic_newassoc(ni, 1); > Index: net80211/ieee80211_beacon.c > =================================================================== > --- net80211/ieee80211_beacon.c (revision 3089) > +++ net80211/ieee80211_beacon.c (working copy) > @@ -201,7 +201,6 @@ > struct sk_buff *skb; > int pktlen; > u_int8_t *frm; > - struct ieee80211_rateset *rs; > > /* > * beacon frame format > @@ -224,7 +223,6 @@ > * XXX Vendor-specific OIDs (e.g. Atheros) > * NB: we allocate the max space required for the TIM bitmap. > */ > - rs = &ni->ni_rates; > pktlen = 8 /* time stamp */ > + sizeof(u_int16_t) /* beacon interval */ > + sizeof(u_int16_t) /* capability information */ > Index: net80211/ieee80211_input.c > =================================================================== > --- net80211/ieee80211_input.c (revision 3089) > +++ net80211/ieee80211_input.c (working copy) > @@ -2995,8 +2995,9 @@ > ieee80211_saveath(ni, scan.ath); > > /* NB: must be after ni_chan is setup */ > - ieee80211_setup_rates(ni, scan.rates, > - scan.xrates, IEEE80211_F_DOSORT); > + ieee80211_setup_rates(ni, scan.rates, > + scan.xrates, > + IEEE80211_F_DOSORT | IEEE80211_F_DODEL); > } > if (ni != NULL) { > ni->ni_rssi = rssi; > Index: net80211/ieee80211_proto.c > =================================================================== > --- net80211/ieee80211_proto.c (revision 3089) > +++ net80211/ieee80211_proto.c (working copy) > @@ -428,13 +428,8 @@ > * remove 0 rates > * they don't make sense and can lead to trouble later > */ > - if (r == 0) { > - nrs->rs_nrates--; > - for (j = i; j < nrs->rs_nrates; j++) > - nrs->rs_rates[j] = nrs->rs_rates[j + 1]; > - nrs->rs_rates[j] = 0; > - continue; > - } > + if (r == 0) > + ignore++; > > /* > * Check for fixed rate. > @@ -479,9 +474,9 @@ > */ > if (ignore) { > nrs->rs_nrates--; > - for (j = i; j < nrs->rs_nrates; j++) > - nrs->rs_rates[j] = nrs->rs_rates[j + 1]; > - nrs->rs_rates[j] = 0; > + memmove(nrs->rs_rates[i], nrs->rs_rates[i + 1], > + (nrs->rs_nrates - i) * sizeof(nrs->rs_rates[0])); > + nrs->rs_rates[nrs->rs_nrates + 1] = 0; > continue; > } > } > @@ -489,8 +484,8 @@ > okrate = nrs->rs_rates[i]; > i++; > } > - if (okrate == 0 || error != 0 || > - ((flags & IEEE80211_F_DOFRATE) && fixedrate != vap->iv_fixed_rate)) > + if (!okrate || !error || > + ((flags & IEEE80211_F_DOFRATE) && (fixedrate != vap->iv_fixed_rate))) > return badrate | IEEE80211_RATE_BASIC; > else > return RV(okrate); > Index: ath/if_ath.c > =================================================================== > --- ath/if_ath.c (revision 3089) > +++ ath/if_ath.c (working copy) > @@ -9270,7 +9259,24 @@ > ath_hal_settxpowlimit(ah, clamped_txpow); > } > > +void ath_rs_add_rates(struct ieee80211_rateset *rs, const HAL_RATE_TABLE > *rt) { + unsigned int i, j; > > + for (i = 0, j = 0; i < rt->rateCount; i++) { > + if (j > IEEE80211_RATE_MAXSIZE) { > + DPRINTF(sc, ATH_DEBUG_ANY, "%s: rate table too small" > + " (%u > %u)\n", __func__, > + rt->rateCount, IEEE80211_RATE_MAXSIZE); > + break; > + } else if (rt->info[i].dot11Rate & IEEE80211_RATE_VAL) { > + rs->rs_rates[j] = rt->info[i].dot11Rate; > + j++; > + } > + } > + > + rs->rs_nrates = j; > +} > + > #ifdef ATH_SUPERG_XR > static int > ath_xr_rate_setup(struct net_device *dev) > @@ -9279,24 +9285,14 @@ > struct ath_hal *ah = sc->sc_ah; > struct ieee80211com *ic = &sc->sc_ic; > const HAL_RATE_TABLE *rt; > - struct ieee80211_rateset *rs; > - unsigned int i, maxrates; > + > sc->sc_xr_rates = ath_hal_getratetable(ah, HAL_MODE_XR); > - rt = sc->sc_xr_rates; > - if (rt == NULL) > + if (sc->sc_xr_rates == NULL) > return 0; > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > - DPRINTF(sc, ATH_DEBUG_ANY, > - "%s: rate table too small (%u > %u)\n", > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > - maxrates = IEEE80211_RATE_MAXSIZE; > - } else > - maxrates = rt->rateCount; > - rs = &ic->ic_sup_xr_rates; > - for (i = 0; i < maxrates; i++) > - rs->rs_rates[i] = rt->info[i].dot11Rate; > - rs->rs_nrates = maxrates; > - return 1; > + else { > + ath_rs_add_rates(&ic->ic_sup_xr_rates, rt); > + return 1; > + } > } > #endif > > @@ -9308,40 +9304,17 @@ > struct ath_hal *ah = sc->sc_ah; > struct ieee80211com *ic = &sc->sc_ic; > const HAL_RATE_TABLE *rt; > - struct ieee80211_rateset *rs; > unsigned int i, maxrates; > > sc->sc_half_rates = ath_hal_getratetable(ah, HAL_MODE_11A_HALF_RATE); > rt = sc->sc_half_rates; > - if (rt != NULL) { > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > - DPRINTF(sc, ATH_DEBUG_ANY, > - "%s: rate table too small (%u > %u)\n", > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > - maxrates = IEEE80211_RATE_MAXSIZE; > - } else > - maxrates = rt->rateCount; > - rs = &ic->ic_sup_half_rates; > - for (i = 0; i < maxrates; i++) > - rs->rs_rates[i] = rt->info[i].dot11Rate; > - rs->rs_nrates = maxrates; > - } > + if (rt != NULL) > + ath_rs_add_rates(&ic->ic_sup_half_rates, rt); > > sc->sc_quarter_rates = ath_hal_getratetable(ah, > HAL_MODE_11A_QUARTER_RATE); rt = sc->sc_quarter_rates; > - if (rt != NULL) { > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > - DPRINTF(sc, ATH_DEBUG_ANY, > - "%s: rate table too small (%u > %u)\n", > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > - maxrates = IEEE80211_RATE_MAXSIZE; > - } else > - maxrates = rt->rateCount; > - rs = &ic->ic_sup_quarter_rates; > - for (i = 0; i < maxrates; i++) > - rs->rs_rates[i] = rt->info[i].dot11Rate; > - rs->rs_nrates = maxrates; > - } > + if (rt != NULL) > + ath_rs_add_rates(&ic->ic_sup_quarter_rates, rt); > } > > static int > @@ -9351,7 +9324,6 @@ > struct ath_hal *ah = sc->sc_ah; > struct ieee80211com *ic = &sc->sc_ic; > const HAL_RATE_TABLE *rt; > - struct ieee80211_rateset *rs; > unsigned int i, maxrates; > > switch (mode) { > @@ -9375,21 +9347,14 @@ > __func__, mode); > return 0; > } > + > rt = sc->sc_rates[mode]; > if (rt == NULL) > return 0; > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > - DPRINTF(sc, ATH_DEBUG_ANY, > - "%s: rate table too small (%u > %u)\n", > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > - maxrates = IEEE80211_RATE_MAXSIZE; > - } else > - maxrates = rt->rateCount; > - rs = &ic->ic_sup_rates[mode]; > - for (i = 0; i < maxrates; i++) > - rs->rs_rates[i] = rt->info[i].dot11Rate; > - rs->rs_nrates = maxrates; > - return 1; > + else { > + ath_rs_add_rates(&ic->ic_sup_rates[mode], rt); > + return 1; > + } > } > > static void ```
 Re: [Madwifi-devel] r3013 - 0-valued rates From: Matthew 'mentor' Bell - 2007-12-29 15:49:40 Attachments: Message as HTML ```On Sat, 2007-12-29 at 13:11 +0900, bruno randolf wrote: > On Saturday 29 December 2007 12:30:50 Matthew 'mentor' Bell wrote: > > > okrate =3D=3D 0 is very different from !okrate > > > > I'm afraid you will have to explain to me why this is so, as I cannot > > see it. >=20 > ok. sorry, my mistake. it's the same. but still there's something wrong i= n: >=20 > > - if (okrate =3D=3D 0 || error !=3D 0 || > > + if (!okrate || !error || >=20 > error !=3D 0 is the opposite of !error. ARRGGGG. > > > i think it's a good idea to move that into a function, but having the > > > if (i > IEEE80211_RATE_MAXSIZE) inside the for loop is quite unnecess= ary > > > and ineffcient. i'd rather do it like it was done in the code you > > > deleted: > > > > My apologies, a misplaced variable; it is fixed now, the purpose should > > be clear. Perhaps you are thinking too close to the code. >=20 > i will test it after next week (as i'm on holidays now). >=20 > bruno >=20 > > > > Index: net80211/ieee80211_node.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- net80211/ieee80211_node.c (revision 3089) > > +++ net80211/ieee80211_node.c (working copy) > > @@ -1470,7 +1470,9 @@ > > ieee80211_saveath(ni, sp->ath); > > > > /* NB: must be after ni_chan is setup */ > > - ieee80211_setup_rates(ni, sp->rates, sp->xrates, IEEE80211_F_DOSORT)= ; > > + ieee80211_setup_rates(ni, sp->rates, sp->xrates, > > + IEEE80211_F_DOSORT | IEEE80211_F_DONEGO | > > + IEEE80211_F_DOFRATE | IEEE80211_F_DODEL); > > > > if (ic->ic_newassoc !=3D NULL) > > ic->ic_newassoc(ni, 1); > > Index: net80211/ieee80211_beacon.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- net80211/ieee80211_beacon.c (revision 3089) > > +++ net80211/ieee80211_beacon.c (working copy) > > @@ -201,7 +201,6 @@ > > struct sk_buff *skb; > > int pktlen; > > u_int8_t *frm; > > - struct ieee80211_rateset *rs; > > > > /* > > * beacon frame format > > @@ -224,7 +223,6 @@ > > * XXX Vendor-specific OIDs (e.g. Atheros) > > * NB: we allocate the max space required for the TIM bitmap. > > */ > > - rs =3D &ni->ni_rates; > > pktlen =3D 8 /* time stamp */ > > + sizeof(u_int16_t) /* beacon interval */ > > + sizeof(u_int16_t) /* capability information */ > > Index: net80211/ieee80211_input.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- net80211/ieee80211_input.c (revision 3089) > > +++ net80211/ieee80211_input.c (working copy) > > @@ -2995,8 +2995,9 @@ > > ieee80211_saveath(ni, scan.ath); > > > > /* NB: must be after ni_chan is setup */ > > - ieee80211_setup_rates(ni, scan.rates, > > - scan.xrates, IEEE80211_F_DOSORT); > > + ieee80211_setup_rates(ni, scan.rates, > > + scan.xrates, > > + IEEE80211_F_DOSORT | IEEE80211_F_DODEL); > > } > > if (ni !=3D NULL) { > > ni->ni_rssi =3D rssi; > > Index: net80211/ieee80211_proto.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- net80211/ieee80211_proto.c (revision 3089) > > +++ net80211/ieee80211_proto.c (working copy) > > @@ -428,13 +428,8 @@ > > * remove 0 rates > > * they don't make sense and can lead to trouble later > > */ > > - if (r =3D=3D 0) { > > - nrs->rs_nrates--; > > - for (j =3D i; j < nrs->rs_nrates; j++) > > - nrs->rs_rates[j] =3D nrs->rs_rates[j + 1]; > > - nrs->rs_rates[j] =3D 0; > > - continue; > > - } > > + if (r =3D=3D 0) > > + ignore++; > > > > /* > > * Check for fixed rate. > > @@ -479,9 +474,9 @@ > > */ > > if (ignore) { > > nrs->rs_nrates--; > > - for (j =3D i; j < nrs->rs_nrates; j++) > > - nrs->rs_rates[j] =3D nrs->rs_rates[j + 1]; > > - nrs->rs_rates[j] =3D 0; > > + memmove(nrs->rs_rates[i], nrs->rs_rates[i + 1], > > + (nrs->rs_nrates - i) * sizeof(nrs->rs_rates[0])); > > + nrs->rs_rates[nrs->rs_nrates + 1] =3D 0; > > continue; > > } > > } > > @@ -489,8 +484,8 @@ > > okrate =3D nrs->rs_rates[i]; > > i++; > > } > > - if (okrate =3D=3D 0 || error !=3D 0 || > > - ((flags & IEEE80211_F_DOFRATE) && fixedrate !=3D vap->iv_fixed_ra= te)) > > + if (!okrate || !error || > > + ((flags & IEEE80211_F_DOFRATE) && (fixedrate !=3D vap->iv_fixed_r= ate))) > > return badrate | IEEE80211_RATE_BASIC; > > else > > return RV(okrate); > > Index: ath/if_ath.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- ath/if_ath.c (revision 3089) > > +++ ath/if_ath.c (working copy) > > @@ -9270,7 +9259,24 @@ > > ath_hal_settxpowlimit(ah, clamped_txpow); > > } > > > > +void ath_rs_add_rates(struct ieee80211_rateset *rs, const HAL_RATE_TAB= LE > > *rt) { + unsigned int i, j; > > > > + for (i =3D 0, j =3D 0; i < rt->rateCount; i++) { > > + if (j > IEEE80211_RATE_MAXSIZE) { > > + DPRINTF(sc, ATH_DEBUG_ANY, "%s: rate table too small" > > + " (%u > %u)\n", __func__, > > + rt->rateCount, IEEE80211_RATE_MAXSIZE); > > + break; > > + } else if (rt->info[i].dot11Rate & IEEE80211_RATE_VAL) { > > + rs->rs_rates[j] =3D rt->info[i].dot11Rate; > > + j++; > > + } > > + } > > + > > + rs->rs_nrates =3D j; > > +} > > + > > #ifdef ATH_SUPERG_XR > > static int > > ath_xr_rate_setup(struct net_device *dev) > > @@ -9279,24 +9285,14 @@ > > struct ath_hal *ah =3D sc->sc_ah; > > struct ieee80211com *ic =3D &sc->sc_ic; > > const HAL_RATE_TABLE *rt; > > - struct ieee80211_rateset *rs; > > - unsigned int i, maxrates; > > + > > sc->sc_xr_rates =3D ath_hal_getratetable(ah, HAL_MODE_XR); > > - rt =3D sc->sc_xr_rates; > > - if (rt =3D=3D NULL) > > + if (sc->sc_xr_rates =3D=3D NULL) > > return 0; > > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > > - DPRINTF(sc, ATH_DEBUG_ANY, > > - "%s: rate table too small (%u > %u)\n", > > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > > - maxrates =3D IEEE80211_RATE_MAXSIZE; > > - } else > > - maxrates =3D rt->rateCount; > > - rs =3D &ic->ic_sup_xr_rates; > > - for (i =3D 0; i < maxrates; i++) > > - rs->rs_rates[i] =3D rt->info[i].dot11Rate; > > - rs->rs_nrates =3D maxrates; > > - return 1; > > + else { > > + ath_rs_add_rates(&ic->ic_sup_xr_rates, rt); > > + return 1; > > + } > > } > > #endif > > > > @@ -9308,40 +9304,17 @@ > > struct ath_hal *ah =3D sc->sc_ah; > > struct ieee80211com *ic =3D &sc->sc_ic; > > const HAL_RATE_TABLE *rt; > > - struct ieee80211_rateset *rs; > > unsigned int i, maxrates; > > > > sc->sc_half_rates =3D ath_hal_getratetable(ah, HAL_MODE_11A_HALF_RATE= ); > > rt =3D sc->sc_half_rates; > > - if (rt !=3D NULL) { > > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > > - DPRINTF(sc, ATH_DEBUG_ANY, > > - "%s: rate table too small (%u > %u)\n", > > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > > - maxrates =3D IEEE80211_RATE_MAXSIZE; > > - } else > > - maxrates =3D rt->rateCount; > > - rs =3D &ic->ic_sup_half_rates; > > - for (i =3D 0; i < maxrates; i++) > > - rs->rs_rates[i] =3D rt->info[i].dot11Rate; > > - rs->rs_nrates =3D maxrates; > > - } > > + if (rt !=3D NULL) > > + ath_rs_add_rates(&ic->ic_sup_half_rates, rt); > > > > sc->sc_quarter_rates =3D ath_hal_getratetable(ah, > > HAL_MODE_11A_QUARTER_RATE); rt =3D sc->sc_quarter_rates; > > - if (rt !=3D NULL) { > > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > > - DPRINTF(sc, ATH_DEBUG_ANY, > > - "%s: rate table too small (%u > %u)\n", > > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > > - maxrates =3D IEEE80211_RATE_MAXSIZE; > > - } else > > - maxrates =3D rt->rateCount; > > - rs =3D &ic->ic_sup_quarter_rates; > > - for (i =3D 0; i < maxrates; i++) > > - rs->rs_rates[i] =3D rt->info[i].dot11Rate; > > - rs->rs_nrates =3D maxrates; > > - } > > + if (rt !=3D NULL) > > + ath_rs_add_rates(&ic->ic_sup_quarter_rates, rt); > > } > > > > static int > > @@ -9351,7 +9324,6 @@ > > struct ath_hal *ah =3D sc->sc_ah; > > struct ieee80211com *ic =3D &sc->sc_ic; > > const HAL_RATE_TABLE *rt; > > - struct ieee80211_rateset *rs; > > unsigned int i, maxrates; > > > > switch (mode) { > > @@ -9375,21 +9347,14 @@ > > __func__, mode); > > return 0; > > } > > + > > rt =3D sc->sc_rates[mode]; > > if (rt =3D=3D NULL) > > return 0; > > - if (rt->rateCount > IEEE80211_RATE_MAXSIZE) { > > - DPRINTF(sc, ATH_DEBUG_ANY, > > - "%s: rate table too small (%u > %u)\n", > > - __func__, rt->rateCount, IEEE80211_RATE_MAXSIZE); > > - maxrates =3D IEEE80211_RATE_MAXSIZE; > > - } else > > - maxrates =3D rt->rateCount; > > - rs =3D &ic->ic_sup_rates[mode]; > > - for (i =3D 0; i < maxrates; i++) > > - rs->rs_rates[i] =3D rt->info[i].dot11Rate; > > - rs->rs_nrates =3D maxrates; > > - return 1; > > + else { > > + ath_rs_add_rates(&ic->ic_sup_rates[mode], rt); > > + return 1; > > + } > > } > > > > static void >=20 >=20 ```