wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/q02-046-hostapd-Add-5GHz-240MHz-support.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

262 lines
8.9 KiB
Diff

From 5205496c33b432d7621ffff86df6540d6854fff2 Mon Sep 17 00:00:00 2001
From: Hari Chandrakanthan <quic_haric@quicinc.com>
Date: Thu, 8 Sep 2022 21:10:01 +0530
Subject: [PATCH] hostapd: Add 5GHz 240MHz support
240MHz is supported in 5GHz for single band from channel
100 - 144 with right hand 80MHz puncturing in 320MHz bandwidth.
EHT phy capability for advertising 320MHz support in 6GHz is
reused for 5GHz as well if 320MHz is configured. EHT opertional
IE is also used to advertise the bandwidth and the center frequency
of the AP.
Signed-off-by: Karthik M <quic_karm@quicinc.com>
Signed-off-by: Ramya Gnanasekar <quic_rgnanase@quicinc.com>
Signed-off-by: Hari Chandrakanthan <quic_haric@quicinc.com>
---
src/ap/beacon.c | 8 +++++++-
src/ap/dfs.c | 19 ++++++++++++++++---
src/ap/hw_features.c | 6 +++++-
src/ap/ieee802_11_eht.c | 10 +++++++---
src/common/hw_features_common.c | 16 ++++++++++++++++
src/common/ieee802_11_common.c | 7 +++++++
src/common/ieee802_11_common.h | 1 +
src/common/ieee802_11_defs.h | 1 +
8 files changed, 60 insertions(+), 8 deletions(-)
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -437,11 +437,13 @@ static u8 * hostapd_eid_ecsa(struct host
static u8 * hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid)
{
u8 op_class, channel;
+ int ch_width;
if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) ||
!hapd->iface->freq)
return eid;
-
+
+ ch_width = hostapd_get_oper_chwidth(hapd->iconf);
if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
hapd->iconf->secondary_channel,
hostapd_get_oper_chwidth(hapd->iconf),
@@ -449,6 +451,10 @@ static u8 * hostapd_eid_supported_op_cla
NUM_HOSTAPD_MODES)
return eid;
+ /*op_class for 5GHz 320MHz bw is not defined in spec. So use op_class of 160MHz*/
+ if (is_5ghz_freq(hapd->iface->freq) && ch_width == CONF_OPER_CHWIDTH_320MHZ)
+ op_class = 129;
+
*eid++ = WLAN_EID_SUPPORTED_OPERATING_CLASSES;
*eid++ = 2;
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -430,7 +430,8 @@ static int dfs_get_start_chan_idx(struct
channel_no -= 4;
/* VHT/HE */
- if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
+ if (iface->conf->ieee80211ac || iface->conf->ieee80211ax ||
+ iface->conf->ieee80211be) {
switch (hostapd_get_oper_chwidth(iface->conf)) {
case CONF_OPER_CHWIDTH_USE_HT:
break;
@@ -448,6 +449,10 @@ static int dfs_get_start_chan_idx(struct
chan_seg1 = hostapd_get_oper_centr_freq_seg1_idx(
iface->conf) - 6;
break;
+ case CONF_OPER_CHWIDTH_320MHZ:
+ channel_no = hostapd_get_oper_centr_freq_seg0_idx(
+ iface->conf) - 30;
+ break;
default:
wpa_printf(MSG_INFO,
"DFS only VHT20/40/80/160/80+80 is supported now");
@@ -490,7 +495,6 @@ static int dfs_get_start_chan_idx(struct
iface->conf->ieee80211n,
iface->conf->secondary_channel,
hostapd_get_oper_chwidth(iface->conf));
-
for (i = 0; i < mode->num_channels; i++) {
wpa_printf(MSG_DEBUG, "Available channel: %d",
mode->channels[i].chan);
@@ -785,6 +789,10 @@ static int set_dfs_state(struct hostapd_
n_chans = 8;
frequency = cf1 - 70;
break;
+ case CHAN_WIDTH_320:
+ n_chans = 16;
+ frequency = cf1 - 150;
+ break;
default:
wpa_printf(MSG_INFO, "DFS chan_width %d not supported",
chan_width);
@@ -970,13 +978,14 @@ int hostapd_handle_dfs(struct hostapd_if
wpa_printf(MSG_DEBUG, "DFS start CAC on %d MHz%s", iface->freq,
dfs_use_radar_background(iface) ? " (background)" : "");
wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
- "freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds",
+ "freq=%d chan=%d sec_chan=%d, width=%d, seg0=%d, seg1=%d, cac_time=%ds bitmap:0x%04x",
iface->freq,
iface->conf->channel, iface->conf->secondary_channel,
hostapd_get_oper_chwidth(iface->conf),
hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
hostapd_get_oper_centr_freq_seg1_idx(iface->conf),
- iface->dfs_cac_ms / 1000);
++ iface->dfs_cac_ms / 1000,
++ iface->conf->ru_punct_bitmap);
res = hostapd_start_dfs_cac(
iface, iface->conf->hw_mode, iface->freq, iface->conf->channel,
@@ -1787,6 +1796,9 @@ int hostapd_is_dfs_overlap(struct hostap
case CHAN_WIDTH_160:
half_width = 80;
break;
+ case CHAN_WIDTH_320:
+ half_width = 160;
+ break;
default:
wpa_printf(MSG_WARNING, "DFS chanwidth %d not supported",
width);
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -940,7 +940,7 @@ static int hostapd_is_usable_edmg(struct
static int hostapd_is_usable_ru_punct_bitmap(struct hostapd_iface *iface)
{
struct hostapd_config *conf = iface->conf;
- u8 bw, start_chan;
+ int bw, start_chan;
if (!conf->ru_punct_bitmap) {
conf->ru_punct_ofdma = 0;
@@ -973,6 +973,10 @@ static int hostapd_is_usable_ru_punct_bi
bw = 160;
start_chan = conf->eht_oper_centr_freq_seg0_idx - 14;
break;
+ case 9:
+ bw = 320;
+ start_chan = conf->eht_oper_centr_freq_seg0_idx - 30;
+ break;
default:
return 0;
}
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -7538,6 +7538,7 @@ static u8 * hostapd_eid_rnr_iface(struct
struct hostapd_iface *iface = hapd->iface;
size_t i, start = 0;
size_t len = *current_len;
+ int ch_width = hostapd_get_oper_chwidth(hapd->iconf);
u8 *tbtt_count_pos, *eid_start = eid, *size_offset = (eid - len) + 1;
u8 tbtt_count = 0, op_class, channel, bss_param;
bool ap_mld = false;
@@ -7549,12 +7550,15 @@ static u8 * hostapd_eid_rnr_iface(struct
if (!(iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) || !iface->freq)
return eid;
- if (ieee80211_freq_to_channel_ext(iface->freq,
- hapd->iconf->secondary_channel,
- hostapd_get_oper_chwidth(hapd->iconf),
- &op_class, &channel) ==
- NUM_HOSTAPD_MODES)
- return eid;
+ /* op_class for 5GHz 320MHz bw is not defined in spec. So use op_class of 160MHz */
+ if (is_5ghz_freq(hapd->iface->freq) && ch_width == CONF_OPER_CHWIDTH_320MHZ)
+ op_class = 129;
+ else
+ if (ieee80211_freq_to_channel_ext(iface->freq,
+ hapd->iconf->secondary_channel,
+ ch_width, &op_class, &channel) ==
+ NUM_HOSTAPD_MODES)
+ return eid;
while (start < iface->num_bss) {
if (!len ||
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -93,8 +93,10 @@ static u8 ieee80211_eht_mcs_set_size(enu
if (band6 &&
(eht_phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] &
- EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK))
+ EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK)) {
sz += EHT_PHYCAP_MCS_NSS_LEN_20MHZ_PLUS;
+ sz += EHT_PHYCAP_MCS_NSS_LEN_160MHZ;
+ }
return sz;
}
@@ -133,7 +135,7 @@ u8 * hostapd_eid_eht_capab(struct hostap
struct eht_capabilities *eht_cap;
struct ieee80211_eht_capabilities *cap;
size_t mcs_nss_len, ppe_thresh_len;
- u8 *pos = eid, *length_pos;
+ u8 *pos = eid, *length_pos, chwidth;
mode = hapd->iface->current_mode;
if (!mode)
@@ -151,8 +153,10 @@ u8 * hostapd_eid_eht_capab(struct hostap
os_memset(cap, 0, sizeof(*cap));
cap->mac_cap = host_to_le16(eht_cap->mac_cap);
os_memcpy(cap->phy_cap, eht_cap->phy_cap, EHT_PHY_CAPAB_LEN);
+ chwidth = hapd->iconf->eht_oper_chwidth;
- if (!is_6ghz_op_class(hapd->iconf->op_class))
+ if (!is_6ghz_op_class(hapd->iconf->op_class) &&
+ (chwidth != CONF_OPER_CHWIDTH_320MHZ))
cap->phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] &=
~EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK;
if (!hapd->iface->conf->eht_phy_capab.su_beamformer)
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -2758,6 +2758,13 @@ int center_idx_to_bw_6ghz(u8 idx)
return -1;
}
+bool is_5ghz_freq(int freq)
+{
+ if ((freq >= 5180 && freq < 5600) ||
+ (freq >= 5660 && freq < 5825))
+ return true;
+ return false;
+}
bool is_6ghz_freq(int freq)
{
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -276,6 +276,7 @@ u8 country_to_global_op_class(const char
const struct oper_class_map * get_oper_class(const char *country, u8 op_class);
int oper_class_bw_to_int(const struct oper_class_map *map);
+bool is_5ghz_freq(int freq);
int center_idx_to_bw_6ghz(u8 idx);
bool is_6ghz_freq(int freq);
bool is_6ghz_op_class(u8 op_class);
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2561,6 +2561,7 @@ struct ieee80211_eht_operation {
/* Figure 9-1002ah: Supported EHT-MCS and NSS Set field format */
#define EHT_PHYCAP_MCS_NSS_LEN_20MHZ_ONLY 4
#define EHT_PHYCAP_MCS_NSS_LEN_20MHZ_PLUS 3
+#define EHT_PHYCAP_MCS_NSS_LEN_160MHZ 3
#define EHT_MCS_NSS_CAPAB_LEN 9
/*
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -88,8 +88,7 @@ u8 * hostapd_eid_vht_operation(struct ho
struct ieee80211_vht_operation *oper;
le32 vht_capabilities_info;
u8 *pos = eid;
- enum oper_chan_width oper_chwidth =
- hostapd_get_oper_chwidth(hapd->iconf);
+ enum oper_chan_width oper_chwidth = hapd->iconf->vht_oper_chwidth;
u8 seg0 = hapd->iconf->vht_oper_centr_freq_seg0_idx;
u8 seg1 = hapd->iconf->vht_oper_centr_freq_seg1_idx;