aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
authorMarco Porsch <marco.porsch@etit.tu-chemnitz.de>2012-10-10 15:39:50 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-19 09:43:51 -0400
commitd012a605108a482392be80710ea35f1db27c4aa9 (patch)
treed39be4edcc102a07a7bb764bef154ccd1b46b399 /net/mac80211/rx.c
parent5c95b940bd97e744267249e3b0780e6ef04b029c (diff)
mac80211: make client powersave independent of interface type
This patch prepares mac80211 for a later implementation of mesh or ad-hoc powersave clients. The structures related to powersave (buffer, TIM map, counters) are moved from the AP-specific interface structure to a generic structure that can be embedded into any interface type. The functions related to powersave are prepared to allow easy extension with different interface types. For example with: + } else if (sta->sdata->vif.type == NL80211_IFTYPE_MESH_POINT) { + ps = &sdata->u.mesh.ps; Some references to the AP's beacon structure are removed where they were obviously not used. The patch compiles without warning and has been briefly tested as AP interface with one client in PS mode. Signed-off-by: Marco Porsch <marco.porsch@etit.tu-chemnitz.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 9f64fc4ecd29..d07216ab5f72 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1141,12 +1141,19 @@ ieee80211_rx_h_check_more_data(struct ieee80211_rx_data *rx)
1141 return RX_CONTINUE; 1141 return RX_CONTINUE;
1142} 1142}
1143 1143
1144static void ap_sta_ps_start(struct sta_info *sta) 1144static void sta_ps_start(struct sta_info *sta)
1145{ 1145{
1146 struct ieee80211_sub_if_data *sdata = sta->sdata; 1146 struct ieee80211_sub_if_data *sdata = sta->sdata;
1147 struct ieee80211_local *local = sdata->local; 1147 struct ieee80211_local *local = sdata->local;
1148 struct ps_data *ps;
1148 1149
1149 atomic_inc(&sdata->bss->num_sta_ps); 1150 if (sta->sdata->vif.type == NL80211_IFTYPE_AP ||
1151 sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
1152 ps = &sdata->bss->ps;
1153 else
1154 return;
1155
1156 atomic_inc(&ps->num_sta_ps);
1150 set_sta_flag(sta, WLAN_STA_PS_STA); 1157 set_sta_flag(sta, WLAN_STA_PS_STA);
1151 if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) 1158 if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS))
1152 drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); 1159 drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta);
@@ -1154,7 +1161,7 @@ static void ap_sta_ps_start(struct sta_info *sta)
1154 sta->sta.addr, sta->sta.aid); 1161 sta->sta.addr, sta->sta.aid);
1155} 1162}
1156 1163
1157static void ap_sta_ps_end(struct sta_info *sta) 1164static void sta_ps_end(struct sta_info *sta)
1158{ 1165{
1159 ps_dbg(sta->sdata, "STA %pM aid %d exits power save mode\n", 1166 ps_dbg(sta->sdata, "STA %pM aid %d exits power save mode\n",
1160 sta->sta.addr, sta->sta.aid); 1167 sta->sta.addr, sta->sta.aid);
@@ -1181,9 +1188,9 @@ int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start)
1181 return -EINVAL; 1188 return -EINVAL;
1182 1189
1183 if (start) 1190 if (start)
1184 ap_sta_ps_start(sta_inf); 1191 sta_ps_start(sta_inf);
1185 else 1192 else
1186 ap_sta_ps_end(sta_inf); 1193 sta_ps_end(sta_inf);
1187 1194
1188 return 0; 1195 return 0;
1189} 1196}
@@ -1335,10 +1342,10 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx)
1335 */ 1342 */
1336 if (ieee80211_is_data(hdr->frame_control) && 1343 if (ieee80211_is_data(hdr->frame_control) &&
1337 !ieee80211_has_pm(hdr->frame_control)) 1344 !ieee80211_has_pm(hdr->frame_control))
1338 ap_sta_ps_end(sta); 1345 sta_ps_end(sta);
1339 } else { 1346 } else {
1340 if (ieee80211_has_pm(hdr->frame_control)) 1347 if (ieee80211_has_pm(hdr->frame_control))
1341 ap_sta_ps_start(sta); 1348 sta_ps_start(sta);
1342 } 1349 }
1343 } 1350 }
1344 1351