aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2013-06-30 00:51:54 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-10-02 12:00:41 -0400
commit4515f30fb6c890faba21dd2d74ff2e84ad94c01c (patch)
tree7d4860e87b29ce9240745966d09357fb1af2e7fb /drivers/net/wireless/iwlwifi/mvm
parent18bc6996c74ba475061fd1532e4a9f4409c8bc63 (diff)
iwlwifi: mvm: BT Coex - use data from firmware
The data in MailBox comes direclty from the BT core. We should use the data processed by the WiFi fw that is appended to the MailBox in the BT Coex notification. Also decide on whether the Coex type based on the input from the the firmware and not hard coded. Also fix the SMPS SISO threshold to 2 (it was 3). Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/bt-coex.c58
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c22
2 files changed, 53 insertions, 27 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
index 1990fde92d64..6473828f761e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/bt-coex.c
@@ -98,18 +98,10 @@ static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = {
98 98
99#undef EVENT_PRIO_ANT 99#undef EVENT_PRIO_ANT
100 100
101#define IWL_BT_LOAD_FORCE_SISO_THRESHOLD (3)
102
103#define BT_ENABLE_REDUCED_TXPOWER_THRESHOLD (-62) 101#define BT_ENABLE_REDUCED_TXPOWER_THRESHOLD (-62)
104#define BT_DISABLE_REDUCED_TXPOWER_THRESHOLD (-65) 102#define BT_DISABLE_REDUCED_TXPOWER_THRESHOLD (-65)
105#define BT_ANTENNA_COUPLING_THRESHOLD (30) 103#define BT_ANTENNA_COUPLING_THRESHOLD (30)
106 104
107static inline bool is_loose_coex(void)
108{
109 return iwlwifi_mod_params.ant_coupling >
110 BT_ANTENNA_COUPLING_THRESHOLD;
111}
112
113int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) 105int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm)
114{ 106{
115 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX)) 107 if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_NEWBT_COEX))
@@ -275,6 +267,40 @@ static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = {
275 cpu_to_le32(0x33113311), 267 cpu_to_le32(0x33113311),
276}; 268};
277 269
270static enum iwl_bt_coex_lut_type
271iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif)
272{
273 struct ieee80211_chanctx_conf *chanctx_conf;
274 enum iwl_bt_coex_lut_type ret;
275 u16 phy_ctx_id;
276
277 lockdep_assert_held(&mvm->mutex);
278
279 rcu_read_lock();
280
281 chanctx_conf = rcu_dereference(vif->chanctx_conf);
282
283 if (!chanctx_conf ||
284 chanctx_conf->def.chan->band != IEEE80211_BAND_2GHZ) {
285 rcu_read_unlock();
286 return BT_COEX_LOOSE_LUT;
287 }
288
289 ret = BT_COEX_TX_DIS_LUT;
290
291 phy_ctx_id = *((u16 *)chanctx_conf->drv_priv);
292
293 if (mvm->last_bt_ci_cmd.primary_ch_phy_id == phy_ctx_id)
294 ret = le32_to_cpu(mvm->last_bt_notif.primary_ch_lut);
295 else if (mvm->last_bt_ci_cmd.secondary_ch_phy_id == phy_ctx_id)
296 ret = le32_to_cpu(mvm->last_bt_notif.secondary_ch_lut);
297 /* else - default = TX TX disallowed */
298
299 rcu_read_unlock();
300
301 return ret;
302}
303
278int iwl_send_bt_init_conf(struct iwl_mvm *mvm) 304int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
279{ 305{
280 struct iwl_bt_coex_cmd *bt_cmd; 306 struct iwl_bt_coex_cmd *bt_cmd;
@@ -528,8 +554,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
528 if (data->notif->bt_status) 554 if (data->notif->bt_status)
529 smps_mode = IEEE80211_SMPS_DYNAMIC; 555 smps_mode = IEEE80211_SMPS_DYNAMIC;
530 556
531 if (le32_to_cpu(data->notif->bt_activity_grading) >= 557 if (le32_to_cpu(data->notif->bt_activity_grading) >= BT_LOW_TRAFFIC)
532 IWL_BT_LOAD_FORCE_SISO_THRESHOLD)
533 smps_mode = IEEE80211_SMPS_STATIC; 558 smps_mode = IEEE80211_SMPS_STATIC;
534 559
535 IWL_DEBUG_COEX(data->mvm, 560 IWL_DEBUG_COEX(data->mvm,
@@ -540,13 +565,13 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
540 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, smps_mode); 565 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, smps_mode);
541 566
542 /* don't reduce the Tx power if in loose scheme */ 567 /* don't reduce the Tx power if in loose scheme */
543 if (is_loose_coex()) 568 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT)
544 return; 569 return;
545 570
546 data->num_bss_ifaces++; 571 data->num_bss_ifaces++;
547 572
548 /* reduced Txpower only if there are open BT connections, so ...*/ 573 /* reduced Txpower only if BT is on, so ...*/
549 if (!BT_MBOX_MSG(data->notif, 3, OPEN_CON_2)) { 574 if (le32_to_cpu(data->notif->bt_activity_grading) == BT_OFF) {
550 /* ... cancel reduced Tx power ... */ 575 /* ... cancel reduced Tx power ... */
551 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) 576 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false))
552 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); 577 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n");
@@ -761,8 +786,8 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
761 if (WARN_ON_ONCE(mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT)) 786 if (WARN_ON_ONCE(mvmvif->ap_sta_id == IWL_MVM_STATION_COUNT))
762 return; 787 return;
763 788
764 /* No open connection - reports should be disabled */ 789 /* No BT - reports should be disabled */
765 if (!BT_MBOX_MSG(&mvm->last_bt_notif, 3, OPEN_CON_2)) 790 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF)
766 return; 791 return;
767 792
768 IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid, 793 IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid,
@@ -772,7 +797,8 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
772 * Check if rssi is good enough for reduced Tx power, but not in loose 797 * Check if rssi is good enough for reduced Tx power, but not in loose
773 * scheme. 798 * scheme.
774 */ 799 */
775 if (rssi_event == RSSI_EVENT_LOW || is_loose_coex()) 800 if (rssi_event == RSSI_EVENT_LOW ||
801 iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT)
776 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, 802 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id,
777 false); 803 false);
778 else 804 else
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 6880ef3d064d..8e2bd7a3ff3f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -282,7 +282,7 @@ static int rs_tl_turn_on_agg_for_tid(struct iwl_mvm *mvm,
282 * Don't create TX aggregation sessions when in high 282 * Don't create TX aggregation sessions when in high
283 * BT traffic, as they would just be disrupted by BT. 283 * BT traffic, as they would just be disrupted by BT.
284 */ 284 */
285 if (BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD) >= 2) { 285 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) >= 2) {
286 IWL_DEBUG_COEX(mvm, "BT traffic (%d), no aggregation allowed\n", 286 IWL_DEBUG_COEX(mvm, "BT traffic (%d), no aggregation allowed\n",
287 BT_MBOX_MSG(&mvm->last_bt_notif, 287 BT_MBOX_MSG(&mvm->last_bt_notif,
288 3, TRAFFIC_LOAD)); 288 3, TRAFFIC_LOAD));
@@ -1322,7 +1322,7 @@ static int rs_move_siso_to_other(struct iwl_mvm *mvm,
1322 u8 update_search_tbl_counter = 0; 1322 u8 update_search_tbl_counter = 0;
1323 int ret; 1323 int ret;
1324 1324
1325 switch (BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)) { 1325 switch (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading)) {
1326 case IWL_BT_COEX_TRAFFIC_LOAD_NONE: 1326 case IWL_BT_COEX_TRAFFIC_LOAD_NONE:
1327 /* nothing */ 1327 /* nothing */
1328 break; 1328 break;
@@ -1342,7 +1342,7 @@ static int rs_move_siso_to_other(struct iwl_mvm *mvm,
1342 break; 1342 break;
1343 default: 1343 default:
1344 IWL_ERR(mvm, "Invalid BT load %d", 1344 IWL_ERR(mvm, "Invalid BT load %d",
1345 BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)); 1345 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading));
1346 break; 1346 break;
1347 } 1347 }
1348 1348
@@ -1453,7 +1453,7 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm,
1453 u8 update_search_tbl_counter = 0; 1453 u8 update_search_tbl_counter = 0;
1454 int ret; 1454 int ret;
1455 1455
1456 switch (BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)) { 1456 switch (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading)) {
1457 case IWL_BT_COEX_TRAFFIC_LOAD_NONE: 1457 case IWL_BT_COEX_TRAFFIC_LOAD_NONE:
1458 /* nothing */ 1458 /* nothing */
1459 break; 1459 break;
@@ -1470,7 +1470,7 @@ static int rs_move_mimo2_to_other(struct iwl_mvm *mvm,
1470 break; 1470 break;
1471 default: 1471 default:
1472 IWL_ERR(mvm, "Invalid BT load %d", 1472 IWL_ERR(mvm, "Invalid BT load %d",
1473 BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)); 1473 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading));
1474 break; 1474 break;
1475 } 1475 }
1476 1476
@@ -1955,24 +1955,24 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
1955 (current_tpt > (100 * tbl->expected_tpt[low])))) 1955 (current_tpt > (100 * tbl->expected_tpt[low]))))
1956 scale_action = 0; 1956 scale_action = 0;
1957 1957
1958 if ((BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD) >= 1958 if ((le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) >=
1959 IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && (is_mimo(tbl->lq_type))) { 1959 IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && (is_mimo(tbl->lq_type))) {
1960 if (lq_sta->last_bt_traffic > 1960 if (lq_sta->last_bt_traffic >
1961 BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)) { 1961 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading)) {
1962 /* 1962 /*
1963 * don't set scale_action, don't want to scale up if 1963 * don't set scale_action, don't want to scale up if
1964 * the rate scale doesn't otherwise think that is a 1964 * the rate scale doesn't otherwise think that is a
1965 * good idea. 1965 * good idea.
1966 */ 1966 */
1967 } else if (lq_sta->last_bt_traffic <= 1967 } else if (lq_sta->last_bt_traffic <=
1968 BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD)) { 1968 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading)) {
1969 scale_action = -1; 1969 scale_action = -1;
1970 } 1970 }
1971 } 1971 }
1972 lq_sta->last_bt_traffic = 1972 lq_sta->last_bt_traffic =
1973 BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD); 1973 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading);
1974 1974
1975 if ((BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD) >= 1975 if ((le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) >=
1976 IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && is_mimo(tbl->lq_type)) { 1976 IWL_BT_COEX_TRAFFIC_LOAD_HIGH) && is_mimo(tbl->lq_type)) {
1977 /* search for a new modulation */ 1977 /* search for a new modulation */
1978 rs_stay_in_table(lq_sta, true); 1978 rs_stay_in_table(lq_sta, true);
@@ -2455,7 +2455,7 @@ static void rs_fill_link_cmd(struct iwl_mvm *mvm,
2455 * overwrite if needed, pass aggregation time limit 2455 * overwrite if needed, pass aggregation time limit
2456 * to uCode in uSec - This is racy - but heh, at least it helps... 2456 * to uCode in uSec - This is racy - but heh, at least it helps...
2457 */ 2457 */
2458 if (mvm && BT_MBOX_MSG(&mvm->last_bt_notif, 3, TRAFFIC_LOAD) >= 2) 2458 if (mvm && le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) >= 2)
2459 lq_cmd->agg_time_limit = cpu_to_le16(1200); 2459 lq_cmd->agg_time_limit = cpu_to_le16(1200);
2460} 2460}
2461 2461