Commit 849b7967 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: further cleanups to stopping BA sessions

Essentially consisting of passing the sta_info pointer around,
instead of repeatedly doing hash lookups.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d75636ef
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <net/mac80211.h> #include <net/mac80211.h>
#include "ieee80211_i.h" #include "ieee80211_i.h"
static void __ieee80211_sta_stop_rx_ba_session(struct sta_info *sta, u16 tid, void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
u16 initiator, u16 reason) u16 initiator, u16 reason)
{ {
struct ieee80211_local *local = sta->local; struct ieee80211_local *local = sta->local;
...@@ -96,7 +96,7 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r ...@@ -96,7 +96,7 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r
return; return;
} }
__ieee80211_sta_stop_rx_ba_session(sta, tid, initiator, reason); __ieee80211_stop_rx_ba_session(sta, tid, initiator, reason);
rcu_read_unlock(); rcu_read_unlock();
} }
......
...@@ -123,10 +123,10 @@ void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u1 ...@@ -123,10 +123,10 @@ void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u1
ieee80211_tx_skb(sdata, skb, 0); ieee80211_tx_skb(sdata, skb, 0);
} }
static int __ieee80211_stop_tx_ba_session(struct ieee80211_local *local, static int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
struct sta_info *sta, u16 tid,
enum ieee80211_back_parties initiator) enum ieee80211_back_parties initiator)
{ {
struct ieee80211_local *local = sta->local;
int ret; int ret;
u8 *state; u8 *state;
...@@ -165,7 +165,6 @@ static void sta_addba_resp_timer_expired(unsigned long data) ...@@ -165,7 +165,6 @@ static void sta_addba_resp_timer_expired(unsigned long data)
u16 tid = *(u8 *)data; u16 tid = *(u8 *)data;
struct sta_info *sta = container_of((void *)data, struct sta_info *sta = container_of((void *)data,
struct sta_info, timer_to_tid[tid]); struct sta_info, timer_to_tid[tid]);
struct ieee80211_local *local = sta->local;
u8 *state; u8 *state;
state = &sta->ampdu_mlme.tid_state_tx[tid]; state = &sta->ampdu_mlme.tid_state_tx[tid];
...@@ -186,7 +185,7 @@ static void sta_addba_resp_timer_expired(unsigned long data) ...@@ -186,7 +185,7 @@ static void sta_addba_resp_timer_expired(unsigned long data)
printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid); printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid);
#endif #endif
__ieee80211_stop_tx_ba_session(local, sta, tid, WLAN_BACK_INITIATOR); ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR);
spin_unlock_bh(&sta->lock); spin_unlock_bh(&sta->lock);
} }
...@@ -427,28 +426,11 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, ...@@ -427,28 +426,11 @@ void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
} }
EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe); EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe);
int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
u8 *ra, u16 tid,
enum ieee80211_back_parties initiator) enum ieee80211_back_parties initiator)
{ {
struct ieee80211_local *local = hw_to_local(hw);
struct sta_info *sta;
u8 *state; u8 *state;
int ret = 0; int ret;
if (WARN_ON(!local->ops->ampdu_action))
return -EINVAL;
if (tid >= STA_TID_NUM)
return -EINVAL;
rcu_read_lock();
sta = sta_info_get(local, ra);
if (!sta) {
rcu_read_unlock();
return -ENOENT;
}
/* check if the TID is in aggregation */ /* check if the TID is in aggregation */
state = &sta->ampdu_mlme.tid_state_tx[tid]; state = &sta->ampdu_mlme.tid_state_tx[tid];
...@@ -461,16 +443,39 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, ...@@ -461,16 +443,39 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
#ifdef CONFIG_MAC80211_HT_DEBUG #ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n", printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
ra, tid); sta->sta.addr, tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */ #endif /* CONFIG_MAC80211_HT_DEBUG */
ret = __ieee80211_stop_tx_ba_session(local, sta, tid, initiator); ret = ___ieee80211_stop_tx_ba_session(sta, tid, initiator);
unlock: unlock:
spin_unlock_bh(&sta->lock); spin_unlock_bh(&sta->lock);
return ret;
}
int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
u8 *ra, u16 tid,
enum ieee80211_back_parties initiator)
{
struct ieee80211_local *local = hw_to_local(hw);
struct sta_info *sta;
int ret = 0;
if (WARN_ON(!local->ops->ampdu_action))
return -EINVAL;
if (tid >= STA_TID_NUM)
return -EINVAL;
rcu_read_lock();
sta = sta_info_get(local, ra);
if (!sta) {
rcu_read_unlock(); rcu_read_unlock();
return -ENOENT;
}
ret = __ieee80211_stop_tx_ba_session(sta, tid, initiator);
rcu_read_unlock();
return ret; return ret;
} }
EXPORT_SYMBOL(ieee80211_stop_tx_ba_session); EXPORT_SYMBOL(ieee80211_stop_tx_ba_session);
...@@ -623,11 +628,9 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, ...@@ -623,11 +628,9 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
#ifdef CONFIG_MAC80211_HT_DEBUG #ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Resuming TX aggregation for tid %d\n", tid); printk(KERN_DEBUG "Resuming TX aggregation for tid %d\n", tid);
#endif /* CONFIG_MAC80211_HT_DEBUG */ #endif /* CONFIG_MAC80211_HT_DEBUG */
spin_unlock_bh(&sta->lock);
} else { } else {
sta->ampdu_mlme.addba_req_num[tid]++; sta->ampdu_mlme.addba_req_num[tid]++;
__ieee80211_stop_tx_ba_session(local, sta, tid, ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR);
WLAN_BACK_INITIATOR);
spin_unlock_bh(&sta->lock);
} }
spin_unlock_bh(&sta->lock);
} }
...@@ -155,14 +155,11 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, ...@@ -155,14 +155,11 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta) void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta)
{ {
struct ieee80211_local *local = sta->local;
int i; int i;
for (i = 0; i < STA_TID_NUM; i++) { for (i = 0; i < STA_TID_NUM; i++) {
ieee80211_stop_tx_ba_session(&local->hw, sta->sta.addr, i, __ieee80211_stop_tx_ba_session(sta, i, WLAN_BACK_INITIATOR);
WLAN_BACK_INITIATOR); __ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT,
ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->sta.addr, i,
WLAN_BACK_RECIPIENT,
WLAN_REASON_QSTA_LEAVE_QBSS); WLAN_REASON_QSTA_LEAVE_QBSS);
} }
} }
......
...@@ -993,6 +993,8 @@ void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, ...@@ -993,6 +993,8 @@ void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da,
u16 tid, u16 initiator, u16 reason); u16 tid, u16 initiator, u16 reason);
void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
u16 initiator, u16 reason);
void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta); void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta);
void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta, struct sta_info *sta,
...@@ -1006,6 +1008,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, ...@@ -1006,6 +1008,9 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
struct ieee80211_mgmt *mgmt, struct ieee80211_mgmt *mgmt,
size_t len); size_t len);
int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
enum ieee80211_back_parties initiator);
/* Spectrum management */ /* Spectrum management */
void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgmt *mgmt, struct ieee80211_mgmt *mgmt,
......
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