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

mac80211: optimise station flags

The flaglock in struct sta_info has long been
something that I wanted to get rid of, this
finally does the conversion to atomic bitops.

The conversion itself is straight-forward in
most places, a few things needed to change a
bit since we can no longer use multiple bits
at the same time.

On x86-64, this is a fairly significant code
size reduction:
   text	   data	    bss	    dec	    hex
 427861	  23648	   1008	 452517	  6e7a5	before
 425383	  23648	    976	 450007	  6ddd7	after
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent deeaee19
...@@ -223,7 +223,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, ...@@ -223,7 +223,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
status = WLAN_STATUS_REQUEST_DECLINED; status = WLAN_STATUS_REQUEST_DECLINED;
if (test_sta_flags(sta, WLAN_STA_BLOCK_BA)) { if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
#ifdef CONFIG_MAC80211_HT_DEBUG #ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "Suspend in progress. " printk(KERN_DEBUG "Suspend in progress. "
"Denying ADDBA request\n"); "Denying ADDBA request\n");
......
...@@ -382,7 +382,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, ...@@ -382,7 +382,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
sdata->vif.type != NL80211_IFTYPE_AP) sdata->vif.type != NL80211_IFTYPE_AP)
return -EINVAL; return -EINVAL;
if (test_sta_flags(sta, WLAN_STA_BLOCK_BA)) { if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) {
#ifdef CONFIG_MAC80211_HT_DEBUG #ifdef CONFIG_MAC80211_HT_DEBUG
printk(KERN_DEBUG "BA sessions blocked. " printk(KERN_DEBUG "BA sessions blocked. "
"Denying BA session request\n"); "Denying BA session request\n");
......
...@@ -668,7 +668,6 @@ static void sta_apply_parameters(struct ieee80211_local *local, ...@@ -668,7 +668,6 @@ static void sta_apply_parameters(struct ieee80211_local *local,
struct sta_info *sta, struct sta_info *sta,
struct station_parameters *params) struct station_parameters *params)
{ {
unsigned long flags;
u32 rates; u32 rates;
int i, j; int i, j;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
...@@ -677,49 +676,53 @@ static void sta_apply_parameters(struct ieee80211_local *local, ...@@ -677,49 +676,53 @@ static void sta_apply_parameters(struct ieee80211_local *local,
sband = local->hw.wiphy->bands[local->oper_channel->band]; sband = local->hw.wiphy->bands[local->oper_channel->band];
spin_lock_irqsave(&sta->flaglock, flags);
mask = params->sta_flags_mask; mask = params->sta_flags_mask;
set = params->sta_flags_set; set = params->sta_flags_set;
if (mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) { if (mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
sta->flags &= ~WLAN_STA_AUTHORIZED;
if (set & BIT(NL80211_STA_FLAG_AUTHORIZED)) if (set & BIT(NL80211_STA_FLAG_AUTHORIZED))
sta->flags |= WLAN_STA_AUTHORIZED; set_sta_flag(sta, WLAN_STA_AUTHORIZED);
else
clear_sta_flag(sta, WLAN_STA_AUTHORIZED);
} }
if (mask & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) { if (mask & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) {
sta->flags &= ~WLAN_STA_SHORT_PREAMBLE;
if (set & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) if (set & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE))
sta->flags |= WLAN_STA_SHORT_PREAMBLE; set_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE);
else
clear_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE);
} }
if (mask & BIT(NL80211_STA_FLAG_WME)) { if (mask & BIT(NL80211_STA_FLAG_WME)) {
sta->flags &= ~WLAN_STA_WME;
sta->sta.wme = false;
if (set & BIT(NL80211_STA_FLAG_WME)) { if (set & BIT(NL80211_STA_FLAG_WME)) {
sta->flags |= WLAN_STA_WME; set_sta_flag(sta, WLAN_STA_WME);
sta->sta.wme = true; sta->sta.wme = true;
} else {
clear_sta_flag(sta, WLAN_STA_WME);
sta->sta.wme = false;
} }
} }
if (mask & BIT(NL80211_STA_FLAG_MFP)) { if (mask & BIT(NL80211_STA_FLAG_MFP)) {
sta->flags &= ~WLAN_STA_MFP;
if (set & BIT(NL80211_STA_FLAG_MFP)) if (set & BIT(NL80211_STA_FLAG_MFP))
sta->flags |= WLAN_STA_MFP; set_sta_flag(sta, WLAN_STA_MFP);
else
clear_sta_flag(sta, WLAN_STA_MFP);
} }
if (mask & BIT(NL80211_STA_FLAG_AUTHENTICATED)) { if (mask & BIT(NL80211_STA_FLAG_AUTHENTICATED)) {
sta->flags &= ~WLAN_STA_AUTH;
if (set & BIT(NL80211_STA_FLAG_AUTHENTICATED)) if (set & BIT(NL80211_STA_FLAG_AUTHENTICATED))
sta->flags |= WLAN_STA_AUTH; set_sta_flag(sta, WLAN_STA_AUTH);
else
clear_sta_flag(sta, WLAN_STA_AUTH);
} }
if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) {
sta->flags &= ~WLAN_STA_TDLS_PEER;
if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) if (set & BIT(NL80211_STA_FLAG_TDLS_PEER))
sta->flags |= WLAN_STA_TDLS_PEER; set_sta_flag(sta, WLAN_STA_TDLS_PEER);
else
clear_sta_flag(sta, WLAN_STA_TDLS_PEER);
} }
spin_unlock_irqrestore(&sta->flaglock, flags);
if (params->sta_modify_mask & STATION_PARAM_APPLY_UAPSD) { if (params->sta_modify_mask & STATION_PARAM_APPLY_UAPSD) {
sta->sta.uapsd_queues = params->uapsd_queues; sta->sta.uapsd_queues = params->uapsd_queues;
...@@ -815,12 +818,13 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, ...@@ -815,12 +818,13 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
if (!sta) if (!sta)
return -ENOMEM; return -ENOMEM;
sta->flags = WLAN_STA_AUTH | WLAN_STA_ASSOC; set_sta_flag(sta, WLAN_STA_AUTH);
set_sta_flag(sta, WLAN_STA_ASSOC);
sta_apply_parameters(local, sta, params); sta_apply_parameters(local, sta, params);
/* Only TDLS-supporting stations can add TDLS peers */ /* Only TDLS-supporting stations can add TDLS peers */
if ((sta->flags & WLAN_STA_TDLS_PEER) && if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
!((wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) && !((wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) &&
sdata->vif.type == NL80211_IFTYPE_STATION)) sdata->vif.type == NL80211_IFTYPE_STATION))
return -ENOTSUPP; return -ENOTSUPP;
...@@ -880,7 +884,7 @@ static int ieee80211_change_station(struct wiphy *wiphy, ...@@ -880,7 +884,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
/* The TDLS bit cannot be toggled after the STA was added */ /* The TDLS bit cannot be toggled after the STA was added */
if ((params->sta_flags_mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) && if ((params->sta_flags_mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) &&
!!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) != !!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) !=
!!test_sta_flags(sta, WLAN_STA_TDLS_PEER)) { !!test_sta_flag(sta, WLAN_STA_TDLS_PEER)) {
rcu_read_unlock(); rcu_read_unlock();
return -EINVAL; return -EINVAL;
} }
...@@ -2449,7 +2453,7 @@ static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, ...@@ -2449,7 +2453,7 @@ static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
return -ENOLINK; return -ENOLINK;
} }
set_sta_flags(sta, WLAN_STA_TDLS_PEER_AUTH); set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH);
rcu_read_unlock(); rcu_read_unlock();
break; break;
case NL80211_TDLS_DISABLE_LINK: case NL80211_TDLS_DISABLE_LINK:
......
...@@ -58,17 +58,17 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf, ...@@ -58,17 +58,17 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
{ {
char buf[100]; char buf[100];
struct sta_info *sta = file->private_data; struct sta_info *sta = file->private_data;
u32 staflags = get_sta_flags(sta);
int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s", int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s",
staflags & WLAN_STA_AUTH ? "AUTH\n" : "", test_sta_flag(sta, WLAN_STA_AUTH) ? "AUTH\n" : "",
staflags & WLAN_STA_ASSOC ? "ASSOC\n" : "", test_sta_flag(sta, WLAN_STA_ASSOC) ? "ASSOC\n" : "",
staflags & WLAN_STA_PS_STA ? "PS (sta)\n" : "", test_sta_flag(sta, WLAN_STA_PS_STA) ? "PS (sta)\n" : "",
staflags & WLAN_STA_PS_DRIVER ? "PS (driver)\n" : "", test_sta_flag(sta, WLAN_STA_PS_DRIVER) ? "PS (driver)\n" : "",
staflags & WLAN_STA_AUTHORIZED ? "AUTHORIZED\n" : "", test_sta_flag(sta, WLAN_STA_AUTHORIZED) ? "AUTHORIZED\n" : "",
staflags & WLAN_STA_SHORT_PREAMBLE ? "SHORT PREAMBLE\n" : "", test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE) ? "SHORT PREAMBLE\n" : "",
staflags & WLAN_STA_WME ? "WME\n" : "", test_sta_flag(sta, WLAN_STA_WME) ? "WME\n" : "",
staflags & WLAN_STA_WDS ? "WDS\n" : "", test_sta_flag(sta, WLAN_STA_WDS) ? "WDS\n" : "",
staflags & WLAN_STA_MFP ? "MFP\n" : ""); test_sta_flag(sta, WLAN_STA_MFP) ? "MFP\n" : "");
return simple_read_from_buffer(userbuf, count, ppos, buf, res); return simple_read_from_buffer(userbuf, count, ppos, buf, res);
} }
STA_OPS(flags); STA_OPS(flags);
......
...@@ -130,7 +130,7 @@ void ieee80211_ba_session_work(struct work_struct *work) ...@@ -130,7 +130,7 @@ void ieee80211_ba_session_work(struct work_struct *work)
* down by the code that set the flag, so this * down by the code that set the flag, so this
* need not run. * need not run.
*/ */
if (test_sta_flags(sta, WLAN_STA_BLOCK_BA)) if (test_sta_flag(sta, WLAN_STA_BLOCK_BA))
return; return;
mutex_lock(&sta->ampdu_mlme.mtx); mutex_lock(&sta->ampdu_mlme.mtx);
......
...@@ -314,7 +314,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, ...@@ -314,7 +314,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
} }
if (sta && elems->wmm_info) if (sta && elems->wmm_info)
set_sta_flags(sta, WLAN_STA_WME); set_sta_flag(sta, WLAN_STA_WME);
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -452,7 +452,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, ...@@ -452,7 +452,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
return NULL; return NULL;
sta->last_rx = jiffies; sta->last_rx = jiffies;
set_sta_flags(sta, WLAN_STA_AUTHORIZED); set_sta_flag(sta, WLAN_STA_AUTHORIZED);
/* make sure mandatory rates are always added */ /* make sure mandatory rates are always added */
sta->sta.supp_rates[band] = supp_rates | sta->sta.supp_rates[band] = supp_rates |
......
...@@ -299,8 +299,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up) ...@@ -299,8 +299,8 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
goto err_del_interface; goto err_del_interface;
} }
/* no locking required since STA is not live yet */ /* no atomic bitop required since STA is not live yet */
sta->flags |= WLAN_STA_AUTHORIZED; set_sta_flag(sta, WLAN_STA_AUTHORIZED);
res = sta_info_insert(sta); res = sta_info_insert(sta);
if (res) { if (res) {
......
...@@ -464,7 +464,7 @@ int ieee80211_key_link(struct ieee80211_key *key, ...@@ -464,7 +464,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
* some hardware cannot handle TKIP with QoS, so * some hardware cannot handle TKIP with QoS, so
* we indicate whether QoS could be in use. * we indicate whether QoS could be in use.
*/ */
if (test_sta_flags(sta, WLAN_STA_WME)) if (test_sta_flag(sta, WLAN_STA_WME))
key->conf.flags |= IEEE80211_KEY_FLAG_WMM_STA; key->conf.flags |= IEEE80211_KEY_FLAG_WMM_STA;
} else { } else {
if (sdata->vif.type == NL80211_IFTYPE_STATION) { if (sdata->vif.type == NL80211_IFTYPE_STATION) {
...@@ -478,7 +478,7 @@ int ieee80211_key_link(struct ieee80211_key *key, ...@@ -478,7 +478,7 @@ int ieee80211_key_link(struct ieee80211_key *key,
/* same here, the AP could be using QoS */ /* same here, the AP could be using QoS */
ap = sta_info_get(key->sdata, key->sdata->u.mgd.bssid); ap = sta_info_get(key->sdata, key->sdata->u.mgd.bssid);
if (ap) { if (ap) {
if (test_sta_flags(ap, WLAN_STA_WME)) if (test_sta_flag(ap, WLAN_STA_WME))
key->conf.flags |= key->conf.flags |=
IEEE80211_KEY_FLAG_WMM_STA; IEEE80211_KEY_FLAG_WMM_STA;
} }
......
...@@ -92,7 +92,9 @@ static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, ...@@ -92,7 +92,9 @@ static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
if (!sta) if (!sta)
return NULL; return NULL;
sta->flags = WLAN_STA_AUTHORIZED | WLAN_STA_AUTH | WLAN_STA_WME; set_sta_flag(sta, WLAN_STA_AUTH);
set_sta_flag(sta, WLAN_STA_AUTHORIZED);
set_sta_flag(sta, WLAN_STA_WME);
sta->sta.supp_rates[local->hw.conf.channel->band] = rates; sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
rate_control_rate_init(sta); rate_control_rate_init(sta);
...@@ -383,7 +385,7 @@ int mesh_plink_open(struct sta_info *sta) ...@@ -383,7 +385,7 @@ int mesh_plink_open(struct sta_info *sta)
__le16 llid; __le16 llid;
struct ieee80211_sub_if_data *sdata = sta->sdata; struct ieee80211_sub_if_data *sdata = sta->sdata;
if (!test_sta_flags(sta, WLAN_STA_AUTH)) if (!test_sta_flag(sta, WLAN_STA_AUTH))
return -EPERM; return -EPERM;
spin_lock_bh(&sta->lock); spin_lock_bh(&sta->lock);
...@@ -503,7 +505,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m ...@@ -503,7 +505,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
return; return;
} }
if (sta && !test_sta_flags(sta, WLAN_STA_AUTH)) { if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) {
mpl_dbg("Mesh plink: Action frame from non-authed peer\n"); mpl_dbg("Mesh plink: Action frame from non-authed peer\n");
rcu_read_unlock(); rcu_read_unlock();
return; return;
......
...@@ -627,7 +627,7 @@ static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata) ...@@ -627,7 +627,7 @@ static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_if_managed *mgd = &sdata->u.mgd; struct ieee80211_if_managed *mgd = &sdata->u.mgd;
struct sta_info *sta = NULL; struct sta_info *sta = NULL;
u32 sta_flags = 0; bool authorized = false;
if (!mgd->powersave) if (!mgd->powersave)
return false; return false;
...@@ -645,13 +645,10 @@ static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata) ...@@ -645,13 +645,10 @@ static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata)
rcu_read_lock(); rcu_read_lock();
sta = sta_info_get(sdata, mgd->bssid); sta = sta_info_get(sdata, mgd->bssid);
if (sta) if (sta)
sta_flags = get_sta_flags(sta); authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED);
rcu_read_unlock(); rcu_read_unlock();
if (!(sta_flags & WLAN_STA_AUTHORIZED)) return authorized;
return false;
return true;
} }
/* need to hold RTNL or interface lock */ /* need to hold RTNL or interface lock */
...@@ -1095,7 +1092,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -1095,7 +1092,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
mutex_lock(&local->sta_mtx); mutex_lock(&local->sta_mtx);
sta = sta_info_get(sdata, bssid); sta = sta_info_get(sdata, bssid);
if (sta) { if (sta) {
set_sta_flags(sta, WLAN_STA_BLOCK_BA); set_sta_flag(sta, WLAN_STA_BLOCK_BA);
ieee80211_sta_tear_down_BA_sessions(sta, tx); ieee80211_sta_tear_down_BA_sessions(sta, tx);
} }
mutex_unlock(&local->sta_mtx); mutex_unlock(&local->sta_mtx);
...@@ -1513,10 +1510,11 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, ...@@ -1513,10 +1510,11 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
return false; return false;
} }
set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | set_sta_flag(sta, WLAN_STA_AUTH);
WLAN_STA_ASSOC_AP); set_sta_flag(sta, WLAN_STA_ASSOC);
set_sta_flag(sta, WLAN_STA_ASSOC_AP);
if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT))
set_sta_flags(sta, WLAN_STA_AUTHORIZED); set_sta_flag(sta, WLAN_STA_AUTHORIZED);
rates = 0; rates = 0;
basic_rates = 0; basic_rates = 0;
...@@ -1575,10 +1573,10 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, ...@@ -1575,10 +1573,10 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
rate_control_rate_init(sta); rate_control_rate_init(sta);
if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED)
set_sta_flags(sta, WLAN_STA_MFP); set_sta_flag(sta, WLAN_STA_MFP);
if (elems.wmm_param) if (elems.wmm_param)
set_sta_flags(sta, WLAN_STA_WME); set_sta_flag(sta, WLAN_STA_WME);
/* sta_info_reinsert will also unlock the mutex lock */ /* sta_info_reinsert will also unlock the mutex lock */
err = sta_info_reinsert(sta); err = sta_info_reinsert(sta);
......
...@@ -42,7 +42,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) ...@@ -42,7 +42,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) {
mutex_lock(&local->sta_mtx); mutex_lock(&local->sta_mtx);
list_for_each_entry(sta, &local->sta_list, list) { list_for_each_entry(sta, &local->sta_list, list) {
set_sta_flags(sta, WLAN_STA_BLOCK_BA); set_sta_flag(sta, WLAN_STA_BLOCK_BA);
ieee80211_sta_tear_down_BA_sessions(sta, true); ieee80211_sta_tear_down_BA_sessions(sta, true);
} }
mutex_unlock(&local->sta_mtx); mutex_unlock(&local->sta_mtx);
......
...@@ -841,7 +841,7 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) ...@@ -841,7 +841,7 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx)
ieee80211_is_pspoll(hdr->frame_control)) && ieee80211_is_pspoll(hdr->frame_control)) &&
rx->sdata->vif.type != NL80211_IFTYPE_ADHOC && rx->sdata->vif.type != NL80211_IFTYPE_ADHOC &&
rx->sdata->vif.type != NL80211_IFTYPE_WDS && rx->sdata->vif.type != NL80211_IFTYPE_WDS &&
(!rx->sta || !test_sta_flags(rx->sta, WLAN_STA_ASSOC)))) { (!rx->sta || !test_sta_flag(rx->sta, WLAN_STA_ASSOC)))) {
if (rx->sta && rx->sta->dummy && if (rx->sta && rx->sta->dummy &&
ieee80211_is_data_present(hdr->frame_control)) { ieee80211_is_data_present(hdr->frame_control)) {
u16 ethertype; u16 ethertype;
...@@ -1110,7 +1110,7 @@ static void ap_sta_ps_start(struct sta_info *sta) ...@@ -1110,7 +1110,7 @@ static void ap_sta_ps_start(struct sta_info *sta)
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
atomic_inc(&sdata->bss->num_sta_ps); atomic_inc(&sdata->bss->num_sta_ps);
set_sta_flags(sta, WLAN_STA_PS_STA); set_sta_flag(sta, WLAN_STA_PS_STA);
if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
...@@ -1130,7 +1130,7 @@ static void ap_sta_ps_end(struct sta_info *sta) ...@@ -1130,7 +1130,7 @@ static void ap_sta_ps_end(struct sta_info *sta)
sdata->name, sta->sta.addr, sta->sta.aid); sdata->name, sta->sta.addr, sta->sta.aid);
#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
if (test_sta_flags(sta, WLAN_STA_PS_DRIVER)) { if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n", printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n",
sdata->name, sta->sta.addr, sta->sta.aid); sdata->name, sta->sta.addr, sta->sta.aid);
...@@ -1149,7 +1149,7 @@ int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start) ...@@ -1149,7 +1149,7 @@ int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start)
WARN_ON(!(sta_inf->local->hw.flags & IEEE80211_HW_AP_LINK_PS)); WARN_ON(!(sta_inf->local->hw.flags & IEEE80211_HW_AP_LINK_PS));
/* Don't let the same PS state be set twice */ /* Don't let the same PS state be set twice */
in_ps = test_sta_flags(sta_inf, WLAN_STA_PS_STA); in_ps = test_sta_flag(sta_inf, WLAN_STA_PS_STA);
if ((start && in_ps) || (!start && !in_ps)) if ((start && in_ps) || (!start && !in_ps))
return -EINVAL; return -EINVAL;
...@@ -1190,15 +1190,15 @@ ieee80211_rx_h_uapsd_and_pspoll(struct ieee80211_rx_data *rx) ...@@ -1190,15 +1190,15 @@ ieee80211_rx_h_uapsd_and_pspoll(struct ieee80211_rx_data *rx)
* the uAPSD case, the station will probably be marked asleep, * the uAPSD case, the station will probably be marked asleep,
* in the PS-Poll case the station must be confused ... * in the PS-Poll case the station must be confused ...
*/ */
if (!test_sta_flags(rx->sta, WLAN_STA_PS_STA)) if (!test_sta_flag(rx->sta, WLAN_STA_PS_STA))
return RX_CONTINUE; return RX_CONTINUE;
if (unlikely(ieee80211_is_pspoll(hdr->frame_control))) { if (unlikely(ieee80211_is_pspoll(hdr->frame_control))) {
if (!test_sta_flags(rx->sta, WLAN_STA_SP)) { if (!test_sta_flag(rx->sta, WLAN_STA_SP)) {
if (!test_sta_flags(rx->sta, WLAN_STA_PS_DRIVER)) if (!test_sta_flag(rx->sta, WLAN_STA_PS_DRIVER))
ieee80211_sta_ps_deliver_poll_response(rx->sta); ieee80211_sta_ps_deliver_poll_response(rx->sta);
else else
set_sta_flags(rx->sta, WLAN_STA_PSPOLL); set_sta_flag(rx->sta, WLAN_STA_PSPOLL);
} }
/* Free PS Poll skb here instead of returning RX_DROP that would /* Free PS Poll skb here instead of returning RX_DROP that would
...@@ -1225,13 +1225,13 @@ ieee80211_rx_h_uapsd_and_pspoll(struct ieee80211_rx_data *rx) ...@@ -1225,13 +1225,13 @@ ieee80211_rx_h_uapsd_and_pspoll(struct ieee80211_rx_data *rx)
return RX_CONTINUE; return RX_CONTINUE;
/* if we are in a service period, do nothing */ /* if we are in a service period, do nothing */
if (test_sta_flags(rx->sta, WLAN_STA_SP)) if (test_sta_flag(rx->sta, WLAN_STA_SP))
return RX_CONTINUE; return RX_CONTINUE;
if (!test_sta_flags(rx->sta, WLAN_STA_PS_DRIVER)) if (!test_sta_flag(rx->sta, WLAN_STA_PS_DRIVER))
ieee80211_sta_ps_deliver_uapsd(rx->sta); ieee80211_sta_ps_deliver_uapsd(rx->sta);
else else
set_sta_flags(rx->sta, WLAN_STA_UAPSD); set_sta_flag(rx->sta, WLAN_STA_UAPSD);
} }
return RX_CONTINUE; return RX_CONTINUE;
...@@ -1295,7 +1295,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) ...@@ -1295,7 +1295,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
!(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) &&
(rx->sdata->vif.type == NL80211_IFTYPE_AP || (rx->sdata->vif.type == NL80211_IFTYPE_AP ||
rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) { rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) {
if (test_sta_flags(sta, WLAN_STA_PS_STA)) { if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
/* /*
* Ignore doze->wake transitions that are * Ignore doze->wake transitions that are
* indicated by non-data frames, the standard * indicated by non-data frames, the standard
...@@ -1570,7 +1570,7 @@ static int ...@@ -1570,7 +1570,7 @@ static int
ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx)
{ {
if (unlikely(!rx->sta || if (unlikely(!rx->sta ||
!test_sta_flags(rx->sta, WLAN_STA_AUTHORIZED))) !test_sta_flag(rx->sta, WLAN_STA_AUTHORIZED)))
return -EACCES; return -EACCES;
return 0; return 0;
...@@ -1613,7 +1613,7 @@ ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx) ...@@ -1613,7 +1613,7 @@ ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx)
if (status->flag & RX_FLAG_DECRYPTED) if (status->flag & RX_FLAG_DECRYPTED)
return 0; return 0;
if (rx->sta && test_sta_flags(rx->sta, WLAN_STA_MFP)) { if (rx->sta && test_sta_flag(rx->sta, WLAN_STA_MFP)) {
if (unlikely(!ieee80211_has_protected(fc) && if (unlikely(!ieee80211_has_protected(fc) &&
ieee80211_is_unicast_robust_mgmt_frame(rx->skb) && ieee80211_is_unicast_robust_mgmt_frame(rx->skb) &&
rx->key)) { rx->key)) {
......
...@@ -244,22 +244,22 @@ static void sta_unblock(struct work_struct *wk) ...@@ -244,22 +244,22 @@ static void sta_unblock(struct work_struct *wk)
if (sta->dead) if (sta->dead)
return; return;
if (!test_sta_flags(sta, WLAN_STA_PS_STA)) if (!test_sta_flag(sta, WLAN_STA_PS_STA))
ieee80211_sta_ps_deliver_wakeup(sta); ieee80211_sta_ps_deliver_wakeup(sta);
else if (test_and_clear_sta_flags(sta, WLAN_STA_PSPOLL)) { else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) {
clear_sta_flags(sta, WLAN_STA_PS_DRIVER); clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
local_bh_disable(); local_bh_disable();
ieee80211_sta_ps_deliver_poll_response(sta); ieee80211_sta_ps_deliver_poll_response(sta);
local_bh_enable(); local_bh_enable();
} else if (test_and_clear_sta_flags(sta, WLAN_STA_UAPSD)) { } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) {
clear_sta_flags(sta, WLAN_STA_PS_DRIVER); clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
local_bh_disable(); local_bh_disable();
ieee80211_sta_ps_deliver_uapsd(sta); ieee80211_sta_ps_deliver_uapsd(sta);
local_bh_enable(); local_bh_enable();
} else } else
clear_sta_flags(sta, WLAN_STA_PS_DRIVER); clear_sta_flag(sta, WLAN_STA_PS_DRIVER);
} }