From nobody Fri Dec 19 18:59:37 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAF95ECAAA1 for ; Mon, 24 Oct 2022 13:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236604AbiJXNvn (ORCPT ); Mon, 24 Oct 2022 09:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236575AbiJXNvC (ORCPT ); Mon, 24 Oct 2022 09:51:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE88AB8C07; Mon, 24 Oct 2022 05:41:39 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 2DF64612B2; Mon, 24 Oct 2022 12:41:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EA59C433C1; Mon, 24 Oct 2022 12:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615261; bh=TWFTvW4p2Dpztexkc4b7jVTIaJVik71BVBhYgVSQ+ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WTxV9dj8KIMcsV+AlyY4ogaypRSDPRiCGn8SHVrTEyNg5Natb+x91ExZmreQXROIv UjU31MMTJvB4PVcmmkLPz394ZhgzuaDRa4YkIBfZQb4JrY+dXd7eKcLinXkkQkCCpD 1L6kpl52rwdm51klfU/LMSyA7fXQupAXOAa+ykps= 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 5.15 183/530] wifi: ath11k: fix number of VHT beamformee spatial streams Date: Mon, 24 Oct 2022 13:28:47 +0200 Message-Id: <20221024113053.314122890@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/a= th/ath11k/mac.c index c7ee373a9d2c..ae6e14fe03c7 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -3684,6 +3684,8 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif= *arvif) if (vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)) { nsts =3D vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; nsts >>=3D IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + if (nsts > (ar->num_rx_chains - 1)) + nsts =3D ar->num_rx_chains - 1; value |=3D SM(nsts, WMI_TXBF_STS_CAP_OFFSET); } =20 @@ -3724,7 +3726,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 =3D 0; + int sound_dim =3D 0, nsts =3D 0; =20 subfer =3D !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE)); subfee =3D !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)); @@ -3734,6 +3736,11 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *a= r, u32 *vht_cap) subfer =3D false; } =20 + if (ar->num_rx_chains < 2) { + *vht_cap &=3D ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE); + subfee =3D false; + } + /* If SU Beaformer is not set, then disable MU Beamformer Capability */ if (!subfer) *vht_cap &=3D ~(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); @@ -3746,7 +3753,9 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar= , u32 *vht_cap) sound_dim >>=3D IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; *vht_cap &=3D ~IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK; =20 - /* TODO: Need to check invalid STS and Sound_dim values set by FW? */ + nsts =3D (*vht_cap & IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK); + nsts >>=3D IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + *vht_cap &=3D ~IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; =20 /* Enable Sounding Dimension Field only if SU BF is enabled */ if (subfer) { @@ -3758,9 +3767,15 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *a= r, u32 *vht_cap) *vht_cap |=3D sound_dim; } =20 - /* Use the STS advertised by FW unless SU Beamformee is not supported*/ - if (!subfee) - *vht_cap &=3D ~(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 =3D ar->num_rx_chains - 1; + + nsts <<=3D IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT; + nsts &=3D IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK; + *vht_cap |=3D nsts; + } } =20 static struct ieee80211_sta_vht_cap --=20 2.35.1