[PATCH 01/20] wifi: mac80211: remove NAN guards on ieee80211_sta_cur_vht_bw() calls

Johannes Berg
2026-04-15T12:45:20Z

The NAN guards here make little sense, just don't WARN inside
the function (and return maximum instead of minimum). Otherwise
we need to guard more calls, such as in EHT in the future.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/he.c | 5 ++---
net/mac80211/vht.c | 9 ++++-----
2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/he.c b/net/mac80211/he.c
index a3e16a5bec22..92d9c4f095b3 100644
--- a/net/mac80211/he.c
+++ b/net/mac80211/he.c
@@ -3,7 +3,7 @@
* HE handling
*
* Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright(c) 2019-2025 Intel Corporation
+ * Copyright(c) 2019-2026 Intel Corporation
*/

#include "ieee80211_i.h"
@@ -160,8 +160,7 @@ _ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
he_cap->has_he = true;

link_sta->cur_max_bandwidth = ieee80211_sta_cap_rx_bw(link_sta);
- if (sdata->vif.type != NL80211_IFTYPE_NAN)
- link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta);
+ link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta);

if (he_6ghz_capa)
ieee80211_update_from_he_6ghz_capa(he_6ghz_capa, link_sta);
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index f3bb5a561a38..edce0b16dc3d 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -324,8 +324,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
IEEE80211_STA_RX_BW_160;
}

- if (sdata->vif.type != NL80211_IFTYPE_NAN)
- link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta);
+ link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta);

/*
* Work around the Cisco 9115 FW 17.3 bug by taking the min of
@@ -528,9 +527,9 @@ _ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta,
struct ieee80211_bss_conf *link_conf;

/* NAN operates on multiple channels so a chandef must be given */
- if (WARN_ON_ONCE(sta->sdata->vif.type == NL80211_IFTYPE_NAN ||
- sta->sdata->vif.type == NL80211_IFTYPE_NAN_DATA))
- return IEEE80211_STA_RX_BW_20;
+ if (sta->sdata->vif.type == NL80211_IFTYPE_NAN ||
+ sta->sdata->vif.type == NL80211_IFTYPE_NAN_DATA)
+ return IEEE80211_STA_RX_BW_MAX;

rcu_read_lock();
link_conf = rcu_dereference(sta->sdata->vif.link_conf[link_sta->link_id]);
--
2.53.0