From patchwork Thu Jun 13 07:31:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Pubbisetty X-Patchwork-Id: 10991347 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-2.web.codeaurora.org (Postfix) with ESMTP id B3E881398 for ; Thu, 13 Jun 2019 07:31:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E0D728A18 for ; Thu, 13 Jun 2019 07:31:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B40C28B05; Thu, 13 Jun 2019 07:31:57 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 0889C28A18 for ; Thu, 13 Jun 2019 07:31:56 +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=1iZ10KIo74ZedUCPnADiI73OnOSCQg1cmjxw7qGEl/U=; b=dAj pdcfKBYtniQEUB9pOlzw6LHcKm8IWm5/CxslL4lQAk07KCA7FZ6Y5qi5lvr8KI4tfN0RY/4DlGfFB OXSk18Et+FOeT6PwgEXX7l2FsB4OJBzel97wUk32f4lJ/rNUv4FPOXg+JhclzAhM+g0XxuRX4Nz8z SCwzZDubkSW21mmNK5WhpW2jnMVrHlAaKhgidEzOIoyv9t1cG2sRVnSS+euQ2IYOaFym7tB2gHPiI UIpbRe18Mq9bEyoxdwkfdIA4guMXbK7blURtXG3XxxSRxX/1+XF6eRNBjYEDG/3ewsMaa2s1Wg114 6LJ/+huH0iwMNa11O3iabmCQUyCQVmQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hbKDD-0003xz-GK; Thu, 13 Jun 2019 07:31:55 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hbKDA-0003xX-Ot for ath11k@lists.infradead.org; Thu, 13 Jun 2019 07:31:54 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1D03E6079C; Thu, 13 Jun 2019 07:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1560411111; bh=59+KalQz7/tEZrfhkqyfYjoYMu2NahW6hmeeu8ndrio=; h=From:To:Cc:Subject:Date:From; b=W2vMp6Mm9R1Y43ym/2qrsXMNUo3wryooEN4mxlRWXq2mWghUIzzB2A8JG9T2FHNTM VmKQ2oKPsj/Q/o4YY4pF2R7+aLC9RYGMnndkArTBZQEZzAru7ue0A1P5XkavrVs6/K gWq5HL32y1bRwr/oio4uXOg9Rgcg60DfqAEsFQmg= Received: from vnaralas-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mpubbise@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2C3EE60213; Thu, 13 Jun 2019 07:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1560411110; bh=59+KalQz7/tEZrfhkqyfYjoYMu2NahW6hmeeu8ndrio=; h=From:To:Cc:Subject:Date:From; b=RwBdhvmOj6l7uFuK3BKUy86zae27+WXHmwDFLJfop6W01osJT9d1T7XvKIc2K//Na 64OKHeDgV2YT+yRusCzjF0uDhjnVgiWMft0igp4O+pLctzgzsof1ze0X2Y2SU2CezI axU8kpao3BWda5T1oeC2mIm9ajMppz1sZil3kotw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2C3EE60213 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=mpubbise@codeaurora.org From: Manikanta Pubbisetty To: ath11k@lists.infradead.org Subject: [PATCH v2] ath11k: fix firmware assert due to phymode mismatch Date: Thu, 13 Jun 2019 13:01:37 +0530 Message-Id: <1560411097-9094-1-git-send-email-mpubbise@codeaurora.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190613_003152_851028_FE5C3F6C X-CRM114-Status: GOOD ( 15.34 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Manikanta Pubbisetty MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP IPQ8074 firmware has a logic wherein it would trigger an assert if the phymode configured for the connecting peer is greater than the phymode configured for the VDEV. For example, if VDEV phymode is configured to be 11A and if a HT STA is configured to operate in HT20 then there would be a firmware assert. Fix this by configuring the phy_mode of the connecting peer correctly based on the current capabilties of the VDEV (AP/MESH). Signed-off-by: Manikanta Pubbisetty --- v2: - use correct IE while checking for vht capabilties drivers/net/wireless/ath/ath11k/core.h | 3 +++ drivers/net/wireless/ath/ath11k/mac.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 038f905..f853c3c 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -211,6 +211,9 @@ struct ath11k_vif { int num_legacy_stations; int rtscts_prot_mode; int txpower; + bool ht_enabled; + bool vht_enabled; + bool he_enabled; }; struct ath11k_vif_iter { diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 8c47e09..7ca6958 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -790,6 +790,7 @@ static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) struct ieee80211_vif *vif = arvif->vif; struct ieee80211_mutable_offsets offs = {}; struct sk_buff *bcn; + u8 *ies; int ret; if (arvif->vdev_type != WMI_VDEV_TYPE_AP) @@ -809,6 +810,20 @@ static int ath11k_mac_setup_bcn_tmpl(struct ath11k_vif *arvif) ath11k_warn(ab, "failed to submit beacon template command: %d\n", ret); + ies = bcn->data + ieee80211_get_hdrlen_from_skb(bcn); + ies += 12; /* fixed parameters */ + + /* ht, vht and he capabilities are required to correctly configure + * the bandwidth (phy_mode) of the connecting peer during peer assoc, + * get these capabilities from beacon since mac80211 doesn't provide + * this info to the driver. + */ + arvif->ht_enabled = !!cfg80211_find_ie(WLAN_EID_HT_CAPABILITY, ies, + (u8 *)skb_tail_pointer(bcn) - ies); + arvif->vht_enabled = !!cfg80211_find_ie(WLAN_EID_VHT_CAPABILITY, ies, + (u8 *)skb_tail_pointer(bcn) - ies); + arvif->he_enabled = !!cfg80211_find_ie(WLAN_EID_EXT_HE_CAPABILITY, ies, + (u8 *)skb_tail_pointer(bcn) - ies); return ret; } @@ -1018,7 +1033,7 @@ static void ath11k_peer_assoc_h_ht(struct ath11k *ar, if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) return; - if (!ht_cap->ht_supported) + if (!ht_cap->ht_supported || !arvif->ht_enabled) return; band = def.chan->band; @@ -1177,7 +1192,7 @@ static void ath11k_peer_assoc_h_vht(struct ath11k *ar, if (WARN_ON(ath11k_mac_vif_chan(vif, &def))) return; - if (!vht_cap->vht_supported) + if (!vht_cap->vht_supported || !arvif->vht_enabled) return; band = def.chan->band; @@ -1255,8 +1270,9 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar, struct peer_assoc_params *arg) { const struct ieee80211_sta_he_cap *he_cap = &sta->he_cap; + struct ath11k_vif *arvif = (void *)vif->drv_priv; - if (!he_cap->has_he) + if (!he_cap->has_he || !arvif->he_enabled) return; arg->he_flag = true; @@ -1537,20 +1553,20 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar, switch (band) { case NL80211_BAND_2GHZ: - if (sta->he_cap.has_he) { + if (sta->he_cap.has_he && arvif->he_enabled) { if (sta->bandwidth == IEEE80211_STA_RX_BW_80) phymode = MODE_11AX_HE80_2G; else if (sta->bandwidth == IEEE80211_STA_RX_BW_40) phymode = MODE_11AX_HE40_2G; else phymode = MODE_11AX_HE20_2G; - } else if (sta->vht_cap.vht_supported && + } else if (sta->vht_cap.vht_supported && arvif->vht_enabled && !ath11k_peer_assoc_h_vht_masked(vht_mcs_mask)) { if (sta->bandwidth == IEEE80211_STA_RX_BW_40) phymode = MODE_11AC_VHT40; else phymode = MODE_11AC_VHT20; - } else if (sta->ht_cap.ht_supported && + } else if (sta->ht_cap.ht_supported && arvif->ht_enabled && !ath11k_peer_assoc_h_ht_masked(ht_mcs_mask)) { if (sta->bandwidth == IEEE80211_STA_RX_BW_40) phymode = MODE_11NG_HT40; @@ -1564,12 +1580,12 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar, break; case NL80211_BAND_5GHZ: /* Check HE first */ - if (sta->he_cap.has_he) { + if (sta->he_cap.has_he && arvif->he_enabled) { phymode = ath11k_mac_get_phymode_he(ar, sta); - } else if (sta->vht_cap.vht_supported && + } else if (sta->vht_cap.vht_supported && arvif->vht_enabled && !ath11k_peer_assoc_h_vht_masked(vht_mcs_mask)) { phymode = ath11k_mac_get_phymode_vht(ar, sta); - } else if (sta->ht_cap.ht_supported && + } else if (sta->ht_cap.ht_supported && arvif->ht_enabled && !ath11k_peer_assoc_h_ht_masked(ht_mcs_mask)) { if (sta->bandwidth >= IEEE80211_STA_RX_BW_40) phymode = MODE_11NA_HT40;