Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp913311rwi; Wed, 19 Oct 2022 04:41:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ox8w9sn7DMoQO0gZmfbyHYua4qZ2nrHMWJnlo9o0zG+KAjQYtJrRI353epiMi0pGCpY15 X-Received: by 2002:a17:90b:1d8b:b0:20d:30a5:499e with SMTP id pf11-20020a17090b1d8b00b0020d30a5499emr45351602pjb.84.1666179663077; Wed, 19 Oct 2022 04:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179663; cv=none; d=google.com; s=arc-20160816; b=LW2EThYr9o/CwJffDWTbV3OEyce9H/Tct6QlRdRlWS1jGdQRsagam3DEnKkz8KFwQi cb+P51ij5vs/4ZcErLeTQEcDWh25izC068ueTBCoQSxDW+qM0j3c+3NCCOkcGj28Ee5G X8JhjDThYzXZhSsIEmvU6vj/hcAqyjabBBRIpRnqmT8RoCToD41u0Pk3BhbRgIPrwJjA Z/jFOHE5yEahtzSJAqxqMWjG1wEfDRsXXXWsGzveaIBaXoRMibK2USPn2GXQ0OnFhhiK AvU5rdRhibe/cQLI0BZdxANjPXRSKN8MKeUBxxYyu/FiToyZRjRKBql9jrXUbFqcD7En 3eKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cThV5rtMIYLgxa1lUHUksv0mAjKNspXtgJPBcTj7Edk=; b=FKGLcuaI7w4pXuER5xEbbynGLfcQSdsoNZq/8ldjx1oLHyYF/oMqshPVB8g57hM2q0 SpZBM2titKwq9op0FZy9TI2qMuyshcmDKBf6BFbFZ8asl94yCv4uyuIa8WRtuDgy8Uj7 XkM87rtQEwmPxnNV7w6H69+NYGOHu/c/eP+FTqNze/E+x8zSUYcPl+Z/cnxpEnz0TbG1 txooaupzYJCaZ1jC6+9nIu7+g4Xr98cpSU2lnea+vMqOvJTOZnm0xepM+CGqq2Rmzl0+ 6tH1+R9InCwuXvmI52/y5Q/JOM1Wikk6Yy/f0VCuc0VzQrOkPdYn7492E2r/9vMrgMV9 JYcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ddUxmY9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a056a00199500b0052e7d706a6fsi19753465pfl.149.2022.10.19.04.40.51; Wed, 19 Oct 2022 04:41:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ddUxmY9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbiJSKfq (ORCPT + 99 others); Wed, 19 Oct 2022 06:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232103AbiJSKe3 (ORCPT ); Wed, 19 Oct 2022 06:34:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AD26E4E46; Wed, 19 Oct 2022 03:13:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 822B3B823AF; Wed, 19 Oct 2022 08:53:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECD19C433C1; Wed, 19 Oct 2022 08:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169611; bh=ocXP7p6k+F8ZylaxYyqY5HxHpFjlyhStwz5dqTrHkEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ddUxmY9p9/TUb1OtthEZfaIpvAnZFThYLtZD+lgQ/9h04VdL2h8YtL01fGGeUD8U0 K7ueGdkU2v57hvrqCWIDBmMLs9Q/kFOOx//9utQmmtwifb6Xe/anDjMIpAyrN9f8TV 7oQ8jubuAE2c+VIzUDpToY/n4kFdRptD6G2OxrlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesus Fernandez Manzano , Kalle Valo , Sasha Levin Subject: [PATCH 6.0 308/862] wifi: ath11k: fix number of VHT beamformee spatial streams Date: Wed, 19 Oct 2022 10:26:35 +0200 Message-Id: <20221019083303.635120026@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jesus Fernandez Manzano [ Upstream commit 55b5ee3357d7bb98ee578cf9b84a652e7a1bc199 ] The number of spatial streams used when acting as a beamformee in VHT mode are reported by the firmware as 7 (8 sts - 1) both in IPQ6018 and IPQ8074 which respectively have 2 and 4 sts each. So the firmware should report 1 (2 - 1) and 3 (4 - 1). Fix this by checking that the number of VHT beamformee sts reported by the firmware is not greater than the number of receiving antennas - 1. The fix is based on the same approach used in this same function for sanitizing the number of sounding dimensions reported by the firmware. Without this change, acting as a beamformee in VHT mode is not working properly. Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Signed-off-by: Jesus Fernandez Manzano Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220616173947.21901-1-jesus.manzano@galgus.net Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/mac.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 7e91e347c9ff..7f6521314b2d 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -4954,6 +4954,8 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif) if (vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)) { nsts = vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; value |= SM(nsts, WMI_TXBF_STS_CAP_OFFSET); } @@ -4994,7 +4996,7 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif) static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) { bool subfer, subfee; - int sound_dim = 0; + int sound_dim = 0, nsts = 0; subfer = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)); subfee = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)); @@ -5004,6 +5006,11 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) subfer = false; } + if (ar->num_rx_chains < 2) { + *vht_cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); + subfee = false; + } + /* If SU Beaformer is not set, then disable MU Beamformer Capability */ if (!subfer) *vht_cap &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); @@ -5016,7 +5023,9 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) sound_dim >>= IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; *vht_cap &= ~IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK; - /* TODO: Need to check invalid STS and Sound_dim values set by FW? */ + nsts = (*vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + nsts >>= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + *vht_cap &= ~IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; /* Enable Sounding Dimension Field only if SU BF is enabled */ if (subfer) { @@ -5028,9 +5037,15 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) *vht_cap |= sound_dim; } - /* Use the STS advertised by FW unless SU Beamformee is not supported*/ - if (!subfee) - *vht_cap &= ~(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + /* Enable Beamformee STS Field only if SU BF is enabled */ + if (subfee) { + if (nsts > (ar->num_rx_chains - 1)) + nsts = ar->num_rx_chains - 1; + + nsts <<= IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + nsts &= IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; + *vht_cap |= nsts; + } } static struct ieee80211_sta_vht_cap -- 2.35.1