Skip to content

Commit f19a531

Browse files
mergify[bot]alainlamarc-po
authored
wireless: T6425: Fixing VHT beamforming for 802.11ac (backport #3576) (#3849)
* wireless: T6425: Fix broken VHT beamforming (cherry picked from commit f75f0f9) * wireless: T6425: Add smoketests for VHT beamforming (cherry picked from commit 578fbe0) * wireless: T6425: adjust to latest country-code changes Commit 9e22ab6 ("wireless: T6318: move country-code to a system wide configuration") removed the per wifi interface setting for a country-code. This commit adjust the smoketests to the new design. (cherry picked from commit 312273c) --------- Co-authored-by: Alain Lamar <alain_lamar@yahoo.de> Co-authored-by: Christian Breunig <christian@breunig.cc>
1 parent 405ae90 commit f19a531

File tree

2 files changed

+156
-16
lines changed

2 files changed

+156
-16
lines changed

data/templates/wifi/hostapd.conf.j2

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -383,23 +383,25 @@ vht_oper_chwidth={{ capabilities.vht.channel_set_width }}
383383
{% for short_gi in capabilities.vht.short_gi if capabilities.vht.short_gi is vyos_defined %}
384384
{% set output.value = output.value ~ '[SHORT-GI-' ~ short_gi | upper ~ ']' %}
385385
{% endfor %}
386-
{% for beamform in capabilities.vht.beamform if capabilities.vht.beamform is vyos_defined %}
387-
{% set output.value = output.value ~ '[SU-BEAMFORMER]' if beamform is vyos_defined('single-user-beamformer') else '' %}
388-
{% set output.value = output.value ~ '[SU-BEAMFORMEE]' if beamform is vyos_defined('single-user-beamformee') else '' %}
389-
{% set output.value = output.value ~ '[MU-BEAMFORMER]' if beamform is vyos_defined('multi-user-beamformer') else '' %}
390-
{% set output.value = output.value ~ '[MU-BEAMFORMEE]' if beamform is vyos_defined('multi-user-beamformee') else '' %}
391-
{% endfor %}
392-
{% if capabilities.vht.antenna_count is vyos_defined and capabilities.vht.antenna_count | int > 1 %}
393-
{% if capabilities.vht.beamform is vyos_defined %}
394-
{% if capabilities.vht.beamform == 'single-user-beamformer' %}
386+
{% if capabilities.vht.beamform is vyos_defined %}
387+
{% for bf in capabilities.vht.beamform %}
388+
{% set output.value = output.value ~ '[SU-BEAMFORMER]' if bf is vyos_defined('single-user-beamformer') else output.value %}
389+
{% set output.value = output.value ~ '[SU-BEAMFORMEE]' if bf is vyos_defined('single-user-beamformee') else output.value %}
390+
{% set output.value = output.value ~ '[MU-BEAMFORMER]' if bf is vyos_defined('multi-user-beamformer') else output.value %}
391+
{% set output.value = output.value ~ '[MU-BEAMFORMEE]' if bf is vyos_defined('multi-user-beamformee') else output.value %}
392+
{% endfor %}
393+
{% if capabilities.vht.antenna_count is vyos_defined and capabilities.vht.antenna_count | int > 1 %}
394+
{% if 'single-user-beamformer' in capabilities.vht.beamform %}
395395
{% if capabilities.vht.antenna_count is vyos_defined and capabilities.vht.antenna_count | int > 1 and capabilities.vht.antenna_count | int < 6 %}
396-
{% set output.value = output.value ~ '[BF-ANTENNA-' ~ capabilities.vht.antenna_count | int -1 ~ ']' %}
397-
{% set output.value = output.value ~ '[SOUNDING-DIMENSION-' ~ capabilities.vht.antenna_count | int -1 ~ ']' %}
396+
{% set dimension = capabilities.vht.antenna_count | int - 1 %}
397+
{% set output.value = output.value ~ '[BF-ANTENNA-' ~ dimension ~ ']' %}
398+
{% set output.value = output.value ~ '[SOUNDING-DIMENSION-' ~ dimension ~ ']' %}
399+
{% endif %}
400+
{% else %}
401+
{% if capabilities.vht.antenna_count is vyos_defined and capabilities.vht.antenna_count | int > 1 and capabilities.vht.antenna_count | int < 5 %}
402+
{% set output.value = output.value ~ '[BF-ANTENNA-' ~ capabilities.vht.antenna_count ~ ']' %}
403+
{% set output.value = output.value ~ '[SOUNDING-DIMENSION-' ~ capabilities.vht.antenna_count ~ ']' %}
398404
{% endif %}
399-
{% endif %}
400-
{% if capabilities.vht.antenna_count is vyos_defined and capabilities.vht.antenna_count | int > 1 and capabilities.vht.antenna_count | int < 5 %}
401-
{% set output.value = output.value ~ '[BF-ANTENNA-' ~ capabilities.vht.antenna_count ~ ']' %}
402-
{% set output.value = output.value ~ '[SOUNDING-DIMENSION-' ~ capabilities.vht.antenna_count ~ ']' %}
403405
{% endif %}
404406
{% endif %}
405407
{% endif %}

smoketest/scripts/cli/test_interfaces_wireless.py

Lines changed: 139 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
#
3-
# Copyright (C) 2020-2023 VyOS maintainers and contributors
3+
# Copyright (C) 2020-2024 VyOS maintainers and contributors
44
#
55
# This program is free software; you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License version 2 or later as
@@ -146,6 +146,144 @@ def test_wireless_hostapd_config(self):
146146
# Check for running process
147147
self.assertTrue(process_named_running('hostapd'))
148148

149+
def test_wireless_hostapd_vht_mu_beamformer_config(self):
150+
# Multi-User-Beamformer
151+
interface = 'wlan1'
152+
ssid = 'vht_mu-beamformer'
153+
antennas = '3'
154+
155+
self.cli_set(self._base_path + [interface, 'ssid', ssid])
156+
self.cli_set(self._base_path + [interface, 'type', 'access-point'])
157+
self.cli_set(self._base_path + [interface, 'channel', '36'])
158+
159+
ht_opt = {
160+
# VyOS CLI option hostapd - ht_capab setting
161+
'channel-set-width ht20' : '[HT20]',
162+
'channel-set-width ht40-' : '[HT40-]',
163+
'channel-set-width ht40+' : '[HT40+]',
164+
'dsss-cck-40' : '[DSSS_CCK-40]',
165+
'short-gi 20' : '[SHORT-GI-20]',
166+
'short-gi 40' : '[SHORT-GI-40]',
167+
'max-amsdu 7935' : '[MAX-AMSDU-7935]',
168+
}
169+
for key in ht_opt:
170+
self.cli_set(self._base_path + [interface, 'capabilities', 'ht'] + key.split())
171+
172+
vht_opt = {
173+
# VyOS CLI option hostapd - ht_capab setting
174+
'max-mpdu 11454' : '[MAX-MPDU-11454]',
175+
'max-mpdu-exp 2' : '[MAX-A-MPDU-LEN-EXP-2]',
176+
'stbc tx' : '[TX-STBC-2BY1]',
177+
'stbc rx 12' : '[RX-STBC-12]',
178+
'ldpc' : '[RXLDPC]',
179+
'tx-powersave' : '[VHT-TXOP-PS]',
180+
'vht-cf' : '[HTC-VHT]',
181+
'antenna-pattern-fixed' : '[RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN]',
182+
'link-adaptation both' : '[VHT-LINK-ADAPT3]',
183+
'short-gi 80' : '[SHORT-GI-80]',
184+
'short-gi 160' : '[SHORT-GI-160]',
185+
'beamform multi-user-beamformer' : '[MU-BEAMFORMER][BF-ANTENNA-3][SOUNDING-DIMENSION-3]',
186+
}
187+
188+
self.cli_set(self._base_path + [interface, 'capabilities', 'vht', 'channel-set-width', '1'])
189+
self.cli_set(self._base_path + [interface, 'capabilities', 'vht', 'center-channel-freq', 'freq-1', '42'])
190+
self.cli_set(self._base_path + [interface, 'capabilities', 'vht', 'antenna-count', antennas])
191+
for key in vht_opt:
192+
self.cli_set(self._base_path + [interface, 'capabilities', 'vht'] + key.split())
193+
194+
self.cli_commit()
195+
196+
#
197+
# Validate Config
198+
#
199+
tmp = get_config_value(interface, 'interface')
200+
self.assertEqual(interface, tmp)
201+
202+
# ssid
203+
tmp = get_config_value(interface, 'ssid')
204+
self.assertEqual(ssid, tmp)
205+
206+
# channel
207+
tmp = get_config_value(interface, 'channel')
208+
self.assertEqual('36', tmp)
209+
210+
tmp = get_config_value(interface, 'ht_capab')
211+
for key, value in ht_opt.items():
212+
self.assertIn(value, tmp)
213+
214+
tmp = get_config_value(interface, 'vht_capab')
215+
for key, value in vht_opt.items():
216+
self.assertIn(value, tmp)
217+
218+
def test_wireless_hostapd_vht_su_beamformer_config(self):
219+
# Single-User-Beamformer
220+
interface = 'wlan1'
221+
ssid = 'vht_su-beamformer'
222+
antennas = '3'
223+
224+
self.cli_set(self._base_path + [interface, 'ssid', ssid])
225+
self.cli_set(self._base_path + [interface, 'type', 'access-point'])
226+
self.cli_set(self._base_path + [interface, 'channel', '36'])
227+
228+
ht_opt = {
229+
# VyOS CLI option hostapd - ht_capab setting
230+
'channel-set-width ht20' : '[HT20]',
231+
'channel-set-width ht40-' : '[HT40-]',
232+
'channel-set-width ht40+' : '[HT40+]',
233+
'dsss-cck-40' : '[DSSS_CCK-40]',
234+
'short-gi 20' : '[SHORT-GI-20]',
235+
'short-gi 40' : '[SHORT-GI-40]',
236+
'max-amsdu 7935' : '[MAX-AMSDU-7935]',
237+
}
238+
for key in ht_opt:
239+
self.cli_set(self._base_path + [interface, 'capabilities', 'ht'] + key.split())
240+
241+
vht_opt = {
242+
# VyOS CLI option hostapd - ht_capab setting
243+
'max-mpdu 11454' : '[MAX-MPDU-11454]',
244+
'max-mpdu-exp 2' : '[MAX-A-MPDU-LEN-EXP-2]',
245+
'stbc tx' : '[TX-STBC-2BY1]',
246+
'stbc rx 12' : '[RX-STBC-12]',
247+
'ldpc' : '[RXLDPC]',
248+
'tx-powersave' : '[VHT-TXOP-PS]',
249+
'vht-cf' : '[HTC-VHT]',
250+
'antenna-pattern-fixed' : '[RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN]',
251+
'link-adaptation both' : '[VHT-LINK-ADAPT3]',
252+
'short-gi 80' : '[SHORT-GI-80]',
253+
'short-gi 160' : '[SHORT-GI-160]',
254+
'beamform single-user-beamformer' : '[SU-BEAMFORMER][BF-ANTENNA-2][SOUNDING-DIMENSION-2]',
255+
}
256+
257+
self.cli_set(self._base_path + [interface, 'capabilities', 'vht', 'channel-set-width', '1'])
258+
self.cli_set(self._base_path + [interface, 'capabilities', 'vht', 'center-channel-freq', 'freq-1', '42'])
259+
self.cli_set(self._base_path + [interface, 'capabilities', 'vht', 'antenna-count', antennas])
260+
for key in vht_opt:
261+
self.cli_set(self._base_path + [interface, 'capabilities', 'vht'] + key.split())
262+
263+
self.cli_commit()
264+
265+
#
266+
# Validate Config
267+
#
268+
tmp = get_config_value(interface, 'interface')
269+
self.assertEqual(interface, tmp)
270+
271+
# ssid
272+
tmp = get_config_value(interface, 'ssid')
273+
self.assertEqual(ssid, tmp)
274+
275+
# channel
276+
tmp = get_config_value(interface, 'channel')
277+
self.assertEqual('36', tmp)
278+
279+
tmp = get_config_value(interface, 'ht_capab')
280+
for key, value in ht_opt.items():
281+
self.assertIn(value, tmp)
282+
283+
tmp = get_config_value(interface, 'vht_capab')
284+
for key, value in vht_opt.items():
285+
self.assertIn(value, tmp)
286+
149287
def test_wireless_hostapd_wpa_config(self):
150288
# Only set the hostapd (access-point) options
151289
interface = 'wlan0'

0 commit comments

Comments
 (0)