aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c73
1 files changed, 49 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index d857f8496f69..3368cfd25a99 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1461,13 +1461,13 @@ bool iwl_good_ack_health(struct iwl_priv *priv,
1461 1461
1462 actual_ack_cnt_delta = 1462 actual_ack_cnt_delta =
1463 le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) - 1463 le32_to_cpu(pkt->u.stats.tx.actual_ack_cnt) -
1464 le32_to_cpu(priv->statistics.tx.actual_ack_cnt); 1464 le32_to_cpu(priv->_agn.statistics.tx.actual_ack_cnt);
1465 expected_ack_cnt_delta = 1465 expected_ack_cnt_delta =
1466 le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) - 1466 le32_to_cpu(pkt->u.stats.tx.expected_ack_cnt) -
1467 le32_to_cpu(priv->statistics.tx.expected_ack_cnt); 1467 le32_to_cpu(priv->_agn.statistics.tx.expected_ack_cnt);
1468 ba_timeout_delta = 1468 ba_timeout_delta =
1469 le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) - 1469 le32_to_cpu(pkt->u.stats.tx.agg.ba_timeout) -
1470 le32_to_cpu(priv->statistics.tx.agg.ba_timeout); 1470 le32_to_cpu(priv->_agn.statistics.tx.agg.ba_timeout);
1471 if ((priv->_agn.agg_tids_count > 0) && 1471 if ((priv->_agn.agg_tids_count > 0) &&
1472 (expected_ack_cnt_delta > 0) && 1472 (expected_ack_cnt_delta > 0) &&
1473 (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta) 1473 (((actual_ack_cnt_delta * 100) / expected_ack_cnt_delta)
@@ -1484,10 +1484,10 @@ bool iwl_good_ack_health(struct iwl_priv *priv,
1484 * DEBUG is not, these will just compile out. 1484 * DEBUG is not, these will just compile out.
1485 */ 1485 */
1486 IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n", 1486 IWL_DEBUG_RADIO(priv, "rx_detected_cnt delta = %d\n",
1487 priv->delta_statistics.tx.rx_detected_cnt); 1487 priv->_agn.delta_statistics.tx.rx_detected_cnt);
1488 IWL_DEBUG_RADIO(priv, 1488 IWL_DEBUG_RADIO(priv,
1489 "ack_or_ba_timeout_collision delta = %d\n", 1489 "ack_or_ba_timeout_collision delta = %d\n",
1490 priv->delta_statistics.tx. 1490 priv->_agn.delta_statistics.tx.
1491 ack_or_ba_timeout_collision); 1491 ack_or_ba_timeout_collision);
1492#endif 1492#endif
1493 IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n", 1493 IWL_DEBUG_RADIO(priv, "agg ba_timeout delta = %d\n",
@@ -2310,9 +2310,9 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
2310 trace_iwlwifi_dev_ucode_error(priv, desc, time, data1, data2, line, 2310 trace_iwlwifi_dev_ucode_error(priv, desc, time, data1, data2, line,
2311 blink1, blink2, ilink1, ilink2); 2311 blink1, blink2, ilink1, ilink2);
2312 2312
2313 IWL_ERR(priv, "Desc Time " 2313 IWL_ERR(priv, "Desc Time "
2314 "data1 data2 line\n"); 2314 "data1 data2 line\n");
2315 IWL_ERR(priv, "%-28s (#%02d) %010u 0x%08X 0x%08X %u\n", 2315 IWL_ERR(priv, "%-28s (0x%04X) %010u 0x%08X 0x%08X %u\n",
2316 desc_lookup(desc), desc, time, data1, data2, line); 2316 desc_lookup(desc), desc, time, data1, data2, line);
2317 IWL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n"); 2317 IWL_ERR(priv, "pc blink1 blink2 ilink1 ilink2 hcmd\n");
2318 IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n", 2318 IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X 0x%05X 0x%05X\n",
@@ -2935,9 +2935,9 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
2935 } 2935 }
2936 2936
2937 if (priv->start_calib) { 2937 if (priv->start_calib) {
2938 iwl_chain_noise_calibration(priv, &priv->statistics); 2938 iwl_chain_noise_calibration(priv, &priv->_agn.statistics);
2939 2939
2940 iwl_sensitivity_calibration(priv, &priv->statistics); 2940 iwl_sensitivity_calibration(priv, &priv->_agn.statistics);
2941 } 2941 }
2942 2942
2943 mutex_unlock(&priv->mutex); 2943 mutex_unlock(&priv->mutex);
@@ -3368,13 +3368,32 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3368 return ret; 3368 return ret;
3369} 3369}
3370 3370
3371/*
3372 * switch to RTS/CTS for TX
3373 */
3374static void iwl_enable_rts_cts(struct iwl_priv *priv)
3375{
3376
3377 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
3378 return;
3379
3380 priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN;
3381 if (!test_bit(STATUS_SCANNING, &priv->status)) {
3382 IWL_DEBUG_INFO(priv, "use RTS/CTS protection\n");
3383 iwlcore_commit_rxon(priv);
3384 } else {
3385 /* scanning, defer the request until scan completed */
3386 IWL_DEBUG_INFO(priv, "defer setting RTS/CTS protection\n");
3387 }
3388}
3389
3371static int iwl_mac_ampdu_action(struct ieee80211_hw *hw, 3390static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3372 struct ieee80211_vif *vif, 3391 struct ieee80211_vif *vif,
3373 enum ieee80211_ampdu_mlme_action action, 3392 enum ieee80211_ampdu_mlme_action action,
3374 struct ieee80211_sta *sta, u16 tid, u16 *ssn) 3393 struct ieee80211_sta *sta, u16 tid, u16 *ssn)
3375{ 3394{
3376 struct iwl_priv *priv = hw->priv; 3395 struct iwl_priv *priv = hw->priv;
3377 int ret; 3396 int ret = -EINVAL;
3378 3397
3379 IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n", 3398 IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
3380 sta->addr, tid); 3399 sta->addr, tid);
@@ -3382,17 +3401,19 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3382 if (!(priv->cfg->sku & IWL_SKU_N)) 3401 if (!(priv->cfg->sku & IWL_SKU_N))
3383 return -EACCES; 3402 return -EACCES;
3384 3403
3404 mutex_lock(&priv->mutex);
3405
3385 switch (action) { 3406 switch (action) {
3386 case IEEE80211_AMPDU_RX_START: 3407 case IEEE80211_AMPDU_RX_START:
3387 IWL_DEBUG_HT(priv, "start Rx\n"); 3408 IWL_DEBUG_HT(priv, "start Rx\n");
3388 return iwl_sta_rx_agg_start(priv, sta, tid, *ssn); 3409 ret = iwl_sta_rx_agg_start(priv, sta, tid, *ssn);
3410 break;
3389 case IEEE80211_AMPDU_RX_STOP: 3411 case IEEE80211_AMPDU_RX_STOP:
3390 IWL_DEBUG_HT(priv, "stop Rx\n"); 3412 IWL_DEBUG_HT(priv, "stop Rx\n");
3391 ret = iwl_sta_rx_agg_stop(priv, sta, tid); 3413 ret = iwl_sta_rx_agg_stop(priv, sta, tid);
3392 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 3414 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
3393 return 0; 3415 ret = 0;
3394 else 3416 break;
3395 return ret;
3396 case IEEE80211_AMPDU_TX_START: 3417 case IEEE80211_AMPDU_TX_START:
3397 IWL_DEBUG_HT(priv, "start Tx\n"); 3418 IWL_DEBUG_HT(priv, "start Tx\n");
3398 ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn); 3419 ret = iwlagn_tx_agg_start(priv, vif, sta, tid, ssn);
@@ -3401,7 +3422,7 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3401 IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n", 3422 IWL_DEBUG_HT(priv, "priv->_agn.agg_tids_count = %u\n",
3402 priv->_agn.agg_tids_count); 3423 priv->_agn.agg_tids_count);
3403 } 3424 }
3404 return ret; 3425 break;
3405 case IEEE80211_AMPDU_TX_STOP: 3426 case IEEE80211_AMPDU_TX_STOP:
3406 IWL_DEBUG_HT(priv, "stop Tx\n"); 3427 IWL_DEBUG_HT(priv, "stop Tx\n");
3407 ret = iwlagn_tx_agg_stop(priv, vif, sta, tid); 3428 ret = iwlagn_tx_agg_stop(priv, vif, sta, tid);
@@ -3411,18 +3432,22 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
3411 priv->_agn.agg_tids_count); 3432 priv->_agn.agg_tids_count);
3412 } 3433 }
3413 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 3434 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
3414 return 0; 3435 ret = 0;
3415 else 3436 break;
3416 return ret;
3417 case IEEE80211_AMPDU_TX_OPERATIONAL: 3437 case IEEE80211_AMPDU_TX_OPERATIONAL:
3418 /* do nothing */ 3438 if (priv->cfg->use_rts_for_ht) {
3419 return -EOPNOTSUPP; 3439 /*
3420 default: 3440 * switch to RTS/CTS if it is the prefer protection
3421 IWL_DEBUG_HT(priv, "unknown\n"); 3441 * method for HT traffic
3422 return -EINVAL; 3442 */
3443 iwl_enable_rts_cts(priv);
3444 }
3445 ret = 0;
3423 break; 3446 break;
3424 } 3447 }
3425 return 0; 3448 mutex_unlock(&priv->mutex);
3449
3450 return ret;
3426} 3451}
3427 3452
3428static void iwl_mac_sta_notify(struct ieee80211_hw *hw, 3453static void iwl_mac_sta_notify(struct ieee80211_hw *hw,