Commit b82730bf authored by Johannes Berg's avatar Johannes Berg
Browse files

wifi: cfg80211/mac80211: move puncturing into chandef

Aloka originally suggested that puncturing should be part of
the chandef, so that it's treated correctly. At the time, I
disagreed and it ended up not part of the chandef, but I've
now realized that this was wrong. Even for clients, the RX,
and perhaps more importantly, CCA configuration needs to take
puncturing into account.

Move puncturing into the chandef, and adjust all the code
accordingly. Also add a few tests for puncturing in chandef
compatibility checking.

Link: https://lore.kernel.org/linux-wireless/20220214223051.3610-1-quic_alokad@quicinc.com/


Suggested-by: default avatarAloka Dixit <quic_alokad@quicinc.com>
Link: https://msgid.link/20240129194108.307183a5d2e5.I4d7fe2f126b2366c1312010e2900dfb2abffa0f6@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 8616f27b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -2784,9 +2784,6 @@ static void ath12k_mac_bss_info_changed(struct ath12k *ar,
	}

	ath12k_mac_fils_discovery(arvif, info);

	if (changed & BSS_CHANGED_EHT_PUNCTURING)
		arvif->punct_bitmap = info->eht_puncturing;
}

static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
@@ -6373,6 +6370,8 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
		if (WARN_ON(!arvif->is_started))
			continue;

		arvif->punct_bitmap = vifs[i].new_ctx->def.punctured;

		/* Firmware expect vdev_restart only if vdev is up.
		 * If vdev is down then it expect vdev_stop->vdev_start.
		 */
@@ -6473,7 +6472,8 @@ static void ath12k_mac_op_change_chanctx(struct ieee80211_hw *hw,
		goto unlock;

	if (changed & IEEE80211_CHANCTX_CHANGE_WIDTH ||
	    changed & IEEE80211_CHANCTX_CHANGE_RADAR)
	    changed & IEEE80211_CHANCTX_CHANGE_RADAR ||
	    changed & IEEE80211_CHANCTX_CHANGE_PUNCTURING)
		ath12k_mac_update_active_vif_chan(ar, ctx);

	/* TODO: Recalc radar detection */
@@ -6536,7 +6536,7 @@ ath12k_mac_op_assign_vif_chanctx(struct ieee80211_hw *hw,
		   "mac chanctx assign ptr %pK vdev_id %i\n",
		   ctx, arvif->vdev_id);

	arvif->punct_bitmap = link_conf->eht_puncturing;
	arvif->punct_bitmap = ctx->def.punctured;

	/* for some targets bss peer must be created before vdev_start */
	if (ab->hw_params->vdev_start_delay &&
+1 −1
Original line number Diff line number Diff line
@@ -1119,7 +1119,7 @@ void ath6kl_cfg80211_ch_switch_notify(struct ath6kl_vif *vif, int freq,
					NL80211_CHAN_HT20 : NL80211_CHAN_NO_HT);

	wiphy_lock(vif->ar->wiphy);
	cfg80211_ch_switch_notify(vif->ndev, &chandef, 0, 0);
	cfg80211_ch_switch_notify(vif->ndev, &chandef, 0);
	wiphy_unlock(vif->ar->wiphy);
}

+12 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
 * Copyright (C) 2022 - 2023 Intel Corporation
 * Copyright (C) 2022 - 2024 Intel Corporation
 */
#include "mvm.h"
#include "time-event.h"
@@ -195,12 +195,20 @@ int iwl_mvm_link_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
	}

	if (changes & LINK_CONTEXT_MODIFY_EHT_PARAMS) {
		struct ieee80211_chanctx_conf *ctx;
		struct cfg80211_chan_def *def = NULL;

		rcu_read_lock();
		ctx = rcu_dereference(link_conf->chanctx_conf);
		if (ctx)
			def = iwl_mvm_chanctx_def(mvm, ctx);

		if (iwlwifi_mod_params.disable_11be ||
		    !link_conf->eht_support)
		    !link_conf->eht_support || !def)
			changes &= ~LINK_CONTEXT_MODIFY_EHT_PARAMS;
		else
			cmd.puncture_mask =
				cpu_to_le16(link_conf->eht_puncturing);
			cmd.puncture_mask = cpu_to_le16(def->punctured);
		rcu_read_unlock();
	}

	cmd.bss_color = link_conf->he_bss_color.color;
+3 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
 * Copyright (C) 2022-2023 Intel Corporation
 * Copyright (C) 2022-2024 Intel Corporation
 */
#include "mvm.h"

@@ -752,8 +752,8 @@ iwl_mvm_mld_link_info_changed_station(struct iwl_mvm *mvm,
		link_changes |= LINK_CONTEXT_MODIFY_HE_PARAMS;
	}

	/* Update EHT Puncturing info */
	if (changes & BSS_CHANGED_EHT_PUNCTURING && vif->cfg.assoc)
	/* if associated, maybe puncturing changed - we'll check later */
	if (vif->cfg.assoc)
		link_changes |= LINK_CONTEXT_MODIFY_EHT_PARAMS;

	if (link_changes) {
+1 −1
Original line number Diff line number Diff line
@@ -288,6 +288,6 @@ void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work)
	mwifiex_dbg(priv->adapter, MSG,
		    "indicating channel switch completion to kernel\n");
	wiphy_lock(priv->wdev.wiphy);
	cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0, 0);
	cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef, 0);
	wiphy_unlock(priv->wdev.wiphy);
}
Loading