aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexei Avshalom Lazar <ailizaro@codeaurora.org>2019-09-11 09:03:07 (GMT)
committerJouni Malinen <j@w1.fi>2019-10-07 14:02:12 (GMT)
commitdc3457cc4a958a491fae1bff7c0be28e50877509 (patch)
tree90e7d5c7b16e6515f75edda6c2cd6949c0574a29
parentbebd91e9c49bac7e5d72fbb58cd8d85432b4d682 (diff)
downloadhostap-dc3457cc4a958a491fae1bff7c0be28e50877509.zip
hostap-dc3457cc4a958a491fae1bff7c0be28e50877509.tar.gz
hostap-dc3457cc4a958a491fae1bff7c0be28e50877509.tar.bz2
hostapd: Check usability of EDMG channel
Signed-off-by: Alexei Avshalom Lazar <ailizaro@codeaurora.org>
-rw-r--r--src/ap/hw_features.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index c1f19e2..a0720ba 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -730,6 +730,67 @@ static int hostapd_is_usable_chan(struct hostapd_iface *iface,
}
+static int hostapd_is_usable_edmg(struct hostapd_iface *iface)
+{
+ int i, contiguous = 0;
+ int num_of_enabled = 0;
+ int max_contiguous = 0;
+ struct ieee80211_edmg_config edmg;
+
+ if (!iface->conf->enable_edmg)
+ return 1;
+
+ hostapd_encode_edmg_chan(iface->conf->enable_edmg,
+ iface->conf->edmg_channel,
+ iface->conf->channel,
+ &edmg);
+ if (!(edmg.channels & BIT(iface->conf->channel - 1)))
+ return 0;
+
+ /* 60 GHz channels 1..6 */
+ for (i = 0; i < 6; i++) {
+ if (edmg.channels & BIT(i)) {
+ contiguous++;
+ num_of_enabled++;
+ } else {
+ contiguous = 0;
+ continue;
+ }
+
+ /* P802.11ay defines that the total number of subfields
+ * set to one does not exceed 4.
+ */
+ if (num_of_enabled > 4)
+ return 0;
+
+ if (!hostapd_is_usable_chan(iface, i + 1, 1))
+ return 0;
+
+ if (contiguous > max_contiguous)
+ max_contiguous = contiguous;
+ }
+
+ /* Check if the EDMG configuration is valid under the limitations
+ * of P802.11ay.
+ */
+ /* check bw_config against contiguous EDMG channels */
+ switch (edmg.bw_config) {
+ case EDMG_BW_CONFIG_4:
+ if (!max_contiguous)
+ return 0;
+ break;
+ case EDMG_BW_CONFIG_5:
+ if (max_contiguous < 2)
+ return 0;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+
static int hostapd_is_usable_chans(struct hostapd_iface *iface)
{
int secondary_chan;
@@ -743,6 +804,9 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
if (!hostapd_is_usable_chan(iface, iface->conf->channel, 1))
return 0;
+ if (!hostapd_is_usable_edmg(iface))
+ return 0;
+
if (!iface->conf->secondary_channel)
return 1;