Commit 9cc40712 authored by Johannes Berg's avatar Johannes Berg

iwlwifi: mvm: fix GO powersave client manipulation

All station commands must include a valid MAC ID,
the ID 0 is randomly valid in some cases, but we
must set the ID properly. Do that by passing the
right station and using its mac_id_n_color.
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent d2931bbd
...@@ -857,7 +857,6 @@ iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw, ...@@ -857,7 +857,6 @@ iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw,
bool more_data) bool more_data)
{ {
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
/* TODO: how do we tell the fw to send frames for a specific TID */ /* TODO: how do we tell the fw to send frames for a specific TID */
...@@ -865,8 +864,7 @@ iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw, ...@@ -865,8 +864,7 @@ iwl_mvm_mac_allow_buffered_frames(struct ieee80211_hw *hw,
* The fw will send EOSP notification when the last frame will be * The fw will send EOSP notification when the last frame will be
* transmitted. * transmitted.
*/ */
iwl_mvm_sta_modify_sleep_tx_count(mvm, mvmsta->sta_id, reason, iwl_mvm_sta_modify_sleep_tx_count(mvm, sta, reason, num_frames);
num_frames);
} }
static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
...@@ -890,7 +888,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw, ...@@ -890,7 +888,7 @@ static void iwl_mvm_mac_sta_notify(struct ieee80211_hw *hw,
case STA_NOTIFY_AWAKE: case STA_NOTIFY_AWAKE:
if (WARN_ON(mvmsta->sta_id == IWL_INVALID_STATION)) if (WARN_ON(mvmsta->sta_id == IWL_INVALID_STATION))
break; break;
iwl_mvm_sta_modify_ps_wake(mvm, mvmsta->sta_id); iwl_mvm_sta_modify_ps_wake(mvm, sta);
break; break;
default: default:
break; break;
......
...@@ -1188,13 +1188,16 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, ...@@ -1188,13 +1188,16 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm,
rcu_read_unlock(); rcu_read_unlock();
} }
void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, int sta_id) void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm,
struct ieee80211_sta *sta)
{ {
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
struct iwl_mvm_add_sta_cmd cmd = { struct iwl_mvm_add_sta_cmd cmd = {
.add_modify = STA_MODE_MODIFY, .add_modify = STA_MODE_MODIFY,
.sta_id = sta_id, .sta_id = mvmsta->sta_id,
.modify_mask = STA_MODIFY_SLEEPING_STA_TX_COUNT, .modify_mask = STA_MODIFY_SLEEPING_STA_TX_COUNT,
.sleep_state_flags = cpu_to_le16(STA_SLEEP_STATE_AWAKE), .sleep_state_flags = cpu_to_le16(STA_SLEEP_STATE_AWAKE),
.mac_id_n_color = cpu_to_le32(mvmsta->mac_id_n_color),
}; };
int ret; int ret;
...@@ -1208,18 +1211,21 @@ void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, int sta_id) ...@@ -1208,18 +1211,21 @@ void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, int sta_id)
IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret);
} }
void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, int sta_id, void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm,
struct ieee80211_sta *sta,
enum ieee80211_frame_release_type reason, enum ieee80211_frame_release_type reason,
u16 cnt) u16 cnt)
{ {
u16 sleep_state_flags = u16 sleep_state_flags =
(reason == IEEE80211_FRAME_RELEASE_UAPSD) ? (reason == IEEE80211_FRAME_RELEASE_UAPSD) ?
STA_SLEEP_STATE_UAPSD : STA_SLEEP_STATE_PS_POLL; STA_SLEEP_STATE_UAPSD : STA_SLEEP_STATE_PS_POLL;
struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv;
struct iwl_mvm_add_sta_cmd cmd = { struct iwl_mvm_add_sta_cmd cmd = {
.add_modify = STA_MODE_MODIFY, .add_modify = STA_MODE_MODIFY,
.sta_id = sta_id, .sta_id = mvmsta->sta_id,
.modify_mask = STA_MODIFY_SLEEPING_STA_TX_COUNT, .modify_mask = STA_MODIFY_SLEEPING_STA_TX_COUNT,
.sleep_tx_count = cpu_to_le16(cnt), .sleep_tx_count = cpu_to_le16(cnt),
.mac_id_n_color = cpu_to_le32(mvmsta->mac_id_n_color),
/* /*
* Same modify mask for sleep_tx_count and sleep_state_flags so * Same modify mask for sleep_tx_count and sleep_state_flags so
* we must set the sleep_state_flags too. * we must set the sleep_state_flags too.
......
...@@ -362,8 +362,10 @@ int iwl_mvm_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -362,8 +362,10 @@ int iwl_mvm_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct iwl_mvm_int_sta *bsta); struct iwl_mvm_int_sta *bsta);
int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *bsta); int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *bsta);
void iwl_mvm_sta_drained_wk(struct work_struct *wk); void iwl_mvm_sta_drained_wk(struct work_struct *wk);
void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, int sta_id); void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm,
void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, int sta_id, struct ieee80211_sta *sta);
void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm,
struct ieee80211_sta *sta,
enum ieee80211_frame_release_type reason, enum ieee80211_frame_release_type reason,
u16 cnt); u16 cnt);
int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
......
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