Skip to content

Commit

Permalink
iwlwifi: mvm: track the number of Rx BA sessions
Browse files Browse the repository at this point in the history
The firmware / HW can't support more than 16 Rx BA sessions.
Deny any attemps to open more sessions than that.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
  • Loading branch information
Emmanuel Grumbach authored and Johannes Berg committed Jul 16, 2013
1 parent 93a4266 commit 113a044
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/mvm/mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
ieee80211_wake_queues(mvm->hw);

mvm->vif_count = 0;
mvm->rx_ba_sessions = 0;
}

static int iwl_mvm_mac_start(struct ieee80211_hw *hw)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/mvm/mvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ struct iwl_mvm {
struct work_struct sta_drained_wk;
unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)];
atomic_t pending_frames[IWL_MVM_STATION_COUNT];
u8 rx_ba_sessions;

/* configured by mac80211 */
u32 rts_threshold;
Expand Down
15 changes: 15 additions & 0 deletions drivers/net/wireless/iwlwifi/mvm/sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *bsta)
return ret;
}

#define IWL_MAX_RX_BA_SESSIONS 16

int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
int tid, u16 ssn, bool start)
{
Expand All @@ -618,6 +620,11 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,

lockdep_assert_held(&mvm->mutex);

if (start && mvm->rx_ba_sessions >= IWL_MAX_RX_BA_SESSIONS) {
IWL_WARN(mvm, "Not enough RX BA SESSIONS\n");
return -ENOSPC;
}

cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color);
cmd.sta_id = mvm_sta->sta_id;
cmd.add_modify = STA_MODE_MODIFY;
Expand Down Expand Up @@ -652,6 +659,14 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
break;
}

if (!ret) {
if (start)
mvm->rx_ba_sessions++;
else if (mvm->rx_ba_sessions > 0)
/* check that restart flow didn't zero the counter */
mvm->rx_ba_sessions--;
}

return ret;
}

Expand Down

0 comments on commit 113a044

Please sign in to comment.