From owner-p4-projects@FreeBSD.ORG Sat Dec 3 23:31:16 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0E72516A427; Sat, 3 Dec 2005 23:31:16 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 95FBC16A420 for ; Sat, 3 Dec 2005 23:31:15 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 009BD43D5C for ; Sat, 3 Dec 2005 23:31:15 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jB3NVENI076505 for ; Sat, 3 Dec 2005 23:31:14 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jB3NVE4k076502 for perforce@freebsd.org; Sat, 3 Dec 2005 23:31:14 GMT (envelope-from sam@freebsd.org) Date: Sat, 3 Dec 2005 23:31:14 GMT Message-Id: <200512032331.jB3NVE4k076502@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 87699 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2005 23:31:16 -0000 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));