ath10k: avoid leaving .bss_info_changed prematurely
ath10k_bss_info_changed() handles various events from the upper layers. It
parses the changed bitfield and then configures the driver/firmware
accordingly. Each detected event is handled in a separate scope which is
independent of each other - but in the same function.
The commit f279294e9e
("ath10k: add support for configuring management
packet rate") changed this behavior by returning from this function
prematurely when some precondition was not fulfilled. All new event
handlers added after the BSS_CHANGED_BASIC_RATES event handler would then
also be skipped.
Signed-off-by: Sven Eckelmann <seckelmann@datto.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
f93bcf0ce6
commit
0227ff3656
|
@ -5635,6 +5635,37 @@ static void ath10k_configure_filter(struct ieee80211_hw *hw,
|
|||
mutex_unlock(&ar->conf_mutex);
|
||||
}
|
||||
|
||||
static void ath10k_recalculate_mgmt_rate(struct ath10k *ar,
|
||||
struct ieee80211_vif *vif,
|
||||
struct cfg80211_chan_def *def)
|
||||
{
|
||||
struct ath10k_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 = ath10k_mac_get_rate_hw_value(bitrate);
|
||||
if (hw_rate_code < 0) {
|
||||
ath10k_warn(ar, "bitrate not supported %d\n", bitrate);
|
||||
return;
|
||||
}
|
||||
|
||||
vdev_param = ar->wmi.vdev_param->mgmt_rate;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
hw_rate_code);
|
||||
if (ret)
|
||||
ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret);
|
||||
}
|
||||
|
||||
static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif,
|
||||
struct ieee80211_bss_conf *info,
|
||||
|
@ -5645,10 +5676,9 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
|||
struct cfg80211_chan_def def;
|
||||
u32 vdev_param, pdev_param, slottime, preamble;
|
||||
u16 bitrate, hw_value;
|
||||
u8 rate, basic_rate_idx, rateidx;
|
||||
int ret = 0, hw_rate_code, mcast_rate;
|
||||
u8 rate, rateidx;
|
||||
int ret = 0, mcast_rate;
|
||||
enum nl80211_band band;
|
||||
const struct ieee80211_supported_band *sband;
|
||||
|
||||
mutex_lock(&ar->conf_mutex);
|
||||
|
||||
|
@ -5872,29 +5902,9 @@ static void ath10k_bss_info_changed(struct ieee80211_hw *hw,
|
|||
arvif->vdev_id, ret);
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_BASIC_RATES) {
|
||||
if (ath10k_mac_vif_chan(vif, &def)) {
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
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 = ath10k_mac_get_rate_hw_value(bitrate);
|
||||
if (hw_rate_code < 0) {
|
||||
ath10k_warn(ar, "bitrate not supported %d\n", bitrate);
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
vdev_param = ar->wmi.vdev_param->mgmt_rate;
|
||||
ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param,
|
||||
hw_rate_code);
|
||||
if (ret)
|
||||
ath10k_warn(ar, "failed to set mgmt tx rate %d\n", ret);
|
||||
}
|
||||
if (changed & BSS_CHANGED_BASIC_RATES &&
|
||||
!ath10k_mac_vif_chan(arvif->vif, &def))
|
||||
ath10k_recalculate_mgmt_rate(ar, vif, &def);
|
||||
|
||||
mutex_unlock(&ar->conf_mutex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue