Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp2798999rwe; Sun, 16 Apr 2023 05:48:20 -0700 (PDT) X-Google-Smtp-Source: AKy350YFCBHQGQfiY09hiyh9WLYA/JIOW1qtZ9CmX/adWXFEj7c8VyVxVcW+D/NuD1Y5E1L66uhA X-Received: by 2002:a05:6a20:9149:b0:ef:a696:993a with SMTP id x9-20020a056a20914900b000efa696993amr974694pzc.22.1681649300512; Sun, 16 Apr 2023 05:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681649300; cv=none; d=google.com; s=arc-20160816; b=QWdh82dqu2TuuN/ZC/Hid6ZDEDfc/go0f21hhb0+T7EYQeA/1MUyfG14RImppxzIKc hfN504yr6ybfAE0B4flpM2irGKTF/e+l3W4i+wSYPaLAh+rhqazPV8NH+jKoZLYphSu+ 5Qn/0s5e6Zr88ewJid+L/kir5IY4Yedgx12ZqWRn5P+ILNXQB+kvSnTxXY31PqJj2rdV L7XEkxrKKKm8iTCNSFuwvM3XKL2azOMgbqTqnyZwZCDfcHrJVXqYGIhBNqC9r7DlhXYt RZ0UaRK/IPs3TWR1jGYypGQi3R+e7ZdqgVvfbUSWVIYbuZtym9PwiNlWhYxrFp7r9Vvr Y/Yg== 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=ka3NHBDJlfbGNdc9C1E6pt18hODYPfVQVO0kAvF9vb0=; b=YhJCf9Z5BNQ91E3USARYlaZhmkEuH1sMpRJ+2WGp7VvuhBKLiUkCUhJdYu8Iau77tv VX1qZtdEBdhaMjUhx3dynG4RmllYdpEM428Yt2/uCGJevFJoQqKyU5BReWivFfQSqG21 TBsxEpQsswEBoEdLa9tkJR8A40Cww0wojEEQuhnFLy3mv82k0+vSJOUl9CLmSNiE+X6k vdE39Gnfb0b6iA7b6dPi9xCYAbfr7HBTTuisMPwLJXF7kN2Kkie0TcKQnL9x7teRZ8BK 2qrYUW2Gavy5VteDdcAbuzgRaZKM7X4vxEJ0JLP8a9bvK/kiMcMO14Z8tyzrZ5Jy0GuM Mkjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ecaFxFx9; 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 a8-20020a656548000000b0050b508f68d8si8974007pgw.206.2023.04.16.05.48.11; Sun, 16 Apr 2023 05:48:20 -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=ecaFxFx9; 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 S230269AbjDPMsG (ORCPT + 63 others); Sun, 16 Apr 2023 08:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbjDPMsB (ORCPT ); Sun, 16 Apr 2023 08:48:01 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69E551982 for ; Sun, 16 Apr 2023 05:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681649279; x=1713185279; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=osJNv1XqJ0gGVhm13OAuQ8rgujHmjOlh8YrLkIbvA5E=; b=ecaFxFx9nunbRF+5m/VT7RjBQCfacGQkdQz5FY6yqGM0ZB9phJ/c+gnz nBUSnwx7bwiiW8a7bhbz7h7iiJCqPjwraNbIAoG3LIi7GQ1+GRHwwjmzp PgH9BBi28fGwFUM3yPIMuKkQKDnx+XDk+YPlyc+ikTmYt/OCq5+mVXoDt npcWwVp97s0WSe1ve43GZHF8fqFfJ6BXyJb5IAXVXrc2XNoeZkCACwj1v 6s4tCbApSk+8mYuIfcdpyYnuwkIMrbY8/LU2p7v1afPioPVkf/mcG6bdT ngUc0Rf1a1A81e+XzSzOWVSXzFJHav1JUCtIr1ykB0L2fpI1jK1OlnSNI w==; X-IronPort-AV: E=McAfee;i="6600,9927,10682"; a="333520549" X-IronPort-AV: E=Sophos;i="5.99,202,1677571200"; d="scan'208";a="333520549" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2023 05:47:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10682"; a="640670418" X-IronPort-AV: E=Sophos;i="5.99,202,1677571200"; d="scan'208";a="640670418" Received: from lavnon-mobl.ger.corp.intel.com (HELO ggreenma-mobl2.lan) ([10.214.215.99]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2023 05:47:57 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Gregory Greenman Subject: [PATCH 03/15] wifi: iwlwifi: mvm: fix getting lowest TX rate for MLO Date: Sun, 16 Apr 2023 15:47:27 +0300 Message-Id: <20230416154301.d892f68d3bcd.I7d6927abeea5c3899db225391dbc6a5c77805e80@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230416124739.1260800-1-gregory.greenman@intel.com> References: <20230416124739.1260800-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,URIBL_BLOCKED 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: Johannes Berg In iwl_mvm_mac_ctxt_get_lowest_rate() we were still accessing vif->bss_conf without any multi-link provisions, and also the info->band, both of which isn't valid in MLO. Fix the code to look at the correct link. In case of EAPOL transmissions for the initial 4-way-HS, look up the correct link here as well, and warn if multiple are active. Signed-off-by: Johannes Berg Signed-off-by: Gregory Greenman --- .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c index 20db9fc2e61a..389eef453d17 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c @@ -874,13 +874,40 @@ u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm, struct ieee80211_tx_info *info, struct ieee80211_vif *vif) { + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct ieee80211_supported_band *sband; unsigned long basic = vif->bss_conf.basic_rates; u16 lowest_cck = IWL_RATE_COUNT, lowest_ofdm = IWL_RATE_COUNT; + u32 link_id = u32_get_bits(info->control.flags, + IEEE80211_TX_CTRL_MLO_LINK); + u8 band = info->band; u8 rate; u32 i; - sband = mvm->hw->wiphy->bands[info->band]; + if (link_id == IEEE80211_LINK_UNSPECIFIED && vif->valid_links) { + for (i = 0; i < ARRAY_SIZE(mvmvif->link); i++) { + if (!mvmvif->link[i]) + continue; + /* shouldn't do this when >1 link is active */ + WARN_ON_ONCE(link_id != IEEE80211_LINK_UNSPECIFIED); + link_id = i; + } + } + + if (link_id < IEEE80211_LINK_UNSPECIFIED) { + struct ieee80211_bss_conf *link_conf; + + rcu_read_lock(); + link_conf = rcu_dereference(vif->link_conf[link_id]); + if (link_conf) { + basic = link_conf->basic_rates; + if (link_conf->chandef.chan) + band = link_conf->chandef.chan->band; + } + rcu_read_unlock(); + } + + sband = mvm->hw->wiphy->bands[band]; for_each_set_bit(i, &basic, BITS_PER_LONG) { u16 hw = sband->bitrates[i].hw_value; @@ -892,7 +919,7 @@ u8 iwl_mvm_mac_ctxt_get_lowest_rate(struct iwl_mvm *mvm, } } - if (info->band == NL80211_BAND_2GHZ && !vif->p2p && + if (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) -- 2.38.1