ath11k: add support for mgmt and mcast rate control
cover ath11k: add support for mgmt and mcast rate control
Hi,
The management frames and multicast frames have to be sent at a basic rate. But the ath11k firmware is always doing them on 1 Mbit/s for 2.4GHz and 6 Mbit/s for 5GHz. These might not be the basic rates which the AP advertised. Clients which don't support these rates will therefore not be able to receive them correctly.
Also some mesh protocols try to estimate the probability of a successful submission of broadcast/multicast frames. In such setups, the multicast rate is usually manually set to an higher value to better simulate the rates which are used for unicast transmission.
mac80211 already provides a list of rates for the driver. ath11k has to pick the lowest one (or only provided one) and send it to the firmware rate control.
Unfortunately, the firmware WLAN.HK.2.1.0.1-00629-QCAHKSWPL_SILICONZ-1 seems to be buggy [1] and ignores the CCK preamble. So setting the CCK rates 1M, 2M, 5.5M and 11M will then result in OFDM rates 6M, 12M, 24M, 48M.
Kind regards,
Sven
[1] at least this is my best guess
Sven Eckelmann (3):
ath11k: support for multicast rate control
ath11k: support for mgmt rate control
ath11k: apply mgmt rate for beacons
drivers/net/wireless/ath/ath11k/mac.c | 119 ++++++++++++++++++++++++++ 1 file changed, 119 insertions(+)
Signature · 7 lines
2.20.1 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 1/3 ath11k: support for multicast rate control
From: Sven Eckelmann <[email protected]>
The multicasts have to be done at a rate which is a basic rate. But the ath11k firmware is always doing them on 1 Mbit/s for 2.4GHz and 6 Mbit/s for 5GHz. These might not be the basic rates which the AP advertised. Clients which don't support these rates will therefore not be able to receive the multicast/broadcast.
Also some mesh protocols try to estimate the probability of a successful submission of broadcast/multicast frames. In such setups, the multicast rate is usually manually set to an higher value to better simulate the rates which are used for unicast transmission.
mac80211 already calculates the correct multicast rate for the driver and ath11k just has to send this information to the firmware rate control.
--- drivers/net/wireless/ath/ath11k/mac.c | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +53 -0
@@ -1621,8 +1621,17 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, {struct ath11k *ar = hw->priv;struct ath11k_vif *arvif =ath11k_vif_to_arvif (vif); +struct cfg80211_chan_def def;u32 param_id, param_value; +enum nl80211_band band; +u32 vdev_param; +int mcast_rate; +u32 preamble; +u16 hw_value; +u16 bitrate;int ret =0 ; +u8 rateidx; +u8 rate;mutex_lock (&ar->conf_mutex);
@@ -1768,6 +1777,50 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,ath11k_mac_txpower_recalc (ar); } +if (changed &BSS_CHANGED_MCAST_RATE && + !ath11k_mac_vif_chan (arvif->vif, &def)) { + band = def.chan->band; + mcast_rate = vif->bss_conf.mcast_rate[band]; + +if (mcast_rate >0 ) + rateidx = mcast_rate -1 ; +else + rateidx =ffs (vif->bss_conf.basic_rates) -1 ; + +if (ar->pdev->cap.supported_bands &WMI_HOST_WLAN_5G_CAP ) + rateidx +=ATH11K_MAC_FIRST_OFDM_RATE_IDX ; + + bitrate = ath11k_legacy_rates[rateidx].bitrate; + hw_value = ath11k_legacy_rates[rateidx].hw_value; + +if (ath11k_mac_bitrate_is_cck (bitrate)) + preamble =WMI_RATE_PREAMBLE_CCK ; +else + preamble =WMI_RATE_PREAMBLE_OFDM ; + + rate =ATH11K_HW_RATE_CODE (hw_value,0 , preamble); + +ath11k_dbg (ar->ab,ATH11K_DBG_MAC , +"mac vdev %d mcast_rate %x\n" , + arvif->vdev_id, rate); + + vdev_param =WMI_VDEV_PARAM_MCAST_DATA_RATE ; + ret =ath11k_wmi_vdev_set_param_cmd (ar, arvif->vdev_id, + vdev_param, rate); +if (ret) +ath11k_warn (ar->ab, +"failed to set mcast rate on vdev %i: %d\n" , + arvif->vdev_id, ret); + + vdev_param =WMI_VDEV_PARAM_BCAST_DATA_RATE ; + ret =ath11k_wmi_vdev_set_param_cmd (ar, arvif->vdev_id, + vdev_param, rate); +if (ret) +ath11k_warn (ar->ab, +"failed to set bcast rate on vdev %i: %d\n" , + arvif->vdev_id, ret); + } +mutex_unlock (&ar->conf_mutex); }
Signature · 7 lines
2.20.1 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Re: [PATCH 1/3] ath11k: support for multicast rate control
Quoted 11 lines · Sven Eckelmann
The multicasts have to be done at a rate which is a basic rate. But the ath11k firmware is always doing them on 1 Mbit/s for 2.4GHz and 6 Mbit/s for 5GHz. These might not be the basic rates which the AP advertised. Clients which don't support these rates will therefore not be able to receive the multicast/broadcast.
Also some mesh protocols try to estimate the probability of a successful submission of broadcast/multicast frames. In such setups, the multicast rate is usually manually set to an higher value to better simulate the rates which are used for unicast transmission.
Quoted 5 lines
mac80211 already calculates the correct multicast rate for the driver and ath11k just has to send this information to the firmware rate control.
Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Kalle Valo <[email protected]>
3 patches applied to ath11k-bringup branch of ath.git, thanks.
c885aaf227ec ath11k: support for multicast rate control caa114b794e3 ath11k: support for mgmt rate control 687fbb379e71 ath11k: apply mgmt rate for beacons
Signature · 9 lines
https://patchwork.kernel.org/patch/11032957/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 2/3 ath11k: support for mgmt rate control
In reply to Sven EckelmannFrom: Sven Eckelmann <[email protected]>
The management frames have to be sent at a basic rate. But the ath11k firmware is always doing them on 1 Mbit/s for 2.4GHz and 6 Mbit/s for 5GHz. These might not be the basic rates which the AP advertised. Clients which don't support these rates will therefore not be able to receive them correctly.
mac80211 already provides a list of basic rates for the driver. ath11k has to pick the lowest one and send it to the firmware rate control.
--- drivers/net/wireless/ath/ath11k/mac.c | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +60 -0
@@ -1614,6 +1614,62 @@ static void ath11k_bss_disassoc(struct ieee80211_hw *hw,/* TODO: cancel connection_loss_work */ } +static u32 ath11k_mac_get_rate_hw_value (int bitrate) +{ +u32 preamble; +u16 hw_value; +int rate; +size_t i; + +if (ath11k_mac_bitrate_is_cck (bitrate)) + preamble =WMI_RATE_PREAMBLE_CCK ; +else + preamble =WMI_RATE_PREAMBLE_OFDM ; + +for (i =0 ; i <ARRAY_SIZE (ath11k_legacy_rates); i++) { +if (ath11k_legacy_rates[i].bitrate != bitrate) +continue ; + + hw_value = ath11k_legacy_rates[i].hw_value; + rate =ATH11K_HW_RATE_CODE (hw_value,0 , preamble); + +return rate; + } + +return -EINVAL ; +} + +static void ath11k_recalculate_mgmt_rate (struct ath11k *ar, +struct ieee80211_vif *vif, +struct cfg80211_chan_def *def) +{ +struct ath11k_vif *arvif = (void *)vif->drv_priv; +const struct ieee80211_supported_band *sband; +u8 basic_rate_idx; +int hw_rate_code; +u32 vdev_param; +u16 bitrate; +int ret; + +lockdep_assert_held (&ar->conf_mutex); + + sband = ar->hw->wiphy->bands[def->chan->band]; + basic_rate_idx =ffs (vif->bss_conf.basic_rates) -1 ; + bitrate = sband->bitrates[basic_rate_idx].bitrate; + + hw_rate_code =ath11k_mac_get_rate_hw_value (bitrate); +if (hw_rate_code <0 ) { +ath11k_warn (ar->ab,"bitrate not supported %d\n" , bitrate); +return ; + } + + vdev_param =WMI_VDEV_PARAM_MGMT_RATE ; + ret =ath11k_wmi_vdev_set_param_cmd (ar, arvif->vdev_id, vdev_param, + hw_rate_code); +if (ret) +ath11k_warn (ar->ab,"failed to set mgmt tx rate %d\n" , ret); +} + static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info,
@@ -1821,6 +1877,10 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw, arvif->vdev_id, ret); } +if (changed &BSS_CHANGED_BASIC_RATES && + !ath11k_mac_vif_chan (arvif->vif, &def)) +ath11k_recalculate_mgmt_rate (ar, vif, &def); +mutex_unlock (&ar->conf_mutex); }
Signature · 7 lines
2.20.1 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 3/3 ath11k: apply mgmt rate for beacons
In reply to Sven EckelmannFrom: Sven Eckelmann <[email protected]>
ath11k is using the lowest basic rate to send management frames. But the firmware is still sending the beacons at 1 Mbit/s for 2.4GHz and 6 Mbit/s on 5GHz. But it could be that these rates are not part of the basic rates. And thus the AP should not try to submit using these rates when clients don't need to support these rates (and thus might not be able to receive these rates).
--- drivers/net/wireless/ath/ath11k/mac.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +6 -0
@@ -1668,6 +1668,12 @@ static void ath11k_recalculate_mgmt_rate(struct ath11k *ar, hw_rate_code);if (ret)ath11k_warn (ar->ab,"failed to set mgmt tx rate %d\n" , ret); + + vdev_param =WMI_VDEV_PARAM_BEACON_RATE ; + ret =ath11k_wmi_vdev_set_param_cmd (ar, arvif->vdev_id, vdev_param, + hw_rate_code); +if (ret) +ath11k_warn (ar->ab,"failed to set beacon tx rate %d\n" , ret); } static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
Signature · 7 lines
2.20.1 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k