Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2014730rdh; Tue, 26 Sep 2023 09:44:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdUrWhw1WkOXfY28ZTX9BrMgkzfdURP7vUEUNpJDnSOHtCYd+kuNrxSc9j1iC/7yvbLKdn X-Received: by 2002:a05:6358:6f86:b0:143:4909:729b with SMTP id s6-20020a0563586f8600b001434909729bmr8324795rwn.32.1695746653585; Tue, 26 Sep 2023 09:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695746653; cv=none; d=google.com; s=arc-20160816; b=qx6aLqPuASfb2tzXjyK/aO6+SmXKdqzEMMsMblAEyyuvaeSp6X+wCVwCBJEZdCPA5x wbNoGiH8rlxsomZuVA4mFUlcBiEqhfAqigbgzRFHt+OpnjdifPS5j9GRxJ7/vqscTvoH rA7QhVwz3/cZ0VxZZ+BEhnCO3p+mlXdWpJOHzkHrhvVcWXm2EZLZTRUI55ftEyFGgR64 R2mllKcj2UMOYxdeg5gMhPV9zjkYrzjbGHnrC43GvyqLJ0dMQD+rzixeXtautqqq6PUa Plem+DfuE19F5zc/Bl9GzcOPsLwLyV6tstrhE2CL7rDhePJIDI8sCV9WRk62YW+rtY0K tt1A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=O8lrlqixKf6HXMRrHvdnKqFTUP6NQaL3rj7yix4mITY=; fh=hQUEiiksHvYN/EFmEKRXMJqwCC0zT2cV3viCNHAv7Ok=; b=waiaxtiumYCzYI2t6AT+ge9GjYLejxSzvDGrkOI9WAGClgLaWUd/WBiuYTN5i9xo5l 9fZg/u68oAhDjjGFIulP7OaqJIrbJ/a3A+acwPV7QZW6D6IY6Ngx99fdIjcrdZ0BS8x6 T5fmnsl7kfqo1FQDAiQZTavZ7t254f/1Wduq9AkqDkXMQMJGoR0lOgvcdsx1eVUwxlTp KTN50uJTYl+Km99sRtixRYlWXnCBuJHLu2sAdLYlA3UXMaDhGU2XFAqaxJ4bw8z5dmD3 BL0UyWYai4P6V5pYL6xBznwEgfOa3SBmWiEeeKmuOYWXSgkg0B48GCV3tB7jcAlGksDx i0mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UV1ZoIUA; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l3-20020a63ea43000000b00573fbbb7803si12498982pgk.613.2023.09.26.09.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 09:44:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UV1ZoIUA; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 466D2819DFC6; Tue, 26 Sep 2023 09:33:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235266AbjIZQeB (ORCPT + 56 others); Tue, 26 Sep 2023 12:34:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjIZQeA (ORCPT ); Tue, 26 Sep 2023 12:34:00 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7061BF for ; Tue, 26 Sep 2023 09:33:53 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2124C433C7; Tue, 26 Sep 2023 16:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695746033; bh=IvKOdEnBJNQyWkBCU4bVbujBnX9sEpD8UoOjF/qG9Ww=; h=From:To:Cc:Subject:Date:From; b=UV1ZoIUAArrZkb7hQWKPAXKrQ5FSLd6Pin1aECc2JD2BcZb81TgYX026LK/4plSe9 xBaaP4hKE+TgUdpUu2vgoZN9RSiBrA+x476Z1B3O/ABXAwWDu2NGTHsk4qljARV44M uB8kJPvu2eGd1MfQKi1tEzWnCmIOK0vpO7oJUyW2sA7hL5dQ31OGs+Z1gNtDrao3ip 2TrBjSnbD6WWQdBLiQIgURmRfl6yZAXtoOau5xHGOkfND8ht6z+qJA8kFGxCt5mbFI xHyJa0UDN+u/uoPKFuBP6twr/iij//YsM2l5iYjaDYRONd+q4PU2+VKiv0TMY+lqS6 hJkRxk1nxi/WQ== From: Kalle Valo To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH v2] wifi: ath11k: mac: fix struct ieee80211_sband_iftype_data handling Date: Tue, 26 Sep 2023 19:33:50 +0300 Message-Id: <20230926163350.2641064-1-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 26 Sep 2023 09:33:58 -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 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index c071bf5841af..79059c42e730 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,8 @@ 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); + 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 +8365,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; base-commit: 73e13f6a439b75a9dbc84bbfa0b0d6624b354853 -- 2.39.2