From b478b7b1f7b9d402190dc3a9db4cad4c9a6fc50d Mon Sep 17 00:00:00 2001 From: Janusz Dziedzic Date: Fri, 20 Sep 2024 19:43:32 +0200 Subject: [PATCH] wifi-scripts: detect and configure EHT Check if EHT/11BE supported, configure in board.json and config/wireless. Signed-off-by: Janusz Dziedzic --- .../wifi-scripts/files/lib/wifi/mac80211.uc | 2 +- .../files/usr/share/hostap/wifi-detect.uc | 27 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc index 8f25a791b3..b68167b754 100644 --- a/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc +++ b/package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc @@ -3,7 +3,7 @@ import { readfile } from "fs"; import * as uci from 'uci'; const bands_order = [ "6G", "5G", "2G" ]; -const htmode_order = [ "HE", "VHT", "HT" ]; +const htmode_order = [ "EHT", "HE", "VHT", "HT" ]; let board = json(readfile("/etc/board.json")); if (!board.wlan) diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc index 6eb6b84c91..468078ad20 100644 --- a/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc +++ b/package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc @@ -113,6 +113,7 @@ function wiphy_detect() { if (band.vht_capa > 0) band_info.vht = true; let he_phy_cap = 0; + let eht_phy_cap = 0; for (let ift in band.iftype_data) { if (!ift.he_cap_phy) @@ -120,7 +121,12 @@ function wiphy_detect() { band_info.he = true; he_phy_cap |= ift.he_cap_phy[0]; - /* TODO: EHT */ + + if (!ift.eht_cap_phy) + continue; + + band_info.eht = true; + eht_phy_cap |= ift.eht_cap_phy[0]; } if (band_name != "2G" && @@ -141,14 +147,19 @@ function wiphy_detect() { push(modes, "VHT20"); if (band_info.he) push(modes, "HE20"); + if (band_info.eht) + push(modes, "EHT20"); if (band.ht_capa & 0x2) { push(modes, "HT40"); if (band_info.vht) push(modes, "VHT40") } - if (he_phy_cap & 0x2) + if (he_phy_cap & 2) push(modes, "HE40"); + if (eht_phy_cap && he_phy_cap & 2) + push(modes, "EHT40"); + for (let freq in band.freqs) { if (freq.disabled) continue; @@ -161,14 +172,26 @@ function wiphy_detect() { if (band_name == "2G") continue; + + if (he_phy_cap & 4) + push(modes, "HE40"); + if (eht_phy_cap && he_phy_cap & 4) + push(modes, "EHT40"); if (band_info.vht) push(modes, "VHT80"); if (he_phy_cap & 4) push(modes, "HE80"); + if (eht_phy_cap && he_phy_cap & 4) + push(modes, "EHT80"); if ((band.vht_capa >> 2) & 0x3) push(modes, "VHT160"); if (he_phy_cap & 0x18) push(modes, "HE160"); + if (eht_phy_cap && he_phy_cap & 0x18) + push(modes, "EHT160"); + + if (eht_phy_cap & 2) + push(modes, "ETH320"); } let entry = wiphy_get_entry(name, path);