[PATCH] tests: enable device ps before sending ps_poll

Andrei Otcheretianski andrei.otcheretianski at intel.com
Tue Jan 30 03:10:10 PST 2018

From: Adiel Aloni <adiel.aloni at intel.com>

Commit c9491367b759 ("mac80211: always update the PM state of a peer on
MGMT / DATA frames") enforces the ap to check only mgmt/data frames pm bit,
and to update station's power save accordingly.
When sending only ps-poll (control frame) the ap will ignore the PM bit.
As the result, the partial virtual bitmap will not be updated, and the test
ap_open_disconnect_in_ps will fail on tshark check.
Since the test needs only the TIM to be updated, setting ps enable will
send NDP that will signal that the station is sleeping.
Sending PS-POLL to enable power save is not correct, according to the
following spec statement: "A PS-Poll frame exchange does not necessarily
result in an Ack frame from the AP, so a non-AP STA cannot change power
management mode using a PS-Poll frame"

Signed-off-by: Adiel Aloni <adiel.aloni at intel.com>
 tests/hwsim/test_ap_open.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/hwsim/test_ap_open.py b/tests/hwsim/test_ap_open.py
index b888002..1b62ea6 100644
--- a/tests/hwsim/test_ap_open.py
+++ b/tests/hwsim/test_ap_open.py
@@ -426,7 +426,9 @@ def test_ap_open_disconnect_in_ps(dev, apdev, params):
         raise Exception("No connection event received from hostapd")
-    hwsim_utils.set_powersave(dev[0], hwsim_utils.PS_MANUAL_POLL)
+    #setting power save enabled
+    hwsim_utils.set_powersave(dev[0], hwsim_utils.PS_ENABLED)
+    time.sleep(0.1)
         # inject some traffic
         sa = hapd.own_addr()

More information about the Hostap mailing list