Skip to content

Commit 4a733ef

Browse files
committed
mac80211: remove PM-QoS listener
As this API has never really seen any use and most drivers don't ever use the value derived from it, remove it. Change the only driver using it (rt2x00) to simply use the DTIM period instead of the "max sleep" time. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 61f6bba commit 4a733ef

File tree

10 files changed

+21
-87
lines changed

10 files changed

+21
-87
lines changed

drivers/net/wireless/rt2x00/rt2x00config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
266266
if (beacon_diff > beacon_int)
267267
beacon_diff = 0;
268268

269-
autowake_timeout = (conf->max_sleep_period * beacon_int) - beacon_diff;
269+
autowake_timeout = (conf->ps_dtim_period * beacon_int) - beacon_diff;
270270
queue_delayed_work(rt2x00dev->workqueue,
271271
&rt2x00dev->autowakeup_work,
272272
autowake_timeout - 15);

include/net/mac80211.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,11 +1241,6 @@ enum ieee80211_smps_mode {
12411241
* @flags: configuration flags defined above
12421242
*
12431243
* @listen_interval: listen interval in units of beacon interval
1244-
* @max_sleep_period: the maximum number of beacon intervals to sleep for
1245-
* before checking the beacon for a TIM bit (managed mode only); this
1246-
* value will be only achievable between DTIM frames, the hardware
1247-
* needs to check for the multicast traffic bit in DTIM beacons.
1248-
* This variable is valid only when the CONF_PS flag is set.
12491244
* @ps_dtim_period: The DTIM period of the AP we're connected to, for use
12501245
* in power saving. Power saving will not be enabled until a beacon
12511246
* has been received and the DTIM period is known.
@@ -1275,7 +1270,6 @@ enum ieee80211_smps_mode {
12751270
struct ieee80211_conf {
12761271
u32 flags;
12771272
int power_level, dynamic_ps_timeout;
1278-
int max_sleep_period;
12791273

12801274
u16 listen_interval;
12811275
u8 ps_dtim_period;

net/mac80211/cfg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
14281428

14291429
if (sdata->vif.type == NL80211_IFTYPE_STATION &&
14301430
params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
1431-
ieee80211_recalc_ps(local, -1);
1431+
ieee80211_recalc_ps(local);
14321432
ieee80211_recalc_ps_vif(sdata);
14331433
}
14341434

@@ -2463,7 +2463,7 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
24632463
if (ieee80211_hw_check(&local->hw, SUPPORTS_DYNAMIC_PS))
24642464
ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
24652465

2466-
ieee80211_recalc_ps(local, -1);
2466+
ieee80211_recalc_ps(local);
24672467
ieee80211_recalc_ps_vif(sdata);
24682468

24692469
return 0;

net/mac80211/ieee80211_i.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,6 @@ struct ieee80211_local {
13051305
struct work_struct dynamic_ps_enable_work;
13061306
struct work_struct dynamic_ps_disable_work;
13071307
struct timer_list dynamic_ps_timer;
1308-
struct notifier_block network_latency_notifier;
13091308
struct notifier_block ifa_notifier;
13101309
struct notifier_block ifa6_notifier;
13111310

@@ -1491,10 +1490,8 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
14911490
struct cfg80211_disassoc_request *req);
14921491
void ieee80211_send_pspoll(struct ieee80211_local *local,
14931492
struct ieee80211_sub_if_data *sdata);
1494-
void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
1493+
void ieee80211_recalc_ps(struct ieee80211_local *local);
14951494
void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
1496-
int ieee80211_max_network_latency(struct notifier_block *nb,
1497-
unsigned long data, void *dummy);
14981495
int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
14991496
void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
15001497
void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,

net/mac80211/iface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
709709
if (hw_reconf_flags)
710710
ieee80211_hw_config(local, hw_reconf_flags);
711711

712-
ieee80211_recalc_ps(local, -1);
712+
ieee80211_recalc_ps(local);
713713

714714
if (sdata->vif.type == NL80211_IFTYPE_MONITOR ||
715715
sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
@@ -1016,7 +1016,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
10161016
drv_remove_interface(local, sdata);
10171017
}
10181018

1019-
ieee80211_recalc_ps(local, -1);
1019+
ieee80211_recalc_ps(local);
10201020

10211021
if (cancel_scan)
10221022
flush_delayed_work(&local->scan_work);

net/mac80211/main.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <linux/if_arp.h>
2121
#include <linux/rtnetlink.h>
2222
#include <linux/bitmap.h>
23-
#include <linux/pm_qos.h>
2423
#include <linux/inetdevice.h>
2524
#include <net/net_namespace.h>
2625
#include <net/cfg80211.h>
@@ -1083,13 +1082,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
10831082

10841083
rtnl_unlock();
10851084

1086-
local->network_latency_notifier.notifier_call =
1087-
ieee80211_max_network_latency;
1088-
result = pm_qos_add_notifier(PM_QOS_NETWORK_LATENCY,
1089-
&local->network_latency_notifier);
1090-
if (result)
1091-
goto fail_pm_qos;
1092-
10931085
#ifdef CONFIG_INET
10941086
local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
10951087
result = register_inetaddr_notifier(&local->ifa_notifier);
@@ -1114,10 +1106,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
11141106
#endif
11151107
#if defined(CONFIG_INET) || defined(CONFIG_IPV6)
11161108
fail_ifa:
1117-
pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
1118-
&local->network_latency_notifier);
11191109
#endif
1120-
fail_pm_qos:
11211110
rtnl_lock();
11221111
rate_control_deinitialize(local);
11231112
ieee80211_remove_interfaces(local);
@@ -1143,8 +1132,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
11431132
tasklet_kill(&local->tx_pending_tasklet);
11441133
tasklet_kill(&local->tasklet);
11451134

1146-
pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
1147-
&local->network_latency_notifier);
11481135
#ifdef CONFIG_INET
11491136
unregister_inetaddr_notifier(&local->ifa_notifier);
11501137
#endif

net/mac80211/mlme.c

Lines changed: 14 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <linux/etherdevice.h>
2121
#include <linux/moduleparam.h>
2222
#include <linux/rtnetlink.h>
23-
#include <linux/pm_qos.h>
2423
#include <linux/crc32.h>
2524
#include <linux/slab.h>
2625
#include <linux/export.h>
@@ -1476,7 +1475,7 @@ static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata)
14761475
}
14771476

14781477
/* need to hold RTNL or interface lock */
1479-
void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
1478+
void ieee80211_recalc_ps(struct ieee80211_local *local)
14801479
{
14811480
struct ieee80211_sub_if_data *sdata, *found = NULL;
14821481
int count = 0;
@@ -1505,48 +1504,23 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
15051504
}
15061505

15071506
if (count == 1 && ieee80211_powersave_allowed(found)) {
1507+
u8 dtimper = found->u.mgd.dtim_period;
15081508
s32 beaconint_us;
15091509

1510-
if (latency < 0)
1511-
latency = pm_qos_request(PM_QOS_NETWORK_LATENCY);
1512-
15131510
beaconint_us = ieee80211_tu_to_usec(
15141511
found->vif.bss_conf.beacon_int);
15151512

15161513
timeout = local->dynamic_ps_forced_timeout;
1517-
if (timeout < 0) {
1518-
/*
1519-
* Go to full PSM if the user configures a very low
1520-
* latency requirement.
1521-
* The 2000 second value is there for compatibility
1522-
* until the PM_QOS_NETWORK_LATENCY is configured
1523-
* with real values.
1524-
*/
1525-
if (latency > (1900 * USEC_PER_MSEC) &&
1526-
latency != (2000 * USEC_PER_SEC))
1527-
timeout = 0;
1528-
else
1529-
timeout = 100;
1530-
}
1514+
if (timeout < 0)
1515+
timeout = 100;
15311516
local->hw.conf.dynamic_ps_timeout = timeout;
15321517

1533-
if (beaconint_us > latency) {
1534-
local->ps_sdata = NULL;
1535-
} else {
1536-
int maxslp = 1;
1537-
u8 dtimper = found->u.mgd.dtim_period;
1538-
1539-
/* If the TIM IE is invalid, pretend the value is 1 */
1540-
if (!dtimper)
1541-
dtimper = 1;
1542-
else if (dtimper > 1)
1543-
maxslp = min_t(int, dtimper,
1544-
latency / beaconint_us);
1545-
1546-
local->hw.conf.max_sleep_period = maxslp;
1547-
local->hw.conf.ps_dtim_period = dtimper;
1548-
local->ps_sdata = found;
1549-
}
1518+
/* If the TIM IE is invalid, pretend the value is 1 */
1519+
if (!dtimper)
1520+
dtimper = 1;
1521+
1522+
local->hw.conf.ps_dtim_period = dtimper;
1523+
local->ps_sdata = found;
15501524
} else {
15511525
local->ps_sdata = NULL;
15521526
}
@@ -1997,7 +1971,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
19971971
ieee80211_bss_info_change_notify(sdata, bss_info_changed);
19981972

19991973
mutex_lock(&local->iflist_mtx);
2000-
ieee80211_recalc_ps(local, -1);
1974+
ieee80211_recalc_ps(local);
20011975
mutex_unlock(&local->iflist_mtx);
20021976

20031977
ieee80211_recalc_smps(sdata);
@@ -2165,7 +2139,7 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
21652139
__ieee80211_stop_poll(sdata);
21662140

21672141
mutex_lock(&local->iflist_mtx);
2168-
ieee80211_recalc_ps(local, -1);
2142+
ieee80211_recalc_ps(local);
21692143
mutex_unlock(&local->iflist_mtx);
21702144

21712145
if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
@@ -2341,7 +2315,7 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
23412315
goto out;
23422316

23432317
mutex_lock(&sdata->local->iflist_mtx);
2344-
ieee80211_recalc_ps(sdata->local, -1);
2318+
ieee80211_recalc_ps(sdata->local);
23452319
mutex_unlock(&sdata->local->iflist_mtx);
23462320

23472321
ifmgd->probe_send_count = 0;
@@ -3548,7 +3522,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
35483522
ifmgd->have_beacon = true;
35493523

35503524
mutex_lock(&local->iflist_mtx);
3551-
ieee80211_recalc_ps(local, -1);
3525+
ieee80211_recalc_ps(local);
35523526
mutex_unlock(&local->iflist_mtx);
35533527

35543528
ieee80211_recalc_ps_vif(sdata);
@@ -4152,21 +4126,6 @@ void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local)
41524126
rcu_read_unlock();
41534127
}
41544128

4155-
int ieee80211_max_network_latency(struct notifier_block *nb,
4156-
unsigned long data, void *dummy)
4157-
{
4158-
s32 latency_usec = (s32) data;
4159-
struct ieee80211_local *local =
4160-
container_of(nb, struct ieee80211_local,
4161-
network_latency_notifier);
4162-
4163-
mutex_lock(&local->iflist_mtx);
4164-
ieee80211_recalc_ps(local, latency_usec);
4165-
mutex_unlock(&local->iflist_mtx);
4166-
4167-
return NOTIFY_OK;
4168-
}
4169-
41704129
static u8 ieee80211_ht_vht_rx_chains(struct ieee80211_sub_if_data *sdata,
41714130
struct cfg80211_bss *cbss)
41724131
{

net/mac80211/scan.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/if_arp.h>
1717
#include <linux/etherdevice.h>
1818
#include <linux/rtnetlink.h>
19-
#include <linux/pm_qos.h>
2019
#include <net/sch_generic.h>
2120
#include <linux/slab.h>
2221
#include <linux/export.h>

net/mac80211/trace.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ TRACE_EVENT(drv_config,
325325
__field(u32, flags)
326326
__field(int, power_level)
327327
__field(int, dynamic_ps_timeout)
328-
__field(int, max_sleep_period)
329328
__field(u16, listen_interval)
330329
__field(u8, long_frame_max_tx_count)
331330
__field(u8, short_frame_max_tx_count)
@@ -339,7 +338,6 @@ TRACE_EVENT(drv_config,
339338
__entry->flags = local->hw.conf.flags;
340339
__entry->power_level = local->hw.conf.power_level;
341340
__entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout;
342-
__entry->max_sleep_period = local->hw.conf.max_sleep_period;
343341
__entry->listen_interval = local->hw.conf.listen_interval;
344342
__entry->long_frame_max_tx_count =
345343
local->hw.conf.long_frame_max_tx_count;

net/mac80211/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
19511951
}
19521952
}
19531953

1954-
ieee80211_recalc_ps(local, -1);
1954+
ieee80211_recalc_ps(local);
19551955

19561956
/*
19571957
* The sta might be in psm against the ap (e.g. because

0 commit comments

Comments
 (0)