From patchwork Tue Aug 7 01:14:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 1282321 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9F224DF288 for ; Tue, 7 Aug 2012 01:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757129Ab2HGBPr (ORCPT ); Mon, 6 Aug 2012 21:15:47 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:6844 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757126Ab2HGBPr (ORCPT ); Mon, 6 Aug 2012 21:15:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1344302148; x=1375838148; h=from:mime-version:content-transfer-encoding:message-id: date:to:cc:subject; bh=6nblkELzumc43+qzPEbwNW/2aRn+c6eF0vMOkg4q+sc=; b=mZD2ls+wBJQJ20oO2WPPJ2P+9erVJcaqH/cKPLRY3+MEAHlh95vJiZUD 8BsunPCKm/HR07WoE5g7RbGrxBEQhL7tf/MCHyMqXqQZlIoNee7+rFmZ+ vbXn1BMRRXyO5Rz0Gbx1USASGP91dxYgOKBjLE45yJ6s9KdWLjeq9ZQV/ Y=; X-IronPort-AV: E=McAfee;i="5400,1158,6795"; a="219150207" Received: from ironmsg04-r.qualcomm.com ([172.30.46.18]) by wolverine02.qualcomm.com with ESMTP; 06 Aug 2012 18:15:48 -0700 X-IronPort-AV: E=Sophos;i="4.77,723,1336374000"; d="scan'208";a="362751406" Received: from nasanexhc09.na.qualcomm.com ([172.30.39.8]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 06 Aug 2012 18:15:48 -0700 Received: from nasanexhc05.na.qualcomm.com (172.30.48.2) by nasanexhc09.na.qualcomm.com (172.30.39.8) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 6 Aug 2012 18:15:46 -0700 Received: from sarge (172.30.48.1) by qcmail1.qualcomm.com (172.30.48.2) with Microsoft SMTP Server (TLS) id 14.2.309.2; Mon, 6 Aug 2012 18:15:45 -0700 From: Sujith Manoharan MIME-Version: 1.0 Message-ID: <20512.27634.565484.124439@gargle.gargle.HOWL> Date: Tue, 7 Aug 2012 06:44:26 +0530 To: X-Mailer: VM 8.2.0b under 24.1.1 (x86_64-unknown-linux-gnu) CC: Subject: [RFC 10/14] ath9k: Fix RTS/CTS rate selection X-Originating-IP: [172.30.48.1] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The current method of assigning the RTS/CTS rate is completely broken for HT mode and breaks P2P operation. Fix this by using the basic_rates provided to the driver by mac80211. For now, choose the lowest supported basic rate for HT frames. Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath9k/rc.c | 41 +++++++++++++------------------------ 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 78192c1..a94c52b 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c @@ -699,37 +699,25 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc, const struct ath_rate_table *rate_table, struct ieee80211_tx_info *tx_info) { - struct ieee80211_tx_rate *rates = tx_info->control.rates; - int i = 0, rix = 0, cix, enable_g_protection = 0; + struct ieee80211_bss_conf *bss_conf; - /* get the cix for the lowest valid rix */ - for (i = 3; i >= 0; i--) { - if (rates[i].count && (rates[i].idx >= 0)) { - rix = ath_rc_get_rateindex(rate_table, &rates[i]); - break; - } - } - cix = rate_table->info[rix].ctrl_rate; + if (!tx_info->control.vif) + return; + /* + * For legacy frames, mac80211 takes care of CTS protection. + */ + if (!(tx_info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) + return; + + bss_conf = &tx_info->control.vif->bss_conf; - /* All protection frames are transmited at 2Mb/s for 802.11g, - * otherwise we transmit them at 1Mb/s */ - if (sc->hw->conf.channel->band == IEEE80211_BAND_2GHZ && - !conf_is_ht(&sc->hw->conf)) - enable_g_protection = 1; + if (!bss_conf->basic_rates) + return; /* - * If 802.11g protection is enabled, determine whether to use RTS/CTS or - * just CTS. Note that this is only done for OFDM/HT unicast frames. + * For now, use the lowest allowed basic rate for HT frames. */ - if ((tx_info->control.vif && - tx_info->control.vif->bss_conf.use_cts_prot) && - (rate_table->info[rix].phy == WLAN_RC_PHY_OFDM || - WLAN_RC_PHY_HT(rate_table->info[rix].phy))) { - rates[0].flags |= IEEE80211_TX_RC_USE_CTS_PROTECT; - cix = rate_table->info[enable_g_protection].ctrl_rate; - } - - tx_info->control.rts_cts_rate_idx = cix; + tx_info->control.rts_cts_rate_idx = __ffs(bss_conf->basic_rates); } static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, @@ -853,7 +841,6 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, rates[0].count = ATH_TXMAXTRY; } - /* Setup RTS/CTS */ ath_rc_rate_set_rtscts(sc, rate_table, tx_info); }