aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-01-20 07:55:22 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:48:25 -0500
commita4ec45a421b80bc36fd37578accf081f32527a7f (patch)
tree2eed7b4fbdece2358be059773b010b6acc3806b0 /net/mac80211
parentf09603a259ffef69ad4516a04eb06cd65ac522fe (diff)
mac80211: implement sta_add/sta_remove in sta_state
Instead of maintaining separate sta_add/sta_remove callsites, implement it in sta_state when the driver has no sta_state implementation. The only behavioural change this should cause is in secure mesh mode: with this the station entries will only be created after the stations are set to AUTH. Given which drivers support mesh, this seems to not be a problem. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/driver-ops.h11
-rw-r--r--net/mac80211/pm.c2
-rw-r--r--net/mac80211/sta_info.c23
-rw-r--r--net/mac80211/util.c2
4 files changed, 19 insertions, 19 deletions
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 4bd266ec533..70dfb6415c2 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -493,9 +493,18 @@ int drv_sta_state(struct ieee80211_local *local,
493 check_sdata_in_driver(sdata); 493 check_sdata_in_driver(sdata);
494 494
495 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state); 495 trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state);
496 if (local->ops->sta_state) 496 if (local->ops->sta_state) {
497 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta, 497 ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta,
498 old_state, new_state); 498 old_state, new_state);
499 } else if (old_state == IEEE80211_STA_AUTH &&
500 new_state == IEEE80211_STA_ASSOC) {
501 ret = drv_sta_add(local, sdata, &sta->sta);
502 if (ret == 0)
503 sta->uploaded = true;
504 } else if (old_state == IEEE80211_STA_ASSOC &&
505 new_state == IEEE80211_STA_AUTH) {
506 drv_sta_remove(local, sdata, &sta->sta);
507 }
499 trace_drv_return_int(local, ret); 508 trace_drv_return_int(local, ret);
500 return ret; 509 return ret;
501} 510}
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index af49ac4f082..2b53a5348ac 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -100,8 +100,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
100 if (sta->uploaded) { 100 if (sta->uploaded) {
101 enum ieee80211_sta_state state; 101 enum ieee80211_sta_state state;
102 102
103 drv_sta_remove(local, sta->sdata, &sta->sta);
104
105 state = sta->sta_state; 103 state = sta->sta_state;
106 for (; state > IEEE80211_STA_NOTEXIST; state--) 104 for (; state > IEEE80211_STA_NOTEXIST; state--)
107 WARN_ON(drv_sta_state(local, sdata, sta, 105 WARN_ON(drv_sta_state(local, sdata, sta,
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index fcd9027c669..5e577bd0e6a 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -365,7 +365,12 @@ static int sta_info_insert_drv_state(struct ieee80211_local *local,
365 } 365 }
366 366
367 if (!err) { 367 if (!err) {
368 sta->uploaded = true; 368 /*
369 * Drivers using legacy sta_add/sta_remove callbacks only
370 * get uploaded set to true after sta_add is called.
371 */
372 if (!local->ops->sta_add)
373 sta->uploaded = true;
369 return 0; 374 return 0;
370 } 375 }
371 376
@@ -417,18 +422,9 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
417 422
418 if (!sta->dummy || dummy_reinsert) { 423 if (!sta->dummy || dummy_reinsert) {
419 /* notify driver */ 424 /* notify driver */
420 err = drv_sta_add(local, sdata, &sta->sta); 425 err = sta_info_insert_drv_state(local, sdata, sta);
421 if (err) { 426 if (err)
422 if (sdata->vif.type != NL80211_IFTYPE_ADHOC) 427 goto out_err;
423 goto out_err;
424 printk(KERN_DEBUG "%s: failed to add IBSS STA %pM to "
425 "driver (%d) - keeping it anyway.\n",
426 sdata->name, sta->sta.addr, err);
427 } else {
428 err = sta_info_insert_drv_state(local, sdata, sta);
429 if (err)
430 goto out_err;
431 }
432 } 428 }
433 429
434 if (!dummy_reinsert) { 430 if (!dummy_reinsert) {
@@ -802,7 +798,6 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
802 } 798 }
803 799
804 if (sta->uploaded) { 800 if (sta->uploaded) {
805 drv_sta_remove(local, sdata, &sta->sta);
806 ret = drv_sta_state(local, sdata, sta, IEEE80211_STA_NONE, 801 ret = drv_sta_state(local, sdata, sta, IEEE80211_STA_NONE,
807 IEEE80211_STA_NOTEXIST); 802 IEEE80211_STA_NOTEXIST);
808 WARN_ON_ONCE(ret != 0); 803 WARN_ON_ONCE(ret != 0);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 8f8b4ecc776..264397aee81 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1187,8 +1187,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
1187 if (sta->uploaded) { 1187 if (sta->uploaded) {
1188 enum ieee80211_sta_state state; 1188 enum ieee80211_sta_state state;
1189 1189
1190 WARN_ON(drv_sta_add(local, sta->sdata, &sta->sta));
1191
1192 for (state = IEEE80211_STA_NOTEXIST; 1190 for (state = IEEE80211_STA_NOTEXIST;
1193 state < sta->sta_state - 1; state++) 1191 state < sta->sta_state - 1; state++)
1194 WARN_ON(drv_sta_state(local, sta->sdata, sta, 1192 WARN_ON(drv_sta_state(local, sta->sdata, sta,