From patchwork Sat Feb 11 00:09:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 9567655 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A5C8660572 for ; Sat, 11 Feb 2017 00:09:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EB85285CF for ; Sat, 11 Feb 2017 00:09:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83576285F1; Sat, 11 Feb 2017 00:09:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 082B5285CF for ; Sat, 11 Feb 2017 00:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Z6jvb6gwrRRFoBOKyyadqwKkPyKfkLV5/g5ymMBmPQI=; b=sN5 Pft9xeL6nLWSLwfFZxTPtU/uQ2qAKiqzvAY/G8lYgzSvqYhC3Scy7haL6QstKx+aMkeesRkkwuKOl wyvy5PTQstGZX/nmckD0c2m1Pn3y+wtNSqPuqddRPASJePRwC3C4t3ujK0g4mQA18/EZmR24GVrTM X6N+rd5uiFaiNqW2kYi4zwrdwPSStMEECxE5RtFCwakj6ipuuxi1PVKs54T9s8uGyzt3D1pKOHv0W ZEJnkRdyC46+CTM1JeGDUjFlA6wEvLWBJA33ptEAvLZY7kU8KrpOWXMDWWXCawxnttJxFGoEj74qV TLnofyGgcXk/Ixp1y/i0WVTSuXevCRA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ccLFx-0000Dk-GN; Sat, 11 Feb 2017 00:09:37 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ccLFs-0000Ce-Eu for ath10k@lists.infradead.org; Sat, 11 Feb 2017 00:09:35 +0000 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 1EEE840C7D4; Fri, 10 Feb 2017 16:09:09 -0800 (PST) From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Subject: [PATCH] ath10k: Configure rxnss_override for 10.4 firmware. Date: Fri, 10 Feb 2017 16:09:05 -0800 Message-Id: <1486771745-15150-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.11 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170210_160932_577994_F02878CC X-CRM114-Status: GOOD ( 11.48 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear , ath10k@lists.infradead.org MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Greear QCA9984 hardware can do 4x4 at 80Mhz, but only 2x2 at 160Mhz. First, report this to user-space by setting the max-tx-speed and max-rx-speed vht capabilities. Second, if the peer rx-speed is configured, and if we are in 160 or 80+80 mode, and the peer rx-speed matches the max speed for 2x2 or 1x1 at 160Mhz (long guard interval), then use that info to set the peer_bw_rxnss_override appropriately. Without this, a 9984 firmware will not use 2x2 ratesets when transmitting to peer (it will be stuck at 1x1), because the firmware would not have configured the rxnss_override. This could use some testing.... Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/mac.c | 30 +++++++++++++++++++++++++++++- drivers/net/wireless/ath/ath10k/wmi.c | 7 ++++++- drivers/net/wireless/ath/ath10k/wmi.h | 2 ++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index b9c9105..0bde1db 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2760,6 +2760,18 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar, sta->addr, arg->peer_max_mpdu, arg->peer_flags, arg->peer_vht_rates.rx_max_rate, arg->peer_vht_rates.rx_mcs_set, arg->peer_vht_rates.tx_max_rate, arg->peer_vht_rates.tx_mcs_set); + + if ((arg->peer_vht_rates.rx_max_rate) && + (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK)) { + if (arg->peer_vht_rates.rx_max_rate == 1560) { + /* Must be 2x2 at 160Mhz is all it can do. */ + arg->peer_bw_rxnss_override = 2; + } + else if (arg->peer_vht_rates.rx_max_rate == 780) { + /* Can only do 1x2 at 160Mhz (Long Guard Interval) */ + arg->peer_bw_rxnss_override = 1; + } + } } static void ath10k_peer_assoc_h_qos(struct ath10k *ar, @@ -4899,7 +4911,8 @@ static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar) vht_cap.cap |= val; } - if ((ar->vht_cap_info & IEEE80211_VHT_CAP_SHORT_GI_160) && !(ar->vht_cap_info & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) { + if ((ar->vht_cap_info & IEEE80211_VHT_CAP_SHORT_GI_160) && + ((ar->vht_cap_info & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) == 0)) { vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; } @@ -4917,6 +4930,21 @@ static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar) vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map); vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map); + /* If we are supporting 160Mhz or 80+80, then the NIC may be able to do a restricted NSS + * for 160 or 80+80 vs what it can do for 80Mhz. Give user-space a clue if that is the + * case. + */ + if (vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) { + /* Something more than 80Mhz at least */ + if (ar->dev_id == QCA9984_1_0_DEVICE_ID) { + /* Can do only 2x2 VHT160 or 80+80. + * 1560Mbps is 4x4 80Mhz or 2x2 160Mhz, long-guard-interval + */ + vht_cap.vht_mcs.rx_highest = 1560; + vht_cap.vht_mcs.tx_highest = 1560; + } + } + return vht_cap; } diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 38db6be..05ca7f5 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -7036,7 +7036,12 @@ ath10k_wmi_peer_assoc_fill_10_4(struct ath10k *ar, void *buf, struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); - cmd->peer_bw_rxnss_override = 0; + if (arg->peer_bw_rxnss_override) + cmd->peer_bw_rxnss_override = + __cpu_to_le32((arg->peer_bw_rxnss_override - 1) | + (1<peer_bw_rxnss_override = 0; } static int diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 5a71bb4..ccbb1bc 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -6173,6 +6173,7 @@ struct wmi_10_2_peer_assoc_complete_cmd_ct { struct wmi_ct_assoc_overrides overrides; } __packed; +#define PEER_BW_RXNSS_OVERRIDE_OFFSET 31 struct wmi_10_4_peer_assoc_complete_cmd { struct wmi_10_2_peer_assoc_complete_cmd cmd; __le32 peer_bw_rxnss_override; @@ -6201,6 +6202,7 @@ struct wmi_peer_assoc_complete_arg { u32 peer_vht_caps; enum wmi_phy_mode peer_phymode; struct wmi_vht_rate_set_arg peer_vht_rates; + u32 peer_bw_rxnss_override; /* CT firmware only (beta-15 and higher ) */ bool has_rate_overrides;