From patchwork Thu Apr 26 09:43:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Gottschall X-Patchwork-Id: 10365117 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 B7DA4601D3 for ; Thu, 26 Apr 2018 09:44:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A54E52905B for ; Thu, 26 Apr 2018 09:44:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9721829077; Thu, 26 Apr 2018 09:44:31 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 38E4F2905B for ; Thu, 26 Apr 2018 09:44:30 +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=zPIVwfktC9PxU59gX/xLvwQ0uiapYBbeq3Cd8TLKLqk=; b=KjX qZhCpv/oN/S5t7WCsRKvEKJYqENJlw2ILoUBm6PPqh+m+wvvNskKXw2jBANlPN8TKLyGFjGLyTwBg UNhNDFCMGviejDeXidnzILHjcbULHhSodYn39Xo8Lk66eRYYBHFFbPCJgvJbVb7zJa3ycvvzpEHYc EVYXC8vhmKKi3sZjim7py81t8ACnCjeBIvGcQA1tjMQKN1yrPL/yJmQ3FnD0D4cSWXnCl07gx8bY7 EI+HGTDyONqlNxUdL3AIOCWEuEdkSZkidsj+WrHGe+n9lyl9GiKxel08rEizymbyrxMJi1mgJMPFo 5HGOLmYihlcx2RT9BEakmsCoAfepxRg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBdRv-0008J4-NZ; Thu, 26 Apr 2018 09:44:23 +0000 Received: from smtps.newmedia-net.de ([2a05:a1c0:0:de::167] helo=webmail.newmedia-net.de) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBdRp-0008II-KX for ath10k@lists.infradead.org; Thu, 26 Apr 2018 09:44:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dd-wrt.com; s=mikd; h=Message-Id:Date:Subject:Cc:To:From; bh=bNp8x4hhGtHhB+MVoYy+augsp5oprAwqLaE/EBmQs+o=; b=WeoshXlw0RUHY4SNdQnLRpTwqUX09aUchag0NfyC48DDLSlbFWv0Y4gzNuwKJCpHXDpyy9KAfBhBIKT1LGVMjC5DO2pb8COR5mySuSCefsC9XJe74DBD/r7zAokb1NJ6w063lQFUaApx/0BX9QSBBrSOYRsPJd9JN/Z3s6deHf4=; From: s.gottschall@dd-wrt.com To: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Subject: [PATCH v1] ath10k: fix band_center_freq handling for VHT160 in recent firmwares Date: Thu, 26 Apr 2018 11:43:57 +0200 Message-Id: <20180426094357.24358-1-s.gottschall@dd-wrt.com> X-Mailer: git-send-email 2.14.1 X-Received: from [2003:c9:3f40:cb00:be5f:f4ff:febd:cb45] (helo=localhost.localdomain) by webmail.newmedia-net.de with esmtpa (Exim 4.72) (envelope-from ) id 1fBdRd-0000b4-Lq; Thu, 26 Apr 2018 11:44:05 +0200 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180426_024419_714226_3798FC0F X-CRM114-Status: GOOD ( 10.78 ) 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: Sebastian Gottschall , kvalo@codeaurora.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: Sebastian Gottschall starting with firmware 10.4.3.4.x series QCA changed the handling of the channel property band_center_freq1 and band_center_freq2 in vht160 operation mode likelly for backward compatiblity with vht80 only capable clients. this patch adjusts the handling to get vht160 to work again with official qca firmwares newer than 3.3 consider that this patch will not work with older firmwares anymore. to avoid undefined behaviour this we disable vht160 capability for outdated firmwares --- drivers/net/wireless/ath/ath10k/mac.c | 7 ------- drivers/net/wireless/ath/ath10k/wmi.c | 11 ++++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 5be6386ede8f..d1239d40ac19 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4449,13 +4449,6 @@ static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar) vht_cap.cap |= val; } - /* Currently the firmware seems to be buggy, don't enable 80+80 - * mode until that's resolved. - */ - 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; - mcs_map = 0; for (i = 0; i < 8; i++) { if ((i < ar->num_rf_chains) && (ar->cfg_tx_chainmask & BIT(i))) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 2c36256a441d..d78b8857a513 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -1671,13 +1671,18 @@ void ath10k_wmi_put_wmi_channel(struct wmi_channel *ch, flags |= WMI_CHAN_FLAG_HT40_PLUS; if (arg->chan_radar) flags |= WMI_CHAN_FLAG_DFS; - + ch->band_center_freq2 = 0; ch->mhz = __cpu_to_le32(arg->freq); ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1); if (arg->mode == MODE_11AC_VHT80_80) ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq2); - else - ch->band_center_freq2 = 0; + if (arg->mode == MODE_11AC_VHT160) { + if (arg->freq < arg->band_center_freq1) + ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 - 40); + else + ch->band_center_freq1 = __cpu_to_le32(arg->band_center_freq1 + 40); + ch->band_center_freq2 = __cpu_to_le32(arg->band_center_freq1); + } ch->min_power = arg->min_power; ch->max_power = arg->max_power; ch->reg_power = arg->max_reg_power;