diff mbox series

[15/15] wifi: cfg80211/mac80211: move puncturing into chandef

Message ID 20240129194108.307183a5d2e5.I4d7fe2f126b2366c1312010e2900dfb2abffa0f6@changeid
State New
Headers show
Series wifi: support wider-BW OFDMA and fix puncturing | expand

Commit Message

Johannes Berg Jan. 29, 2024, 6:34 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

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.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 drivers/net/wireless/ath/ath6kl/cfg80211.c    |   2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/link.c |  16 +-
 .../wireless/intel/iwlwifi/mvm/mld-mac80211.c |   6 +-
 drivers/net/wireless/marvell/mwifiex/11h.c    |   2 +-
 .../net/wireless/quantenna/qtnfmac/event.c    |   2 +-
 drivers/net/wireless/realtek/rtw89/fw.c       |   5 +-
 include/net/cfg80211.h                        |  44 ++---
 include/net/mac80211.h                        |  11 +-
 net/mac80211/cfg.c                            |  21 +-
 net/mac80211/chan.c                           |  10 +-
 net/mac80211/link.c                           |   2 +-
 net/mac80211/mlme.c                           | 180 +++---------------
 net/mac80211/util.c                           |  26 ++-
 net/wireless/chan.c                           |  62 +++---
 net/wireless/nl80211.c                        |  67 +++----
 net/wireless/tests/chan.c                     |  48 ++++-
 net/wireless/trace.h                          |  38 ++--
 17 files changed, 222 insertions(+), 320 deletions(-)

Comments

kernel test robot Jan. 30, 2024, 6:45 a.m. UTC | #1
Hi Johannes,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[cannot apply to wireless/main staging/staging-testing staging/staging-next staging/staging-linus linus/master v6.8-rc2 next-20240130]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Johannes-Berg/wifi-mac80211-clean-up-band-switch-in-duration/20240130-025313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20240129194108.307183a5d2e5.I4d7fe2f126b2366c1312010e2900dfb2abffa0f6%40changeid
patch subject: [PATCH 15/15] wifi: cfg80211/mac80211: move puncturing into chandef
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20240130/202401301417.rknKsCyo-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 4a39d08908942b2d415db405844cbe4af73e75d4)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240130/202401301417.rknKsCyo-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401301417.rknKsCyo-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/net/wireless/ath/ath12k/mac.c:2771:16: error: use of undeclared identifier 'BSS_CHANGED_EHT_PUNCTURING'
    2771 |         if (changed & BSS_CHANGED_EHT_PUNCTURING)
         |                       ^
>> drivers/net/wireless/ath/ath12k/mac.c:2772:31: error: no member named 'eht_puncturing' in 'struct ieee80211_bss_conf'
    2772 |                 arvif->punct_bitmap = info->eht_puncturing;
         |                                       ~~~~  ^
   drivers/net/wireless/ath/ath12k/mac.c:6374:35: error: no member named 'eht_puncturing' in 'struct ieee80211_bss_conf'
    6374 |         arvif->punct_bitmap = link_conf->eht_puncturing;
         |                               ~~~~~~~~~  ^
   3 errors generated.


vim +/BSS_CHANGED_EHT_PUNCTURING +2771 drivers/net/wireless/ath/ath12k/mac.c

d889913205cf7e Kalle Valo    2022-11-28  2493  
d889913205cf7e Kalle Valo    2022-11-28  2494  static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
d889913205cf7e Kalle Valo    2022-11-28  2495  					   struct ieee80211_vif *vif,
d889913205cf7e Kalle Valo    2022-11-28  2496  					   struct ieee80211_bss_conf *info,
d889913205cf7e Kalle Valo    2022-11-28  2497  					   u64 changed)
d889913205cf7e Kalle Valo    2022-11-28  2498  {
d889913205cf7e Kalle Valo    2022-11-28  2499  	struct ath12k *ar = hw->priv;
d889913205cf7e Kalle Valo    2022-11-28  2500  	struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
d889913205cf7e Kalle Valo    2022-11-28  2501  	struct cfg80211_chan_def def;
d889913205cf7e Kalle Valo    2022-11-28  2502  	u32 param_id, param_value;
d889913205cf7e Kalle Valo    2022-11-28  2503  	enum nl80211_band band;
d889913205cf7e Kalle Valo    2022-11-28  2504  	u32 vdev_param;
d889913205cf7e Kalle Valo    2022-11-28  2505  	int mcast_rate;
d889913205cf7e Kalle Valo    2022-11-28  2506  	u32 preamble;
d889913205cf7e Kalle Valo    2022-11-28  2507  	u16 hw_value;
d889913205cf7e Kalle Valo    2022-11-28  2508  	u16 bitrate;
d889913205cf7e Kalle Valo    2022-11-28  2509  	int ret;
d889913205cf7e Kalle Valo    2022-11-28  2510  	u8 rateidx;
d889913205cf7e Kalle Valo    2022-11-28  2511  	u32 rate;
d889913205cf7e Kalle Valo    2022-11-28  2512  
d889913205cf7e Kalle Valo    2022-11-28  2513  	mutex_lock(&ar->conf_mutex);
d889913205cf7e Kalle Valo    2022-11-28  2514  
d889913205cf7e Kalle Valo    2022-11-28  2515  	if (changed & BSS_CHANGED_BEACON_INT) {
d889913205cf7e Kalle Valo    2022-11-28  2516  		arvif->beacon_interval = info->beacon_int;
d889913205cf7e Kalle Valo    2022-11-28  2517  
d889913205cf7e Kalle Valo    2022-11-28  2518  		param_id = WMI_VDEV_PARAM_BEACON_INTERVAL;
d889913205cf7e Kalle Valo    2022-11-28  2519  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2520  						    param_id,
d889913205cf7e Kalle Valo    2022-11-28  2521  						    arvif->beacon_interval);
d889913205cf7e Kalle Valo    2022-11-28  2522  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2523  			ath12k_warn(ar->ab, "Failed to set beacon interval for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2524  				    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2525  		else
d889913205cf7e Kalle Valo    2022-11-28  2526  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2527  				   "Beacon interval: %d set for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2528  				   arvif->beacon_interval, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2529  	}
d889913205cf7e Kalle Valo    2022-11-28  2530  
d889913205cf7e Kalle Valo    2022-11-28  2531  	if (changed & BSS_CHANGED_BEACON) {
d889913205cf7e Kalle Valo    2022-11-28  2532  		param_id = WMI_PDEV_PARAM_BEACON_TX_MODE;
c4cb46dfb291e1 Sidhanta Sahu 2023-09-05  2533  		param_value = WMI_BEACON_BURST_MODE;
d889913205cf7e Kalle Valo    2022-11-28  2534  		ret = ath12k_wmi_pdev_set_param(ar, param_id,
d889913205cf7e Kalle Valo    2022-11-28  2535  						param_value, ar->pdev->pdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2536  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2537  			ath12k_warn(ar->ab, "Failed to set beacon mode for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2538  				    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2539  		else
d889913205cf7e Kalle Valo    2022-11-28  2540  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
c4cb46dfb291e1 Sidhanta Sahu 2023-09-05  2541  				   "Set burst beacon mode for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2542  				   arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2543  
d889913205cf7e Kalle Valo    2022-11-28  2544  		ret = ath12k_mac_setup_bcn_tmpl(arvif);
d889913205cf7e Kalle Valo    2022-11-28  2545  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2546  			ath12k_warn(ar->ab, "failed to update bcn template: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2547  				    ret);
d889913205cf7e Kalle Valo    2022-11-28  2548  	}
d889913205cf7e Kalle Valo    2022-11-28  2549  
d889913205cf7e Kalle Valo    2022-11-28  2550  	if (changed & (BSS_CHANGED_BEACON_INFO | BSS_CHANGED_BEACON)) {
d889913205cf7e Kalle Valo    2022-11-28  2551  		arvif->dtim_period = info->dtim_period;
d889913205cf7e Kalle Valo    2022-11-28  2552  
d889913205cf7e Kalle Valo    2022-11-28  2553  		param_id = WMI_VDEV_PARAM_DTIM_PERIOD;
d889913205cf7e Kalle Valo    2022-11-28  2554  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2555  						    param_id,
d889913205cf7e Kalle Valo    2022-11-28  2556  						    arvif->dtim_period);
d889913205cf7e Kalle Valo    2022-11-28  2557  
d889913205cf7e Kalle Valo    2022-11-28  2558  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2559  			ath12k_warn(ar->ab, "Failed to set dtim period for VDEV %d: %i\n",
d889913205cf7e Kalle Valo    2022-11-28  2560  				    arvif->vdev_id, ret);
d889913205cf7e Kalle Valo    2022-11-28  2561  		else
d889913205cf7e Kalle Valo    2022-11-28  2562  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2563  				   "DTIM period: %d set for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2564  				   arvif->dtim_period, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2565  	}
d889913205cf7e Kalle Valo    2022-11-28  2566  
d889913205cf7e Kalle Valo    2022-11-28  2567  	if (changed & BSS_CHANGED_SSID &&
d889913205cf7e Kalle Valo    2022-11-28  2568  	    vif->type == NL80211_IFTYPE_AP) {
d889913205cf7e Kalle Valo    2022-11-28  2569  		arvif->u.ap.ssid_len = vif->cfg.ssid_len;
d889913205cf7e Kalle Valo    2022-11-28  2570  		if (vif->cfg.ssid_len)
d889913205cf7e Kalle Valo    2022-11-28  2571  			memcpy(arvif->u.ap.ssid, vif->cfg.ssid, vif->cfg.ssid_len);
d889913205cf7e Kalle Valo    2022-11-28  2572  		arvif->u.ap.hidden_ssid = info->hidden_ssid;
d889913205cf7e Kalle Valo    2022-11-28  2573  	}
d889913205cf7e Kalle Valo    2022-11-28  2574  
d889913205cf7e Kalle Valo    2022-11-28  2575  	if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid))
d889913205cf7e Kalle Valo    2022-11-28  2576  		ether_addr_copy(arvif->bssid, info->bssid);
d889913205cf7e Kalle Valo    2022-11-28  2577  
d889913205cf7e Kalle Valo    2022-11-28  2578  	if (changed & BSS_CHANGED_BEACON_ENABLED) {
d889913205cf7e Kalle Valo    2022-11-28  2579  		ath12k_control_beaconing(arvif, info);
d889913205cf7e Kalle Valo    2022-11-28  2580  
d889913205cf7e Kalle Valo    2022-11-28  2581  		if (arvif->is_up && vif->bss_conf.he_support &&
d889913205cf7e Kalle Valo    2022-11-28  2582  		    vif->bss_conf.he_oper.params) {
d889913205cf7e Kalle Valo    2022-11-28  2583  			/* TODO: Extend to support 1024 BA Bitmap size */
d889913205cf7e Kalle Valo    2022-11-28  2584  			ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2585  							    WMI_VDEV_PARAM_BA_MODE,
d889913205cf7e Kalle Valo    2022-11-28  2586  							    WMI_BA_MODE_BUFFER_SIZE_256);
d889913205cf7e Kalle Valo    2022-11-28  2587  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2588  				ath12k_warn(ar->ab,
d889913205cf7e Kalle Valo    2022-11-28  2589  					    "failed to set BA BUFFER SIZE 256 for vdev: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2590  					    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2591  
d889913205cf7e Kalle Valo    2022-11-28  2592  			param_id = WMI_VDEV_PARAM_HEOPS_0_31;
d889913205cf7e Kalle Valo    2022-11-28  2593  			param_value = vif->bss_conf.he_oper.params;
d889913205cf7e Kalle Valo    2022-11-28  2594  			ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2595  							    param_id, param_value);
d889913205cf7e Kalle Valo    2022-11-28  2596  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2597  				   "he oper param: %x set for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2598  				   param_value, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2599  
d889913205cf7e Kalle Valo    2022-11-28  2600  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2601  				ath12k_warn(ar->ab, "Failed to set he oper params %x for VDEV %d: %i\n",
d889913205cf7e Kalle Valo    2022-11-28  2602  					    param_value, arvif->vdev_id, ret);
d889913205cf7e Kalle Valo    2022-11-28  2603  		}
d889913205cf7e Kalle Valo    2022-11-28  2604  	}
d889913205cf7e Kalle Valo    2022-11-28  2605  
d889913205cf7e Kalle Valo    2022-11-28  2606  	if (changed & BSS_CHANGED_ERP_CTS_PROT) {
d889913205cf7e Kalle Valo    2022-11-28  2607  		u32 cts_prot;
d889913205cf7e Kalle Valo    2022-11-28  2608  
d889913205cf7e Kalle Valo    2022-11-28  2609  		cts_prot = !!(info->use_cts_prot);
d889913205cf7e Kalle Valo    2022-11-28  2610  		param_id = WMI_VDEV_PARAM_PROTECTION_MODE;
d889913205cf7e Kalle Valo    2022-11-28  2611  
d889913205cf7e Kalle Valo    2022-11-28  2612  		if (arvif->is_started) {
d889913205cf7e Kalle Valo    2022-11-28  2613  			ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2614  							    param_id, cts_prot);
d889913205cf7e Kalle Valo    2022-11-28  2615  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2616  				ath12k_warn(ar->ab, "Failed to set CTS prot for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2617  					    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2618  			else
d889913205cf7e Kalle Valo    2022-11-28  2619  				ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "Set CTS prot: %d for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2620  					   cts_prot, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2621  		} else {
d889913205cf7e Kalle Valo    2022-11-28  2622  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "defer protection mode setup, vdev is not ready yet\n");
d889913205cf7e Kalle Valo    2022-11-28  2623  		}
d889913205cf7e Kalle Valo    2022-11-28  2624  	}
d889913205cf7e Kalle Valo    2022-11-28  2625  
d889913205cf7e Kalle Valo    2022-11-28  2626  	if (changed & BSS_CHANGED_ERP_SLOT) {
d889913205cf7e Kalle Valo    2022-11-28  2627  		u32 slottime;
d889913205cf7e Kalle Valo    2022-11-28  2628  
d889913205cf7e Kalle Valo    2022-11-28  2629  		if (info->use_short_slot)
d889913205cf7e Kalle Valo    2022-11-28  2630  			slottime = WMI_VDEV_SLOT_TIME_SHORT; /* 9us */
d889913205cf7e Kalle Valo    2022-11-28  2631  
d889913205cf7e Kalle Valo    2022-11-28  2632  		else
d889913205cf7e Kalle Valo    2022-11-28  2633  			slottime = WMI_VDEV_SLOT_TIME_LONG; /* 20us */
d889913205cf7e Kalle Valo    2022-11-28  2634  
d889913205cf7e Kalle Valo    2022-11-28  2635  		param_id = WMI_VDEV_PARAM_SLOT_TIME;
d889913205cf7e Kalle Valo    2022-11-28  2636  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2637  						    param_id, slottime);
d889913205cf7e Kalle Valo    2022-11-28  2638  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2639  			ath12k_warn(ar->ab, "Failed to set erp slot for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2640  				    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2641  		else
d889913205cf7e Kalle Valo    2022-11-28  2642  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2643  				   "Set slottime: %d for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2644  				   slottime, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2645  	}
d889913205cf7e Kalle Valo    2022-11-28  2646  
d889913205cf7e Kalle Valo    2022-11-28  2647  	if (changed & BSS_CHANGED_ERP_PREAMBLE) {
d889913205cf7e Kalle Valo    2022-11-28  2648  		u32 preamble;
d889913205cf7e Kalle Valo    2022-11-28  2649  
d889913205cf7e Kalle Valo    2022-11-28  2650  		if (info->use_short_preamble)
d889913205cf7e Kalle Valo    2022-11-28  2651  			preamble = WMI_VDEV_PREAMBLE_SHORT;
d889913205cf7e Kalle Valo    2022-11-28  2652  		else
d889913205cf7e Kalle Valo    2022-11-28  2653  			preamble = WMI_VDEV_PREAMBLE_LONG;
d889913205cf7e Kalle Valo    2022-11-28  2654  
d889913205cf7e Kalle Valo    2022-11-28  2655  		param_id = WMI_VDEV_PARAM_PREAMBLE;
d889913205cf7e Kalle Valo    2022-11-28  2656  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2657  						    param_id, preamble);
d889913205cf7e Kalle Valo    2022-11-28  2658  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2659  			ath12k_warn(ar->ab, "Failed to set preamble for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2660  				    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2661  		else
d889913205cf7e Kalle Valo    2022-11-28  2662  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2663  				   "Set preamble: %d for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2664  				   preamble, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2665  	}
d889913205cf7e Kalle Valo    2022-11-28  2666  
d889913205cf7e Kalle Valo    2022-11-28  2667  	if (changed & BSS_CHANGED_ASSOC) {
d889913205cf7e Kalle Valo    2022-11-28  2668  		if (vif->cfg.assoc)
d889913205cf7e Kalle Valo    2022-11-28  2669  			ath12k_bss_assoc(hw, vif, info);
d889913205cf7e Kalle Valo    2022-11-28  2670  		else
d889913205cf7e Kalle Valo    2022-11-28  2671  			ath12k_bss_disassoc(hw, vif);
d889913205cf7e Kalle Valo    2022-11-28  2672  	}
d889913205cf7e Kalle Valo    2022-11-28  2673  
d889913205cf7e Kalle Valo    2022-11-28  2674  	if (changed & BSS_CHANGED_TXPOWER) {
d889913205cf7e Kalle Valo    2022-11-28  2675  		ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vdev_id %i txpower %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2676  			   arvif->vdev_id, info->txpower);
d889913205cf7e Kalle Valo    2022-11-28  2677  
d889913205cf7e Kalle Valo    2022-11-28  2678  		arvif->txpower = info->txpower;
d889913205cf7e Kalle Valo    2022-11-28  2679  		ath12k_mac_txpower_recalc(ar);
d889913205cf7e Kalle Valo    2022-11-28  2680  	}
d889913205cf7e Kalle Valo    2022-11-28  2681  
d889913205cf7e Kalle Valo    2022-11-28  2682  	if (changed & BSS_CHANGED_MCAST_RATE &&
d889913205cf7e Kalle Valo    2022-11-28  2683  	    !ath12k_mac_vif_chan(arvif->vif, &def)) {
d889913205cf7e Kalle Valo    2022-11-28  2684  		band = def.chan->band;
d889913205cf7e Kalle Valo    2022-11-28  2685  		mcast_rate = vif->bss_conf.mcast_rate[band];
d889913205cf7e Kalle Valo    2022-11-28  2686  
d889913205cf7e Kalle Valo    2022-11-28  2687  		if (mcast_rate > 0)
d889913205cf7e Kalle Valo    2022-11-28  2688  			rateidx = mcast_rate - 1;
d889913205cf7e Kalle Valo    2022-11-28  2689  		else
d889913205cf7e Kalle Valo    2022-11-28  2690  			rateidx = ffs(vif->bss_conf.basic_rates) - 1;
d889913205cf7e Kalle Valo    2022-11-28  2691  
d889913205cf7e Kalle Valo    2022-11-28  2692  		if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP)
d889913205cf7e Kalle Valo    2022-11-28  2693  			rateidx += ATH12K_MAC_FIRST_OFDM_RATE_IDX;
d889913205cf7e Kalle Valo    2022-11-28  2694  
d889913205cf7e Kalle Valo    2022-11-28  2695  		bitrate = ath12k_legacy_rates[rateidx].bitrate;
d889913205cf7e Kalle Valo    2022-11-28  2696  		hw_value = ath12k_legacy_rates[rateidx].hw_value;
d889913205cf7e Kalle Valo    2022-11-28  2697  
d889913205cf7e Kalle Valo    2022-11-28  2698  		if (ath12k_mac_bitrate_is_cck(bitrate))
d889913205cf7e Kalle Valo    2022-11-28  2699  			preamble = WMI_RATE_PREAMBLE_CCK;
d889913205cf7e Kalle Valo    2022-11-28  2700  		else
d889913205cf7e Kalle Valo    2022-11-28  2701  			preamble = WMI_RATE_PREAMBLE_OFDM;
d889913205cf7e Kalle Valo    2022-11-28  2702  
d889913205cf7e Kalle Valo    2022-11-28  2703  		rate = ATH12K_HW_RATE_CODE(hw_value, 0, preamble);
d889913205cf7e Kalle Valo    2022-11-28  2704  
d889913205cf7e Kalle Valo    2022-11-28  2705  		ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2706  			   "mac vdev %d mcast_rate %x\n",
d889913205cf7e Kalle Valo    2022-11-28  2707  			   arvif->vdev_id, rate);
d889913205cf7e Kalle Valo    2022-11-28  2708  
d889913205cf7e Kalle Valo    2022-11-28  2709  		vdev_param = WMI_VDEV_PARAM_MCAST_DATA_RATE;
d889913205cf7e Kalle Valo    2022-11-28  2710  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2711  						    vdev_param, rate);
d889913205cf7e Kalle Valo    2022-11-28  2712  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2713  			ath12k_warn(ar->ab,
d889913205cf7e Kalle Valo    2022-11-28  2714  				    "failed to set mcast rate on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2715  				    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2716  
d889913205cf7e Kalle Valo    2022-11-28  2717  		vdev_param = WMI_VDEV_PARAM_BCAST_DATA_RATE;
d889913205cf7e Kalle Valo    2022-11-28  2718  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2719  						    vdev_param, rate);
d889913205cf7e Kalle Valo    2022-11-28  2720  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2721  			ath12k_warn(ar->ab,
d889913205cf7e Kalle Valo    2022-11-28  2722  				    "failed to set bcast rate on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2723  				    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2724  	}
d889913205cf7e Kalle Valo    2022-11-28  2725  
d889913205cf7e Kalle Valo    2022-11-28  2726  	if (changed & BSS_CHANGED_BASIC_RATES &&
d889913205cf7e Kalle Valo    2022-11-28  2727  	    !ath12k_mac_vif_chan(arvif->vif, &def))
d889913205cf7e Kalle Valo    2022-11-28  2728  		ath12k_recalculate_mgmt_rate(ar, vif, &def);
d889913205cf7e Kalle Valo    2022-11-28  2729  
d889913205cf7e Kalle Valo    2022-11-28  2730  	if (changed & BSS_CHANGED_TWT) {
d889913205cf7e Kalle Valo    2022-11-28  2731  		if (info->twt_requester || info->twt_responder)
d889913205cf7e Kalle Valo    2022-11-28  2732  			ath12k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2733  		else
d889913205cf7e Kalle Valo    2022-11-28  2734  			ath12k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2735  	}
d889913205cf7e Kalle Valo    2022-11-28  2736  
d889913205cf7e Kalle Valo    2022-11-28  2737  	if (changed & BSS_CHANGED_HE_OBSS_PD)
d889913205cf7e Kalle Valo    2022-11-28  2738  		ath12k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2739  					     &info->he_obss_pd);
d889913205cf7e Kalle Valo    2022-11-28  2740  
d889913205cf7e Kalle Valo    2022-11-28  2741  	if (changed & BSS_CHANGED_HE_BSS_COLOR) {
d889913205cf7e Kalle Valo    2022-11-28  2742  		if (vif->type == NL80211_IFTYPE_AP) {
d889913205cf7e Kalle Valo    2022-11-28  2743  			ret = ath12k_wmi_obss_color_cfg_cmd(ar,
d889913205cf7e Kalle Valo    2022-11-28  2744  							    arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2745  							    info->he_bss_color.color,
d889913205cf7e Kalle Valo    2022-11-28  2746  							    ATH12K_BSS_COLOR_AP_PERIODS,
d889913205cf7e Kalle Valo    2022-11-28  2747  							    info->he_bss_color.enabled);
d889913205cf7e Kalle Valo    2022-11-28  2748  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2749  				ath12k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2750  					    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2751  		} else if (vif->type == NL80211_IFTYPE_STATION) {
d889913205cf7e Kalle Valo    2022-11-28  2752  			ret = ath12k_wmi_send_bss_color_change_enable_cmd(ar,
d889913205cf7e Kalle Valo    2022-11-28  2753  									  arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2754  									  1);
d889913205cf7e Kalle Valo    2022-11-28  2755  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2756  				ath12k_warn(ar->ab, "failed to enable bss color change on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2757  					    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2758  			ret = ath12k_wmi_obss_color_cfg_cmd(ar,
d889913205cf7e Kalle Valo    2022-11-28  2759  							    arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2760  							    0,
d889913205cf7e Kalle Valo    2022-11-28  2761  							    ATH12K_BSS_COLOR_STA_PERIODS,
d889913205cf7e Kalle Valo    2022-11-28  2762  							    1);
d889913205cf7e Kalle Valo    2022-11-28  2763  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2764  				ath12k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2765  					    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2766  		}
d889913205cf7e Kalle Valo    2022-11-28  2767  	}
d889913205cf7e Kalle Valo    2022-11-28  2768  
d889913205cf7e Kalle Valo    2022-11-28  2769  	ath12k_mac_fils_discovery(arvif, info);
d889913205cf7e Kalle Valo    2022-11-28  2770  
07c01b86f21dd4 Aloka Dixit   2023-08-02 @2771  	if (changed & BSS_CHANGED_EHT_PUNCTURING)
07c01b86f21dd4 Aloka Dixit   2023-08-02 @2772  		arvif->punct_bitmap = info->eht_puncturing;
07c01b86f21dd4 Aloka Dixit   2023-08-02  2773  
d889913205cf7e Kalle Valo    2022-11-28  2774  	mutex_unlock(&ar->conf_mutex);
d889913205cf7e Kalle Valo    2022-11-28  2775  }
d889913205cf7e Kalle Valo    2022-11-28  2776
Johannes Berg Jan. 30, 2024, 7:13 a.m. UTC | #2
On Tue, 2024-01-30 at 14:45 +0800, kernel test robot wrote:
> 
> All errors (new ones prefixed by >>):
> 
> > > drivers/net/wireless/ath/ath12k/mac.c:2771:16: error: use of undeclared identifier 'BSS_CHANGED_EHT_PUNCTURING'
>     2771 |         if (changed & BSS_CHANGED_EHT_PUNCTURING)
>          |                       ^
> > > drivers/net/wireless/ath/ath12k/mac.c:2772:31: error: no member named 'eht_puncturing' in 'struct ieee80211_bss_conf'
>     2772 |                 arvif->punct_bitmap = info->eht_puncturing;
>          |                                       ~~~~  ^
>    drivers/net/wireless/ath/ath12k/mac.c:6374:35: error: no member named 'eht_puncturing' in 'struct ieee80211_bss_conf'
>     6374 |         arvif->punct_bitmap = link_conf->eht_puncturing;
>          |                               ~~~~~~~~~  ^
>    3 errors generated.
> 

Not sure why my build test didn't catch that (probably .config issues),
but yes ... I clearly forgot that. Will fix.

johannes
kernel test robot Jan. 30, 2024, 9:40 a.m. UTC | #3
Hi Johannes,

kernel test robot noticed the following build errors:

[auto build test ERROR on wireless-next/main]
[cannot apply to wireless/main staging/staging-testing staging/staging-next staging/staging-linus linus/master v6.8-rc2 next-20240130]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Johannes-Berg/wifi-mac80211-clean-up-band-switch-in-duration/20240130-025313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20240129194108.307183a5d2e5.I4d7fe2f126b2366c1312010e2900dfb2abffa0f6%40changeid
patch subject: [PATCH 15/15] wifi: cfg80211/mac80211: move puncturing into chandef
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240130/202401301758.FyMQrGkP-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240130/202401301758.FyMQrGkP-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401301758.FyMQrGkP-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/wireless/ath/ath12k/mac.c: In function 'ath12k_mac_op_bss_info_changed':
>> drivers/net/wireless/ath/ath12k/mac.c:2771:23: error: 'BSS_CHANGED_EHT_PUNCTURING' undeclared (first use in this function)
    2771 |         if (changed & BSS_CHANGED_EHT_PUNCTURING)
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/ath12k/mac.c:2771:23: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/net/wireless/ath/ath12k/mac.c:2772:43: error: 'struct ieee80211_bss_conf' has no member named 'eht_puncturing'
    2772 |                 arvif->punct_bitmap = info->eht_puncturing;
         |                                           ^~
   drivers/net/wireless/ath/ath12k/mac.c: In function 'ath12k_mac_op_assign_vif_chanctx':
   drivers/net/wireless/ath/ath12k/mac.c:6374:40: error: 'struct ieee80211_bss_conf' has no member named 'eht_puncturing'
    6374 |         arvif->punct_bitmap = link_conf->eht_puncturing;
         |                                        ^~


vim +/BSS_CHANGED_EHT_PUNCTURING +2771 drivers/net/wireless/ath/ath12k/mac.c

d889913205cf7e Kalle Valo    2022-11-28  2493  
d889913205cf7e Kalle Valo    2022-11-28  2494  static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
d889913205cf7e Kalle Valo    2022-11-28  2495  					   struct ieee80211_vif *vif,
d889913205cf7e Kalle Valo    2022-11-28  2496  					   struct ieee80211_bss_conf *info,
d889913205cf7e Kalle Valo    2022-11-28  2497  					   u64 changed)
d889913205cf7e Kalle Valo    2022-11-28  2498  {
d889913205cf7e Kalle Valo    2022-11-28  2499  	struct ath12k *ar = hw->priv;
d889913205cf7e Kalle Valo    2022-11-28  2500  	struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
d889913205cf7e Kalle Valo    2022-11-28  2501  	struct cfg80211_chan_def def;
d889913205cf7e Kalle Valo    2022-11-28  2502  	u32 param_id, param_value;
d889913205cf7e Kalle Valo    2022-11-28  2503  	enum nl80211_band band;
d889913205cf7e Kalle Valo    2022-11-28  2504  	u32 vdev_param;
d889913205cf7e Kalle Valo    2022-11-28  2505  	int mcast_rate;
d889913205cf7e Kalle Valo    2022-11-28  2506  	u32 preamble;
d889913205cf7e Kalle Valo    2022-11-28  2507  	u16 hw_value;
d889913205cf7e Kalle Valo    2022-11-28  2508  	u16 bitrate;
d889913205cf7e Kalle Valo    2022-11-28  2509  	int ret;
d889913205cf7e Kalle Valo    2022-11-28  2510  	u8 rateidx;
d889913205cf7e Kalle Valo    2022-11-28  2511  	u32 rate;
d889913205cf7e Kalle Valo    2022-11-28  2512  
d889913205cf7e Kalle Valo    2022-11-28  2513  	mutex_lock(&ar->conf_mutex);
d889913205cf7e Kalle Valo    2022-11-28  2514  
d889913205cf7e Kalle Valo    2022-11-28  2515  	if (changed & BSS_CHANGED_BEACON_INT) {
d889913205cf7e Kalle Valo    2022-11-28  2516  		arvif->beacon_interval = info->beacon_int;
d889913205cf7e Kalle Valo    2022-11-28  2517  
d889913205cf7e Kalle Valo    2022-11-28  2518  		param_id = WMI_VDEV_PARAM_BEACON_INTERVAL;
d889913205cf7e Kalle Valo    2022-11-28  2519  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2520  						    param_id,
d889913205cf7e Kalle Valo    2022-11-28  2521  						    arvif->beacon_interval);
d889913205cf7e Kalle Valo    2022-11-28  2522  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2523  			ath12k_warn(ar->ab, "Failed to set beacon interval for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2524  				    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2525  		else
d889913205cf7e Kalle Valo    2022-11-28  2526  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2527  				   "Beacon interval: %d set for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2528  				   arvif->beacon_interval, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2529  	}
d889913205cf7e Kalle Valo    2022-11-28  2530  
d889913205cf7e Kalle Valo    2022-11-28  2531  	if (changed & BSS_CHANGED_BEACON) {
d889913205cf7e Kalle Valo    2022-11-28  2532  		param_id = WMI_PDEV_PARAM_BEACON_TX_MODE;
c4cb46dfb291e1 Sidhanta Sahu 2023-09-05  2533  		param_value = WMI_BEACON_BURST_MODE;
d889913205cf7e Kalle Valo    2022-11-28  2534  		ret = ath12k_wmi_pdev_set_param(ar, param_id,
d889913205cf7e Kalle Valo    2022-11-28  2535  						param_value, ar->pdev->pdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2536  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2537  			ath12k_warn(ar->ab, "Failed to set beacon mode for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2538  				    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2539  		else
d889913205cf7e Kalle Valo    2022-11-28  2540  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
c4cb46dfb291e1 Sidhanta Sahu 2023-09-05  2541  				   "Set burst beacon mode for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2542  				   arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2543  
d889913205cf7e Kalle Valo    2022-11-28  2544  		ret = ath12k_mac_setup_bcn_tmpl(arvif);
d889913205cf7e Kalle Valo    2022-11-28  2545  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2546  			ath12k_warn(ar->ab, "failed to update bcn template: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2547  				    ret);
d889913205cf7e Kalle Valo    2022-11-28  2548  	}
d889913205cf7e Kalle Valo    2022-11-28  2549  
d889913205cf7e Kalle Valo    2022-11-28  2550  	if (changed & (BSS_CHANGED_BEACON_INFO | BSS_CHANGED_BEACON)) {
d889913205cf7e Kalle Valo    2022-11-28  2551  		arvif->dtim_period = info->dtim_period;
d889913205cf7e Kalle Valo    2022-11-28  2552  
d889913205cf7e Kalle Valo    2022-11-28  2553  		param_id = WMI_VDEV_PARAM_DTIM_PERIOD;
d889913205cf7e Kalle Valo    2022-11-28  2554  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2555  						    param_id,
d889913205cf7e Kalle Valo    2022-11-28  2556  						    arvif->dtim_period);
d889913205cf7e Kalle Valo    2022-11-28  2557  
d889913205cf7e Kalle Valo    2022-11-28  2558  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2559  			ath12k_warn(ar->ab, "Failed to set dtim period for VDEV %d: %i\n",
d889913205cf7e Kalle Valo    2022-11-28  2560  				    arvif->vdev_id, ret);
d889913205cf7e Kalle Valo    2022-11-28  2561  		else
d889913205cf7e Kalle Valo    2022-11-28  2562  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2563  				   "DTIM period: %d set for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2564  				   arvif->dtim_period, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2565  	}
d889913205cf7e Kalle Valo    2022-11-28  2566  
d889913205cf7e Kalle Valo    2022-11-28  2567  	if (changed & BSS_CHANGED_SSID &&
d889913205cf7e Kalle Valo    2022-11-28  2568  	    vif->type == NL80211_IFTYPE_AP) {
d889913205cf7e Kalle Valo    2022-11-28  2569  		arvif->u.ap.ssid_len = vif->cfg.ssid_len;
d889913205cf7e Kalle Valo    2022-11-28  2570  		if (vif->cfg.ssid_len)
d889913205cf7e Kalle Valo    2022-11-28  2571  			memcpy(arvif->u.ap.ssid, vif->cfg.ssid, vif->cfg.ssid_len);
d889913205cf7e Kalle Valo    2022-11-28  2572  		arvif->u.ap.hidden_ssid = info->hidden_ssid;
d889913205cf7e Kalle Valo    2022-11-28  2573  	}
d889913205cf7e Kalle Valo    2022-11-28  2574  
d889913205cf7e Kalle Valo    2022-11-28  2575  	if (changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid))
d889913205cf7e Kalle Valo    2022-11-28  2576  		ether_addr_copy(arvif->bssid, info->bssid);
d889913205cf7e Kalle Valo    2022-11-28  2577  
d889913205cf7e Kalle Valo    2022-11-28  2578  	if (changed & BSS_CHANGED_BEACON_ENABLED) {
d889913205cf7e Kalle Valo    2022-11-28  2579  		ath12k_control_beaconing(arvif, info);
d889913205cf7e Kalle Valo    2022-11-28  2580  
d889913205cf7e Kalle Valo    2022-11-28  2581  		if (arvif->is_up && vif->bss_conf.he_support &&
d889913205cf7e Kalle Valo    2022-11-28  2582  		    vif->bss_conf.he_oper.params) {
d889913205cf7e Kalle Valo    2022-11-28  2583  			/* TODO: Extend to support 1024 BA Bitmap size */
d889913205cf7e Kalle Valo    2022-11-28  2584  			ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2585  							    WMI_VDEV_PARAM_BA_MODE,
d889913205cf7e Kalle Valo    2022-11-28  2586  							    WMI_BA_MODE_BUFFER_SIZE_256);
d889913205cf7e Kalle Valo    2022-11-28  2587  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2588  				ath12k_warn(ar->ab,
d889913205cf7e Kalle Valo    2022-11-28  2589  					    "failed to set BA BUFFER SIZE 256 for vdev: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2590  					    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2591  
d889913205cf7e Kalle Valo    2022-11-28  2592  			param_id = WMI_VDEV_PARAM_HEOPS_0_31;
d889913205cf7e Kalle Valo    2022-11-28  2593  			param_value = vif->bss_conf.he_oper.params;
d889913205cf7e Kalle Valo    2022-11-28  2594  			ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2595  							    param_id, param_value);
d889913205cf7e Kalle Valo    2022-11-28  2596  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2597  				   "he oper param: %x set for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2598  				   param_value, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2599  
d889913205cf7e Kalle Valo    2022-11-28  2600  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2601  				ath12k_warn(ar->ab, "Failed to set he oper params %x for VDEV %d: %i\n",
d889913205cf7e Kalle Valo    2022-11-28  2602  					    param_value, arvif->vdev_id, ret);
d889913205cf7e Kalle Valo    2022-11-28  2603  		}
d889913205cf7e Kalle Valo    2022-11-28  2604  	}
d889913205cf7e Kalle Valo    2022-11-28  2605  
d889913205cf7e Kalle Valo    2022-11-28  2606  	if (changed & BSS_CHANGED_ERP_CTS_PROT) {
d889913205cf7e Kalle Valo    2022-11-28  2607  		u32 cts_prot;
d889913205cf7e Kalle Valo    2022-11-28  2608  
d889913205cf7e Kalle Valo    2022-11-28  2609  		cts_prot = !!(info->use_cts_prot);
d889913205cf7e Kalle Valo    2022-11-28  2610  		param_id = WMI_VDEV_PARAM_PROTECTION_MODE;
d889913205cf7e Kalle Valo    2022-11-28  2611  
d889913205cf7e Kalle Valo    2022-11-28  2612  		if (arvif->is_started) {
d889913205cf7e Kalle Valo    2022-11-28  2613  			ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2614  							    param_id, cts_prot);
d889913205cf7e Kalle Valo    2022-11-28  2615  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2616  				ath12k_warn(ar->ab, "Failed to set CTS prot for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2617  					    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2618  			else
d889913205cf7e Kalle Valo    2022-11-28  2619  				ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "Set CTS prot: %d for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2620  					   cts_prot, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2621  		} else {
d889913205cf7e Kalle Valo    2022-11-28  2622  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "defer protection mode setup, vdev is not ready yet\n");
d889913205cf7e Kalle Valo    2022-11-28  2623  		}
d889913205cf7e Kalle Valo    2022-11-28  2624  	}
d889913205cf7e Kalle Valo    2022-11-28  2625  
d889913205cf7e Kalle Valo    2022-11-28  2626  	if (changed & BSS_CHANGED_ERP_SLOT) {
d889913205cf7e Kalle Valo    2022-11-28  2627  		u32 slottime;
d889913205cf7e Kalle Valo    2022-11-28  2628  
d889913205cf7e Kalle Valo    2022-11-28  2629  		if (info->use_short_slot)
d889913205cf7e Kalle Valo    2022-11-28  2630  			slottime = WMI_VDEV_SLOT_TIME_SHORT; /* 9us */
d889913205cf7e Kalle Valo    2022-11-28  2631  
d889913205cf7e Kalle Valo    2022-11-28  2632  		else
d889913205cf7e Kalle Valo    2022-11-28  2633  			slottime = WMI_VDEV_SLOT_TIME_LONG; /* 20us */
d889913205cf7e Kalle Valo    2022-11-28  2634  
d889913205cf7e Kalle Valo    2022-11-28  2635  		param_id = WMI_VDEV_PARAM_SLOT_TIME;
d889913205cf7e Kalle Valo    2022-11-28  2636  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2637  						    param_id, slottime);
d889913205cf7e Kalle Valo    2022-11-28  2638  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2639  			ath12k_warn(ar->ab, "Failed to set erp slot for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2640  				    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2641  		else
d889913205cf7e Kalle Valo    2022-11-28  2642  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2643  				   "Set slottime: %d for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2644  				   slottime, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2645  	}
d889913205cf7e Kalle Valo    2022-11-28  2646  
d889913205cf7e Kalle Valo    2022-11-28  2647  	if (changed & BSS_CHANGED_ERP_PREAMBLE) {
d889913205cf7e Kalle Valo    2022-11-28  2648  		u32 preamble;
d889913205cf7e Kalle Valo    2022-11-28  2649  
d889913205cf7e Kalle Valo    2022-11-28  2650  		if (info->use_short_preamble)
d889913205cf7e Kalle Valo    2022-11-28  2651  			preamble = WMI_VDEV_PREAMBLE_SHORT;
d889913205cf7e Kalle Valo    2022-11-28  2652  		else
d889913205cf7e Kalle Valo    2022-11-28  2653  			preamble = WMI_VDEV_PREAMBLE_LONG;
d889913205cf7e Kalle Valo    2022-11-28  2654  
d889913205cf7e Kalle Valo    2022-11-28  2655  		param_id = WMI_VDEV_PARAM_PREAMBLE;
d889913205cf7e Kalle Valo    2022-11-28  2656  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2657  						    param_id, preamble);
d889913205cf7e Kalle Valo    2022-11-28  2658  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2659  			ath12k_warn(ar->ab, "Failed to set preamble for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2660  				    arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2661  		else
d889913205cf7e Kalle Valo    2022-11-28  2662  			ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2663  				   "Set preamble: %d for VDEV: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2664  				   preamble, arvif->vdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2665  	}
d889913205cf7e Kalle Valo    2022-11-28  2666  
d889913205cf7e Kalle Valo    2022-11-28  2667  	if (changed & BSS_CHANGED_ASSOC) {
d889913205cf7e Kalle Valo    2022-11-28  2668  		if (vif->cfg.assoc)
d889913205cf7e Kalle Valo    2022-11-28  2669  			ath12k_bss_assoc(hw, vif, info);
d889913205cf7e Kalle Valo    2022-11-28  2670  		else
d889913205cf7e Kalle Valo    2022-11-28  2671  			ath12k_bss_disassoc(hw, vif);
d889913205cf7e Kalle Valo    2022-11-28  2672  	}
d889913205cf7e Kalle Valo    2022-11-28  2673  
d889913205cf7e Kalle Valo    2022-11-28  2674  	if (changed & BSS_CHANGED_TXPOWER) {
d889913205cf7e Kalle Valo    2022-11-28  2675  		ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vdev_id %i txpower %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2676  			   arvif->vdev_id, info->txpower);
d889913205cf7e Kalle Valo    2022-11-28  2677  
d889913205cf7e Kalle Valo    2022-11-28  2678  		arvif->txpower = info->txpower;
d889913205cf7e Kalle Valo    2022-11-28  2679  		ath12k_mac_txpower_recalc(ar);
d889913205cf7e Kalle Valo    2022-11-28  2680  	}
d889913205cf7e Kalle Valo    2022-11-28  2681  
d889913205cf7e Kalle Valo    2022-11-28  2682  	if (changed & BSS_CHANGED_MCAST_RATE &&
d889913205cf7e Kalle Valo    2022-11-28  2683  	    !ath12k_mac_vif_chan(arvif->vif, &def)) {
d889913205cf7e Kalle Valo    2022-11-28  2684  		band = def.chan->band;
d889913205cf7e Kalle Valo    2022-11-28  2685  		mcast_rate = vif->bss_conf.mcast_rate[band];
d889913205cf7e Kalle Valo    2022-11-28  2686  
d889913205cf7e Kalle Valo    2022-11-28  2687  		if (mcast_rate > 0)
d889913205cf7e Kalle Valo    2022-11-28  2688  			rateidx = mcast_rate - 1;
d889913205cf7e Kalle Valo    2022-11-28  2689  		else
d889913205cf7e Kalle Valo    2022-11-28  2690  			rateidx = ffs(vif->bss_conf.basic_rates) - 1;
d889913205cf7e Kalle Valo    2022-11-28  2691  
d889913205cf7e Kalle Valo    2022-11-28  2692  		if (ar->pdev->cap.supported_bands & WMI_HOST_WLAN_5G_CAP)
d889913205cf7e Kalle Valo    2022-11-28  2693  			rateidx += ATH12K_MAC_FIRST_OFDM_RATE_IDX;
d889913205cf7e Kalle Valo    2022-11-28  2694  
d889913205cf7e Kalle Valo    2022-11-28  2695  		bitrate = ath12k_legacy_rates[rateidx].bitrate;
d889913205cf7e Kalle Valo    2022-11-28  2696  		hw_value = ath12k_legacy_rates[rateidx].hw_value;
d889913205cf7e Kalle Valo    2022-11-28  2697  
d889913205cf7e Kalle Valo    2022-11-28  2698  		if (ath12k_mac_bitrate_is_cck(bitrate))
d889913205cf7e Kalle Valo    2022-11-28  2699  			preamble = WMI_RATE_PREAMBLE_CCK;
d889913205cf7e Kalle Valo    2022-11-28  2700  		else
d889913205cf7e Kalle Valo    2022-11-28  2701  			preamble = WMI_RATE_PREAMBLE_OFDM;
d889913205cf7e Kalle Valo    2022-11-28  2702  
d889913205cf7e Kalle Valo    2022-11-28  2703  		rate = ATH12K_HW_RATE_CODE(hw_value, 0, preamble);
d889913205cf7e Kalle Valo    2022-11-28  2704  
d889913205cf7e Kalle Valo    2022-11-28  2705  		ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
d889913205cf7e Kalle Valo    2022-11-28  2706  			   "mac vdev %d mcast_rate %x\n",
d889913205cf7e Kalle Valo    2022-11-28  2707  			   arvif->vdev_id, rate);
d889913205cf7e Kalle Valo    2022-11-28  2708  
d889913205cf7e Kalle Valo    2022-11-28  2709  		vdev_param = WMI_VDEV_PARAM_MCAST_DATA_RATE;
d889913205cf7e Kalle Valo    2022-11-28  2710  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2711  						    vdev_param, rate);
d889913205cf7e Kalle Valo    2022-11-28  2712  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2713  			ath12k_warn(ar->ab,
d889913205cf7e Kalle Valo    2022-11-28  2714  				    "failed to set mcast rate on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2715  				    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2716  
d889913205cf7e Kalle Valo    2022-11-28  2717  		vdev_param = WMI_VDEV_PARAM_BCAST_DATA_RATE;
d889913205cf7e Kalle Valo    2022-11-28  2718  		ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2719  						    vdev_param, rate);
d889913205cf7e Kalle Valo    2022-11-28  2720  		if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2721  			ath12k_warn(ar->ab,
d889913205cf7e Kalle Valo    2022-11-28  2722  				    "failed to set bcast rate on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2723  				    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2724  	}
d889913205cf7e Kalle Valo    2022-11-28  2725  
d889913205cf7e Kalle Valo    2022-11-28  2726  	if (changed & BSS_CHANGED_BASIC_RATES &&
d889913205cf7e Kalle Valo    2022-11-28  2727  	    !ath12k_mac_vif_chan(arvif->vif, &def))
d889913205cf7e Kalle Valo    2022-11-28  2728  		ath12k_recalculate_mgmt_rate(ar, vif, &def);
d889913205cf7e Kalle Valo    2022-11-28  2729  
d889913205cf7e Kalle Valo    2022-11-28  2730  	if (changed & BSS_CHANGED_TWT) {
d889913205cf7e Kalle Valo    2022-11-28  2731  		if (info->twt_requester || info->twt_responder)
d889913205cf7e Kalle Valo    2022-11-28  2732  			ath12k_wmi_send_twt_enable_cmd(ar, ar->pdev->pdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2733  		else
d889913205cf7e Kalle Valo    2022-11-28  2734  			ath12k_wmi_send_twt_disable_cmd(ar, ar->pdev->pdev_id);
d889913205cf7e Kalle Valo    2022-11-28  2735  	}
d889913205cf7e Kalle Valo    2022-11-28  2736  
d889913205cf7e Kalle Valo    2022-11-28  2737  	if (changed & BSS_CHANGED_HE_OBSS_PD)
d889913205cf7e Kalle Valo    2022-11-28  2738  		ath12k_wmi_send_obss_spr_cmd(ar, arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2739  					     &info->he_obss_pd);
d889913205cf7e Kalle Valo    2022-11-28  2740  
d889913205cf7e Kalle Valo    2022-11-28  2741  	if (changed & BSS_CHANGED_HE_BSS_COLOR) {
d889913205cf7e Kalle Valo    2022-11-28  2742  		if (vif->type == NL80211_IFTYPE_AP) {
d889913205cf7e Kalle Valo    2022-11-28  2743  			ret = ath12k_wmi_obss_color_cfg_cmd(ar,
d889913205cf7e Kalle Valo    2022-11-28  2744  							    arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2745  							    info->he_bss_color.color,
d889913205cf7e Kalle Valo    2022-11-28  2746  							    ATH12K_BSS_COLOR_AP_PERIODS,
d889913205cf7e Kalle Valo    2022-11-28  2747  							    info->he_bss_color.enabled);
d889913205cf7e Kalle Valo    2022-11-28  2748  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2749  				ath12k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2750  					    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2751  		} else if (vif->type == NL80211_IFTYPE_STATION) {
d889913205cf7e Kalle Valo    2022-11-28  2752  			ret = ath12k_wmi_send_bss_color_change_enable_cmd(ar,
d889913205cf7e Kalle Valo    2022-11-28  2753  									  arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2754  									  1);
d889913205cf7e Kalle Valo    2022-11-28  2755  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2756  				ath12k_warn(ar->ab, "failed to enable bss color change on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2757  					    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2758  			ret = ath12k_wmi_obss_color_cfg_cmd(ar,
d889913205cf7e Kalle Valo    2022-11-28  2759  							    arvif->vdev_id,
d889913205cf7e Kalle Valo    2022-11-28  2760  							    0,
d889913205cf7e Kalle Valo    2022-11-28  2761  							    ATH12K_BSS_COLOR_STA_PERIODS,
d889913205cf7e Kalle Valo    2022-11-28  2762  							    1);
d889913205cf7e Kalle Valo    2022-11-28  2763  			if (ret)
d889913205cf7e Kalle Valo    2022-11-28  2764  				ath12k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n",
d889913205cf7e Kalle Valo    2022-11-28  2765  					    arvif->vdev_id,  ret);
d889913205cf7e Kalle Valo    2022-11-28  2766  		}
d889913205cf7e Kalle Valo    2022-11-28  2767  	}
d889913205cf7e Kalle Valo    2022-11-28  2768  
d889913205cf7e Kalle Valo    2022-11-28  2769  	ath12k_mac_fils_discovery(arvif, info);
d889913205cf7e Kalle Valo    2022-11-28  2770  
07c01b86f21dd4 Aloka Dixit   2023-08-02 @2771  	if (changed & BSS_CHANGED_EHT_PUNCTURING)
07c01b86f21dd4 Aloka Dixit   2023-08-02 @2772  		arvif->punct_bitmap = info->eht_puncturing;
07c01b86f21dd4 Aloka Dixit   2023-08-02  2773  
d889913205cf7e Kalle Valo    2022-11-28  2774  	mutex_unlock(&ar->conf_mutex);
d889913205cf7e Kalle Valo    2022-11-28  2775  }
d889913205cf7e Kalle Valo    2022-11-28  2776
Johannes Berg Jan. 30, 2024, 2:22 p.m. UTC | #4
> 
> Move puncturing into the chandef, and adjust all the code
> accordingly.

So I clearly forgot ath12k in "all the code" ;-)

Looking at the code, this seems to be an appropriate update for ath12k:

--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -2767,10 +2767,6 @@ static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
 	}
 
 	ath12k_mac_fils_discovery(arvif, info);
-
-	if (changed & BSS_CHANGED_EHT_PUNCTURING)
-		arvif->punct_bitmap = info->eht_puncturing;
-
 	mutex_unlock(&ar->conf_mutex);
 }
 
@@ -6215,6 +6211,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.
 		 */
@@ -6311,7 +6309,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 */
@@ -6371,7 +6370,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 &&


Any thoughts?

johannes
Jeff Johnson Feb. 1, 2024, 3:50 p.m. UTC | #5
On 1/30/2024 6:22 AM, Johannes Berg wrote:
>>
>> Move puncturing into the chandef, and adjust all the code
>> accordingly.
> 
> So I clearly forgot ath12k in "all the code" ;-)
> 
> Looking at the code, this seems to be an appropriate update for ath12k:
> 
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -2767,10 +2767,6 @@ static void ath12k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
>  	}
>  
>  	ath12k_mac_fils_discovery(arvif, info);
> -
> -	if (changed & BSS_CHANGED_EHT_PUNCTURING)
> -		arvif->punct_bitmap = info->eht_puncturing;
> -
>  	mutex_unlock(&ar->conf_mutex);
>  }
>  
> @@ -6215,6 +6211,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.
>  		 */
> @@ -6311,7 +6309,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 */
> @@ -6371,7 +6370,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 &&
> 
> 
> Any thoughts?
Looks good
Jeff Johnson Feb. 1, 2024, 4:17 p.m. UTC | #6
On 1/29/2024 10:34 AM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> 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.
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Perhaps add:
+ Suggested-by: Aloka Dixit <quic_alokad@quicinc.com>
+ Link:
https://lore.kernel.org/linux-wireless/20220214223051.3610-1-quic_alokad@quicinc.com/
Ping-Ke Shih Feb. 13, 2024, 7:42 a.m. UTC | #7
On Mon, 2024-01-29 at 19:34 +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> 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.
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---

[...]

> diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
> index e49360e29faf..876c8d581759 100644
> --- a/drivers/net/wireless/realtek/rtw89/fw.c
> +++ b/drivers/net/wireless/realtek/rtw89/fw.c
> @@ -2495,8 +2495,11 @@ int rtw89_fw_h2c_assoc_cmac_tbl_g7(struct rtw89_dev *rtwdev,
>  	}
>  
>  	if (vif->bss_conf.eht_support) {
> -		h2c->w4 |= le32_encode_bits(~vif->bss_conf.eht_puncturing,
> +		u16 punct = vif->bss_conf.chanreq.oper.punctured;
> +
> +		h2c->w4 |= le32_encode_bits(~punct,
>  					    CCTLINFO_G7_W4_ACT_SUBCH_CBW);
> +		rcu_read_unlock();

We don't deference chanctx to reference puncture value. Instead use the
value from vif->bss_conf.chanreq, so I think we don't need RCU locks, right?

I can prepare a fix for this, but want to confirm if my thinking is correct.


>  		h2c->m4 |= cpu_to_le32(CCTLINFO_G7_W4_ACT_SUBCH_CBW);
>  	}
>  
>
Johannes Berg Feb. 13, 2024, 8:57 a.m. UTC | #8
Hi PK,

Actually, sorry about this part of the patch. Pretty sure I meant to ask
you, but then wanted to get things together before everything broke ...

> > +++ b/drivers/net/wireless/realtek/rtw89/fw.c
> > @@ -2495,8 +2495,11 @@ int rtw89_fw_h2c_assoc_cmac_tbl_g7(struct rtw89_dev *rtwdev,
> >  	}
> >  
> >  	if (vif->bss_conf.eht_support) {
> > -		h2c->w4 |= le32_encode_bits(~vif->bss_conf.eht_puncturing,
> > +		u16 punct = vif->bss_conf.chanreq.oper.punctured;
> > +
> > +		h2c->w4 |= le32_encode_bits(~punct,
> >  					    CCTLINFO_G7_W4_ACT_SUBCH_CBW);
> > +		rcu_read_unlock();
> 
> We don't deference chanctx to reference puncture value. Instead use the
> value from vif->bss_conf.chanreq, so I think we don't need RCU locks, right?

Well, clearly the rcu_read_unlock() is wrong since it's not paired with
rcu_read_lock(). I don't know how neither I nor the robots noticed
that?!

The other thing here is that I'm not entirely sure how the driver works,
chances are that this was previously a bug, and now is still a bug,
unless the driver doesn't really support channel contexts, or any form
of concurrency.

If you actually have the ability to support two connections (e.g. P2P
and BSS client) then theoretically it's possible that you have two EHT
connections with compatible puncturing, using the same channel context,
but with different bandwidths, e.g.

BSS 160 MHz   |   |   |   |   | C |   |   | P |
P2P                           | C |   |   | P |

(P) indicates punctured subchannel, (C) indicates control channel

In this case, p2p_vif->bss_conf.chanreq.oper.punctured == 0x8 whereas
bss_vif->bss_conf.chanreq.oper.punctured == 0x80.

However, you'd really be using the actual channel configuration from the
channel context, which matches the BSS vif, so should be puncturing
bitmap 0x80.


So realistically, what you probably need/want to do is move this whole
chunk of code to when the *channel context* changes, i.e. to
rtw89_chanctx_ops_change(). You even get the
IEEE80211_CHANCTX_CHANGE_PUNCTURING flag when the puncturing changes
there. Also need it in rtw89_chanctx_ops_add() of course, and possibly
in rtw89_chanctx_ops_remove().

Though it _looks_ like you only support one channel context there, so
maybe also only one vif, and it doesn't matter? I'd probably still move
it over to the chan.c code though, it really does belong there more as
discussed in the commit message of this change.

But I didn't want to make those more semantic changes because I don't
know what logic your device applies here.


And sorry about the locking bug! Not sure how that happened :(

johannes
Ping-Ke Shih Feb. 13, 2024, 12:13 p.m. UTC | #9
Hi Johannes,

On Tue, 2024-02-13 at 09:57 +0100, Johannes Berg wrote:
> 
> 
> Actually, sorry about this part of the patch. Pretty sure I meant to ask
> you, but then wanted to get things together before everything broke ...
> 
> > > +++ b/drivers/net/wireless/realtek/rtw89/fw.c
> > > @@ -2495,8 +2495,11 @@ int rtw89_fw_h2c_assoc_cmac_tbl_g7(struct rtw89_dev *rtwdev,
> > >     }
> > > 
> > >     if (vif->bss_conf.eht_support) {
> > > -           h2c->w4 |= le32_encode_bits(~vif->bss_conf.eht_puncturing,
> > > +           u16 punct = vif->bss_conf.chanreq.oper.punctured;
> > > +
> > > +           h2c->w4 |= le32_encode_bits(~punct,
> > >                                         CCTLINFO_G7_W4_ACT_SUBCH_CBW);
> > > +           rcu_read_unlock();
> > 
> > We don't deference chanctx to reference puncture value. Instead use the
> > value from vif->bss_conf.chanreq, so I think we don't need RCU locks, right?
> 
> Well, clearly the rcu_read_unlock() is wrong since it's not paired with
> rcu_read_lock(). I don't know how neither I nor the robots noticed
> that?!
> 
> The other thing here is that I'm not entirely sure how the driver works,
> chances are that this was previously a bug, and now is still a bug,
> unless the driver doesn't really support channel contexts, or any form
> of concurrency.

This function is to initialize a station instance in firmware while
associating, and the field of firmware command is to tell MAC hardware
the sub-channels it can use to transmit, which should rely on 
bitmap of puncturing. Initially, we just wanted the field value to
be ~0 (0xFFFF) to prevent TX stuck, but not fully implemented puncturing
feature.

I think this is the reason you are confused. 

> 
> If you actually have the ability to support two connections (e.g. P2P
> and BSS client) then theoretically it's possible that you have two EHT
> connections with compatible puncturing, using the same channel context,
> but with different bandwidths, e.g.
> 
> BSS 160 MHz   |   |   |   |   | C |   |   | P |
> P2P                           | C |   |   | P |
> 
> (P) indicates punctured subchannel, (C) indicates control channel
> 
> In this case, p2p_vif->bss_conf.chanreq.oper.punctured == 0x8 whereas
> bss_vif->bss_conf.chanreq.oper.punctured == 0x80.
> 
> However, you'd really be using the actual channel configuration from the
> channel context, which matches the BSS vif, so should be puncturing
> bitmap 0x80.
> 
> 
> So realistically, what you probably need/want to do is move this whole
> chunk of code to when the *channel context* changes, i.e. to
> rtw89_chanctx_ops_change(). You even get the
> IEEE80211_CHANCTX_CHANGE_PUNCTURING flag when the puncturing changes
> there. Also need it in rtw89_chanctx_ops_add() of course, and possibly
> in rtw89_chanctx_ops_remove().

Thanks for this hint. I will check my colleagues about the detail of 
puncturing behavior next week, because people are offline for the lunar
new year. I will also check people about the beacon CSA mentioned in
another discussion thread.

> 
> Though it _looks_ like you only support one channel context there, so
> maybe also only one vif, and it doesn't matter? I'd probably still move
> it over to the chan.c code though, it really does belong there more as
> discussed in the commit message of this change.
> 
> But I didn't want to make those more semantic changes because I don't
> know what logic your device applies here.

We are going to support MCC and MLO, so we will/must consider more than
one channel context. Currently, rtw89 just consider 'deflink' not actually
'links' that is the next main work we are doing. 

> 
> 
> And sorry about the locking bug! Not sure how that happened :(
> 

I will send a patch to fix locking ahead. 

Ping-Ke
Johannes Berg Feb. 13, 2024, 12:41 p.m. UTC | #10
Hi,

> > The other thing here is that I'm not entirely sure how the driver works,
> > chances are that this was previously a bug, and now is still a bug,
> > unless the driver doesn't really support channel contexts, or any form
> > of concurrency.
> 
> This function is to initialize a station instance in firmware while
> associating, and the field of firmware command is to tell MAC hardware
> the sub-channels it can use to transmit, which should rely on 
> bitmap of puncturing. Initially, we just wanted the field value to
> be ~0 (0xFFFF) to prevent TX stuck, but not fully implemented puncturing
> feature.
> 
> I think this is the reason you are confused.

Not sure that explanations helps ;-)

If you have this per station how do you handle CCA? Which was kind of
the reason I moved it all back to the chandef? Not that this didn't make
the code simpler (in mac80211) either as a nice side effect :-)

> Thanks for this hint. I will check my colleagues about the detail of 
> puncturing behavior next week, because people are offline for the lunar
> new year. 

Right.

> I will also check people about the beacon CSA mentioned in
> another discussion thread.

Thanks!

> > Though it _looks_ like you only support one channel context there, so
> > maybe also only one vif, and it doesn't matter? I'd probably still move
> > it over to the chan.c code though, it really does belong there more as
> > discussed in the commit message of this change.
> > 
> > But I didn't want to make those more semantic changes because I don't
> > know what logic your device applies here.
> 
> We are going to support MCC and MLO, so we will/must consider more than
> one channel context. Currently, rtw89 just consider 'deflink' not actually
> 'links' that is the next main work we are doing. 

For MLO you have just one vif still, so it doesn't matter.

Looks like MCC is something with multi-vif (looking at your other
patchset) so there that makes sense. Not that I know what "MCC" means :)

> > And sorry about the locking bug! Not sure how that happened :(
> > 
> 
> I will send a patch to fix locking ahead. 
> 

Great, thanks a lot!

johannes
Ping-Ke Shih Feb. 13, 2024, 2:05 p.m. UTC | #11
On Tue, 2024-02-13 at 13:41 +0100, Johannes Berg wrote:
> 
> > > The other thing here is that I'm not entirely sure how the driver works,
> > > chances are that this was previously a bug, and now is still a bug,
> > > unless the driver doesn't really support channel contexts, or any form
> > > of concurrency.
> > 
> > This function is to initialize a station instance in firmware while
> > associating, and the field of firmware command is to tell MAC hardware
> > the sub-channels it can use to transmit, which should rely on
> > bitmap of puncturing. Initially, we just wanted the field value to
> > be ~0 (0xFFFF) to prevent TX stuck, but not fully implemented puncturing
> > feature.
> > 
> > I think this is the reason you are confused.
> 
> Not sure that explanations helps ;-)

Oops. I assumed you want to know "how did it work to you?", and my answer
was that we just wanted to fix TX stuck problem. But this story isn't 
interesting at all. XD

> 
> If you have this per station how do you handle CCA? Which was kind of
> the reason I moved it all back to the chandef? Not that this didn't make
> the code simpler (in mac80211) either as a nice side effect :-)

Do you mean CCA should consider punctured sub-channels? (CCA doesn't
need to consider energy of punctured ones)

The firmware command mentioned in this patch is used to control
TX sub-channels from MAC to BB layers, and I think BB layer has another
control registers related CCA I missed. Thanks for pointing this, I 
will check our BB team.

> > > Though it _looks_ like you only support one channel context there, so
> > > maybe also only one vif, and it doesn't matter? I'd probably still move
> > > it over to the chan.c code though, it really does belong there more as
> > > discussed in the commit message of this change.
> > > 
> > > But I didn't want to make those more semantic changes because I don't
> > > know what logic your device applies here.
> > 
> > We are going to support MCC and MLO, so we will/must consider more than
> > one channel context. Currently, rtw89 just consider 'deflink' not actually
> > 'links' that is the next main work we are doing.
> 
> For MLO you have just one vif still, so it doesn't matter.

I feel theoretically one MLO vif can consist of two links that use
two channel contexts. Please correct me if this is wrong. 

But, yes currently we just have one vif. We will have two later. 

> 
> Looks like MCC is something with multi-vif (looking at your other
> patchset) so there that makes sense. Not that I know what "MCC" means :)

MCC is short for multi-channel concurrency that is a TDMA based concurrency
of STA + P2P using standard ieee802.11 power saving protocol and P2P GO NoA.


Ping-Ke
Johannes Berg Feb. 13, 2024, 2:09 p.m. UTC | #12
On Tue, 2024-02-13 at 14:05 +0000, Ping-Ke Shih wrote:
> On Tue, 2024-02-13 at 13:41 +0100, Johannes Berg wrote:
> > 
> > > > The other thing here is that I'm not entirely sure how the driver works,
> > > > chances are that this was previously a bug, and now is still a bug,
> > > > unless the driver doesn't really support channel contexts, or any form
> > > > of concurrency.
> > > 
> > > This function is to initialize a station instance in firmware while
> > > associating, and the field of firmware command is to tell MAC hardware
> > > the sub-channels it can use to transmit, which should rely on
> > > bitmap of puncturing. Initially, we just wanted the field value to
> > > be ~0 (0xFFFF) to prevent TX stuck, but not fully implemented puncturing
> > > feature.
> > > 
> > > I think this is the reason you are confused.
> > 
> > Not sure that explanations helps ;-)
> 
> Oops. I assumed you want to know "how did it work to you?", and my answer
> was that we just wanted to fix TX stuck problem. But this story isn't 
> interesting at all. XD

Ah, sorry! I thought you were talking about the HW/FW :)

> > If you have this per station how do you handle CCA? Which was kind of
> > the reason I moved it all back to the chandef? Not that this didn't make
> > the code simpler (in mac80211) either as a nice side effect :-)
> 
> Do you mean CCA should consider punctured sub-channels? (CCA doesn't
> need to consider energy of punctured ones)

Yeah, I agree it _shouldn't_ consider energy of punctured sub-channels,
but then you can't really do it per station or even per vif since you'd
be listening without really knowing which peer/interface you're going to
transmit to/from.

Hence all the work of making it part of the channel context.

> The firmware command mentioned in this patch is used to control
> TX sub-channels from MAC to BB layers, and I think BB layer has another
> control registers related CCA I missed. Thanks for pointing this, I 
> will check our BB team.

Heh. I have no idea :)

> > > > Though it _looks_ like you only support one channel context there, so
> > > > maybe also only one vif, and it doesn't matter? I'd probably still move
> > > > it over to the chan.c code though, it really does belong there more as
> > > > discussed in the commit message of this change.
> > > > 
> > > > But I didn't want to make those more semantic changes because I don't
> > > > know what logic your device applies here.
> > > 
> > > We are going to support MCC and MLO, so we will/must consider more than
> > > one channel context. Currently, rtw89 just consider 'deflink' not actually
> > > 'links' that is the next main work we are doing.
> > 
> > For MLO you have just one vif still, so it doesn't matter.
> 
> I feel theoretically one MLO vif can consist of two links that use
> two channel contexts. Please correct me if this is wrong. 

Yes, but I wouldn't think they're on the same (control) channel, but
usually two different bands? So you do get two chanctx indeed (sorry)
but they're pretty separate, never would I expect two links on a single
vif to share a chanctx, even though I guess technically it's not
impossible.

> But, yes currently we just have one vif. We will have two later. 

Right.

> MCC is short for multi-channel concurrency that is a TDMA based concurrency
> of STA + P2P using standard ieee802.11 power saving protocol and P2P GO NoA.

Aha! Sure, everyone implements things that way and has to, but the
acronym was new to me :)

johannes
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index e37db4af33de..61b2e3f15f0e 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -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);
 }
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/link.c b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
index be48b0fc9cb6..0f2d8be1c222 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/link.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/link.c
@@ -1,6 +1,6 @@ 
 // 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"
@@ -190,12 +190,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 = &ctx->def;
+
 		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;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
index c7cbbee3e464..a62e105fb373 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
@@ -1,6 +1,6 @@ 
 // 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"
 
@@ -749,8 +749,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) {
diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wireless/marvell/mwifiex/11h.c
index da211372a481..b90f922f1cdc 100644
--- a/drivers/net/wireless/marvell/mwifiex/11h.c
+++ b/drivers/net/wireless/marvell/mwifiex/11h.c
@@ -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);
 }
diff --git a/drivers/net/wireless/quantenna/qtnfmac/event.c b/drivers/net/wireless/quantenna/qtnfmac/event.c
index 3b283e93a13e..76b07db284f8 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/event.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/event.c
@@ -478,7 +478,7 @@  qtnf_event_handle_freq_change(struct qtnf_wmac *mac,
 			continue;
 
 		wiphy_lock(priv_to_wiphy(vif->mac));
-		cfg80211_ch_switch_notify(vif->netdev, &chandef, 0, 0);
+		cfg80211_ch_switch_notify(vif->netdev, &chandef, 0);
 		wiphy_unlock(priv_to_wiphy(vif->mac));
 	}
 
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index e49360e29faf..876c8d581759 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -2495,8 +2495,11 @@  int rtw89_fw_h2c_assoc_cmac_tbl_g7(struct rtw89_dev *rtwdev,
 	}
 
 	if (vif->bss_conf.eht_support) {
-		h2c->w4 |= le32_encode_bits(~vif->bss_conf.eht_puncturing,
+		u16 punct = vif->bss_conf.chanreq.oper.punctured;
+
+		h2c->w4 |= le32_encode_bits(~punct,
 					    CCTLINFO_G7_W4_ACT_SUBCH_CBW);
+		rcu_read_unlock();
 		h2c->m4 |= cpu_to_le32(CCTLINFO_G7_W4_ACT_SUBCH_CBW);
 	}
 
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9d7333064866..965787d54e3a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -7,7 +7,7 @@ 
  * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014 Intel Mobile Communications GmbH
  * Copyright 2015-2017	Intel Deutschland GmbH
- * Copyright (C) 2018-2021, 2023 Intel Corporation
+ * Copyright (C) 2018-2024 Intel Corporation
  */
 
 #include <linux/ethtool.h>
@@ -808,6 +808,9 @@  struct key_params {
  *	chan will define the primary channel and all other
  *	parameters are ignored.
  * @freq1_offset: offset from @center_freq1, in KHz
+ * @punctured: mask of the punctured 20 MHz subchannels, with
+ *	bits turned on being disabled (punctured); numbered
+ *	from lower to higher frequency (like in the spec)
  */
 struct cfg80211_chan_def {
 	struct ieee80211_channel *chan;
@@ -816,6 +819,7 @@  struct cfg80211_chan_def {
 	u32 center_freq2;
 	struct ieee80211_edmg edmg;
 	u16 freq1_offset;
+	u16 punctured;
 };
 
 /*
@@ -956,7 +960,8 @@  cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
 		chandef1->width == chandef2->width &&
 		chandef1->center_freq1 == chandef2->center_freq1 &&
 		chandef1->freq1_offset == chandef2->freq1_offset &&
-		chandef1->center_freq2 == chandef2->center_freq2);
+		chandef1->center_freq2 == chandef2->center_freq2 &&
+		chandef1->punctured == chandef2->punctured);
 }
 
 /**
@@ -1051,12 +1056,15 @@  cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
  * cfg80211_chandef_primary_freq - calculate primary 40/80/160 MHz freq
  * @chandef: chandef to calculate for
  * @primary_chan_width: primary channel width to calculate center for
+ * @punctured: punctured sub-channel bitmap, will be recalculated
+ *	according to the new bandwidth, can be %NULL
  *
  * Returns: the primary 40/80/160 MHz channel center frequency, or -1
- *	for errors
+ *	for errors, updating the punctured bitmap
  */
-int cfg80211_chandef_primary_freq(const struct cfg80211_chan_def *chandef,
-				  enum nl80211_chan_width primary_chan_width);
+int cfg80211_chandef_primary(const struct cfg80211_chan_def *chandef,
+			     enum nl80211_chan_width primary_chan_width,
+			     u16 *punctured);
 
 /**
  * nl80211_send_chandef - sends the channel definition.
@@ -1468,9 +1476,6 @@  struct cfg80211_unsol_bcast_probe_resp {
  * @fils_discovery: FILS discovery transmission parameters
  * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
  * @mbssid_config: AP settings for multiple bssid
- * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
- *	a 20 MHz channel, lowest bit corresponding to the lowest channel.
- *	Bit set to 1 indicates that the channel is punctured.
  */
 struct cfg80211_ap_settings {
 	struct cfg80211_chan_def chandef;
@@ -1505,7 +1510,6 @@  struct cfg80211_ap_settings {
 	struct cfg80211_fils_discovery fils_discovery;
 	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
 	struct cfg80211_mbssid_config mbssid_config;
-	u16 punct_bitmap;
 };
 
 
@@ -1539,9 +1543,6 @@  struct cfg80211_ap_update {
  * @radar_required: whether radar detection is required on the new channel
  * @block_tx: whether transmissions should be blocked while changing
  * @count: number of beacons until switch
- * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
- *	a 20 MHz channel, lowest bit corresponding to the lowest channel.
- *	Bit set to 1 indicates that the channel is punctured.
  */
 struct cfg80211_csa_settings {
 	struct cfg80211_chan_def chandef;
@@ -1554,7 +1555,6 @@  struct cfg80211_csa_settings {
 	bool radar_required;
 	bool block_tx;
 	u8 count;
-	u16 punct_bitmap;
 };
 
 /**
@@ -8734,14 +8734,13 @@  bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
  * @dev: the device which switched channels
  * @chandef: the new channel definition
  * @link_id: the link ID for MLO, must be 0 for non-MLO
- * @punct_bitmap: the new puncturing bitmap
  *
  * Caller must hold wiphy mutex, therefore must only be called from sleepable
  * driver context!
  */
 void cfg80211_ch_switch_notify(struct net_device *dev,
 			       struct cfg80211_chan_def *chandef,
-			       unsigned int link_id, u16 punct_bitmap);
+			       unsigned int link_id);
 
 /*
  * cfg80211_ch_switch_started_notify - notify channel switch start
@@ -8750,7 +8749,6 @@  void cfg80211_ch_switch_notify(struct net_device *dev,
  * @link_id: the link ID for MLO, must be 0 for non-MLO
  * @count: the number of TBTTs until the channel switch happens
  * @quiet: whether or not immediate quiet was requested by the AP
- * @punct_bitmap: the future puncturing bitmap
  *
  * Inform the userspace about the channel switch that has just
  * started, so that it can take appropriate actions (eg. starting
@@ -8759,7 +8757,7 @@  void cfg80211_ch_switch_notify(struct net_device *dev,
 void cfg80211_ch_switch_started_notify(struct net_device *dev,
 				       struct cfg80211_chan_def *chandef,
 				       unsigned int link_id, u8 count,
-				       bool quiet, u16 punct_bitmap);
+				       bool quiet);
 
 /**
  * ieee80211_operating_class_to_band - convert operating class to band
@@ -9377,18 +9375,6 @@  static inline int cfg80211_color_change_notify(struct net_device *dev)
 					 0, 0);
 }
 
-/**
- * cfg80211_valid_disable_subchannel_bitmap - validate puncturing bitmap
- * @bitmap: bitmap to be validated
- * @chandef: channel definition
- *
- * Validate the puncturing bitmap.
- *
- * Return: %true if the bitmap is valid. %false otherwise.
- */
-bool cfg80211_valid_disable_subchannel_bitmap(u16 *bitmap,
-					      const struct cfg80211_chan_def *chandef);
-
 /**
  * cfg80211_links_removed - Notify about removed STA MLD setup links.
  * @dev: network device.
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ab6bc89d3394..54aa4a06c878 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -7,7 +7,7 @@ 
  * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
- * Copyright (C) 2018 - 2023 Intel Corporation
+ * Copyright (C) 2018 - 2024 Intel Corporation
  */
 
 #ifndef MAC80211_H
@@ -216,6 +216,8 @@  struct ieee80211_low_level_stats {
  * @IEEE80211_CHANCTX_CHANGE_MIN_WIDTH: The min required channel width changed
  * @IEEE80211_CHANCTX_CHANGE_AP: The AP channel definition changed, so (wider
  *	bandwidth) OFDMA settings need to be changed
+ * @IEEE80211_CHANCTX_CHANGE_PUNCTURING: The punctured channel(s) bitmap
+ *	was changed.
  */
 enum ieee80211_chanctx_change {
 	IEEE80211_CHANCTX_CHANGE_WIDTH		= BIT(0),
@@ -224,6 +226,7 @@  enum ieee80211_chanctx_change {
 	IEEE80211_CHANCTX_CHANGE_CHANNEL	= BIT(3),
 	IEEE80211_CHANCTX_CHANGE_MIN_WIDTH	= BIT(4),
 	IEEE80211_CHANCTX_CHANGE_AP		= BIT(5),
+	IEEE80211_CHANCTX_CHANGE_PUNCTURING	= BIT(6),
 };
 
 /**
@@ -357,7 +360,6 @@  struct ieee80211_vif_chanctx_switch {
  * @BSS_CHANGED_FILS_DISCOVERY: FILS discovery status changed.
  * @BSS_CHANGED_UNSOL_BCAST_PROBE_RESP: Unsolicited broadcast probe response
  *	status changed.
- * @BSS_CHANGED_EHT_PUNCTURING: The channel puncturing bitmap changed.
  * @BSS_CHANGED_MLD_VALID_LINKS: MLD valid links status changed.
  * @BSS_CHANGED_MLD_TTLM: TID to link mapping was changed
  */
@@ -394,7 +396,6 @@  enum ieee80211_bss_change {
 	BSS_CHANGED_HE_BSS_COLOR	= 1<<29,
 	BSS_CHANGED_FILS_DISCOVERY      = 1<<30,
 	BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = 1<<31,
-	BSS_CHANGED_EHT_PUNCTURING	= BIT_ULL(32),
 	BSS_CHANGED_MLD_VALID_LINKS	= BIT_ULL(33),
 	BSS_CHANGED_MLD_TTLM		= BIT_ULL(34),
 
@@ -661,9 +662,7 @@  struct ieee80211_fils_discovery {
  * @tx_pwr_env_num: number of @tx_pwr_env.
  * @pwr_reduction: power constraint of BSS.
  * @eht_support: does this BSS support EHT
- * @eht_puncturing: bitmap to indicate which channels are punctured in this BSS
  * @csa_active: marks whether a channel switch is going on.
- * @csa_punct_bitmap: new puncturing bitmap for channel switch
  * @mu_mimo_owner: indicates interface owns MU-MIMO capability
  * @chanctx_conf: The channel context this interface is assigned to, or %NULL
  *	when it is not assigned. This pointer is RCU-protected due to the TX
@@ -766,10 +765,8 @@  struct ieee80211_bss_conf {
 	u8 tx_pwr_env_num;
 	u8 pwr_reduction;
 	bool eht_support;
-	u16 eht_puncturing;
 
 	bool csa_active;
-	u16 csa_punct_bitmap;
 
 	bool mu_mimo_owner;
 	struct ieee80211_chanctx_conf __rcu *chanctx_conf;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 400abed929f4..e006d59087e7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1339,8 +1339,6 @@  static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 			return -EOPNOTSUPP;
 
 		link_conf->eht_support = true;
-		link_conf->eht_puncturing = params->punct_bitmap;
-		changed |= BSS_CHANGED_EHT_PUNCTURING;
 
 		link_conf->eht_su_beamformer =
 			params->eht_cap->fixed.phy_cap_info[0] &
@@ -3666,12 +3664,6 @@  static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
 	if (err)
 		return err;
 
-	if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) {
-		sdata->vif.bss_conf.eht_puncturing =
-					sdata->vif.bss_conf.csa_punct_bitmap;
-		changed |= BSS_CHANGED_EHT_PUNCTURING;
-	}
-
 	ieee80211_link_info_change_notify(sdata, link_data, changed);
 
 	if (link_data->csa_block_tx) {
@@ -3685,8 +3677,7 @@  static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
 		return err;
 
 	cfg80211_ch_switch_notify(sdata->dev, &link_data->csa_chanreq.oper,
-				  link_data->link_id,
-				  link_data->conf->eht_puncturing);
+				  link_data->link_id);
 
 	return 0;
 }
@@ -3887,6 +3878,9 @@  __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
 				       &sdata->vif.bss_conf.chanreq.oper))
 		return -EINVAL;
 
+	if (chanreq.oper.punctured && !sdata->vif.bss_conf.eht_support)
+		return -EINVAL;
+
 	/* don't allow another channel switch if one is already active. */
 	if (sdata->vif.bss_conf.csa_active)
 		return -EBUSY;
@@ -3939,13 +3933,9 @@  __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
 		goto out;
 	}
 
-	if (params->punct_bitmap && !sdata->vif.bss_conf.eht_support)
-		goto out;
-
 	sdata->deflink.csa_chanreq = chanreq; 
 	sdata->deflink.csa_block_tx = params->block_tx;
 	sdata->vif.bss_conf.csa_active = true;
-	sdata->vif.bss_conf.csa_punct_bitmap = params->punct_bitmap;
 
 	if (sdata->deflink.csa_block_tx)
 		ieee80211_stop_vif_queues(local, sdata,
@@ -3953,8 +3943,7 @@  __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
 
 	cfg80211_ch_switch_started_notify(sdata->dev,
 					  &sdata->deflink.csa_chanreq.oper, 0,
-					  params->count, params->block_tx,
-					  sdata->vif.bss_conf.csa_punct_bitmap);
+					  params->count, params->block_tx);
 
 	if (changed) {
 		ieee80211_link_info_change_notify(sdata, &sdata->deflink,
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 0d7944a9d3a6..9aba0a3a8eb4 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -1,7 +1,7 @@ 
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * mac80211 - channel management
- * Copyright 2020 - 2022 Intel Corporation
+ * Copyright 2020 - 2024 Intel Corporation
  */
 
 #include <linux/nl80211.h>
@@ -517,8 +517,12 @@  static void _ieee80211_change_chanctx(struct ieee80211_local *local,
 
 	ieee80211_remove_wbrf(local, &ctx->conf.def);
 
-	if (!cfg80211_chandef_identical(&ctx->conf.def, &chanreq->oper))
-		changed |= IEEE80211_CHANCTX_CHANGE_WIDTH;
+	if (!cfg80211_chandef_identical(&ctx->conf.def, &chanreq->oper)) {
+		if (ctx->conf.def.width != chanreq->oper.width)
+			changed |= IEEE80211_CHANCTX_CHANGE_WIDTH;
+		if (ctx->conf.def.punctured != chanreq->oper.punctured)
+			changed |= IEEE80211_CHANCTX_CHANGE_PUNCTURING;
+	}
 	if (!cfg80211_chandef_identical(&ctx->conf.ap, &chanreq->ap))
 		changed |= IEEE80211_CHANCTX_CHANGE_AP;
 	ctx->conf.def = *chandef;
diff --git a/net/mac80211/link.c b/net/mac80211/link.c
index 070f536acd76..79bda7184fe8 100644
--- a/net/mac80211/link.c
+++ b/net/mac80211/link.c
@@ -2,7 +2,7 @@ 
 /*
  * MLO link handling
  *
- * Copyright (C) 2022-2023 Intel Corporation
+ * Copyright (C) 2022-2024 Intel Corporation
  */
 #include <linux/slab.h>
 #include <linux/kernel.h>
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 03919bb36e2d..64367cb141ca 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -93,83 +93,6 @@  MODULE_PARM_DESC(probe_wait_ms,
  */
 #define IEEE80211_SIGNAL_AVE_MIN_COUNT	4
 
-/*
- * Extract from the given disabled subchannel bitmap (raw format
- * from the EHT Operation Element) the bits for the subchannel
- * we're using right now.
- */
-static u16
-ieee80211_extract_dis_subch_bmap(const struct ieee80211_eht_operation *eht_oper,
-				 struct cfg80211_chan_def *chandef, u16 bitmap)
-{
-	struct ieee80211_eht_operation_info *info = (void *)eht_oper->optional;
-	struct cfg80211_chan_def ap_chandef = *chandef;
-	u32 ap_center_freq, local_center_freq;
-	u32 ap_bw, local_bw;
-	int ap_start_freq, local_start_freq;
-	u16 shift, mask;
-
-	if (!(eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT) ||
-	    !(eht_oper->params &
-	      IEEE80211_EHT_OPER_DISABLED_SUBCHANNEL_BITMAP_PRESENT))
-		return 0;
-
-	/* set 160/320 supported to get the full AP definition */
-	ieee80211_chandef_eht_oper((const void *)eht_oper->optional,
-				   &ap_chandef);
-	ap_center_freq = ap_chandef.center_freq1;
-	ap_bw = 20 * BIT(u8_get_bits(info->control,
-				     IEEE80211_EHT_OPER_CHAN_WIDTH));
-	ap_start_freq = ap_center_freq - ap_bw / 2;
-	local_center_freq = chandef->center_freq1;
-	local_bw = 20 * BIT(ieee80211_chan_width_to_rx_bw(chandef->width));
-	local_start_freq = local_center_freq - local_bw / 2;
-	shift = (local_start_freq - ap_start_freq) / 20;
-	mask = BIT(local_bw / 20) - 1;
-
-	return (bitmap >> shift) & mask;
-}
-
-/*
- * Handle the puncturing bitmap, possibly downgrading bandwidth to get a
- * valid bitmap.
- */
-static void
-ieee80211_handle_puncturing_bitmap(struct ieee80211_link_data *link,
-				   const struct ieee80211_eht_operation *eht_oper,
-				   u16 bitmap, u64 *changed)
-{
-	struct cfg80211_chan_def *chandef = &link->conf->chanreq.oper;
-	struct ieee80211_local *local = link->sdata->local;
-	u16 extracted;
-	u64 _changed = 0;
-
-	if (!changed)
-		changed = &_changed;
-
-	while (chandef->width > NL80211_CHAN_WIDTH_40) {
-		extracted =
-			ieee80211_extract_dis_subch_bmap(eht_oper, chandef,
-							 bitmap);
-
-		if (cfg80211_valid_disable_subchannel_bitmap(&bitmap,
-							     chandef) &&
-		    !(bitmap && ieee80211_hw_check(&local->hw,
-						   DISALLOW_PUNCTURING)))
-			break;
-		ieee80211_chandef_downgrade(chandef, &link->u.mgd.conn);
-		*changed |= BSS_CHANGED_BANDWIDTH;
-	}
-
-	if (chandef->width <= NL80211_CHAN_WIDTH_40)
-		extracted = 0;
-
-	if (link->conf->eht_puncturing != extracted) {
-		link->conf->eht_puncturing = extracted;
-		*changed |= BSS_CHANGED_EHT_PUNCTURING;
-	}
-}
-
 /*
  * We can have multiple work items (and connection probing)
  * scheduling this timer, but we need to take care to only
@@ -396,6 +319,9 @@  ieee80211_determine_ap_chan(struct ieee80211_sub_if_data *sdata,
 		ieee80211_chandef_eht_oper((const void *)eht_oper->optional,
 					   &eht_chandef);
 
+		eht_chandef.punctured =
+			ieee80211_eht_oper_dis_subchan_bitmap(eht_oper);
+
 		if (!cfg80211_chandef_valid(&eht_chandef)) {
 			sdata_info(sdata,
 				   "AP EHT information is invalid, disabling EHT\n");
@@ -661,13 +587,27 @@  ieee80211_verify_sta_eht_mcs_support(struct ieee80211_sub_if_data *sdata,
 	return true;
 }
 
+static bool ieee80211_chandef_usable(struct ieee80211_sub_if_data *sdata,
+				     const struct cfg80211_chan_def *chandef,
+				     u32 prohibited_flags)
+{
+	if (!cfg80211_chandef_usable(sdata->local->hw.wiphy,
+				     chandef, prohibited_flags))
+		return false;
+
+	if (chandef->punctured &&
+	    ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING))
+		return false;
+
+	return true;
+}
+
 static struct ieee802_11_elems *
 ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
 			      struct ieee80211_conn_settings *conn,
 			      struct cfg80211_bss *cbss, int link_id,
 			      struct ieee80211_chan_req *chanreq)
 {
-	struct ieee80211_local *local = sdata->local;
 	const struct cfg80211_bss_ies *ies = rcu_dereference(cbss->ies);
 	struct ieee80211_bss *bss = (void *)cbss->priv;
 	struct ieee80211_channel *channel = cbss->channel;
@@ -761,8 +701,8 @@  ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
 	else
 		chanreq->ap.chan = NULL;
 
-	while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, &chanreq->oper,
-					IEEE80211_CHAN_DISABLED)) {
+	while (!ieee80211_chandef_usable(sdata, &chanreq->oper,
+					 IEEE80211_CHAN_DISABLED)) {
 		if (WARN_ON(chanreq->oper.width == NL80211_CHAN_WIDTH_20_NOHT)) {
 			ret = -EINVAL;
 			goto free;
@@ -812,30 +752,6 @@  ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata,
 		sdata_info(sdata, "required MCSes not supported, disabling EHT\n");
 	}
 
-	if (conn->mode >= IEEE80211_CONN_MODE_EHT) {
-		u16 bitmap;
-
-		if (WARN_ON_ONCE(!elems->eht_operation)) {
-			ret = -EINVAL;
-			goto free;
-		}
-
-		bitmap = ieee80211_eht_oper_dis_subchan_bitmap(elems->eht_operation);
-
-		if (!cfg80211_valid_disable_subchannel_bitmap(&bitmap,
-							      &ap_chandef) ||
-		    (bitmap &&
-		     ieee80211_hw_check(&local->hw, DISALLOW_PUNCTURING))) {
-			conn->mode = IEEE80211_CONN_MODE_HE;
-			conn->bw_limit = min_t(enum ieee80211_conn_bw_limit,
-					       conn->bw_limit,
-					       IEEE80211_CONN_BW_LIMIT_160);
-			sdata_info(sdata,
-				   "AP has invalid/unsupported puncturing, disabling EHT\n");
-		}
-		/* FIXME: store puncturing bitmap */
-	}
-
 	/* the mode can only decrease, so this must terminate */
 	if (ap_mode != conn->mode)
 		goto again;
@@ -2127,7 +2043,7 @@  static void ieee80211_chswitch_post_beacon(struct ieee80211_link_data *link)
 	}
 
 	cfg80211_ch_switch_notify(sdata->dev, &link->reserved.oper,
-				  link->link_id, 0);
+				  link->link_id);
 }
 
 void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success,
@@ -2330,7 +2246,7 @@  ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
 
 	cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chanreq.oper,
 					  link->link_id, csa_ie.count,
-					  csa_ie.mode, 0);
+					  csa_ie.mode);
 
 	if (local->ops->channel_switch) {
 		/* use driver's channel switch callback */
@@ -3393,8 +3309,6 @@  static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
 	sdata->deflink.u.mgd.tracking_signal_avg = false;
 	sdata->deflink.u.mgd.disable_wmm_tracking = false;
 
-	sdata->vif.bss_conf.eht_puncturing = 0;
-
 	ifmgd->flags = 0;
 
 	for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) {
@@ -4624,7 +4538,6 @@  static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link,
 							    link_sta);
 
 			bss_conf->eht_support = link_sta->pub->eht_cap.has_eht;
-			*changed |= BSS_CHANGED_EHT_PUNCTURING;
 		} else {
 			bss_conf->eht_support = false;
 		}
@@ -5867,40 +5780,6 @@  static bool ieee80211_rx_our_beacon(const u8 *tx_bssid,
 	return ether_addr_equal(tx_bssid, bss->transmitted_bss->bssid);
 }
 
-static bool ieee80211_config_puncturing(struct ieee80211_link_data *link,
-					const struct ieee80211_eht_operation *eht_oper,
-					u64 *changed)
-{
-	struct ieee80211_local *local = link->sdata->local;
-	u16 bitmap, extracted;
-
-	bitmap = ieee80211_eht_oper_dis_subchan_bitmap(eht_oper);
-	extracted = ieee80211_extract_dis_subch_bmap(eht_oper,
-						     &link->conf->chanreq.oper,
-						     bitmap);
-
-	/* accept if there are no changes */
-	if (!(*changed & BSS_CHANGED_BANDWIDTH) &&
-	    extracted == link->conf->eht_puncturing)
-		return true;
-
-	if (!cfg80211_valid_disable_subchannel_bitmap(&bitmap,
-						      &link->conf->chanreq.oper)) {
-		link_info(link,
-			  "Got an invalid disable subchannel bitmap from AP %pM: bitmap = 0x%x, bw = 0x%x. disconnect\n",
-			  link->u.mgd.bssid,
-			  bitmap,
-			  link->conf->chanreq.oper.width);
-		return false;
-	}
-
-	if (bitmap && ieee80211_hw_check(&local->hw, DISALLOW_PUNCTURING))
-		return false;
-
-	ieee80211_handle_puncturing_bitmap(link, eht_oper, bitmap, changed);
-	return true;
-}
-
 static void ieee80211_ml_reconf_work(struct wiphy *wiphy,
 				     struct wiphy_work *work)
 {
@@ -6616,21 +6495,6 @@  static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,
 					       elems->pwr_constr_elem,
 					       elems->cisco_dtpc_elem);
 
-	if (elems->eht_operation &&
-	    link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_EHT) {
-		if (!ieee80211_config_puncturing(link, elems->eht_operation,
-						 &changed)) {
-			ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
-					       WLAN_REASON_DEAUTH_LEAVING,
-					       true, deauth_buf);
-			ieee80211_report_disconnect(sdata, deauth_buf,
-						    sizeof(deauth_buf), true,
-						    WLAN_REASON_DEAUTH_LEAVING,
-						    false);
-			goto free;
-		}
-	}
-
 	ieee80211_ml_reconfiguration(sdata, elems);
 	ieee80211_process_adv_ttlm(sdata, elems,
 				      le64_to_cpu(mgmt->u.beacon.timestamp));
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 63a88169d53d..5108dbaa9360 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -6,7 +6,7 @@ 
  * Copyright 2007	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
  * Copyright (C) 2015-2017	Intel Deutschland GmbH
- * Copyright (C) 2018-2023 Intel Corporation
+ * Copyright (C) 2018-2024 Intel Corporation
  *
  * utilities for mac80211
  */
@@ -2810,9 +2810,6 @@  int ieee80211_reconfig(struct ieee80211_local *local)
 				    sdata->vif.bss_conf.protected_keep_alive)
 					changed |= BSS_CHANGED_KEEP_ALIVE;
 
-				if (sdata->vif.bss_conf.eht_puncturing)
-					changed |= BSS_CHANGED_EHT_PUNCTURING;
-
 				ieee80211_bss_info_change_notify(sdata,
 								 changed);
 			} else if (!WARN_ON(!link)) {
@@ -4365,14 +4362,17 @@  EXPORT_SYMBOL(ieee80211_radar_detected);
 void ieee80211_chandef_downgrade(struct cfg80211_chan_def *c,
 				 struct ieee80211_conn_settings *conn)
 {
-	/* no-HT indicates nothing to do */
-	enum nl80211_chan_width new_primary_width = NL80211_CHAN_WIDTH_20_NOHT;
+	enum nl80211_chan_width new_primary_width;
 	struct ieee80211_conn_settings _ignored = {};
 
 	/* allow passing NULL if caller doesn't care */
 	if (!conn)
 		conn = &_ignored;
 
+again:
+	/* no-HT indicates nothing to do */
+	new_primary_width = NL80211_CHAN_WIDTH_20_NOHT;
+
 	switch (c->width) {
 	default:
 	case NL80211_CHAN_WIDTH_20_NOHT:
@@ -4382,6 +4382,7 @@  void ieee80211_chandef_downgrade(struct cfg80211_chan_def *c,
 		c->width = NL80211_CHAN_WIDTH_20_NOHT;
 		conn->mode = IEEE80211_CONN_MODE_LEGACY;
 		conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20;
+		c->punctured = 0;
 		break;
 	case NL80211_CHAN_WIDTH_40:
 		c->width = NL80211_CHAN_WIDTH_20;
@@ -4389,6 +4390,7 @@  void ieee80211_chandef_downgrade(struct cfg80211_chan_def *c,
 		if (conn->mode == IEEE80211_CONN_MODE_VHT)
 			conn->mode = IEEE80211_CONN_MODE_HT;
 		conn->bw_limit = IEEE80211_CONN_BW_LIMIT_20;
+		c->punctured = 0;
 		break;
 	case NL80211_CHAN_WIDTH_80:
 		new_primary_width = NL80211_CHAN_WIDTH_40;
@@ -4429,11 +4431,19 @@  void ieee80211_chandef_downgrade(struct cfg80211_chan_def *c,
 	}
 
 	if (new_primary_width != NL80211_CHAN_WIDTH_20_NOHT) {
-		c->center_freq1 =
-			cfg80211_chandef_primary_freq(c, new_primary_width);
+		c->center_freq1 = cfg80211_chandef_primary(c, new_primary_width,
+							   &c->punctured);
 		c->width = new_primary_width;
 	}
 
+	/*
+	 * With an 80 MHz channel, we might have the puncturing in the primary
+	 * 40 Mhz channel, but that's not valid when downgraded to 40 MHz width.
+	 * In that case, downgrade again.
+	 */
+	if (!cfg80211_chandef_valid(c) && c->punctured)
+		goto again;
+
 	WARN_ON_ONCE(!cfg80211_chandef_valid(c));
 }
 
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index bfa2ea935fc2..e2ce89afa9ff 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -6,7 +6,7 @@ 
  *
  * Copyright 2009	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
- * Copyright 2018-2023	Intel Corporation
+ * Copyright 2018-2024	Intel Corporation
  */
 
 #include <linux/export.h>
@@ -27,11 +27,10 @@  void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
 	if (WARN_ON(!chan))
 		return;
 
-	chandef->chan = chan;
-	chandef->freq1_offset = chan->freq_offset;
-	chandef->center_freq2 = 0;
-	chandef->edmg.bw_config = 0;
-	chandef->edmg.channels = 0;
+	*chandef = (struct cfg80211_chan_def) {
+		.chan = chan,
+		.freq1_offset = chan->freq_offset,
+	};
 
 	switch (chan_type) {
 	case NL80211_CHAN_NO_HT:
@@ -87,10 +86,9 @@  static const struct cfg80211_per_bw_puncturing_values per_bw_puncturing[] = {
 	CFG80211_PER_BW_VALID_PUNCTURING_VALUES(320)
 };
 
-bool cfg80211_valid_disable_subchannel_bitmap(u16 *bitmap,
-					      const struct cfg80211_chan_def *chandef)
+static bool valid_puncturing_bitmap(const struct cfg80211_chan_def *chandef)
 {
-	u32 idx, i, start_freq;
+	u32 idx, i, start_freq, primary_center = chandef->chan->center_freq;
 
 	switch (chandef->width) {
 	case NL80211_CHAN_WIDTH_80:
@@ -106,24 +104,23 @@  bool cfg80211_valid_disable_subchannel_bitmap(u16 *bitmap,
 		start_freq = chandef->center_freq1 - 160;
 		break;
 	default:
-		*bitmap = 0;
-		break;
+		return chandef->punctured == 0;
 	}
 
-	if (!*bitmap)
+	if (!chandef->punctured)
 		return true;
 
 	/* check if primary channel is punctured */
-	if (*bitmap & (u16)BIT((chandef->chan->center_freq - start_freq) / 20))
+	if (chandef->punctured & (u16)BIT((primary_center - start_freq) / 20))
 		return false;
 
-	for (i = 0; i < per_bw_puncturing[idx].len; i++)
-		if (per_bw_puncturing[idx].valid_values[i] == *bitmap)
+	for (i = 0; i < per_bw_puncturing[idx].len; i++) {
+		if (per_bw_puncturing[idx].valid_values[i] == chandef->punctured)
 			return true;
+	}
 
 	return false;
 }
-EXPORT_SYMBOL(cfg80211_valid_disable_subchannel_bitmap);
 
 static bool cfg80211_edmg_chandef_valid(const struct cfg80211_chan_def *chandef)
 {
@@ -386,17 +383,19 @@  bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
 	    !cfg80211_edmg_chandef_valid(chandef))
 		return false;
 
-	return true;
+	return valid_puncturing_bitmap(chandef);
 }
 EXPORT_SYMBOL(cfg80211_chandef_valid);
 
-int cfg80211_chandef_primary_freq(const struct cfg80211_chan_def *c,
-				  enum nl80211_chan_width primary_chan_width)
+int cfg80211_chandef_primary(const struct cfg80211_chan_def *c,
+			     enum nl80211_chan_width primary_chan_width,
+			     u16 *punctured)
 {
 	int pri_width = nl80211_chan_width_to_mhz(primary_chan_width);
 	int width = cfg80211_chandef_get_width(c);
 	u32 control = c->chan->center_freq;
 	u32 center = c->center_freq1;
+	u16 _punct = 0;
 
 	if (WARN_ON_ONCE(pri_width < 0 || width < 0))
 		return -1;
@@ -405,26 +404,41 @@  int cfg80211_chandef_primary_freq(const struct cfg80211_chan_def *c,
 	if (WARN_ON_ONCE(pri_width > width))
 		return -1;
 
+	if (!punctured)
+		punctured = &_punct;
+
+	*punctured = c->punctured;
+
 	while (width > pri_width) {
-		if (control > center)
+		unsigned int bits_to_drop = width / 20 / 2;
+
+		if (control > center) {
 			center += width / 4;
-		else
+			*punctured >>= bits_to_drop;
+		} else {
 			center -= width / 4;
+			*punctured &= (1 << bits_to_drop) - 1;
+		}
 		width /= 2;
 	}
 
 	return center;
 }
-EXPORT_SYMBOL(cfg80211_chandef_primary_freq);
+EXPORT_SYMBOL(cfg80211_chandef_primary);
 
 static const struct cfg80211_chan_def *
 check_chandef_primary_compat(const struct cfg80211_chan_def *c1,
 			     const struct cfg80211_chan_def *c2,
 			     enum nl80211_chan_width primary_chan_width)
 {
+	u16 punct_c1 = 0, punct_c2 = 0;
+
 	/* check primary is compatible -> error if not */
-	if (cfg80211_chandef_primary_freq(c1, primary_chan_width) !=
-	    cfg80211_chandef_primary_freq(c2, primary_chan_width))
+	if (cfg80211_chandef_primary(c1, primary_chan_width, &punct_c1) !=
+	    cfg80211_chandef_primary(c2, primary_chan_width, &punct_c2))
+		return ERR_PTR(-EINVAL);
+
+	if (punct_c1 != punct_c2)
 		return ERR_PTR(-EINVAL);
 
 	/* assumes c1 is smaller width, if that was just checked -> done */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e4f41f86e295..1331e39da0e6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3214,21 +3214,6 @@  static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev)
 		wdev->iftype == NL80211_IFTYPE_P2P_GO;
 }
 
-static int nl80211_parse_punct_bitmap(struct cfg80211_registered_device *rdev,
-				      struct genl_info *info,
-				      const struct cfg80211_chan_def *chandef,
-				      u16 *punct_bitmap)
-{
-	if (!wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_PUNCT))
-		return -EINVAL;
-
-	*punct_bitmap = nla_get_u32(info->attrs[NL80211_ATTR_PUNCT_BITMAP]);
-	if (!cfg80211_valid_disable_subchannel_bitmap(punct_bitmap, chandef))
-		return -EINVAL;
-
-	return 0;
-}
-
 int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
 			  struct genl_info *info,
 			  struct cfg80211_chan_def *chandef)
@@ -3336,6 +3321,19 @@  int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
 		chandef->edmg.channels = 0;
 	}
 
+	if (info->attrs[NL80211_ATTR_PUNCT_BITMAP]) {
+		chandef->punctured =
+			nla_get_u32(info->attrs[NL80211_ATTR_PUNCT_BITMAP]);
+
+		if (chandef->punctured &&
+		    !wiphy_ext_feature_isset(&rdev->wiphy,
+					     NL80211_EXT_FEATURE_PUNCT)) {
+			NL_SET_ERR_MSG(extack,
+				       "driver doesn't support puncturing");
+			return -EINVAL;
+		}
+	}
+
 	if (!cfg80211_chandef_valid(chandef)) {
 		NL_SET_ERR_MSG(extack, "invalid channel definition");
 		return -EINVAL;
@@ -3812,6 +3810,10 @@  int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *ch
 	if (chandef->center_freq2 &&
 	    nla_put_u32(msg, NL80211_ATTR_CENTER_FREQ2, chandef->center_freq2))
 		return -ENOBUFS;
+	if (chandef->punctured &&
+	    nla_put_u32(msg, NL80211_ATTR_PUNCT_BITMAP, chandef->punctured))
+		return -ENOBUFS;
+
 	return 0;
 }
 EXPORT_SYMBOL(nl80211_send_chandef);
@@ -6057,14 +6059,6 @@  static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 		goto out;
 	}
 
-	if (info->attrs[NL80211_ATTR_PUNCT_BITMAP]) {
-		err = nl80211_parse_punct_bitmap(rdev, info,
-						 &params->chandef,
-						 &params->punct_bitmap);
-		if (err)
-			goto out;
-	}
-
 	if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &params->chandef,
 					   wdev->iftype)) {
 		err = -EINVAL;
@@ -10224,14 +10218,6 @@  static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info)
 	if (info->attrs[NL80211_ATTR_CH_SWITCH_BLOCK_TX])
 		params.block_tx = true;
 
-	if (info->attrs[NL80211_ATTR_PUNCT_BITMAP]) {
-		err = nl80211_parse_punct_bitmap(rdev, info,
-						 &params.chandef,
-						 &params.punct_bitmap);
-		if (err)
-			goto free;
-	}
-
 	err = rdev_channel_switch(rdev, dev, &params);
 
 free:
@@ -19362,7 +19348,7 @@  static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
 				     struct cfg80211_chan_def *chandef,
 				     gfp_t gfp,
 				     enum nl80211_commands notif,
-				     u8 count, bool quiet, u16 punct_bitmap)
+				     u8 count, bool quiet)
 {
 	struct wireless_dev *wdev = netdev->ieee80211_ptr;
 	struct sk_buff *msg;
@@ -19396,9 +19382,6 @@  static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
 			goto nla_put_failure;
 	}
 
-	if (nla_put_u32(msg, NL80211_ATTR_PUNCT_BITMAP, punct_bitmap))
-		goto nla_put_failure;
-
 	genlmsg_end(msg, hdr);
 
 	genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
@@ -19411,7 +19394,7 @@  static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
 
 void cfg80211_ch_switch_notify(struct net_device *dev,
 			       struct cfg80211_chan_def *chandef,
-			       unsigned int link_id, u16 punct_bitmap)
+			       unsigned int link_id)
 {
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	struct wiphy *wiphy = wdev->wiphy;
@@ -19420,7 +19403,7 @@  void cfg80211_ch_switch_notify(struct net_device *dev,
 	lockdep_assert_wiphy(wdev->wiphy);
 	WARN_INVALID_LINK_ID(wdev, link_id);
 
-	trace_cfg80211_ch_switch_notify(dev, chandef, link_id, punct_bitmap);
+	trace_cfg80211_ch_switch_notify(dev, chandef, link_id);
 
 	switch (wdev->iftype) {
 	case NL80211_IFTYPE_STATION:
@@ -19449,15 +19432,14 @@  void cfg80211_ch_switch_notify(struct net_device *dev,
 	cfg80211_sched_dfs_chan_update(rdev);
 
 	nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL,
-				 NL80211_CMD_CH_SWITCH_NOTIFY, 0, false,
-				 punct_bitmap);
+				 NL80211_CMD_CH_SWITCH_NOTIFY, 0, false);
 }
 EXPORT_SYMBOL(cfg80211_ch_switch_notify);
 
 void cfg80211_ch_switch_started_notify(struct net_device *dev,
 				       struct cfg80211_chan_def *chandef,
 				       unsigned int link_id, u8 count,
-				       bool quiet, u16 punct_bitmap)
+				       bool quiet)
 {
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
 	struct wiphy *wiphy = wdev->wiphy;
@@ -19466,13 +19448,12 @@  void cfg80211_ch_switch_started_notify(struct net_device *dev,
 	lockdep_assert_wiphy(wdev->wiphy);
 	WARN_INVALID_LINK_ID(wdev, link_id);
 
-	trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id,
-						punct_bitmap);
+	trace_cfg80211_ch_switch_started_notify(dev, chandef, link_id);
 
 
 	nl80211_ch_switch_notify(rdev, dev, link_id, chandef, GFP_KERNEL,
 				 NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
-				 count, quiet, punct_bitmap);
+				 count, quiet);
 }
 EXPORT_SYMBOL(cfg80211_ch_switch_started_notify);
 
diff --git a/net/wireless/tests/chan.c b/net/wireless/tests/chan.c
index b9e7a27e43cb..d02258ac2dab 100644
--- a/net/wireless/tests/chan.c
+++ b/net/wireless/tests/chan.c
@@ -2,7 +2,7 @@ 
 /*
  * KUnit tests for channel helper functions
  *
- * Copyright (C) 2023 Intel Corporation
+ * Copyright (C) 2023-2024 Intel Corporation
  */
 #include <net/cfg80211.h>
 #include <kunit/test.h>
@@ -140,6 +140,52 @@  static const struct chandef_compat_case {
 		},
 		.compat = true,
 	},
+	{
+		.desc = "matching primary 160 MHz & punctured secondary 160 Mhz",
+		.c1 = {
+			.width = NL80211_CHAN_WIDTH_160,
+			.chan = &chan_6ghz_105,
+			.center_freq1 = 6475 + 70,
+		},
+		.c2 = {
+			.width = NL80211_CHAN_WIDTH_320,
+			.chan = &chan_6ghz_105,
+			.center_freq1 = 6475 - 10,
+			.punctured = 0xf,
+		},
+		.compat = true,
+	},
+	{
+		.desc = "matching primary 160 MHz & punctured matching",
+		.c1 = {
+			.width = NL80211_CHAN_WIDTH_160,
+			.chan = &chan_6ghz_105,
+			.center_freq1 = 6475 + 70,
+			.punctured = 0xc0,
+		},
+		.c2 = {
+			.width = NL80211_CHAN_WIDTH_320,
+			.chan = &chan_6ghz_105,
+			.center_freq1 = 6475 - 10,
+			.punctured = 0xc000,
+		},
+		.compat = true,
+	},
+	{
+		.desc = "matching primary 160 MHz & punctured not matching",
+		.c1 = {
+			.width = NL80211_CHAN_WIDTH_160,
+			.chan = &chan_6ghz_105,
+			.center_freq1 = 6475 + 70,
+			.punctured = 0x80,
+		},
+		.c2 = {
+			.width = NL80211_CHAN_WIDTH_320,
+			.chan = &chan_6ghz_105,
+			.center_freq1 = 6475 - 10,
+			.punctured = 0xc000,
+		},
+	},
 };
 
 KUNIT_ARRAY_PARAM_DESC(chandef_compat, chandef_compat_cases, desc)
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 1f374c8a17a5..ae5e585b6863 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1,4 +1,9 @@ 
 /* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Portions of this file
+ * Copyright(c) 2016-2017 Intel Deutschland GmbH
+ * Copyright (C) 2018, 2020-2024 Intel Corporation
+ */
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM cfg80211
 
@@ -135,7 +140,8 @@ 
 		       __field(u32, width)				\
 		       __field(u32, center_freq1)			\
 		       __field(u32, freq1_offset)			\
-		       __field(u32, center_freq2)
+		       __field(u32, center_freq2)			\
+		       __field(u16, punctured)
 #define CHAN_DEF_ASSIGN(chandef)					\
 	do {								\
 		if ((chandef) && (chandef)->chan) {			\
@@ -148,6 +154,7 @@ 
 			__entry->center_freq1 = (chandef)->center_freq1;\
 			__entry->freq1_offset = (chandef)->freq1_offset;\
 			__entry->center_freq2 = (chandef)->center_freq2;\
+			__entry->punctured = (chandef)->punctured;	\
 		} else {						\
 			__entry->band = 0;				\
 			__entry->control_freq = 0;			\
@@ -156,14 +163,15 @@ 
 			__entry->center_freq1 = 0;			\
 			__entry->freq1_offset = 0;			\
 			__entry->center_freq2 = 0;			\
+			__entry->punctured = 0;				\
 		}							\
 	} while (0)
 #define CHAN_DEF_PR_FMT							\
-	"band: %d, control freq: %u.%03u, width: %d, cf1: %u.%03u, cf2: %u"
+	"band: %d, control freq: %u.%03u, width: %d, cf1: %u.%03u, cf2: %u, punct: 0x%x"
 #define CHAN_DEF_PR_ARG __entry->band, __entry->control_freq,		\
 			__entry->freq_offset, __entry->width,		\
 			__entry->center_freq1, __entry->freq1_offset,	\
-			__entry->center_freq2
+			__entry->center_freq2, __entry->punctured
 
 #define FILS_AAD_ASSIGN(fa)						\
 	do {								\
@@ -3267,47 +3275,39 @@  TRACE_EVENT(cfg80211_chandef_dfs_required,
 TRACE_EVENT(cfg80211_ch_switch_notify,
 	TP_PROTO(struct net_device *netdev,
 		 struct cfg80211_chan_def *chandef,
-		 unsigned int link_id,
-		 u16 punct_bitmap),
-	TP_ARGS(netdev, chandef, link_id, punct_bitmap),
+		 unsigned int link_id),
+	TP_ARGS(netdev, chandef, link_id),
 	TP_STRUCT__entry(
 		NETDEV_ENTRY
 		CHAN_DEF_ENTRY
 		__field(unsigned int, link_id)
-		__field(u16, punct_bitmap)
 	),
 	TP_fast_assign(
 		NETDEV_ASSIGN;
 		CHAN_DEF_ASSIGN(chandef);
 		__entry->link_id = link_id;
-		__entry->punct_bitmap = punct_bitmap;
 	),
-	TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d, punct_bitmap:%u",
-		  NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id,
-		  __entry->punct_bitmap)
+	TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d",
+		  NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id)
 );
 
 TRACE_EVENT(cfg80211_ch_switch_started_notify,
 	TP_PROTO(struct net_device *netdev,
 		 struct cfg80211_chan_def *chandef,
-		 unsigned int link_id,
-		 u16 punct_bitmap),
-	TP_ARGS(netdev, chandef, link_id, punct_bitmap),
+		 unsigned int link_id),
+	TP_ARGS(netdev, chandef, link_id),
 	TP_STRUCT__entry(
 		NETDEV_ENTRY
 		CHAN_DEF_ENTRY
 		__field(unsigned int, link_id)
-		__field(u16, punct_bitmap)
 	),
 	TP_fast_assign(
 		NETDEV_ASSIGN;
 		CHAN_DEF_ASSIGN(chandef);
 		__entry->link_id = link_id;
-		__entry->punct_bitmap = punct_bitmap;
 	),
-	TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d, punct_bitmap:%u",
-		  NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id,
-		  __entry->punct_bitmap)
+	TP_printk(NETDEV_PR_FMT ", " CHAN_DEF_PR_FMT ", link:%d",
+		  NETDEV_PR_ARG, CHAN_DEF_PR_ARG, __entry->link_id)
 );
 
 TRACE_EVENT(cfg80211_radar_event,