Skip to contentSkip to conversation

mac80211 powersave work

PATCH In review Johannes Berg 5 participants 17 messages Apr 16, 2009 – Apr 21, 2009

Subsystems (3)
lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

cover mac80211 powersave work

This is pretty much unchanged from my previous v2 RFCs, except that I added a default of 500ms for the dynamic powersave timer.

The fourth patch is new, it adds beacon filtering to mac80211 -- for the reasons explained in that patch.

For 2.6.31, we should make MAC80211_DEFAULT_PS default off instead. John, how do you want to handle that?

johannes

author maintainer
#1 lore raw

PATCH 1/4 mac80211: improve powersave implementation

When you have multiple virtual interfaces the current implementation requires setting them up properly from userspace, which is undesirable when we want to default to power save mode. Keep track of powersave requested from userspace per managed mode interface, and only enable powersave globally when exactly one managed mode interface is active and has powersave turned on.

Second, only start the dynPS timer when PS is turned on, and properly turn it off when PS is turned off.

Third, fix the scan_sdata abuse in the dynps code.

Finally, also reorder the code and refactor the code that enables PS or the dynps timer instead of having it copied in two places.

---
v2: * don't disable PS when adding monitor interfaces
* fix scan_sdata use for powersave timer bug by keeping track of which interface is _the_ managed interface (can only be one)

 net/mac80211/ieee80211_i.h |    9 +
 net/mac80211/iface.c       |    4 
 net/mac80211/mlme.c        |  228 ++++++++++++++++++++++++++++-----------------
 net/mac80211/scan.c        |    2 
 net/mac80211/wext.c        |   43 +-------
 5 files changed, 165 insertions(+), 121 deletions(-)
net/mac80211/ieee80211_i.h +8 -1
@@ -295,6 +295,8 @@ struct ieee80211_if_managed {
 	int auth_tries; /* retries for auth req */
 	int assoc_tries; /* retries for assoc req */
 
+	bool powersave; /* powersave requested for this iface */
+
 	unsigned long request;
 
 	unsigned long last_probe;
@@ -739,8 +741,12 @@ struct ieee80211_local {
 	int wifi_wme_noack_test;
 	unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
 
-	bool powersave;
 	bool pspolling;
+	/*
+	 * PS can only be enabled when we have exactly one managed
+	 * interface (and monitors) in PS, this then points there.
+	 */
+	struct ieee80211_sub_if_data *ps_sdata;
 	struct work_struct dynamic_ps_enable_work;
 	struct work_struct dynamic_ps_disable_work;
 	struct timer_list dynamic_ps_timer;
@@ -932,6 +938,7 @@ int ieee80211_sta_deauthenticate(struct 
 int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason);
 void ieee80211_send_pspoll(struct ieee80211_local *local,
 			   struct ieee80211_sub_if_data *sdata);
+void ieee80211_recalc_ps(struct ieee80211_local *local);
 
 /* IBSS code */
 int ieee80211_ibss_commit(struct ieee80211_sub_if_data *sdata);
net/mac80211/iface.c +4 -0
@@ -317,6 +317,8 @@ static int ieee80211_open(struct net_dev
 		ieee80211_set_wmm_default(sdata);
 	}
 
+	ieee80211_recalc_ps(local);
+
 	/*
 	 * ieee80211_sta_work is disabled while network interface
 	 * is down. Therefore, some configuration changes may not
@@ -572,6 +574,8 @@ static int ieee80211_stop(struct net_dev
 		hw_reconf_flags = 0;
 	}
 
+	ieee80211_recalc_ps(local);
+
 	/* do after stop to avoid reconfiguring when we stop anyway */
 	if (hw_reconf_flags)
 		ieee80211_hw_config(local, hw_reconf_flags);
net/mac80211/wext.c +10 -33

68 lines not on this page · raw message

net/mac80211/mlme.c +142 -86

243 lines not on this page · raw message

net/mac80211/scan.c +1 -1
@@ -253,7 +253,7 @@ static void ieee80211_scan_ps_disable(st
 {
 	struct ieee80211_local *local = sdata->local;
 
-	if (!local->powersave)
+	if (!local->ps_sdata)
 		ieee80211_send_nullfunc(local, sdata, 0);
 	else {
 		/*
author maintainer
#2 lore raw

PATCH 2/4 mac80211: disable powersave if pm_qos asks for low latency

In reply to Johannes Berg

When an application asks for a latency lower than the beacon interval there's nothing we can do -- we need to stay awake and not have the AP buffer frames for us. Add code to automatically calculate this constraint in mac80211 so drivers need not concern themselves with it.

---
v2: rebased

 include/linux/ieee80211.h  |    9 +++++++++
 net/mac80211/ieee80211_i.h |    5 ++++-
 net/mac80211/iface.c       |    4 ++--
 net/mac80211/main.c        |   31 ++++++++++++++++++++++++-------
 net/mac80211/mlme.c        |   36 ++++++++++++++++++++++++++++++++----
 net/mac80211/wext.c        |    2 +-
 6 files changed, 72 insertions(+), 15 deletions(-)
net/mac80211/mlme.c +32 -4
@@ -17,6 +17,7 @@
 #include <linux/if_arp.h>
 #include <linux/etherdevice.h>
 #include <linux/rtnetlink.h>
+#include <linux/pm_qos_params.h>
 #include <net/mac80211.h>
 #include <asm/unaligned.h>
 
@@ -515,7 +516,7 @@ static void ieee80211_change_ps(struct i
 }
 
 /* need to hold RTNL or interface lock */
-void ieee80211_recalc_ps(struct ieee80211_local *local)
+void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
 {
 	struct ieee80211_sub_if_data *sdata, *found = NULL;
 	int count = 0;
@@ -534,10 +535,22 @@ void ieee80211_recalc_ps(struct ieee8021
 		count++;
 	}
 
-	if (count == 1 && found->u.mgd.powersave)
-		local->ps_sdata = found;
-	else
+	if (count == 1 && found->u.mgd.powersave) {
+		s32 beaconint_us;
+
+		if (latency < 0)
+			latency = pm_qos_requirement(PM_QOS_NETWORK_LATENCY);
+
+		beaconint_us = ieee80211_tu_to_usec(
+					found->vif.bss_conf.beacon_int);
+
+		if (beaconint_us > latency)
+			local->ps_sdata = NULL;
+		else
+			local->ps_sdata = found;
+	} else {
 		local->ps_sdata = NULL;
+	}
 
 	ieee80211_change_ps(local);
 }
@@ -2313,3 +2326,18 @@ void ieee80211_mlme_notify_scan_complete
 		ieee80211_restart_sta_timer(sdata);
 	rcu_read_unlock();
 }
+
+int ieee80211_max_network_latency(struct notifier_block *nb,
+				  unsigned long data, void *dummy)
+{
+	s32 latency_usec = (s32) data;
+	struct ieee80211_local *local =
+		container_of(nb, struct ieee80211_local,
+			     network_latency_notifier);
+
+	mutex_lock(&local->iflist_mtx);
+	ieee80211_recalc_ps(local, latency_usec);
+	mutex_unlock(&local->iflist_mtx);
+
+	return 0;
+}
net/mac80211/ieee80211_i.h +4 -1
@@ -750,6 +750,7 @@ struct ieee80211_local {
 	struct work_struct dynamic_ps_enable_work;
 	struct work_struct dynamic_ps_disable_work;
 	struct timer_list dynamic_ps_timer;
+	struct notifier_block network_latency_notifier;
 
 	int user_power_level; /* in dBm */
 	int power_constr_level; /* in dBm */
@@ -938,7 +939,9 @@ int ieee80211_sta_deauthenticate(struct 
 int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason);
 void ieee80211_send_pspoll(struct ieee80211_local *local,
 			   struct ieee80211_sub_if_data *sdata);
-void ieee80211_recalc_ps(struct ieee80211_local *local);
+void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency);
+int ieee80211_max_network_latency(struct notifier_block *nb,
+				  unsigned long data, void *dummy);
 
 /* IBSS code */
 int ieee80211_ibss_commit(struct ieee80211_sub_if_data *sdata);
net/mac80211/main.c +24 -7
@@ -21,6 +21,7 @@
 #include <linux/wireless.h>
 #include <linux/rtnetlink.h>
 #include <linux/bitmap.h>
+#include <linux/pm_qos_params.h>
 #include <net/net_namespace.h>
 #include <net/cfg80211.h>
 
@@ -1038,25 +1039,38 @@ int ieee80211_register_hw(struct ieee802
 		}
 	}
 
+	local->network_latency_notifier.notifier_call =
+		ieee80211_max_network_latency;
+	result = pm_qos_add_notifier(PM_QOS_NETWORK_LATENCY,
+				     &local->network_latency_notifier);
+
+	if (result) {
+		rtnl_lock();
+		goto fail_pm_qos;
+	}
+
 	return 0;
 
-fail_wep:
+ fail_pm_qos:
+	ieee80211_led_exit(local);
+	ieee80211_remove_interfaces(local);
+ fail_wep:
 	rate_control_deinitialize(local);
-fail_rate:
+ fail_rate:
 	unregister_netdevice(local->mdev);
 	local->mdev = NULL;
-fail_dev:
+ fail_dev:
 	rtnl_unlock();
 	sta_info_stop(local);
-fail_sta_info:
+ fail_sta_info:
 	debugfs_hw_del(local);
 	destroy_workqueue(local->hw.workqueue);
-fail_workqueue:
+ fail_workqueue:
 	if (local->mdev)
 		free_netdev(local->mdev);
-fail_mdev_alloc:
+ fail_mdev_alloc:
 	wiphy_unregister(local->hw.wiphy);
-fail_wiphy_register:
+ fail_wiphy_register:
 	kfree(local->int_scan_req.channels);
 	return result;
 }
@@ -1069,6 +1083,9 @@ void ieee80211_unregister_hw(struct ieee
 	tasklet_kill(&local->tx_pending_tasklet);
 	tasklet_kill(&local->tasklet);
 
+	pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
+			       &local->network_latency_notifier);
+
 	rtnl_lock();
 
 	/*
net/mac80211/iface.c +2 -2
@@ -317,7 +317,7 @@ static int ieee80211_open(struct net_dev
 		ieee80211_set_wmm_default(sdata);
 	}
 
-	ieee80211_recalc_ps(local);
+	ieee80211_recalc_ps(local, -1);
 
 	/*
 	 * ieee80211_sta_work is disabled while network interface
@@ -574,7 +574,7 @@ static int ieee80211_stop(struct net_dev
 		hw_reconf_flags = 0;
 	}
 
-	ieee80211_recalc_ps(local);
+	ieee80211_recalc_ps(local, -1);
 
 	/* do after stop to avoid reconfiguring when we stop anyway */
 	if (hw_reconf_flags)
net/mac80211/wext.c +1 -1
@@ -789,7 +789,7 @@ static int ieee80211_ioctl_siwpower(stru
 		ieee80211_hw_config(local,
 				    IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT);
 
-	ieee80211_recalc_ps(local);
+	ieee80211_recalc_ps(local, -1);
 
 	return 0;
 }
include/linux/ieee80211.h +9 -0
@@ -1383,4 +1383,13 @@ static inline int ieee80211_freq_to_ofdm
 		return -1;
 }
 
+/**
+ * ieee80211_tu_to_usec - convert time units (TU) to microseconds
+ * @tu: the TUs
+ */
+static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
+{
+	return 1024 * tu;
+}
+
 #endif /* LINUX_IEEE80211_H */
author maintainer
#3 lore raw

PATCH 3/4 mac80211: implement beacon filtering in software

In reply to Johannes Berg

Regardless of whether the hardware implements beacon filtering, there's no need to process all beacons in software all the time throughout the stack (mac80211 does a lot, then cfg80211, then in the future possibly userspace).

This patch implements the "best possible" beacon filtering in mac80211. "Best possible" means that it can look for changes in all requested information elements, and distinguish vendor IEs by their OUI.

In the future, we will add nl80211 API for userspace to request information elements and vendor IE OUIs to watch -- drivers can then implement the best they can do while software implements it fully.

It is unclear whether or not this actually saves CPU time, but the data is all in the cache already so it should be fairly cheap. The additional _testing_, however, has great benefit; Without this, and on hardware that doesn't implement beacon filtering, wrong assumptions about, for example, scan result updates could quickly creep into code.

---
 net/mac80211/ieee80211_i.h |    5 ++++
 net/mac80211/mlme.c        |   52 ++++++++++++++++++++++++++++++++++-----------
 net/mac80211/util.c        |   23 ++++++++++++++++++-
 3 files changed, 66 insertions(+), 14 deletions(-)
net/mac80211/ieee80211_i.h +5 -0
@@ -308,6 +308,8 @@ struct ieee80211_if_managed {
 	int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
 	int auth_transaction;
 
+	u32 beacon_crc;
+
 	enum {
 		IEEE80211_MFP_DISABLED,
 		IEEE80211_MFP_OPTIONAL,
@@ -1085,6 +1087,9 @@ void ieee80211_tx_skb(struct ieee80211_s
 		      int encrypt);
 void ieee802_11_parse_elems(u8 *start, size_t len,
 			    struct ieee802_11_elems *elems);
+u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
+			       struct ieee802_11_elems *elems,
+			       u64 filter, u32 crc);
 int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq);
 u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
 			      enum ieee80211_band band);
net/mac80211/mlme.c +40 -12

92 lines not on this page · raw message

net/mac80211/util.c +21 -2
@@ -20,6 +20,7 @@
 #include <linux/if_arp.h>
 #include <linux/wireless.h>
 #include <linux/bitmap.h>
+#include <linux/crc32.h>
 #include <net/net_namespace.h>
 #include <net/cfg80211.h>
 #include <net/rtnetlink.h>
@@ -537,8 +538,16 @@ EXPORT_SYMBOL_GPL(ieee80211_iterate_acti
 void ieee802_11_parse_elems(u8 *start, size_t len,
 			    struct ieee802_11_elems *elems)
 {
+	ieee802_11_parse_elems_crc(start, len, elems, 0, 0);
+}
+
+u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
+			       struct ieee802_11_elems *elems,
+			       u64 filter, u32 crc)
+{
 	size_t left = len;
 	u8 *pos = start;
+	bool calc_crc = filter != 0;
 
 	memset(elems, 0, sizeof(*elems));
 	elems->ie_start = start;
@@ -552,7 +561,10 @@ void ieee802_11_parse_elems(u8 *start, s
 		left -= 2;
 
 		if (elen > left)
-			return;
+			break;
+
+		if (calc_crc && id < 64 && (filter & BIT(id)))
+			crc = crc32_be(crc, pos - 2, elen + 2);
 
 		switch (id) {
 		case WLAN_EID_SSID:
@@ -587,15 +599,20 @@ void ieee802_11_parse_elems(u8 *start, s
 			elems->challenge = pos;
 			elems->challenge_len = elen;
 			break;
-		case WLAN_EID_WPA:
+		case WLAN_EID_VENDOR_SPECIFIC:
 			if (elen >= 4 && pos[0] == 0x00 && pos[1] == 0x50 &&
 			    pos[2] == 0xf2) {
 				/* Microsoft OUI (00:50:F2) */
+
+				if (calc_crc)
+					crc = crc32_be(crc, pos - 2, elen + 2);
+
 				if (pos[3] == 1) {
 					/* OUI Type 1 - WPA IE */
 					elems->wpa = pos;
 					elems->wpa_len = elen;
 				} else if (elen >= 5 && pos[3] == 2) {
+					/* OUI Type 2 - WMM IE */
 					if (pos[4] == 0) {
 						elems->wmm_info = pos;
 						elems->wmm_info_len = elen;
@@ -680,6 +697,8 @@ void ieee802_11_parse_elems(u8 *start, s
 		left -= elen;
 		pos += elen;
 	}
+
+	return crc;
 }
 
 void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata)
author maintainer
#4 lore raw

PATCH 4/4 mac80211: enable PS by default

In reply to Johannes Berg

Enable PS by default (depending on Kconfig) -- rely on drivers to control the level using pm_qos. Due to the previous patch we turn off PS when necessary due to latency requirements.

This has a Kconfig symbol so people can, if they really want, configure the default in their kernels. We may want to keep it at "default y" only in wireless-testing for a while.

---
 net/mac80211/Kconfig |   16 ++++++++++++++++
 net/mac80211/mlme.c  |    8 ++++++++
 2 files changed, 24 insertions(+)
net/mac80211/mlme.c +8 -0
@@ -2181,6 +2181,7 @@ static void ieee80211_restart_sta_timer(
 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_if_managed *ifmgd;
+	u32 hw_flags;
 
 	ifmgd = &sdata->u.mgd;
 	INIT_WORK(&ifmgd->work, ieee80211_sta_work);
@@ -2200,6 +2201,13 @@ void ieee80211_sta_setup_sdata(struct ie
 		IEEE80211_STA_AUTO_CHANNEL_SEL;
 	if (sdata->local->hw.queues >= 4)
 		ifmgd->flags |= IEEE80211_STA_WMM_ENABLED;
+
+	hw_flags = sdata->local->hw.flags;
+
+	if (hw_flags & IEEE80211_HW_SUPPORTS_PS) {
+		ifmgd->powersave = CONFIG_MAC80211_DEFAULT_PS_VALUE;
+		local->hw.conf.dynamic_ps_timeout = 500;
+	}
 }
 
 /* configuration hooks */
net/mac80211/Kconfig +16 -0
@@ -11,6 +11,22 @@ config MAC80211
 	  This option enables the hardware independent IEEE 802.11
 	  networking stack.
 
+config MAC80211_DEFAULT_PS
+	bool "enable powersave by default"
+	depends on MAC80211
+	default y
+	help
+	  This option enables powersave mode by default.
+
+	  If this causes your applications to misbehave you should fix your
+	  applications instead -- they need to register their network
+	  latency requirement, see Documentation/power/pm_qos_interface.txt.
+
+config MAC80211_DEFAULT_PS_VALUE
+	int
+	default 1 if MAC80211_DEFAULT_PS
+	default 0
+
 menu "Rate control algorithm selection"
 	depends on MAC80211 != n
 
author maintainer
#5 lore raw

PATCH v2 4/4 mac80211: enable PS by default

Enable PS by default (depending on Kconfig) -- rely on drivers to control the level using pm_qos. Due to the previous patch we turn off PS when necessary due to latency requirements.

This has a Kconfig symbol so people can, if they really want, configure the default in their kernels. We may want to keep it at "default y" only in wireless-testing for a while.

---
v2: oops. forgot to refresh -- compile error

 net/mac80211/Kconfig |   16 ++++++++++++++++
 net/mac80211/mlme.c  |    8 ++++++++
 2 files changed, 24 insertions(+)
net/mac80211/mlme.c +8 -0
@@ -2181,6 +2181,7 @@ static void ieee80211_restart_sta_timer(
 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
 {
 	struct ieee80211_if_managed *ifmgd;
+	u32 hw_flags;
 
 	ifmgd = &sdata->u.mgd;
 	INIT_WORK(&ifmgd->work, ieee80211_sta_work);
@@ -2200,6 +2201,13 @@ void ieee80211_sta_setup_sdata(struct ie
 		IEEE80211_STA_AUTO_CHANNEL_SEL;
 	if (sdata->local->hw.queues >= 4)
 		ifmgd->flags |= IEEE80211_STA_WMM_ENABLED;
+
+	hw_flags = sdata->local->hw.flags;
+
+	if (hw_flags & IEEE80211_HW_SUPPORTS_PS) {
+		ifmgd->powersave = CONFIG_MAC80211_DEFAULT_PS_VALUE;
+		sdata->local->hw.conf.dynamic_ps_timeout = 500;
+	}
 }
 
 /* configuration hooks */
net/mac80211/Kconfig +16 -0
@@ -11,6 +11,22 @@ config MAC80211
 	  This option enables the hardware independent IEEE 802.11
 	  networking stack.
 
+config MAC80211_DEFAULT_PS
+	bool "enable powersave by default"
+	depends on MAC80211
+	default y
+	help
+	  This option enables powersave mode by default.
+
+	  If this causes your applications to misbehave you should fix your
+	  applications instead -- they need to register their network
+	  latency requirement, see Documentation/power/pm_qos_interface.txt.
+
+config MAC80211_DEFAULT_PS_VALUE
+	int
+	default 1 if MAC80211_DEFAULT_PS
+	default 0
+
 menu "Rate control algorithm selection"
 	depends on MAC80211 != n
 
#6 lore raw
In reply to Johannes Berg
Quoted 9 lines · Johannes Berg

This is pretty much unchanged from my previous v2 RFCs, except that I added a default of 500ms for the dynamic powersave timer.

The fourth patch is new, it adds beacon filtering to mac80211 -- for the reasons explained in that patch.

For 2.6.31, we should make MAC80211_DEFAULT_PS default off instead. John, how do you want to handle that?

I'm not sure I understand. Your patch (which would go to 2.6.31) has it turned-on by default. Which way do you want it?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
author maintainer
#7 lore raw
Quoted 5 lines · John W. Linville
Quoted 4 lines · Johannes Berg

This is pretty much unchanged from my previous v2 RFCs, except that I added a default of 500ms for the dynamic powersave timer.

Quoted 8 lines
Quoted 5 lines

The fourth patch is new, it adds beacon filtering to mac80211 -- for the reasons explained in that patch.

For 2.6.31, we should make MAC80211_DEFAULT_PS default off instead. John, how do you want to handle that?

I'm not sure I understand. Your patch (which would go to 2.6.31) has it turned-on by default. Which way do you want it?

I want it turned on by default, at least in wireless-testing; Kalle thinks that we should turn it off for a .31 release.

I would think that since an easy workaround is available ("iwconfig wlan0 power off") and it doesn't affect most hardware yet anyway (only those supporting powersave) we should turn it on by default anyway, since otherwise we won't find any bugs -- but maybe that's just me.

johannes

#8 lore raw

On Mon, Apr 20, 2009 at 21:53, Johannes Berg <[email protected]=

Quoted 14 lines

wrote:

Quoted 12 lines · John W. Linville
Quoted 9 lines · Johannes Berg

This is pretty much unchanged from my previous v2 RFCs, except that I added a default of 500ms for the dynamic powersave timer.

The fourth patch is new, it adds beacon filtering to mac80211 -- for the reasons explained in that patch.

For 2.6.31, we should make MAC80211_DEFAULT_PS default off instead. John, how do you want to handle that?

I'm not sure I understand. =C2=A0Your patch (which would go to 2.6.3=

1)

Quoted 7 lines
Quoted 1 line

has it turned-on by default. =C2=A0Which way do you want it?

I want it turned on by default, at least in wireless-testing; Kalle thinks that we should turn it off for a .31 release.

I would think that since an easy workaround is available ("iwconfig wlan0 power off") and it doesn't affect most hardware yet anyway (onl=

y

Quoted 3 lines

those supporting powersave) we should turn it on by default anyway, since otherwise we won't find any bugs -- but maybe that's just me.

As I've already reported [1][2], ath9k is currently broken when power saving is enabled, at least on AR5418 hardware. So please don't turn it on by default yet.

Thanks,
Davide

[1] http://marc.info/?l=3Dlinux-wireless&m=3D123816406913599&w=3D2
[2] http://marc.info/?l=3Dlinux-wireless&m=3D123999864507104&w=3D2
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#9 lore raw
Quoted 3 lines · Davide Pesavento

As I've already reported [1][2], ath9k is currently broken when power saving is enabled, at least on AR5418 hardware. So please don't turn it on by default yet.

But if that's just a hardware/driver bug shouldn't the driver disable PS for that combination? It seems wrong to disable PS in the stack by default just because one driver has a problem with it, when that driver could just unset the PS support bit.

johannes

#10 lore raw
Quoted 11 lines · Johannes Berg
Quoted 3 lines · Davide Pesavento

As I've already reported [1][2], ath9k is currently broken when power saving is enabled, at least on AR5418 hardware. So please don't turn it on by default yet.

But if that's just a hardware/driver bug shouldn't the driver disable PS for that combination? It seems wrong to disable PS in the stack by default just because one driver has a problem with it, when that driver could just unset the PS support bit.

You're right. It makes perfect sense.
Unfortunately I don't know how to do it... :-(

Regards,
Davide

author maintainer
#11 lore raw
Quoted 4 lines · Davide Pesavento
Quoted 4 lines
Quoted 3 lines

As I've already reported [1][2], ath9k is currently broken when power saving is enabled, at least on AR5418 hardware. So please don't turn it on by default yet.

Quoted 8 lines
Quoted 5 lines

But if that's just a hardware/driver bug shouldn't the driver disable PS for that combination? It seems wrong to disable PS in the stack by default just because one driver has a problem with it, when that driver could just unset the PS support bit.

You're right. It makes perfect sense.
Unfortunately I don't know how to do it... :-(

Something like this.

johannes

drivers/net/wireless/ath/ath9k/main.c +0 -2
@@ -1537,8 +1537,6 @@ void ath_set_hw_capab(struct ath_softc *
 		IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
 		IEEE80211_HW_SIGNAL_DBM |
 		IEEE80211_HW_AMPDU_AGGREGATION |
-		IEEE80211_HW_SUPPORTS_PS |
-		IEEE80211_HW_PS_NULLFUNC_STACK |
 		IEEE80211_HW_SPECTRUM_MGMT;
 
 	if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || modparam_nohwcrypt)
#12 lore raw
In reply to Johannes Berg
Quoted 4 lines · Johannes Berg

But if that's just a hardware/driver bug shouldn't the driver disable PS for that combination? It seems wrong to disable PS in the stack by default just because one driver has a problem with it, when that driver could just unset the PS support bit.

I think that a printk notice message could be useful to state that the powersave management is active (of course with DEBUG on, at least during the first larger-user-base test period).

Fabio

#13 lore raw
In reply to Johannes Berg
Quoted 15 lines · Johannes Berg
Quoted 5 lines · John W. Linville
Quoted 4 lines · Johannes Berg

This is pretty much unchanged from my previous v2 RFCs, except that I added a default of 500ms for the dynamic powersave timer.

Quoted 8 lines
Quoted 5 lines

The fourth patch is new, it adds beacon filtering to mac80211 -- for the reasons explained in that patch.

For 2.6.31, we should make MAC80211_DEFAULT_PS default off instead. John, how do you want to handle that?

I'm not sure I understand. Your patch (which would go to 2.6.31) has it turned-on by default. Which way do you want it?

Quoted 7 lines

I want it turned on by default, at least in wireless-testing; Kalle thinks that we should turn it off for a .31 release.

I would think that since an easy workaround is available ("iwconfig wlan0 power off") and it doesn't affect most hardware yet anyway (only those supporting powersave) we should turn it on by default anyway, since otherwise we won't find any bugs -- but maybe that's just me.

Ah, OK -- let's leave it on for now and if it is a problem we can turn it off in 2.6.31 during/after 2.6.31-rc1.

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#14 lore raw
In reply to Johannes Berg
Quoted 10 lines · Johannes Berg
Quoted 2 lines

I'm not sure I understand. Your patch (which would go to 2.6.31) has it turned-on by default. Which way do you want it?

I want it turned on by default, at least in wireless-testing; Kalle thinks that we should turn it off for a .31 release.

I would think that since an easy workaround is available ("iwconfig wlan0 power off") and it doesn't affect most hardware yet anyway (only those supporting powersave) we should turn it on by default anyway, since otherwise we won't find any bugs -- but maybe that's just me.

Yes, in my opinion the power save should not be enabled by default for the big masses, at least not yet. My understanding is that only few people have tested it and I would like to see more testing first.

But if you (Johannes&John) think it's ready for the prime time, I'm not going to complain :)

Signature · 1 line
Kalle Valo
#15 lore raw
Quoted 13 lines · Kalle Valo
Quoted 10 lines · Johannes Berg
Quoted 2 lines

I'm not sure I understand. Your patch (which would go to 2.6.31) has it turned-on by default. Which way do you want it?

I want it turned on by default, at least in wireless-testing; Kalle thinks that we should turn it off for a .31 release.

I would think that since an easy workaround is available ("iwconfig wlan0 power off") and it doesn't affect most hardware yet anyway (only those supporting powersave) we should turn it on by default anyway, since otherwise we won't find any bugs -- but maybe that's just me.

Quoted 6 lines

Yes, in my opinion the power save should not be enabled by default for the big masses, at least not yet. My understanding is that only few people have tested it and I would like to see more testing first.

But if you (Johannes&John) think it's ready for the prime time, I'm not going to complain :)

Well there is always a trade-off. But by the time 2.6.31 come around the code will have been in wireless-testing, net-next, and linux-next for a reasonably long time. Hopefully we will have good confidence in it by then. If not, then we can disable it by default later.

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#16 lore raw
Quoted 11 lines · John W. Linville
Quoted 6 lines

Yes, in my opinion the power save should not be enabled by default for the big masses, at least not yet. My understanding is that only few people have tested it and I would like to see more testing first.

But if you (Johannes&John) think it's ready for the prime time, I'm not going to complain :)

Well there is always a trade-off. But by the time 2.6.31 come around the code will have been in wireless-testing, net-next, and linux-next for a reasonably long time. Hopefully we will have good confidence in it by then. If not, then we can disable it by default later.

That sounds good. With those three trees there should be quite a lot of testers.

Signature · 1 line
Kalle Valo