From owner-p4-projects@FreeBSD.ORG Sun Oct 19 20:44:08 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B5C80106567B; Sun, 19 Oct 2008 20:44:08 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60EC31065673 for ; Sun, 19 Oct 2008 20:44:08 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4F42B8FC0A for ; Sun, 19 Oct 2008 20:44:08 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m9JKi8iL051682 for ; Sun, 19 Oct 2008 20:44:08 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9JKi81X051680 for perforce@freebsd.org; Sun, 19 Oct 2008 20:44:08 GMT (envelope-from sam@freebsd.org) Date: Sun, 19 Oct 2008 20:44:08 GMT Message-Id: <200810192044.m9JKi81X051680@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 151570 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: Sun, 19 Oct 2008 20:44:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=151570 Change 151570 by sam@sam_ebb on 2008/10/19 20:43:58 move complaints about bad rate codes up a level so we can print the h/w rate code and other useful info Affected files ... .. //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.c#15 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.c#15 (text+ko) ==== @@ -393,11 +393,8 @@ size_bin = size_to_bin(frame_size); size = bin_to_size(size_bin); - if (!(0 <= ndx0 && ndx0 < sn->num_rates)) { - printf("%s: bogus ndx0 %d, max %u, mode %u\n", - __func__, ndx0, sn->num_rates, sc->sc_curmode); + if (!(0 <= ndx0 && ndx0 < sn->num_rates)) return; - } rate = sn->rates[ndx0].rate; tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx0].rix, @@ -405,11 +402,8 @@ MIN(tries0, tries) - 1); tries_so_far += tries0; if (tries1 && tries0 < tries) { - if (!(0 <= ndx1 && ndx1 < sn->num_rates)) { - printf("%s: bogus ndx1 %d, max %u, mode %u\n", - __func__, ndx1, sn->num_rates, sc->sc_curmode); + if (!(0 <= ndx1 && ndx1 < sn->num_rates)) return; - } tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx1].rix, short_tries, MIN(tries1 + tries_so_far, tries) - tries_so_far - 1); @@ -417,11 +411,8 @@ tries_so_far += tries1; if (tries2 && tries0 + tries1 < tries) { - if (!(0 <= ndx2 && ndx2 < sn->num_rates)) { - printf("%s: bogus ndx2 %d, max %u, mode %u\n", - __func__, ndx2, sn->num_rates, sc->sc_curmode); + if (!(0 <= ndx2 && ndx2 < sn->num_rates)) return; - } tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx2].rix, short_tries, MIN(tries2 + tries_so_far, tries) - tries_so_far - 1); @@ -430,11 +421,8 @@ tries_so_far += tries2; if (tries3 && tries0 + tries1 + tries2 < tries) { - if (!(0 <= ndx3 && ndx3 < sn->num_rates)) { - printf("%s: bogus ndx3 %d, max %u, mode %u\n", - __func__, ndx3, sn->num_rates, sc->sc_curmode); + if (!(0 <= ndx3 && ndx3 < sn->num_rates)) return; - } tt += calc_usecs_unicast_packet(sc, size, sn->rates[ndx3].rix, short_tries, MIN(tries3 + tries_so_far, tries) - tries_so_far - 1); @@ -488,6 +476,13 @@ } } +static void +badrate(struct ifnet *ifp, int series, int hwrate, int tries, int status) +{ + if_printf(ifp, "bad series%d hwrate 0x%x, tries %u ts_status 0x%x\n", + series, hwrate, tries, status); +} + void ath_rate_tx_complete(struct ath_softc *sc, struct ath_node *an, const struct ath_buf *bf) @@ -523,6 +518,10 @@ if (!mrr || !(ts->ts_rate & HAL_TXSTAT_ALTRATE)) { int ndx = rate_to_ndx(sn, final_rate); + if (ndx < 0) { + badrate(ifp, 0, ts->ts_rate, long_tries, ts->ts_status); + return; + } /* * Only one rate was used; optimize work. */ @@ -576,6 +575,15 @@ tries3 = MS(ds0->ds_ctl2, AR_XmitDataTries3); ndx3 = rate_to_ndx(sn, rate3); + if (tries0 && ndx0 < 0) + badrate(ifp, 0, hwrate0, tries0, ts->ts_status); + if (tries1 && ndx1 < 0) + badrate(ifp, 1, hwrate1, tries1, ts->ts_status); + if (tries2 && ndx2 < 0) + badrate(ifp, 2, hwrate2, tries2, ts->ts_status); + if (tries3 && ndx3 < 0) + badrate(ifp, 3, hwrate3, tries3, ts->ts_status); + IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, &an->an_node, "%s: size %d finaltsidx %d tries %d %s rate/try [%d/%d %d/%d %d/%d %d/%d]",