Commit d94c5a82 authored by Gregory Greenman's avatar Gregory Greenman Committed by Luca Coelho

iwlwifi: mvm: open BA session only when sta is authorized

Currently, a BA session is opened when the tx traffic exceeds
10 frames per second. As a result of inter-op problems with some
APs, add a condition to open BA session only when station is
already authorized.

Fixes: 482e4844 ("iwlwifi: mvm: change open and close criteria of a BA session")
Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent b38c395f
...@@ -2685,7 +2685,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, ...@@ -2685,7 +2685,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
mutex_lock(&mvm->mutex); mutex_lock(&mvm->mutex);
/* track whether or not the station is associated */ /* track whether or not the station is associated */
mvm_sta->associated = new_state >= IEEE80211_STA_ASSOC; mvm_sta->sta_state = new_state;
if (old_state == IEEE80211_STA_NOTEXIST && if (old_state == IEEE80211_STA_NOTEXIST &&
new_state == IEEE80211_STA_NONE) { new_state == IEEE80211_STA_NONE) {
...@@ -2737,8 +2737,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, ...@@ -2737,8 +2737,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL);
} }
iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band);
true);
ret = iwl_mvm_update_sta(mvm, vif, sta); ret = iwl_mvm_update_sta(mvm, vif, sta);
} else if (old_state == IEEE80211_STA_ASSOC && } else if (old_state == IEEE80211_STA_ASSOC &&
new_state == IEEE80211_STA_AUTHORIZED) { new_state == IEEE80211_STA_AUTHORIZED) {
...@@ -2754,8 +2753,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, ...@@ -2754,8 +2753,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
/* enable beacon filtering */ /* enable beacon filtering */
WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band, iwl_mvm_rs_rate_init(mvm, sta, mvmvif->phy_ctxt->channel->band);
false);
ret = 0; ret = 0;
} else if (old_state == IEEE80211_STA_AUTHORIZED && } else if (old_state == IEEE80211_STA_AUTHORIZED &&
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 - 2017 Intel Deutschland GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
...@@ -13,10 +14,6 @@ ...@@ -13,10 +14,6 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details. * more details.
* *
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the * The full GNU General Public License is included in this distribution in the
* file called LICENSE. * file called LICENSE.
* *
...@@ -651,9 +648,10 @@ static void rs_tl_turn_on_agg(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, ...@@ -651,9 +648,10 @@ static void rs_tl_turn_on_agg(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
} }
tid_data = &mvmsta->tid_data[tid]; tid_data = &mvmsta->tid_data[tid];
if ((tid_data->state == IWL_AGG_OFF) && if (mvmsta->sta_state >= IEEE80211_STA_AUTHORIZED &&
tid_data->state == IWL_AGG_OFF &&
(lq_sta->tx_agg_tid_en & BIT(tid)) && (lq_sta->tx_agg_tid_en & BIT(tid)) &&
(tid_data->tx_count_last >= IWL_MVM_RS_AGG_START_THRESHOLD)) { tid_data->tx_count_last >= IWL_MVM_RS_AGG_START_THRESHOLD) {
IWL_DEBUG_RATE(mvm, "try to aggregate tid %d\n", tid); IWL_DEBUG_RATE(mvm, "try to aggregate tid %d\n", tid);
if (rs_tl_turn_on_agg_for_tid(mvm, lq_sta, tid, sta) == 0) if (rs_tl_turn_on_agg_for_tid(mvm, lq_sta, tid, sta) == 0)
tid_data->state = IWL_AGG_QUEUED; tid_data->state = IWL_AGG_QUEUED;
...@@ -1257,7 +1255,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -1257,7 +1255,7 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
(unsigned long)(lq_sta->last_tx + (unsigned long)(lq_sta->last_tx +
(IWL_MVM_RS_IDLE_TIMEOUT * HZ)))) { (IWL_MVM_RS_IDLE_TIMEOUT * HZ)))) {
IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n");
iwl_mvm_rs_rate_init(mvm, sta, info->band, false); iwl_mvm_rs_rate_init(mvm, sta, info->band);
return; return;
} }
lq_sta->last_tx = jiffies; lq_sta->last_tx = jiffies;
...@@ -2690,9 +2688,9 @@ static void rs_get_initial_rate(struct iwl_mvm *mvm, ...@@ -2690,9 +2688,9 @@ static void rs_get_initial_rate(struct iwl_mvm *mvm,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct iwl_lq_sta *lq_sta, struct iwl_lq_sta *lq_sta,
enum nl80211_band band, enum nl80211_band band,
struct rs_rate *rate, struct rs_rate *rate)
bool init)
{ {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
int i, nentries; int i, nentries;
unsigned long active_rate; unsigned long active_rate;
s8 best_rssi = S8_MIN; s8 best_rssi = S8_MIN;
...@@ -2754,7 +2752,8 @@ static void rs_get_initial_rate(struct iwl_mvm *mvm, ...@@ -2754,7 +2752,8 @@ static void rs_get_initial_rate(struct iwl_mvm *mvm,
* bandwidth rate, and after authorization, when the phy context * bandwidth rate, and after authorization, when the phy context
* is already up-to-date, re-init rs with the correct bw. * is already up-to-date, re-init rs with the correct bw.
*/ */
u32 bw = init ? RATE_MCS_CHAN_WIDTH_20 : rs_bw_from_sta_bw(sta); u32 bw = mvmsta->sta_state < IEEE80211_STA_AUTHORIZED ?
RATE_MCS_CHAN_WIDTH_20 : rs_bw_from_sta_bw(sta);
switch (bw) { switch (bw) {
case RATE_MCS_CHAN_WIDTH_40: case RATE_MCS_CHAN_WIDTH_40:
...@@ -2839,9 +2838,9 @@ void rs_update_last_rssi(struct iwl_mvm *mvm, ...@@ -2839,9 +2838,9 @@ void rs_update_last_rssi(struct iwl_mvm *mvm,
static void rs_initialize_lq(struct iwl_mvm *mvm, static void rs_initialize_lq(struct iwl_mvm *mvm,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct iwl_lq_sta *lq_sta, struct iwl_lq_sta *lq_sta,
enum nl80211_band band, enum nl80211_band band)
bool init)
{ {
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
struct iwl_scale_tbl_info *tbl; struct iwl_scale_tbl_info *tbl;
struct rs_rate *rate; struct rs_rate *rate;
u8 active_tbl = 0; u8 active_tbl = 0;
...@@ -2857,7 +2856,7 @@ static void rs_initialize_lq(struct iwl_mvm *mvm, ...@@ -2857,7 +2856,7 @@ static void rs_initialize_lq(struct iwl_mvm *mvm,
tbl = &(lq_sta->lq_info[active_tbl]); tbl = &(lq_sta->lq_info[active_tbl]);
rate = &tbl->rate; rate = &tbl->rate;
rs_get_initial_rate(mvm, sta, lq_sta, band, rate, init); rs_get_initial_rate(mvm, sta, lq_sta, band, rate);
rs_init_optimal_rate(mvm, sta, lq_sta); rs_init_optimal_rate(mvm, sta, lq_sta);
WARN_ONCE(rate->ant != ANT_A && rate->ant != ANT_B, WARN_ONCE(rate->ant != ANT_A && rate->ant != ANT_B,
...@@ -2870,7 +2869,8 @@ static void rs_initialize_lq(struct iwl_mvm *mvm, ...@@ -2870,7 +2869,8 @@ static void rs_initialize_lq(struct iwl_mvm *mvm,
rs_set_expected_tpt_table(lq_sta, tbl); rs_set_expected_tpt_table(lq_sta, tbl);
rs_fill_lq_cmd(mvm, sta, lq_sta, rate); rs_fill_lq_cmd(mvm, sta, lq_sta, rate);
/* TODO restore station should remember the lq cmd */ /* TODO restore station should remember the lq cmd */
iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq, init); iwl_mvm_send_lq_cmd(mvm, &lq_sta->lq,
mvmsta->sta_state < IEEE80211_STA_AUTHORIZED);
} }
static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta, static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta,
...@@ -3123,7 +3123,7 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg) ...@@ -3123,7 +3123,7 @@ void iwl_mvm_update_frame_stats(struct iwl_mvm *mvm, u32 rate, bool agg)
* Called after adding a new station to initialize rate scaling * Called after adding a new station to initialize rate scaling
*/ */
static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
enum nl80211_band band, bool init) enum nl80211_band band)
{ {
int i, j; int i, j;
struct ieee80211_hw *hw = mvm->hw; struct ieee80211_hw *hw = mvm->hw;
...@@ -3203,7 +3203,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -3203,7 +3203,7 @@ static void rs_drv_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
#ifdef CONFIG_IWLWIFI_DEBUGFS #ifdef CONFIG_IWLWIFI_DEBUGFS
iwl_mvm_reset_frame_stats(mvm); iwl_mvm_reset_frame_stats(mvm);
#endif #endif
rs_initialize_lq(mvm, sta, lq_sta, band, init); rs_initialize_lq(mvm, sta, lq_sta, band);
} }
static void rs_drv_rate_update(void *mvm_r, static void rs_drv_rate_update(void *mvm_r,
...@@ -3223,7 +3223,7 @@ static void rs_drv_rate_update(void *mvm_r, ...@@ -3223,7 +3223,7 @@ static void rs_drv_rate_update(void *mvm_r,
for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++)
ieee80211_stop_tx_ba_session(sta, tid); ieee80211_stop_tx_ba_session(sta, tid);
iwl_mvm_rs_rate_init(mvm, sta, sband->band, false); iwl_mvm_rs_rate_init(mvm, sta, sband->band);
} }
#ifdef CONFIG_MAC80211_DEBUGFS #ifdef CONFIG_MAC80211_DEBUGFS
...@@ -4069,12 +4069,12 @@ static const struct rate_control_ops rs_mvm_ops_drv = { ...@@ -4069,12 +4069,12 @@ static const struct rate_control_ops rs_mvm_ops_drv = {
}; };
void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
enum nl80211_band band, bool init) enum nl80211_band band)
{ {
if (iwl_mvm_has_tlc_offload(mvm)) if (iwl_mvm_has_tlc_offload(mvm))
rs_fw_rate_init(mvm, sta, band); rs_fw_rate_init(mvm, sta, band);
else else
rs_drv_rate_init(mvm, sta, band, init); rs_drv_rate_init(mvm, sta, band);
} }
int iwl_mvm_rate_control_register(void) int iwl_mvm_rate_control_register(void)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2015 Intel Mobile Communications GmbH * Copyright(c) 2015 Intel Mobile Communications GmbH
* Copyright(c) 2017 Intel Deutschland GmbH * Copyright(c) 2017 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as * under the terms of version 2 of the GNU General Public License as
...@@ -13,10 +14,6 @@ ...@@ -13,10 +14,6 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details. * more details.
* *
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the * The full GNU General Public License is included in this distribution in the
* file called LICENSE. * file called LICENSE.
* *
...@@ -410,7 +407,7 @@ struct iwl_lq_sta { ...@@ -410,7 +407,7 @@ struct iwl_lq_sta {
/* Initialize station's rate scaling information after adding station */ /* Initialize station's rate scaling information after adding station */
void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
enum nl80211_band band, bool init); enum nl80211_band band);
/* Notify RS about Tx status */ /* Notify RS about Tx status */
void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta, void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
......
...@@ -216,7 +216,7 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, ...@@ -216,7 +216,7 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
cpu_to_le32(agg_size << STA_FLG_MAX_AGG_SIZE_SHIFT); cpu_to_le32(agg_size << STA_FLG_MAX_AGG_SIZE_SHIFT);
add_sta_cmd.station_flags |= add_sta_cmd.station_flags |=
cpu_to_le32(mpdu_dens << STA_FLG_AGG_MPDU_DENS_SHIFT); cpu_to_le32(mpdu_dens << STA_FLG_AGG_MPDU_DENS_SHIFT);
if (mvm_sta->associated) if (mvm_sta->sta_state >= IEEE80211_STA_ASSOC)
add_sta_cmd.assoc_id = cpu_to_le16(sta->aid); add_sta_cmd.assoc_id = cpu_to_le16(sta->aid);
if (sta->wme) { if (sta->wme) {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
* Copyright(c) 2015 - 2016 Intel Deutschland GmbH * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as * it under the terms of version 2 of the GNU General Public License as
...@@ -18,11 +19,6 @@ ...@@ -18,11 +19,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution * The full GNU General Public License is included in this distribution
* in the file called COPYING. * in the file called COPYING.
* *
...@@ -35,6 +31,7 @@ ...@@ -35,6 +31,7 @@
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
* Copyright(c) 2015 - 2016 Intel Deutschland GmbH * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
* Copyright(c) 2018 Intel Corporation
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -376,6 +373,7 @@ struct iwl_mvm_rxq_dup_data { ...@@ -376,6 +373,7 @@ struct iwl_mvm_rxq_dup_data {
* tid. * tid.
* @max_agg_bufsize: the maximal size of the AGG buffer for this station * @max_agg_bufsize: the maximal size of the AGG buffer for this station
* @sta_type: station type * @sta_type: station type
* @sta_state: station state according to enum %ieee80211_sta_state
* @bt_reduced_txpower: is reduced tx power enabled for this station * @bt_reduced_txpower: is reduced tx power enabled for this station
* @next_status_eosp: the next reclaimed packet is a PS-Poll response and * @next_status_eosp: the next reclaimed packet is a PS-Poll response and
* we need to signal the EOSP * we need to signal the EOSP
...@@ -416,6 +414,7 @@ struct iwl_mvm_sta { ...@@ -416,6 +414,7 @@ struct iwl_mvm_sta {
u16 tid_disable_agg; u16 tid_disable_agg;
u8 max_agg_bufsize; u8 max_agg_bufsize;
enum iwl_sta_type sta_type; enum iwl_sta_type sta_type;
enum ieee80211_sta_state sta_state;
bool bt_reduced_txpower; bool bt_reduced_txpower;
bool next_status_eosp; bool next_status_eosp;
spinlock_t lock; spinlock_t lock;
...@@ -441,7 +440,6 @@ struct iwl_mvm_sta { ...@@ -441,7 +440,6 @@ struct iwl_mvm_sta {
u16 amsdu_enabled; u16 amsdu_enabled;
u16 max_amsdu_len; u16 max_amsdu_len;
bool sleeping; bool sleeping;
bool associated;
u8 agg_tids; u8 agg_tids;
u8 sleep_tx_count; u8 sleep_tx_count;
u8 avg_energy; u8 avg_energy;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment