From patchwork Wed Jul 4 09:54:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Gottschall X-Patchwork-Id: 10506439 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 2ECE2603D7 for ; Wed, 4 Jul 2018 09:54:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F2A228DD5 for ; Wed, 4 Jul 2018 09:54:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2329728DD9; Wed, 4 Jul 2018 09:54:56 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE24628DD5 for ; Wed, 4 Jul 2018 09:54:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933160AbeGDJyx (ORCPT ); Wed, 4 Jul 2018 05:54:53 -0400 Received: from smtps.newmedia-net.de ([185.84.6.167]:32809 "EHLO webmail.newmedia-net.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932392AbeGDJyx (ORCPT ); Wed, 4 Jul 2018 05:54:53 -0400 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=kaRlegfLj7Xb2sFQCLUmbYQW1Zj0kuNbKYaO91iHtcc=; b=g6ygdUOhiLYZl8ZaiAF0oqxVdnM5zxfk70ID4n7BD9PEQpMbqYeHUmq50H6x+v4qHlzL/TUVeqY8eFDrxZkLHUO676L2drFve29xz9aNkWEccMMm71V4mkoAPSMSek4dtnKeVxGbCHmyGAqPFQBPz0jNmZSkZi/by9XYUnW/8Zg=; From: s.gottschall@dd-wrt.com To: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org Cc: kvalo@codeaurora.org, Sebastian Gottschall Subject: [PATCH v2] ath10k: fix band_center_freq handling for VHT160 in recent firmwares Date: Wed, 4 Jul 2018 11:54:44 +0200 Message-Id: <20180704095444.662-1-s.gottschall@dd-wrt.com> X-Mailer: git-send-email 2.17.1 X-Received: from [2003:c9:3f1d:6800:be5f:f4ff:febd:cb45] (helo=localhost.localdomain) by webmail.newmedia-net.de with esmtpa (Exim 4.72) (envelope-from ) id 1faeUt-0001fD-PU; Wed, 04 Jul 2018 11:54:51 +0200 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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 compatibility 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 we disable vht160 capability for outdated firmwares Signed-off-by: Sebastian Gottschall v2: fix trailing whitespace issue and fix some typos within the commit note --- 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 95243b48a179..46885b915eb7 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -4442,13 +4442,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 877249ac6fd4..e2adf34effb3 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -1677,13 +1677,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;