diff options
Diffstat (limited to 'net/mac80211/ht.c')
-rw-r--r-- | net/mac80211/ht.c | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 529bf58bc145..9a8be8f69224 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -448,14 +448,25 @@ int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, | |||
448 | return 0; | 448 | return 0; |
449 | } | 449 | } |
450 | 450 | ||
451 | void ieee80211_request_smps_work(struct work_struct *work) | 451 | void ieee80211_request_smps_mgd_work(struct work_struct *work) |
452 | { | 452 | { |
453 | struct ieee80211_sub_if_data *sdata = | 453 | struct ieee80211_sub_if_data *sdata = |
454 | container_of(work, struct ieee80211_sub_if_data, | 454 | container_of(work, struct ieee80211_sub_if_data, |
455 | u.mgd.request_smps_work); | 455 | u.mgd.request_smps_work); |
456 | 456 | ||
457 | sdata_lock(sdata); | 457 | sdata_lock(sdata); |
458 | __ieee80211_request_smps(sdata, sdata->u.mgd.driver_smps_mode); | 458 | __ieee80211_request_smps_mgd(sdata, sdata->u.mgd.driver_smps_mode); |
459 | sdata_unlock(sdata); | ||
460 | } | ||
461 | |||
462 | void ieee80211_request_smps_ap_work(struct work_struct *work) | ||
463 | { | ||
464 | struct ieee80211_sub_if_data *sdata = | ||
465 | container_of(work, struct ieee80211_sub_if_data, | ||
466 | u.ap.request_smps_work); | ||
467 | |||
468 | sdata_lock(sdata); | ||
469 | __ieee80211_request_smps_ap(sdata, sdata->u.ap.driver_smps_mode); | ||
459 | sdata_unlock(sdata); | 470 | sdata_unlock(sdata); |
460 | } | 471 | } |
461 | 472 | ||
@@ -464,19 +475,29 @@ void ieee80211_request_smps(struct ieee80211_vif *vif, | |||
464 | { | 475 | { |
465 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | 476 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
466 | 477 | ||
467 | if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) | 478 | if (WARN_ON_ONCE(vif->type != NL80211_IFTYPE_STATION && |
479 | vif->type != NL80211_IFTYPE_AP)) | ||
468 | return; | 480 | return; |
469 | 481 | ||
470 | if (WARN_ON(smps_mode == IEEE80211_SMPS_OFF)) | 482 | if (WARN_ON(smps_mode == IEEE80211_SMPS_OFF)) |
471 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 483 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
472 | 484 | ||
473 | if (sdata->u.mgd.driver_smps_mode == smps_mode) | 485 | if (vif->type == NL80211_IFTYPE_STATION) { |
474 | return; | 486 | if (sdata->u.mgd.driver_smps_mode == smps_mode) |
475 | 487 | return; | |
476 | sdata->u.mgd.driver_smps_mode = smps_mode; | 488 | sdata->u.mgd.driver_smps_mode = smps_mode; |
477 | 489 | ieee80211_queue_work(&sdata->local->hw, | |
478 | ieee80211_queue_work(&sdata->local->hw, | 490 | &sdata->u.mgd.request_smps_work); |
479 | &sdata->u.mgd.request_smps_work); | 491 | } else { |
492 | /* AUTOMATIC is meaningless in AP mode */ | ||
493 | if (WARN_ON_ONCE(smps_mode == IEEE80211_SMPS_AUTOMATIC)) | ||
494 | return; | ||
495 | if (sdata->u.ap.driver_smps_mode == smps_mode) | ||
496 | return; | ||
497 | sdata->u.ap.driver_smps_mode = smps_mode; | ||
498 | ieee80211_queue_work(&sdata->local->hw, | ||
499 | &sdata->u.ap.request_smps_work); | ||
500 | } | ||
480 | } | 501 | } |
481 | /* this might change ... don't want non-open drivers using it */ | 502 | /* this might change ... don't want non-open drivers using it */ |
482 | EXPORT_SYMBOL_GPL(ieee80211_request_smps); | 503 | EXPORT_SYMBOL_GPL(ieee80211_request_smps); |