From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2.tohojo.dk (mail2.tohojo.dk [77.235.48.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 176E33B2C9 for ; Fri, 3 Jun 2016 12:52:38 -0400 (EDT) X-Virus-Scanned: amavisd-new at mail2.tohojo.dk DKIM-Filter: OpenDKIM Filter v2.10.3 mail2.tohojo.dk F0B0340B3F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=201310; t=1464972750; bh=2ZzWJAyqFuhuX7IvuKI/89khIyBZ2QxtGpe2bB6G1ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ky4urT/FTqkTcIgRQb8Jy1v6utFYinYOwrTCS8ghf6ckmcJt4EzLEABtifjoL/26c whm/DlTlEJlLP09UoJcousRiLlcY8LbZz+g2DD1nkMMN+gDDpZEmAzgo0fIaowjKTT mRgFFiBMHRKl0yTp1/rPdmJ3NIlimfeHaSXp2MOY= Received: by alrua-kau.kau.toke.dk (Postfix, from userid 1000) id 52FC1C40173; Fri, 3 Jun 2016 18:52:25 +0200 (CEST) From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= To: linux-wireless@vger.kernel.org, make-wifi-fast@lists.bufferbloat.net, ath9k-devel@lists.ath9k.org Date: Fri, 3 Jun 2016 18:51:44 +0200 Message-Id: <20160603165144.17356-6-toke@toke.dk> In-Reply-To: <20160603165144.17356-1-toke@toke.dk> References: <20160603165144.17356-1-toke@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Make-wifi-fast] [RFC/RFT 5/5] ath9k: Count RX airtime in airtime deficit X-BeenThere: make-wifi-fast@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2016 16:52:38 -0000 This adds RX airtime to the airtime deficit used in the scheduler. This is not a definite win, but I have only done very limited testing where it has been included. Feel free to skip this patch when testing. Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen --- drivers/net/wireless/ath/ath9k/recv.c | 51 +++++++++++++++++++++++++++++= +++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless= /ath/ath9k/recv.c index 7eb8980..23d6ebe 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -991,6 +991,55 @@ static void ath9k_apply_ampdu_details(struct ath_sof= tc *sc, } } =20 +static void ath_rx_count_airtime(struct ath_softc *sc, + struct ath_rx_status *rs, + struct sk_buff *skb) +{ + struct ath_node *an; + struct ieee80211_hdr *hdr =3D (struct ieee80211_hdr *) skb->data; + struct ath_hw *ah =3D sc->sc_ah; + struct ath_common *common =3D ath9k_hw_common(ah); + struct ieee80211_sta *sta; + struct ieee80211_rx_status *rxs; + const struct ieee80211_rate *rate; + bool is_sgi, is_40, is_sp; + int phy; + u32 airtime =3D 0; + + if (!ieee80211_is_data(hdr->frame_control)) + return; + + rcu_read_lock(); + + sta =3D ieee80211_find_sta_by_ifaddr(sc->hw, hdr->addr2, NULL); + if (!sta) + goto exit; + an =3D (struct ath_node *) sta->drv_priv; + rxs =3D IEEE80211_SKB_RXCB(skb); + + is_sgi =3D !!(rxs->flag & RX_FLAG_SHORT_GI); + is_40 =3D !!(rxs->flag & RX_FLAG_40MHZ); + is_sp =3D !!(rxs->flag & RX_FLAG_SHORTPRE); + + if (!!(rxs->flag & RX_FLAG_HT)) { + /* MCS rates */ + + airtime +=3D ath_pkt_duration(sc, rxs->rate_idx, rs->rs_datalen, + is_40, is_sgi, is_sp); + } else { + + phy =3D IS_CCK_RATE(rs->rs_rate) ? WLAN_RC_PHY_CCK : WLAN_RC_PHY_OFDM; + rate =3D &common->sbands[rxs->band].bitrates[rxs->rate_idx]; + airtime +=3D ath9k_hw_computetxtime(ah, phy, rate->bitrate * 100, + rs->rs_datalen, rxs->rate_idx, is_sp); + } + + an->airtime_deficit -=3D airtime; + ath_debug_airtime(sc, an, airtime, 0); +exit: + rcu_read_unlock(); +} + int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) { struct ath_rxbuf *bf; @@ -1137,7 +1186,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush,= bool hp) ath9k_antenna_check(sc, &rs); ath9k_apply_ampdu_details(sc, &rs, rxs); ath_debug_rate_stats(sc, &rs, skb); - ath_debug_rx_airtime(sc, &rs, skb); + ath_rx_count_airtime(sc, &rs, skb); =20 hdr =3D (struct ieee80211_hdr *)skb->data; if (ieee80211_is_ack(hdr->frame_control)) --=20 2.7.4