From patchwork Fri Jun 9 11:07:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 9778087 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 89AF86034B for ; Fri, 9 Jun 2017 11:08:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B4E4285FB for ; Fri, 9 Jun 2017 11:08:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 701B428609; Fri, 9 Jun 2017 11:08:34 +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=unavailable 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 D51A0285FB for ; Fri, 9 Jun 2017 11:08:33 +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:References: In-Reply-To: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:List-Owner; bh=DlBPqf8Zm9XDJUTomia3kx4gP8UlQa6MKIYKxlWkbBg=; b=p0DBcu+tdFrur2pWkPG20I0c6Q 7cT5H0uTMt6F//iTUr/8shumII4jpB7EnWl9rlSA8SzJdN48xDcPUtfV0VSvuH4FSrn5qCO4oHqV0 JrisxrPheSFwtyJYi9PXObs8tIqzH8s5VlQ/2nosXA/IHM0F6Wm2WA1aZGu/uRUptYHSPW2/WxLb4 E6jDqlyfEj02UUIvbqF8uJWZ9wQ4njZl6NlqmmjDnf+hkAjbLTOi/pGCUZFuv1yzzawHPBcCHLMPB MC1QFJkO/jgv4kuVaNF2N0yb1KB4MRK1hekq9iJ1w3dyHQ49hynH9oYQQekrmxp+WFNcYI60wh3OH O167S+yw==; 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 1dJHmH-0002Oh-0f; Fri, 09 Jun 2017 11:08:29 +0000 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dJHmD-0002JP-2j for ath10k@lists.infradead.org; Fri, 09 Jun 2017 11:08:27 +0000 Received: by mail-wr0-x22a.google.com with SMTP id q97so29169665wrb.2 for ; Fri, 09 Jun 2017 04:08:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openmesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zRhLLmy052OcJMtyG41TMReHOO2R91yb+cGdln2M/os=; b=oeht3UDaEctAnv4Co16S0B2tU45y9R7M0c+0e2tXxPWGFqC/9jdNpdvLSAeJcuJBl/ hpjRqKxOGzlsrgwkEiilVIyFhsvbosF0HmtaMY1XgBDU3ZpaviI/E0qZekO3i8+fun39 Y1swCK5V5ewthPdy9lTdOZayfoYc1blqVRQHNzdfq+Kxfka3XisaJH7cGqXEsq1kdxJ8 5bgkASgyNF/zT72aRIc5pbmQLOqiIU1skokIrKEBzWgYWjRC0JwYPLwmh0TXxMMR+nwQ Aq7k3uH/OWn6vVtP32hzcfKmMg3ycIKwtS4MEicf+ZSCYbtD1l3n49LN//gM/0vDyqxl HhJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zRhLLmy052OcJMtyG41TMReHOO2R91yb+cGdln2M/os=; b=pWkRZkMABGCRxUPN+Eg1z6jBbr3uDr1elNYBpc9rzLVTXvJbyFvdiBhkuJP0wuiULg cWaQuuxF44+XwK/XH3U3cENZaniypiDA4MGs36wPLmGDo1zRzDy8iLphiH0NT/SzMbih J65sYaqv1k4DZ94dawK+osHya1Vjsm4Q/0WuRG6S0E2e7TA4jsB+mUDJ7VPqQr5DyCTn RtcbuzskIt+XZPQjUIgGw4U1AjAvw0weEyItq6vICUZj/vIxztSsQV/04lNwcoo3Qf0S PmzmNPk9WWNbUPzXeqUyD+YMqSfBVe5NDp2RQ+sU3kMuvlruGwpOcArzzFs5QWsj5L+g Ad5Q== X-Gm-Message-State: AODbwcAqL8YYRXe4LnT1nIyv5yRfujNdUJA5/VdIlqSO3LLRXgslFiKl uS/8cm2ZZi2OsedvwDc= X-Received: by 10.28.54.154 with SMTP id y26mr7258470wmh.53.1497006482839; Fri, 09 Jun 2017 04:08:02 -0700 (PDT) Received: from sven-desktop.home.narfation.org (p2003007C6F55E5FE527B9DFFFECE2683.dip0.t-ipconnect.de. [2003:7c:6f55:e5fe:527b:9dff:fece:2683]) by smtp.gmail.com with ESMTPSA id x126sm1547354wme.12.2017.06.09.04.08.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Jun 2017 04:08:02 -0700 (PDT) From: Sven Eckelmann To: ath10k@lists.infradead.org Subject: [PATCH v2 2/3] ath10k: Configure rxnss_override for 10.4 firmware. Date: Fri, 9 Jun 2017 13:07:49 +0200 Message-Id: <20170609110750.14950-2-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170609110750.14950-1-sven.eckelmann@openmesh.com> References: <20170609110750.14950-1-sven.eckelmann@openmesh.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170609_040825_325847_67859836 X-CRM114-Status: GOOD ( 14.28 ) 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 , linux-wireless@vger.kernel.org, Sven Eckelmann 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 [sven.eckelmann@openmesh.com: rebase, cleanup, drop 160Mhz workaround cleanup] Signed-off-by: Sven Eckelmann --- v2: - rebased patch - minor cleanups - removal of the 160 MHz workaround (see patch 1) drivers/net/wireless/ath/ath10k/mac.c | 31 +++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/wmi.c | 7 ++++++- drivers/net/wireless/ath/ath10k/wmi.h | 2 ++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 8087b6be5484..0752cf351b4a 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2519,6 +2519,20 @@ static void ath10k_peer_assoc_h_vht(struct ath10k *ar, ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n", sta->addr, arg->peer_max_mpdu, arg->peer_flags); + + if (arg->peer_vht_rates.rx_max_rate && + (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK)) { + switch (arg->peer_vht_rates.rx_max_rate) { + case 1560: + /* Must be 2x2 at 160Mhz is all it can do. */ + arg->peer_bw_rxnss_override = 2; + break; + case 780: + /* Can only do 1x1 at 160Mhz (Long Guard Interval) */ + arg->peer_bw_rxnss_override = 1; + break; + } + } } static void ath10k_peer_assoc_h_qos(struct ath10k *ar, @@ -4408,6 +4422,23 @@ 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) { + switch (ar->dev_id) { + case 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; + break; + } + } + return vht_cap; } diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 6afc8d27f0d5..2c3b0214ba5f 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -6757,7 +6757,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) | + BIT(PEER_BW_RXNSS_OVERRIDE_OFFSET)); + else + cmd->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 1b4865a55595..dd6cac150749 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -6028,6 +6028,7 @@ struct wmi_10_2_peer_assoc_complete_cmd { __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */ } __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; @@ -6051,6 +6052,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; }; struct wmi_peer_add_wds_entry_cmd {