From owner-p4-projects@FreeBSD.ORG Mon Apr 28 22:54:07 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F211B1065687; Mon, 28 Apr 2008 22:54:06 +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 9B3711065681 for ; Mon, 28 Apr 2008 22:54:06 +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 84FCA8FC0A for ; Mon, 28 Apr 2008 22:54:06 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m3SMs67G073572 for ; Mon, 28 Apr 2008 22:54:06 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m3SMs6P1073570 for perforce@freebsd.org; Mon, 28 Apr 2008 22:54:06 GMT (envelope-from sam@freebsd.org) Date: Mon, 28 Apr 2008 22:54:06 GMT Message-Id: <200804282254.m3SMs6P1073570@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 140816 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: Mon, 28 Apr 2008 22:54:07 -0000 http://perforce.freebsd.org/chv.cgi?CH=140816 Change 140816 by sam@sam_ebb on 2008/04/28 22:53:17 o lie to amrr about retry counts to avoid pessmimizing the rate estimator; this is mostly to compensate for bb issues but also papers over the generic amrr algorithm only handling a single tx rate (and we often supply two) o simplify tb_rate data recorded by tx complete status processing; we don't need the rate indices, the rates are sufficient and less work to acquire; also no need to bzero values we always write Affected files ... .. //depot/projects/vap/sys/dev/bwi/if_bwi.c#10 edit .. //depot/projects/vap/sys/dev/bwi/if_bwivar.h#6 edit Differences ... ==== //depot/projects/vap/sys/dev/bwi/if_bwi.c#10 (text+ko) ==== @@ -2942,7 +2942,7 @@ uint32_t mac_ctrl; uint16_t phy_ctrl; bus_addr_t paddr; - int type, ismcast, pkt_len, error; + int type, ismcast, pkt_len, error, rix; #if 0 const uint8_t *p; int i; @@ -2962,7 +2962,6 @@ /* * Find TX rate */ - bzero(tb->tb_rate_idx, sizeof(tb->tb_rate_idx)); tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; if (type != IEEE80211_FC0_TYPE_DATA || (m->m_flags & M_EAPOL)) { rate = rate_fb = tp->mgmtrate; @@ -2971,19 +2970,18 @@ } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { rate = rate_fb = tp->ucastrate; } else { - tb->tb_rate_idx[0] = - ieee80211_amrr_choose(ni, &BWI_NODE(ni)->amn); + rix = ieee80211_amrr_choose(ni, &BWI_NODE(ni)->amn); rate = ni->ni_txrate; - if (tb->tb_rate_idx[0] > 0) { - tb->tb_rate_idx[1] = tb->tb_rate_idx[0] - 1; - rate_fb = ni->ni_rates.rs_rates[tb->tb_rate_idx[1]] & + if (rix > 0) { + rate_fb = ni->ni_rates.rs_rates[rix-1] & IEEE80211_RATE_VAL; } else { rate_fb = rate; - tb->tb_rate_idx[1] = tb->tb_rate_idx[0]; } } + tb->tb_rate[0] = rate; + tb->tb_rate[1] = rate_fb; sc->sc_tx_rate = rate; /* @@ -3147,12 +3145,11 @@ /* * Find TX rate */ - bzero(tb->tb_rate_idx, sizeof(tb->tb_rate_idx)); rate = params->ibp_rate0; rate_fb = (params->ibp_try1 != 0) ? params->ibp_rate1 : params->ibp_rate0; - tb->tb_rate_idx[0] = rate; - tb->tb_rate_idx[1] = rate_fb; + tb->tb_rate[0] = rate; + tb->tb_rate[1] = rate_fb; sc->sc_tx_rate = rate; /* @@ -3347,12 +3344,15 @@ /* NB: update rate control only for unicast frames */ if (hdr->txh_mac_ctrl & htole32(BWI_TXH_MAC_C_ACK)) { - /* Feed back 'acked and data_txcnt' */ - ieee80211_amrr_tx_complete(&bn->amn, - (acked && - (data_txcnt <= BWI_SHRETRY_FB || - tb->tb_rate_idx[0] == tb->tb_rate_idx[1])), - data_txcnt-1); + /* + * Feed back 'acked and data_txcnt'. Note that the + * generic AMRR code only understands one tx rate + * and the estimator doesn't handle real retry counts + * well so to avoid over-aggressive downshifting we + * treat any number of retries as "1". + */ + ieee80211_amrr_tx_complete(&bn->amn, acked, + data_txcnt > 1); } /* ==== //depot/projects/vap/sys/dev/bwi/if_bwivar.h#6 (text+ko) ==== @@ -233,7 +233,7 @@ bus_dmamap_t tb_dmap; struct ieee80211_node *tb_ni; - int tb_rate_idx[2]; + int tb_rate[2]; }; struct bwi_txbuf_data {