[PATCH 3/9] nl80211: Explicitly differentiate between 5GHz mode and 6GHz mode
benjamin at sipsolutions.net
benjamin at sipsolutions.net
Fri Feb 9 07:18:53 PST 2024
From: Ilan Peer <ilan.peer at intel.com>
When a device supports both the 5GHz band and the 6GHz band,
these are reported as two separate modes, both with mode set to
HOSTAPD_MODE_IEEE80211A. However, as these are different modes,
each with its own characteristics, e.g., rates, capabilities etc.,
specifically differentiate between them by adding a flag to indicate
whether the mode describes a 6GHz band capabilities or not.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/ap/hw_features.c | 8 ++------
src/drivers/driver.h | 5 +++++
src/drivers/driver_nl80211_capa.c | 11 +++++++++--
wpa_supplicant/wpa_supplicant.c | 3 +--
4 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 596f2f020..fd401d78a 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -107,9 +107,7 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
*/
orig_mode_valid = true;
mode = iface->current_mode->mode;
- is_6ghz = mode == HOSTAPD_MODE_IEEE80211A &&
- iface->current_mode->num_channels > 0 &&
- is_6ghz_freq(iface->current_mode->channels[0].freq);
+ is_6ghz = iface->current_mode->is_6ghz;
iface->current_mode = NULL;
}
hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
@@ -1070,9 +1068,7 @@ static bool skip_mode(struct hostapd_iface *iface,
return true;
if (is_6ghz_op_class(iface->conf->op_class) && iface->freq == 0 &&
- (mode->mode != HOSTAPD_MODE_IEEE80211A ||
- mode->num_channels == 0 ||
- !is_6ghz_freq(mode->channels[0].freq)))
+ !mode->is_6ghz)
return true;
return false;
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index bff7502f1..3dcab8f31 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -246,6 +246,11 @@ struct hostapd_hw_modes {
*/
enum hostapd_hw_mode mode;
+ /**
+ * is_6ghz - true iff the mode information is for the 6GHz band
+ */
+ bool is_6ghz;
+
/**
* num_channels - Number of entries in the channels array
*/
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
index 59f1414ac..cef23b183 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -2156,6 +2156,9 @@ wpa_driver_nl80211_postprocess_modes(struct hostapd_hw_modes *modes,
for (m = 0; m < *num_modes; m++) {
if (!modes[m].num_channels)
continue;
+
+ modes[m].is_6ghz = false;
+
if (modes[m].channels[0].freq < 2000) {
modes[m].num_channels = 0;
continue;
@@ -2167,10 +2170,14 @@ wpa_driver_nl80211_postprocess_modes(struct hostapd_hw_modes *modes,
break;
}
}
- } else if (modes[m].channels[0].freq > 50000)
+ } else if (modes[m].channels[0].freq > 50000) {
modes[m].mode = HOSTAPD_MODE_IEEE80211AD;
- else
+ } else if (is_6ghz_freq(modes[m].channels[0].freq)) {
modes[m].mode = HOSTAPD_MODE_IEEE80211A;
+ modes[m].is_6ghz = true;
+ } else {
+ modes[m].mode = HOSTAPD_MODE_IEEE80211A;
+ }
}
/* Remove unsupported bands */
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 172a863cb..cf25df0ec 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -9045,8 +9045,7 @@ struct hostapd_hw_modes * get_mode(struct hostapd_hw_modes *modes,
if (modes[i].mode != mode ||
!modes[i].num_channels || !modes[i].channels)
continue;
- if ((!is_6ghz && !is_6ghz_freq(modes[i].channels[0].freq)) ||
- (is_6ghz && is_6ghz_freq(modes[i].channels[0].freq)))
+ if (is_6ghz == modes[i].is_6ghz)
return &modes[i];
}
--
2.43.0
More information about the Hostap
mailing list