diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/bt-coex.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/bt-coex.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c index a17e2cc2bedb..7d41a0efd37b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c | |||
@@ -490,6 +490,20 @@ struct iwl_bt_iterator_data { | |||
490 | struct ieee80211_chanctx_conf *secondary; | 490 | struct ieee80211_chanctx_conf *secondary; |
491 | }; | 491 | }; |
492 | 492 | ||
493 | static inline | ||
494 | void iwl_mvm_bt_coex_enable_rssi_event(struct iwl_mvm *mvm, | ||
495 | struct ieee80211_vif *vif, | ||
496 | bool enable, int rssi) | ||
497 | { | ||
498 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
499 | |||
500 | mvmvif->bf_data.last_bt_coex_event = rssi; | ||
501 | mvmvif->bf_data.bt_coex_max_thold = | ||
502 | enable ? BT_ENABLE_REDUCED_TXPOWER_THRESHOLD : 0; | ||
503 | mvmvif->bf_data.bt_coex_min_thold = | ||
504 | enable ? BT_DISABLE_REDUCED_TXPOWER_THRESHOLD : 0; | ||
505 | } | ||
506 | |||
493 | /* must be called under rcu_read_lock */ | 507 | /* must be called under rcu_read_lock */ |
494 | static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | 508 | static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, |
495 | struct ieee80211_vif *vif) | 509 | struct ieee80211_vif *vif) |
@@ -518,6 +532,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
518 | if (vif->type == NL80211_IFTYPE_STATION && vif->bss_conf.assoc) | 532 | if (vif->type == NL80211_IFTYPE_STATION && vif->bss_conf.assoc) |
519 | iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, | 533 | iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, |
520 | smps_mode); | 534 | smps_mode); |
535 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); | ||
521 | return; | 536 | return; |
522 | } | 537 | } |
523 | 538 | ||
@@ -568,6 +583,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
568 | if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || | 583 | if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || |
569 | mvm->cfg->bt_shared_single_ant) { | 584 | mvm->cfg->bt_shared_single_ant) { |
570 | data->reduced_tx_power = false; | 585 | data->reduced_tx_power = false; |
586 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); | ||
571 | return; | 587 | return; |
572 | } | 588 | } |
573 | 589 | ||
@@ -579,9 +595,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
579 | data->reduced_tx_power = false; | 595 | data->reduced_tx_power = false; |
580 | 596 | ||
581 | /* ... and there is no need to get reports on RSSI any more. */ | 597 | /* ... and there is no need to get reports on RSSI any more. */ |
582 | mvmvif->bf_data.last_bt_coex_event = 0; | 598 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); |
583 | mvmvif->bf_data.bt_coex_max_thold = 0; | ||
584 | mvmvif->bf_data.bt_coex_min_thold = 0; | ||
585 | return; | 599 | return; |
586 | } | 600 | } |
587 | 601 | ||
@@ -614,13 +628,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
614 | } | 628 | } |
615 | 629 | ||
616 | /* Begin to monitor the RSSI: it may influence the reduced Tx power */ | 630 | /* Begin to monitor the RSSI: it may influence the reduced Tx power */ |
617 | 631 | iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, true, ave_rssi); | |
618 | /* reset previous bt coex event tracking */ | ||
619 | mvmvif->bf_data.last_bt_coex_event = 0; | ||
620 | mvmvif->bf_data.bt_coex_max_thold = | ||
621 | BT_ENABLE_REDUCED_TXPOWER_THRESHOLD; | ||
622 | mvmvif->bf_data.bt_coex_min_thold = | ||
623 | BT_DISABLE_REDUCED_TXPOWER_THRESHOLD; | ||
624 | } | 632 | } |
625 | 633 | ||
626 | static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) | 634 | static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) |
@@ -752,6 +760,18 @@ static void iwl_mvm_bt_rssi_iterator(void *_data, u8 *mac, | |||
752 | struct ieee80211_sta *sta; | 760 | struct ieee80211_sta *sta; |
753 | struct iwl_mvm_sta *mvmsta; | 761 | struct iwl_mvm_sta *mvmsta; |
754 | 762 | ||
763 | struct ieee80211_chanctx_conf *chanctx_conf; | ||
764 | |||
765 | rcu_read_lock(); | ||
766 | chanctx_conf = rcu_dereference(vif->chanctx_conf); | ||
767 | /* If channel context is invalid or not on 2.4GHz - don't count it */ | ||
768 | if (!chanctx_conf || | ||
769 | chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ) { | ||
770 | rcu_read_unlock(); | ||
771 | return; | ||
772 | } | ||
773 | rcu_read_unlock(); | ||
774 | |||
755 | if (vif->type != NL80211_IFTYPE_STATION || | 775 | if (vif->type != NL80211_IFTYPE_STATION || |
756 | mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT) | 776 | mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT) |
757 | return; | 777 | return; |