Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2605846rdh; Wed, 27 Sep 2023 07:32:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG82t0Snz/Df7ElmxuYPecqcyi0bay8LSVMT5BZWt1qSKJAHbQFLpncqPlp13Rjuv5yFA3G X-Received: by 2002:a17:902:f68e:b0:1c6:2f59:8c4d with SMTP id l14-20020a170902f68e00b001c62f598c4dmr1855469plg.28.1695825164076; Wed, 27 Sep 2023 07:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695825164; cv=none; d=google.com; s=arc-20160816; b=GiJsaaC9dj47/FZaLoObE2EDTk+aOnjISXjOh4/e6TeY5TLU3EAWRrioqzAn1HeEJm m45TBrcxTzNoDnkYa8pOAZKkToZNMQnPSelpDM6totU4SWaDao6MS0goZjVTSZZ+hM75 ys/7IrCt2QSX3xT7talrBKgF8rm7r9MgrhzRQxT0LV2pXIkEwMFS2IYKSSdDMmupLzv9 UbZ96JM5EcXIKLUPG9v1Gb6Ab9YSP31RgXgfz7O3P0o+xC3SxYxoENAOGI/CZaUFzmah cJCybjbuD5ir27A/d++pq2JhikM1mcMc9ShZJSbYL1WHXMOdysfD6TN18+UBa9MqbwUO h9mA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8XcawVooIwFIkJe4bj8qw2KNAk36NghtORgZ3YrswbE=; fh=hQUEiiksHvYN/EFmEKRXMJqwCC0zT2cV3viCNHAv7Ok=; b=KWut4BBNrMCqBkgwiV1JIsRnjR2w/A2NpLtMddvp4TiWmSJyv7KT4vhIfII2JNNMxd UEJWcEjBm/eJa/wF3+Whn8fRN7wlA57GPCAdfzuVvnQPpnV0ApAO+mCDhb3FDc1mjidk 0DpHyWcQ7JMpqGemuCp6YemfQZNAnU4Vt66O6oJUjiz27Q1K7QPDb3uwJRkAji/EhsRB 0z2qfI93dfCeME09OpeLVdfNg09EJ85f6V9D5WI2Gck9CV6KTG7ye11pwM86urkyg3lM 5Gt6z8dY/bCklEX4WJgRrAwawoHZH3LnQ6zN9gaWhlLovWGZL6jgvQnNtN1W363ecmoJ VHXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kzRerRnr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id kg5-20020a170903060500b001c3f96ec6d6si15084199plb.111.2023.09.27.07.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 07:32:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kzRerRnr; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0D5A88028547; Wed, 27 Sep 2023 07:27:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232090AbjI0O1O (ORCPT + 56 others); Wed, 27 Sep 2023 10:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232045AbjI0O1O (ORCPT ); Wed, 27 Sep 2023 10:27:14 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06ABCF9 for ; Wed, 27 Sep 2023 07:27:13 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18E73C433C9; Wed, 27 Sep 2023 14:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695824832; bh=f+v5UowMpSo6BDqMvUCNLp85mOEj74iDaFicyPQ7Wis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzRerRnrqaK2UHiKx3wt5YowrJIudSwqP4eSeUuO0mUduLb5UmO69PeTgl5ZNW0zQ 5BIqMM8RLBDr9d2RCNoIopE5o73o9akyQMUQcfWXenNPzBVafOAAD5nyzDvLS7typq F7li8knimDEpjmNYGTAIH4quRUBgriSwnuOZUJ6PFP9qTjX8ttW4YSs4i4fi0a2s8D 9XTgMFKh8vw6jdhTpnFvJCpJcrvXFPfpUmLfYPR97Ev2yPNL+XzwVZtMEnkK9RCM5L 9SVHmsmXM6/Le21hcC8tOfAo62EzTRD4OLhBnjdk0ahBZrjpXCTZaoeTk542DaJogz nTCF+CpkROfbA== From: Kalle Valo To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH v3 1/1] wifi: ath11k: mac: fix struct ieee80211_sband_iftype_data handling Date: Wed, 27 Sep 2023 17:27:08 +0300 Message-Id: <20230927142708.2897504-2-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927142708.2897504-1-kvalo@kernel.org> References: <20230927142708.2897504-1-kvalo@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 27 Sep 2023 07:27:18 -0700 (PDT) From: Kalle Valo Commit e8c1841278a7 ("wifi: cfg80211: annotate iftype_data pointer with sparse") added sparse checks for struct ieee80211_sband_iftype_data handling which immediately found an issue in ath11k: drivers/net/wireless/ath/ath11k/mac.c:7952:22: warning: incorrect type in argument 1 (different address spaces) drivers/net/wireless/ath/ath11k/mac.c:7952:22: expected struct ieee80211_sta_he_cap const *he_cap drivers/net/wireless/ath/ath11k/mac.c:7952:22: got struct ieee80211_sta_he_cap const [noderef] __iftype_data * The problem here is that we are accessing sband->iftype_data directly even though we should use for_each_sband_iftype_data() or similar. Fortunately there's ieee80211_get_he_iftype_cap_vif() which is just what we need here so use it to get HE capabilities. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 Reported-by: Johannes Berg Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath11k/mac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index c071bf5841af..19e8cb9bf728 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -7910,12 +7910,14 @@ ath11k_mac_get_tx_mcs_map(const struct ieee80211_sta_he_cap *he_cap) static bool ath11k_mac_bitrate_mask_get_single_nss(struct ath11k *ar, + struct ath11k_vif *arvif, enum nl80211_band band, const struct cfg80211_bitrate_mask *mask, int *nss) { struct ieee80211_supported_band *sband = &ar->mac.sbands[band]; u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map); + const struct ieee80211_sta_he_cap *he_cap; u16 he_mcs_map = 0; u8 ht_nss_mask = 0; u8 vht_nss_mask = 0; @@ -7946,7 +7948,11 @@ ath11k_mac_bitrate_mask_get_single_nss(struct ath11k *ar, return false; } - he_mcs_map = le16_to_cpu(ath11k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap)); + he_cap = ieee80211_get_he_iftype_cap_vif(sband, arvif->vif); + if (!he_cap) + return false; + + he_mcs_map = le16_to_cpu(ath11k_mac_get_tx_mcs_map(he_cap)); for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) { if (mask->control[band].he_mcs[i] == 0) @@ -8362,7 +8368,7 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, ieee80211_iterate_stations_atomic(ar->hw, ath11k_mac_disable_peer_fixed_rate, arvif); - } else if (ath11k_mac_bitrate_mask_get_single_nss(ar, band, mask, + } else if (ath11k_mac_bitrate_mask_get_single_nss(ar, arvif, band, mask, &single_nss)) { rate = WMI_FIXED_RATE_NONE; nss = single_nss; -- 2.39.2