[PATCH] Change vht_capab according to user requested BW

Dmitrijs Martinovs dmartinovs at maxlinear.com
Thu Dec 7 02:13:05 PST 2023

In hostapd_cli chan_switch command (hostapd_ctrl_iface_chan_switch) there are 2 flows - for non-DFS channels and for DFS channels.

Sets new BW (from chan_switch command input) into iface->conf struct
Create after-switch-beacon template
Resets iface->conf BW back to original value.
During saving of original BW there is a check if that BW corresponds to vht_capab.

Sets new BW (from chan_switch command input) into iface->conf struct
Read vht_capab from driver
Create all necessary beacon templates and do chan switch using new BW and driver's vht_capab
After this flow new BW remains in iface->conf

The issue is:
By default we don't have VHT160 support in vht_capab. If we set BW = 160 for a DFS channel, it will be saved in iface->conf. If we try to set a non-DFS channel afterwards the function that saves previous values will fail the check for old BW == vht_capab as old BW comes from first (DFS) chan_switch command and vht_capab comes from original values.

Set ch=60 bw=160 -> saves BW as 160
Set ch=40 bw=160 -> compares that BW with original vht_capab that doesn't include VHT160

Change iface->conf->vht_capab according to BW that is requested by user, i.e. add VHT160 if input BW=160

>From c6104b3ecc281d01e7cf617fe984f9a2818ed0d8 Mon Sep 17 00:00:00 2001
From: Dmitrijs Martinovs <dmartinovs at maxlinear.com>
Date: Thu, 7 Dec 2023 11:59:10 +0200
Subject: [PATCH] Change vht_capab according to user requested BW
To: hostap at lists.infradead.org

There are different chan_switch flows for DFS and non-DFS channels.
Non-DFS one saves previous BW value in iface->conf, but DFS flow
replaces it with a new user requested value.  Setting a non-DFS channel
after a DFS one with BW = 160 would have resulted in a mismatch
between the saved BW and vht_capab (if VHT160 was not included by default).
This would have led to a check fail in the hostapd_set_freq_params function.

Signed-off-by: Dmitrijs Martinovs <dmartinovs at maxlinear.com>
 src/ap/hostapd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index fea3d8b3c..0c693a8a9 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -4103,13 +4103,15 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
 	case 80:
-		if (freq_params->center_freq2)
+		if (freq_params->center_freq2) {
-		else
+			iface->conf->vht_capab |= VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
+		} else
 	case 160:
+		iface->conf->vht_capab |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
 	case 320:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Change-vht_capab-according-to-user-requested-BW.patch
Type: application/octet-stream
Size: 1508 bytes
Desc: 0001-Change-vht_capab-according-to-user-requested-BW.patch
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20231207/8c7ae58c/attachment.obj>

More information about the Hostap mailing list