Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Feb 2011 05:16:59 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218761 - head/sys/dev/ath/ath_rate/sample
Message-ID:  <201102170516.p1H5GxNv096014@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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++) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102170516.p1H5GxNv096014>