Files
wlan-ap/feeds/qca-wifi-7/hostapd/patches/r08-05-hostapd-add-device-bandwidth-params-to-channel-switc.patch
John Crispin 68cf54d9f7 qca-wifi-7: update to ath12.5.5
Signed-off-by: John Crispin <john@phrozen.org>
2025-02-27 12:45:52 +01:00

196 lines
7.6 KiB
Diff

From 21e1f3bbbff3b7398e274df29bc06dd782525664 Mon Sep 17 00:00:00 2001
From: Aloka Dixit <quic_alokad@quicinc.com>
Date: Thu, 30 Nov 2023 16:16:21 -0800
Subject: [PATCH 5/7] hostapd: add device bandwidth params to channel switch
events
Add device parameters (bandwidth and center frequency) to channel
switch events.
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
src/ap/drv_callbacks.c | 34 ++++++++++++++++++++++++++----
src/ap/hostapd.h | 1 +
src/drivers/driver.h | 4 ++++
src/drivers/driver_nl80211_event.c | 10 +++++++++
wpa_supplicant/ap.c | 7 ++++--
wpa_supplicant/ap.h | 3 ++-
wpa_supplicant/events.c | 2 ++
7 files changed, 54 insertions(+), 7 deletions(-)
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -927,7 +927,8 @@ void hostapd_event_sta_opmode_changed(st
void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
int offset, int width, int cf1, int cf2,
- u16 punct_bitmap, u16 ru_punct_bitmap, u8 ru_punct_ofdma, int finished)
+ u16 punct_bitmap, u16 ru_punct_bitmap, u8 ru_punct_ofdma,
+ int width_device, int cf_device, int finished)
{
#ifdef NEED_AP_MLME
int channel, chwidth, is_dfs0, is_dfs;
@@ -936,7 +937,7 @@ void hostapd_event_ch_switch(struct host
hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_INFO,
- "driver %s channel switch: iface->freq=%d, freq=%d, ht=%d, vht_ch=0x%x, he_ch=0x%x, eht_ch=0x%x, offset=%d, width=%d (%s), cf1=%d, cf2=%d, puncturing_bitmap=0x%x, ru_punct_bitmap=0x%x, ru_punct_ofdma=%u",
+ "driver %s channel switch: iface->freq=%d, freq=%d, ht=%d, vht_ch=0x%x, he_ch=0x%x, eht_ch=0x%x, offset=%d, width=%d (%s), cf1=%d, cf2=%d, puncturing_bitmap=0x%x, ru_punct_bitmap=0x%x, ru_punct_ofdma=%u width_device=%d, cf_device=%d ",
finished ? "had" : "starting",
hapd->iface->freq,
freq, ht, hapd->iconf->ch_switch_vht_config,
@@ -944,7 +945,7 @@ void hostapd_event_ch_switch(struct host
hapd->iconf->ch_switch_eht_config, offset,
width, channel_width_to_string(width), cf1, cf2,
punct_bitmap,
- ru_punct_bitmap, ru_punct_ofdma);
+ ru_punct_bitmap, ru_punct_ofdma, width_device, cf_device);
if (!hapd->iface->current_mode) {
hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
@@ -1050,6 +1051,26 @@ void hostapd_event_ch_switch(struct host
hapd->iconf->op_class = op_class;
hapd->iconf->ru_punct_bitmap = ru_punct_bitmap;
hapd->iconf->ru_punct_ofdma = ru_punct_ofdma;
+
+ hapd->iconf->center_freq_device = cf_device;
+ switch (width_device) {
+ case CHAN_WIDTH_40:
+ hapd->iconf->bandwidth_device = 40;
+ break;
+ case CHAN_WIDTH_80:
+ hapd->iconf->bandwidth_device = 80;
+ break;
+ case CHAN_WIDTH_160:
+ hapd->iconf->bandwidth_device = 160;
+ break;
+ case CHAN_WIDTH_320:
+ hapd->iconf->bandwidth_device = 320;
+ break;
+ default:
+ hapd->iconf->bandwidth_device = 0;
+ hapd->iconf->center_freq_device = 0;
+ break;
+ }
#ifdef CONFIG_IEEE80211BE
hapd->iconf->punct_bitmap = punct_bitmap;
#endif /* CONFIG_IEEE80211BE */
@@ -1068,12 +1089,12 @@ void hostapd_event_ch_switch(struct host
wpa_msg(hapd->msg_ctx, MSG_INFO,
"%sfreq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d is_dfs0=%d dfs=%d puncturing_bitmap=0x%04x"
- "ru_punct_bitmap=0x%x ru_punct_ofdma=%u",
+ "ru_punct_bitmap=0x%x ru_punct_ofdma=%u width_device=%d, cf_device=%d",
finished ? WPA_EVENT_CHANNEL_SWITCH :
WPA_EVENT_CHANNEL_SWITCH_STARTED,
freq, ht, offset, channel_width_to_string(width),
cf1, cf2, is_dfs0, is_dfs, punct_bitmap,
- ru_punct_bitmap, ru_punct_ofdma);
+ ru_punct_bitmap, ru_punct_ofdma, width_device, cf_device);
if (!finished)
return;
@@ -2352,6 +2373,8 @@ void hostapd_wpa_event(void *ctx, enum w
data->ch_switch.punct_bitmap,
data->ch_switch.ru_punct_bitmap,
data->ch_switch.ru_punct_ofdma,
+ data->ch_switch.ch_width_device,
+ data->ch_switch.cf_device,
event == EVENT_CH_SWITCH);
break;
case EVENT_CONNECT_FAILED_REASON:
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -852,6 +852,7 @@ int hostapd_probe_req_rx(struct hostapd_
void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
int offset, int width, int cf1, int cf2,
u16 punct_bitmap, u16 ru_punct_bitmap, u8 ru_punct_ofdma,
+ int width_device, int cf_device,
int finished);
struct survey_results;
void hostapd_event_get_survey(struct hostapd_iface *iface,
--- a/src/drivers/driver_nl80211_event.c
+++ b/src/drivers/driver_nl80211_event.c
@@ -1206,6 +1206,8 @@ static void mlme_event_ch_switch(struct
struct nlattr *count,
struct nlattr *ru_punct_bitmap,
struct nlattr *ru_punct_ofdma,
+ struct nlattr *bw_device,
+ struct nlattr *cf_device,
int finished)
{
struct wpa_driver_nl80211_data *drv = bss->drv;
@@ -1287,6 +1289,10 @@ static void mlme_event_ch_switch(struct
if (ru_punct_ofdma)
data.ch_switch.ru_punct_ofdma = nla_get_flag(ru_punct_ofdma);
}
+ if (bw_device)
+ data.ch_switch.ch_width_device = convert2width(nla_get_u32(bw_device));
+ if (cf_device)
+ data.ch_switch.cf_device = nla_get_u32(cf_device);
if (finished)
mld_link->freq = data.ch_switch.freq;
@@ -4296,6 +4302,8 @@ static void do_process_drv_event(struct
tb[NL80211_ATTR_CH_SWITCH_COUNT],
tb[NL80211_ATTR_RU_PUNCT_BITMAP],
tb[NL80211_ATTR_RU_PUNCT_SUPP_HE],
+ tb[NL80211_ATTR_CHANNEL_WIDTH_DEVICE],
+ tb[NL80211_ATTR_CENTER_FREQ_DEVICE],
0);
break;
case NL80211_CMD_CH_SWITCH_NOTIFY:
@@ -4311,6 +4319,8 @@ static void do_process_drv_event(struct
NULL,
tb[NL80211_ATTR_RU_PUNCT_BITMAP],
tb[NL80211_ATTR_RU_PUNCT_SUPP_HE],
+ tb[NL80211_ATTR_CHANNEL_WIDTH_DEVICE],
+ tb[NL80211_ATTR_CENTER_FREQ_DEVICE],
1);
break;
case NL80211_CMD_DISCONNECT:
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -1901,7 +1901,8 @@ int ap_ctrl_iface_chanswitch(struct wpa_
void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
int offset, int width, int cf1, int cf2,
- u16 punct_bitmap, int ru_punct_ofdma, int finished)
+ u16 punct_bitmap, int ru_punct_ofdma,
+ int width_device, int cf_device, int finished)
{
struct hostapd_iface *iface = wpa_s->ap_iface;
@@ -1914,7 +1915,7 @@ void wpas_ap_ch_switch(struct wpa_suppli
wpa_s->current_ssid->frequency = freq;
hostapd_event_ch_switch(iface->bss[0], freq, ht,
offset, width, cf1, cf2, punct_bitmap,
- punct_bitmap, ru_punct_ofdma, finished);
+ punct_bitmap, ru_punct_ofdma, width_device, cf_device, finished);
}
--- a/wpa_supplicant/ap.h
+++ b/wpa_supplicant/ap.h
@@ -74,7 +74,8 @@ int ap_switch_channel(struct wpa_supplic
int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *txtaddr);
void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
int offset, int width, int cf1, int cf2,
- u16 punct_bitmap, int ru_punct_ofdma, int finished);
+ u16 punct_bitmap, int ru_punct_ofdma,
+ int width_device, int cf_device, int finished);
struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
int ndef);
#ifdef CONFIG_AP
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -5809,6 +5809,8 @@ void supplicant_event(void *ctx, enum wp
data->ch_switch.cf2,
data->ch_switch.punct_bitmap,
data->ch_switch.ru_punct_ofdma,
+ data->ch_switch.ch_width_device,
+ data->ch_switch.cf_device,
1);
}
#endif /* CONFIG_AP */