Hostapd.conf WMM paramaters setting does not work

Hi, I intend to change the wmm parameters of four traffic categories in hostapd file. Then by using qos-map-set I can prioritize traffics and have different rates in wifi network by configuring DSCP filed in the network.
In the following I provide the hostapd.phy.conf in openwrt that show the configuration of qos_map_set and wmm parameters.
/lib/netifd/hostapd.sh

	append bss_conf "wmm_enabled=$wmm" "$N"

	append bss_conf "wmm_ac_bk_cwmin=2" "$N"
	append bss_conf "wmm_ac_bk_cwmax=3" "$N"
	append bss_conf "wmm_ac_bk_aifs=1" "$N"
	append bss_conf "wmm_ac_bk_txop_limit=0" "$N"
	append bss_conf "wmm_ac_bk_acm=1" "$N"
	append bss_conf "wmm_ac_be_cwmin=2" "$N"
	append bss_conf "wmm_ac_be_cwmax=3" "$N"
	append bss_conf "wmm_ac_be_aifs=1" "$N"
	append bss_conf "wmm_ac_be_txop_limit=0" "$N"
	append bss_conf "wmm_ac_be_acm=1" "$N"
	append bss_conf "wmm_ac_vi_cwmin=2" "$N"
	append bss_conf "wmm_ac_vi_cwmax=3" "$N"
	append bss_conf "wmm_ac_vi_aifs=1" "$N"
	append bss_conf "wmm_ac_vi_txop_limit=0" "$N"
	append bss_conf "wmm_ac_vi_acm=1" "$N"
	append bss_conf "wmm_ac_vo_cwmin=2" "$N"
	append bss_conf "wmm_ac_vo_cwmax=3" "$N"
	append bss_conf "wmm_ac_vo_aifs=1" "$N"
	append bss_conf "wmm_ac_vo_txop_limit=0" "$N"
	append bss_conf "wmm_ac_vo_acm=1" "$N"

/tmp/run/hostapd-phy0.conf

driver=nl80211
logger_syslog=127
logger_syslog_level=2
logger_stdout=127
logger_stdout_level=2
hw_mode=g
supported_rates=60 90 120 180 240 360 480 540
basic_rates=60 120 240
beacon_int=100
airtime_mode=1
channel=acs_survey




#num_global_macaddr=1
ieee80211n=1
ht_coex=0
ht_capab=[SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]

interface=phy0-ap0
ctrl_interface=/var/run/hostapd
ap_isolate=1
bss_load_update_period=60
chan_util_avg_period=600
disassoc_low_ack=1
skip_inactivity_poll=0
preamble=1
wmm_enabled=1
wmm_ac_bk_cwmin=2
wmm_ac_bk_cwmax=3
wmm_ac_bk_aifs=1
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=1
wmm_ac_be_cwmin=2
wmm_ac_be_cwmax=3
wmm_ac_be_aifs=1
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=1
wmm_ac_vi_cwmin=2
wmm_ac_vi_cwmax=3
wmm_ac_vi_aifs=1
wmm_ac_vi_txop_limit=0
wmm_ac_vi_acm=1
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_aifs=1
wmm_ac_vo_txop_limit=0
wmm_ac_vo_acm=1
ignore_broadcast_ssid=0
uapsd_advertisement_enabled=1
utf8_ssid=1
multi_ap=0
wpa_passphrase=12341234
wpa_psk_file=/var/run/hostapd-phy0-ap0.psk
auth_algs=1
wpa=2
wpa_pairwise=CCMP
ssid=MCI-OpenWifi-2GHz-XIAOMI
bridge=br-lan
wds_bridge=
snoop_iface=br-lan
wpa_disable_eapol_key_retries=0
wpa_key_mgmt=WPA-PSK
okc=0
disable_pmksa_caching=1
dynamic_vlan=0
vlan_naming=1
vlan_no_bridge=1
vlan_file=/var/run/hostapd-phy0-ap0.vlan
qos_map_set=0,7,8,15,16,23,24,31,32,39,40,47,48,55,56,63
bssid=c8:bf:4c:48:16:e1
#default_macaddr

/tmp/run/hostapd-phy1.conf

driver=nl80211
logger_syslog=127
logger_syslog_level=2
logger_stdout=127
logger_stdout_level=2
hw_mode=a
beacon_int=100
airtime_mode=1
channel=36
chanlist=36
noscan=1
tx_queue_data2_burst=2.0

#num_global_macaddr=1
ieee80211n=1
ht_coex=0
ht_capab=[LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]
ieee80211ac=1
vht_oper_chwidth=0
vht_oper_centr_freq_seg0_idx=
vht_capab=[RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN][RX-STBC-1][MAX-A-MPDU-LEN-EXP3]

interface=phy1-ap0
ctrl_interface=/var/run/hostapd
ap_isolate=1
bss_load_update_period=60
chan_util_avg_period=600
disassoc_low_ack=1
skip_inactivity_poll=0
preamble=1
wmm_enabled=1
wmm_ac_bk_cwmin=2
wmm_ac_bk_cwmax=3
wmm_ac_bk_aifs=1
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=1
wmm_ac_be_cwmin=2
wmm_ac_be_cwmax=3
wmm_ac_be_aifs=1
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=1
wmm_ac_vi_cwmin=2
wmm_ac_vi_cwmax=3
wmm_ac_vi_aifs=1
wmm_ac_vi_txop_limit=0
wmm_ac_vi_acm=1
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_aifs=1
wmm_ac_vo_txop_limit=0
wmm_ac_vo_acm=1
ignore_broadcast_ssid=0
uapsd_advertisement_enabled=1
utf8_ssid=1
multi_ap=0
wpa_passphrase=12341234
wpa_psk_file=/var/run/hostapd-phy1-ap0.psk
auth_algs=1
wpa=2
wpa_pairwise=CCMP
ssid=MCI-OpenWifi-5GHz-XIAOMI
bridge=br-lan
wds_bridge=
snoop_iface=br-lan
wpa_disable_eapol_key_retries=0
wpa_key_mgmt=WPA-PSK
okc=0
disable_pmksa_caching=1
dynamic_vlan=0
vlan_naming=1
vlan_no_bridge=1
vlan_file=/var/run/hostapd-phy1-ap0.vlan
qos_map_set=0,7,8,15,16,23,24,31,32,39,40,47,48,55,56,63
bssid=c8:bf:4c:48:16:e2
#default_macaddr

I set up an openspeedtest server in my laptop and connect it to the ethernet port of router. Then I assign the DSCP value based of destination ip address for two clients connected to the wifi. The iptables configuration is as below.

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
DSCP       all  --  anywhere             AM-Arefkhani.lan     DSCP set 0x00
DSCP       all  --  anywhere             yasin-VivoBook-ASUSLaptop-X545FB-R545FB.lan  DSCP set 0x3f

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         
LIBVIRT_PRT  all  --  anywhere             anywhere            

Chain LIBVIRT_PRT (1 references)
target     prot opt source               destination         
CHECKSUM   udp  --  anywhere             anywhere             udp dpt:bootpc CHECKSUM fill

Based on wmm configuration above, I expect same rate for both clients when I run speedtest simultaneously on the clients. But one with DSCP 63 (0x3f) has much higher speed than another one. It seems that although I changed the wmm parameters, the default parameters are applied to the access point that are as below.

# Low priority / AC_BK = background
#tx_queue_data3_aifs=7
#tx_queue_data3_cwmin=15
#tx_queue_data3_cwmax=1023
#tx_queue_data3_burst=0
# Note: for IEEE 802.11b mode: cWmin=31 cWmax=1023 burst=0
#
# Normal priority / AC_BE = best effort
#tx_queue_data2_aifs=3
#tx_queue_data2_cwmin=15
#tx_queue_data2_cwmax=63
#tx_queue_data2_burst=0
# Note: for IEEE 802.11b mode: cWmin=31 cWmax=127 burst=0
#
# High priority / AC_VI = video
#tx_queue_data1_aifs=1
#tx_queue_data1_cwmin=7
#tx_queue_data1_cwmax=15
#tx_queue_data1_burst=3.0
# Note: for IEEE 802.11b mode: cWmin=15 cWmax=31 burst=6.0
#
# Highest priority / AC_VO = voice
#tx_queue_data0_aifs=1
#tx_queue_data0_cwmin=3
#tx_queue_data0_cwmax=7
#tx_queue_data0_burst=1.5
# Note: for IEEE 802.11b mode: cWmin=7 cWmax=15 burst=3.3

# 802.1D Tag (= UP) to AC mappings
# WMM specifies following mapping of data frames to different ACs. This mapping
# can be configured using Linux QoS/tc and sch_pktpri.o module.
# 802.1D Tag	802.1D Designation	Access Category	WMM Designation
# 1		BK			AC_BK		Background
# 2		-			AC_BK		Background
# 0		BE			AC_BE		Best Effort
# 3		EE			AC_BE		Best Effort
# 4		CL			AC_VI		Video
# 5		VI			AC_VI		Video
# 6		VO			AC_VO		Voice
# 7		NC			AC_VO		Voice
# Data frames with no priority information: AC_BE
# Management frames: AC_VO
# PS-Poll frames: AC_BE

# Default WMM parameters (IEEE 802.11 draft; 11-03-0504-03-000e):
# for 802.11a or 802.11g networks
# These parameters are sent to WMM clients when they associate.
# The parameters will be used by WMM clients for frames transmitted to the
# access point.
#
# note - txop_limit is in units of 32microseconds
# note - acm is admission control mandatory flag. 0 = admission control not
# required, 1 = mandatory
# note - here cwMin and cmMax are in exponent form. the actual cw value used
# will be (2^n)-1 where n is the value given here
#
wmm_enabled=1
#
# WMM-PS Unscheduled Automatic Power Save Delivery [U-APSD]
# Enable this flag if U-APSD supported outside hostapd (eg., Firmware/driver)
#uapsd_advertisement_enabled=1
#
# Low priority / AC_BK = background
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
# Note: for IEEE 802.11b mode: cWmin=5 cWmax=10
#
# Normal priority / AC_BE = best effort
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
# Note: for IEEE 802.11b mode: cWmin=5 cWmax=7
#
# High priority / AC_VI = video
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
# Note: for IEEE 802.11b mode: cWmin=4 cWmax=5 txop_limit=188
#
# Highest priority / AC_VO = voice
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0
# Note: for IEEE 802.11b mode: cWmin=3 cWmax=4 burst=102

I would be thankful if anyone help to solve it.

Sure about this? And have you tried setting two ACs to the default parameter set of AC_BE? I seem to recall that this is part of WiFi testing procedures so this should work...

I'm sorry but I didn't get your point. The /tmp/run/hostapd-phy0.conf file in my router is as below:

driver=nl80211
logger_syslog=127
logger_syslog_level=2
logger_stdout=127
logger_stdout_level=2
hw_mode=g
supported_rates=60 90 120 180 240 360 480 540
basic_rates=60 120 240
beacon_int=100
airtime_mode=1
channel=acs_survey




#num_global_macaddr=1
ieee80211n=1
ht_coex=0
ht_capab=[SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]

interface=phy0-ap0
ctrl_interface=/var/run/hostapd
ap_isolate=1
bss_load_update_period=60
chan_util_avg_period=600
disassoc_low_ack=1
skip_inactivity_poll=0
preamble=1
wmm_enabled=1
wmm_ac_bk_cwmin=2
wmm_ac_bk_cwmax=3
wmm_ac_bk_aifs=2
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_cwmin=2
wmm_ac_be_cwmax=3
wmm_ac_be_aifs=2
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_cwmin=2
wmm_ac_vi_cwmax=3
wmm_ac_vi_aifs=2
wmm_ac_vi_txop_limit=0
wmm_ac_vi_acm=0
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_aifs=2
wmm_ac_vo_txop_limit=0
wmm_ac_vo_acm=0
ignore_broadcast_ssid=0
uapsd_advertisement_enabled=1
utf8_ssid=1
multi_ap=0
wpa_passphrase=12341234
wpa_psk_file=/var/run/hostapd-phy0-ap0.psk
auth_algs=1
wpa=2
wpa_pairwise=CCMP
ssid=MCI-OpenWifi-2GHz-XIAOMI
bridge=br-lan
wds_bridge=
snoop_iface=br-lan
wpa_disable_eapol_key_retries=0
wpa_key_mgmt=WPA-PSK
okc=0
disable_pmksa_caching=1
dynamic_vlan=0
vlan_naming=1
vlan_no_bridge=1
vlan_file=/var/run/hostapd-phy0-ap0.vlan
qos_map_set=0,7,8,15,16,23,24,31,32,39,40,47,48,55,56,63
bssid=c8:bf:4c:48:16:e1
#default_macaddr

I generate traffics for two clients with different DSCP value and based on configuration above they should have the same rate. But the one with 63 has so more rate.

You do not provide any parameters, hostapd does not have crystall ball to pull them in from your forum posts.