From owner-svn-src-all@FreeBSD.ORG Thu Feb 17 05:16:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB8C5106564A; Thu, 17 Feb 2011 05:16:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A951A8FC0A; Thu, 17 Feb 2011 05:16:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1H5GxwL096017; Thu, 17 Feb 2011 05:16:59 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1H5GxNv096014; Thu, 17 Feb 2011 05:16:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201102170516.p1H5GxNv096014@svn.freebsd.org> From: Adrian Chadd Date: Thu, 17 Feb 2011 05:16:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218761 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Feb 2011 05:16:59 -0000 Author: adrian Date: Thu Feb 17 05:16:59 2011 New Revision: 218761 URL: http://svn.freebsd.org/changeset/base/218761 Log: Properly propagate whether the channel is HT40 or not when calculating packet duration for the ath_rate_sample module. This doesn't affect the packet TX at all; only how much time the sample rate module attributes to a completed TX. Modified: head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Wed Feb 16 21:59:42 2011 (r218760) +++ head/sys/dev/ath/ath_rate/sample/sample.c Thu Feb 17 05:16:59 2011 (r218761) @@ -426,18 +426,19 @@ update_stats(struct ath_softc *sc, struc const int size_bin = size_to_bin(frame_size); const int size = bin_to_size(size_bin); int tt, tries_so_far; + int is_ht40 = (an->an_node.ni_htcap & IEEE80211_HTCAP_CHWIDTH40); if (!IS_RATE_DEFINED(sn, rix0)) return; tt = calc_usecs_unicast_packet(sc, size, rix0, short_tries, - MIN(tries0, tries) - 1); + MIN(tries0, tries) - 1, is_ht40); tries_so_far = tries0; if (tries1 && tries_so_far < tries) { if (!IS_RATE_DEFINED(sn, rix1)) return; tt += calc_usecs_unicast_packet(sc, size, rix1, short_tries, - MIN(tries1 + tries_so_far, tries) - tries_so_far - 1); + MIN(tries1 + tries_so_far, tries) - tries_so_far - 1, is_ht40); tries_so_far += tries1; } @@ -445,7 +446,7 @@ update_stats(struct ath_softc *sc, struc if (!IS_RATE_DEFINED(sn, rix2)) return; tt += calc_usecs_unicast_packet(sc, size, rix2, short_tries, - MIN(tries2 + tries_so_far, tries) - tries_so_far - 1); + MIN(tries2 + tries_so_far, tries) - tries_so_far - 1, is_ht40); tries_so_far += tries2; } @@ -453,7 +454,7 @@ update_stats(struct ath_softc *sc, struc if (!IS_RATE_DEFINED(sn, rix3)) return; tt += calc_usecs_unicast_packet(sc, size, rix3, short_tries, - MIN(tries3 + tries_so_far, tries) - tries_so_far - 1); + MIN(tries3 + tries_so_far, tries) - tries_so_far - 1, is_ht40); } if (sn->stats[size_bin][rix0].total_packets < ssc->smoothing_minpackets) { @@ -765,7 +766,8 @@ ath_rate_ctl_reset(struct ath_softc *sc, if ((mask & 1) == 0) continue; printf(" %d/%d", dot11rate(rt, rix), - calc_usecs_unicast_packet(sc, 1600, rix, 0,0)); + calc_usecs_unicast_packet(sc, 1600, rix, 0,0, + (ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40))); } printf("\n"); } @@ -794,7 +796,8 @@ ath_rate_ctl_reset(struct ath_softc *sc, sn->stats[y][rix].last_tx = 0; sn->stats[y][rix].perfect_tx_time = - calc_usecs_unicast_packet(sc, size, rix, 0, 0); + calc_usecs_unicast_packet(sc, size, rix, 0, 0, + (ni->ni_htcap & IEEE80211_HTCAP_CHWIDTH40)); sn->stats[y][rix].average_tx_time = sn->stats[y][rix].perfect_tx_time; } Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Wed Feb 16 21:59:42 2011 (r218760) +++ head/sys/dev/ath/ath_rate/sample/sample.h Thu Feb 17 05:16:59 2011 (r218761) @@ -115,7 +115,9 @@ struct sample_node { */ static unsigned calc_usecs_unicast_packet(struct ath_softc *sc, int length, - int rix, int short_retries, int long_retries) { + int rix, int short_retries, + int long_retries, int is_ht40) +{ const HAL_RATE_TABLE *rt = sc->sc_currates; struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; @@ -198,7 +200,7 @@ static unsigned calc_usecs_unicast_packe /* XXX assumes short preamble */ /* XXX assumes HT/20; the node info isn't yet available here */ - ctsduration += ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, 0, AH_TRUE); + ctsduration += ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, 0, is_ht40); if (cts) /* SIFS + ACK */ ctsduration += rt->info[cix].spAckDuration; @@ -209,7 +211,7 @@ static unsigned calc_usecs_unicast_packe /* XXX assumes short preamble */ /* XXX assumes HT/20; the node info isn't yet available here */ - tt += (long_retries+1)*ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, 0, AH_TRUE); + tt += (long_retries+1)*ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, 0, is_ht40); tt += (long_retries+1)*(t_sifs + rt->info[rix].spAckDuration); for (x = 0; x <= short_retries + long_retries; x++) {