Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp311540rwe; Fri, 14 Apr 2023 03:16:46 -0700 (PDT) X-Google-Smtp-Source: AKy350aYpWh53+nsdWuk+fxyosnwfmzLdSqeLCItIa1fXFZxnlDnIamXyuXHCi3CtnSUy1PSpXBk X-Received: by 2002:a17:902:d488:b0:1a1:be45:9857 with SMTP id c8-20020a170902d48800b001a1be459857mr2340550plg.1.1681467406750; Fri, 14 Apr 2023 03:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681467406; cv=none; d=google.com; s=arc-20160816; b=Rkwnrv4K1BA+0/dL0BYPJQPGijnH8GU5Hcl4HMUcvi5JRvClY13b7c9IbhLsfIQPx1 VypheWtpxgaUbuOKZIWqk0edc2PgQ9KvvPz86qk9ilrAdaRBLGZ9N8u1yktjZki8aJeT VTVqra76NQIf2qcDvpK8eVhp/ZqvkO3KvhJ/WY48Ica7LXsR4/p99BAb6ZqfNz2VRY1l pNxpy2R22zBwN0rh1izCczr7NrNiok2BysRuYZpzwlXZx+fa80GmCaYGZOdnyxWT4NRZ dUCVDdagu0GvTY79RPbL3kQT8tQ3ao3QTMCbzZUa972xtB3oseSY3GAdQZOUn9cUBmUF 5XhQ== 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=JqjKAck+Zjwd8TcVJed271CAfGHo+wqZR7CeO9LLZHg=; b=QrC1TTyIL+6qgsvW/jMcEUXRd3LuLCecc4ODzyWIN/1vSPfGKdF+fT+SwYCR/bmWPB R5OrztOfBNqed7HofBfJ0IYgQds4wa9eCofZGk+Kylvl/1lrAj2/aHKFmlLOe9ckoRSy gWsrrBWB9+MrviaNN8ssRcPFtkl8/ehORvBGQx0kfQfeJiGu+FZKSVRc4ebvk0n+s+8u aBQP3IYC8tBd5ca7IHHU9GxrD6gOrnufrMtXqhteJj/0uE/DBy3IcYvWj0N900nfoP0T OEh/FYBYxNVOMJjM+xfTODACJXyt6EX8a/hF6N+g5fq1YQBp3RD3qq828RhbbjgtrS7h Jh4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hyMJXn1N; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l185-20020a6391c2000000b0051b4a135853si4226872pge.686.2023.04.14.03.16.35; Fri, 14 Apr 2023 03:16:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@intel.com header.s=Intel header.b=hyMJXn1N; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229982AbjDNKP4 (ORCPT + 62 others); Fri, 14 Apr 2023 06:15:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbjDNKPz (ORCPT ); Fri, 14 Apr 2023 06:15:55 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16F1F1FC8 for ; Fri, 14 Apr 2023 03:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681467346; x=1713003346; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p82OLvRfpqwvqSOhI7tVEiN1UuPXnGNNQ1BIcqliosY=; b=hyMJXn1NUM8+x4NkxctKGJm681rrfJMzCb6JqJm4E+DVYJ2vjqzXJ46s d1PEhBzVZ/taNX9xWQFFqebtqBHweGBfoCaWQdTZYd3fSNhrEyep/kbLw JH5KqEVizWrZe+1ehuYBhH7VXwb64rNqcXXQK87Xu3Wl+TUGV9897CU6+ qwlJKYsL4FBOAqu6IzgK126VD4YjpuFcRapavCqsHYRZnh9vXLkxgQY3l we5dCf6LaERFXlT14ZrnIZHG93Jxr0YdJn2NM6Lz1MubRH6VsmjjBpCV6 xMQa++HK08dtagrCOOALCG1XYT71Eb3IrdKsTG+m7MJqLW7+1v4v1LoPL A==; X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="346263693" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="346263693" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2023 03:12:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="692351828" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="692351828" Received: from yalankry-mobl.ger.corp.intel.com (HELO ggreenma-mobl2.lan) ([10.214.233.156]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2023 03:12:46 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Ilan Peer , Gregory Greenman Subject: [PATCH 14/15] wifi: iwlwifi: mvm: Fix setting the rate for non station cases Date: Fri, 14 Apr 2023 13:12:05 +0300 Message-Id: <20230414130637.fa0e4d42205d.Iab4784560c77b965fec070d4d0a1ec84171d94ff@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230414101206.1170180-1-gregory.greenman@intel.com> References: <20230414101206.1170180-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 From: Ilan Peer The setting of the rate used for non station cases did not take into consideration the interface type etc., thus when probe responses are transmitted on P2P Device interface etc. CCK rates were used which is not allowed. Modify the code so the non station case would consider the interface type etc. For HWs/FWs that do not support rate control, preserve the previous behavior, i.e., take the rate from the skb metadata and adjust as needed. Signed-off-by: Ilan Peer Signed-off-by: Gregory Greenman --- .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 10 ++++--- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 +++ drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 26 +++++++++---------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index 962d8c286fd8..20db9fc2e61a 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c @@ -870,9 +870,9 @@ static u32 iwl_mvm_find_ie_offset(u8 *beacon, u8 eid, u32 frame_size) return ie - beacon; } -static u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm, - struct ieee80211_tx_info *info, - struct ieee80211_vif *vif) +u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm, + struct ieee80211_tx_info *info, + struct ieee80211_vif *vif) { struct ieee80211_supported_band *sband; unsigned long basic = vif->bss_conf.basic_rates; @@ -892,7 +892,9 @@ static u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm, } } - if (info->band == NL80211_BAND_2GHZ && !vif->p2p) { + if (info->band == NL80211_BAND_2GHZ && !vif->p2p && + vif->type != NL80211_IFTYPE_P2P_DEVICE && + !(info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)) { if (lowest_cck != IWL_RATE_COUNT) rate = lowest_cck; else if (lowest_ofdm != IWL_RATE_COUNT) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index a4f8b5a04c64..7a8b4be8dcf2 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h @@ -1786,6 +1786,9 @@ int iwl_mvm_mac_ctxt_send_beacon_cmd(struct iwl_mvm *mvm, u8 iwl_mvm_mac_ctxt_get_beacon_rate(struct iwl_mvm *mvm, struct ieee80211_tx_info *info, struct ieee80211_vif *vif); +u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm, + struct ieee80211_tx_info *info, + struct ieee80211_vif *vif); u16 iwl_mvm_mac_ctxt_get_beacon_flags(const struct iwl_fw *fw, u8 rate_idx); void iwl_mvm_mac_ctxt_set_tim(struct iwl_mvm *mvm, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index 478442e16d43..ab448ff6a740 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c @@ -329,23 +329,23 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm, sta ? iwl_mvm_sta_from_mac80211(sta)->sta_state : -1); rate_idx = info->control.rates[0].idx; + + /* For non 2 GHZ band, remap mac80211 rate ndices into driver + * indices. + */ + if (info->band != NL80211_BAND_2GHZ || + (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)) + rate_idx += IWL_FIRST_OFDM_RATE; + + /* For 2.4 GHZ band, check that there is no need to remap */ + BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0); } /* if the rate isn't a well known legacy rate, take the lowest one */ if (rate_idx < 0 || rate_idx >= IWL_RATE_COUNT_LEGACY) - rate_idx = rate_lowest_index( - &mvm->nvm_data->bands[info->band], sta); - - /* - * For non 2 GHZ band, remap mac80211 rate - * indices into driver indices - */ - if (info->band != NL80211_BAND_2GHZ || - (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)) - rate_idx += IWL_FIRST_OFDM_RATE; - - /* For 2.4 GHZ band, check that there is no need to remap */ - BUILD_BUG_ON(IWL_FIRST_CCK_RATE != 0); + rate_idx = iwl_mvm_mac_ctxt_get_lowest_rate(mvm, + info, + info->control.vif); /* Get PLCP rate for tx_cmd->rate_n_flags */ rate_plcp = iwl_mvm_mac80211_idx_to_hwrate(mvm->fw, rate_idx); -- 2.38.1