Date: Sat, 3 Dec 2005 23:31:14 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 87699 for review Message-ID: <200512032331.jB3NVE4k076502@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=87699 Change 87699 by sam@sam_ebb on 2005/12/03 23:30:32 don't panic if a fixed rate isn't found in the rate set; this can happen for various reasons and we'll be called again later once things settle (if necessary) Affected files ... .. //depot/projects/wifi/sys/dev/ath/ath_rate/amrr/amrr.c#16 edit .. //depot/projects/wifi/sys/dev/ath/ath_rate/onoe/onoe.c#16 edit .. //depot/projects/wifi/sys/dev/ath/ath_rate/sample/sample.c#8 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/ath_rate/amrr/amrr.c#16 (text+ko) ==== @@ -299,7 +299,6 @@ /* NB: the rate set is assumed sorted */ for (; srate >= 0 && RATE(srate) > 72; srate--) ; - KASSERT(srate >= 0, ("bogus rate set")); } } else { /* @@ -313,10 +312,14 @@ srate = ni->ni_rates.rs_nrates - 1; for (; srate >= 0 && RATE(srate) != ic->ic_fixed_rate; srate--) ; - KASSERT(srate >= 0, - ("fixed rate %d not in rate set", ic->ic_fixed_rate)); } - ath_rate_update(sc, ni, srate); + /* + * The selected rate may not be available due to races + * and mode settings. Also orphaned nodes created in + * adhoc mode may not have any rate set so this lookup + * can fail. This is not fatal. + */ + ath_rate_update(sc, ni, srate < 0 ? 0 : srate); #undef RATE } ==== //depot/projects/wifi/sys/dev/ath/ath_rate/onoe/onoe.c#16 (text+ko) ==== @@ -283,7 +283,6 @@ /* NB: the rate set is assumed sorted */ for (; srate >= 0 && RATE(srate) > 72; srate--) ; - KASSERT(srate >= 0, ("bogus rate set")); } } else { /* @@ -297,10 +296,14 @@ srate = ni->ni_rates.rs_nrates - 1; for (; srate >= 0 && RATE(srate) != ic->ic_fixed_rate; srate--) ; - KASSERT(srate >= 0, - ("fixed rate %d not in rate set", ic->ic_fixed_rate)); } - ath_rate_update(sc, ni, srate); + /* + * The selected rate may not be available due to races + * and mode settings. Also orphaned nodes created in + * adhoc mode may not have any rate set so this lookup + * can fail. This is not fatal. + */ + ath_rate_update(sc, ni, srate < 0 ? 0 : srate); #undef RATE } ==== //depot/projects/wifi/sys/dev/ath/ath_rate/sample/sample.c#8 (text+ko) ==== @@ -690,16 +690,20 @@ * A fixed rate is to be used; ic_fixed_rate is the * IEEE code for this rate (sans basic bit). Convert this * to the index into the negotiated rate set for - * the node. We know the rate is there because the - * rate set is checked when the station associates. + * the node. */ /* NB: the rate set is assumed sorted */ srate = ni->ni_rates.rs_nrates - 1; for (; srate >= 0 && RATE(srate) != ic->ic_fixed_rate; srate--) ; - KASSERT(srate >= 0, - ("fixed rate %d not in rate set", ic->ic_fixed_rate)); - sn->static_rate_ndx = srate; + /* + * The fixed rate may not be available due to races + * and mode settings. Also orphaned nodes created in + * adhoc mode may not have any rate set so this lookup + * can fail. + */ + if (srate >= 0) + sn->static_rate_ndx = srate; } DPRINTF(sc, "%s: %s size 1600 rate/tt", __func__, ether_sprintf(ni->ni_macaddr));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512032331.jB3NVE4k076502>