From: Daniel Gabay Date: Wed, 6 May 2026 03:44:28 +0000 (+0300) Subject: wifi: mac80211_hwsim: set HAS_RATE_CONTROL when using NAN X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60e33987268c637f0ed5458f0f81ea865fed369f;p=thirdparty%2Flinux.git wifi: mac80211_hwsim: set HAS_RATE_CONTROL when using NAN - NAN switches between bands/channels per its schedule, so mac80211 rate control can't work, set HAS_RATE_CONTROL instead. - Skip rate control checks for NAN interfaces in mac80211_hwsim_sta_rc_update() as it's not relevant. - Move set_rts_threshold stub to HWSIM_COMMON_OPS and return 0 instead of -EOPNOTSUPP to prevent failures in non-MLO tests that set RTS threshold (hwsim ignores the use_rts instruction from mac80211 anyway). Signed-off-by: Daniel Gabay Signed-off-by: Miri Korenblit Link: https://patch.msgid.link/20260506064301.216e68be61ac.If9ef94a12cec8dfc55416afaf745d6e5025a5ec9@changeid Signed-off-by: Johannes Berg --- diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c index 1ea33ec577ddd..107d47d310736 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c @@ -2747,6 +2747,10 @@ mac80211_hwsim_sta_rc_update(struct ieee80211_hw *hw, u32 bw = U32_MAX; int link_id; + if (vif->type == NL80211_IFTYPE_NAN || + vif->type == NL80211_IFTYPE_NAN_DATA) + return; + rcu_read_lock(); for (link_id = 0; link_id < ARRAY_SIZE(vif->link_conf); @@ -3475,7 +3479,8 @@ static int mac80211_hwsim_tx_last_beacon(struct ieee80211_hw *hw) static int mac80211_hwsim_set_rts_threshold(struct ieee80211_hw *hw, int radio_idx, u32 value) { - return -EOPNOTSUPP; + /* hwsim ignores the use_rts instruction from mac80211 anyway */ + return 0; } static int mac80211_hwsim_change_vif_links(struct ieee80211_hw *hw, @@ -4239,6 +4244,7 @@ static int mac80211_hwsim_set_radar_background(struct ieee80211_hw *hw, .abort_pmsr = mac80211_hwsim_abort_pmsr, \ .set_radar_background = mac80211_hwsim_set_radar_background, \ .set_key = mac80211_hwsim_set_key, \ + .set_rts_threshold = mac80211_hwsim_set_rts_threshold, \ .start_nan = mac80211_hwsim_nan_start, \ .stop_nan = mac80211_hwsim_nan_stop, \ .nan_change_conf = mac80211_hwsim_nan_change_config, \ @@ -4284,7 +4290,6 @@ static const struct ieee80211_ops mac80211_hwsim_mchan_ops = { static const struct ieee80211_ops mac80211_hwsim_mlo_ops = { HWSIM_COMMON_OPS HWSIM_CHANCTX_OPS - .set_rts_threshold = mac80211_hwsim_set_rts_threshold, .change_vif_links = mac80211_hwsim_change_vif_links, .change_sta_links = mac80211_hwsim_change_sta_links, .sta_state = mac80211_hwsim_sta_state, @@ -5726,6 +5731,12 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, hw->wiphy->nan_capa.phy.ht = hwsim_nan_ht_cap; hw->wiphy->nan_capa.phy.vht = hwsim_nan_vht_cap; hw->wiphy->nan_capa.phy.he = hwsim_nan_he_cap; + + /* + * NAN switches between bands/channels per its schedule, + * so mac80211 rate control can't work here. + */ + ieee80211_hw_set(hw, HAS_RATE_CONTROL); } data->if_combination.radar_detect_widths =