Received: by 10.223.185.116 with SMTP id b49csp1076451wrg; Sat, 3 Mar 2018 14:54:34 -0800 (PST) X-Google-Smtp-Source: AG47ELupqmbIv+TzJYqT54hahQMRwg691qHRyNbcsfxbQ1IVLT1A/RwYygyOSBdOY3fDPUjdt5EG X-Received: by 10.98.198.146 with SMTP id x18mr10312872pfk.22.1520117674016; Sat, 03 Mar 2018 14:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520117673; cv=none; d=google.com; s=arc-20160816; b=gUpO+EaDJMD5hjCkyJ9j7xDrOi8Rk0eFP+eqcqmPEIEFAtl89g2gN6fPUMdQMBhTxz 4GXTC1pqOay4TOddSVK9xmeqYAIlzMlRrYbO9egQyGbGiva7LoFC5ec30DDCVCO0OmMB Ul0/G2f0b3aIh6KaUiT3VN9cU6rF2IUtYfJLUbhzq7HViiaYiP2XBk7tugqF1mvFbl/W yHbgkEjRh8LuApUZllF4wBE78B7zzv7o+PqEtt/i2G6zZT4xSS6Y9ecC8V9vaxFcbaCq M+XyYB21Oz8EYriwMbEUC10QIXsjhTRabmhD4oxYTwT9D3eY5ubXc5+XIE+XoAO5iMV8 d9Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=4Cd6ZC7F86f74gd05XdpPlEnVKFyWUpCKRS6bW1aQC8=; b=qG+RH/hnuhlMlAjDLOLXdsLA5preN9b40LJScic74qroXnSXTkM2hYhRvz1mANhU3g f37Cn1vVmoQ4iE/PWPYw4Iu5I2jXvZlAG2q4hOj2fUouu67e9ZdMNTDLX6IVBvprERGj BTf7IfpGtIJwPRwhH1wKadrSFpGagrWQuJ8NgJDFAn0djcp34xk9dt1SW8PK4tTUUlN4 YU5SukWwIPNalLVqGfnnxCsoVbCHEZsKm7HqPkCvFh1haN3kWOTCgi2i7HQ4MJCHCQTA hgHw2h/tEfPynbvpFlW1lVA7rNk7Ji5jQRi8iLEYUoCdYzEXlwwp8+Tq7KO4KVJVdRjc tIZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=UanrChXw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l62si7435252pfl.160.2018.03.03.14.54.19; Sat, 03 Mar 2018 14:54:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=UanrChXw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935427AbeCCWlI (ORCPT + 99 others); Sat, 3 Mar 2018 17:41:08 -0500 Received: from mail-cys01nam02on0110.outbound.protection.outlook.com ([104.47.37.110]:31968 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935328AbeCCWkz (ORCPT ); Sat, 3 Mar 2018 17:40:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4Cd6ZC7F86f74gd05XdpPlEnVKFyWUpCKRS6bW1aQC8=; b=UanrChXw2zEeIqLKq2bjbyZapj/ush5nsqkeominiBOZDahukrJu6C5sNfNA8pbHeM2qwmNjMzLGA1UPe+uJC3nzi0y8M/bf90SaVuEu3HLWHZvwi7UmmJ1gGNOIQJikgaCZyTWTWx08f9nSXEWo6N7b2fDfAhcodpcgmvSXWYA= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MWHSPR01MB344.namprd21.prod.outlook.com (10.174.251.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:40:51 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:40:51 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Adiel Aloni , Luca Coelho , Johannes Berg , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 110/115] mac80211_hwsim: enforce PS_MANUAL_POLL to be set after PS_ENABLED Thread-Topic: [PATCH AUTOSEL for 4.4 110/115] mac80211_hwsim: enforce PS_MANUAL_POLL to be set after PS_ENABLED Thread-Index: AQHTsz9vUbvbEUv1cU+cB1dqb4wo9w== Date: Sat, 3 Mar 2018 22:31:55 +0000 Message-ID: <20180303223010.27106-110-alexander.levin@microsoft.com> References: <20180303223010.27106-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223010.27106-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHSPR01MB344;6:Me43IXlnBvGH3w+hk6XKzdC9ibNewmaXG1BqbRr506OghKCKTHS9TD7KAB+fgb4WVCtTrJV4eDhBmdbGaK2orpZiwzBbD5KjmI9Jwqrc3GIQoRET7tchvPxWrAn+OhssIdwyXGE4Xg1iczmvzPOZZ/6Z/3GvZqfzRGGI8jd/0XDSTEY/8g0DqOoYQC+VqiCpZkw0YJFtwXKl+GppdmXgJKFftSUhT5vP5o09VKrcR4cp1aZZ0kyATvQ/L00BgMkPv4LU9bRhFjcE0y2wbWuymUghNtPp1vYgbdQxUkAItZA4jVfeOaJeYvXD0ZZnw5dO1RujLtNIKbST/BZjtJGtXKwRGWcCwqA8Vwf23d4xRGLhQLQiNjVsLFXz2AlTVGaB;5:1hZXotP+qCLDqabTfd4LSwKQKrNXwx6aEyG3U5mOKKRXX/yIXQwSEmOoaB6XpGXwMU9tIAjZYdPJDFVFz7REMpKtEDCG9+xfIDrfOaPaB8eR3hW60g52TwPKawSrPZQuaRpDF1QqFqb67wYY8bV4IK8/8QrFI82Ng5+BMy3ccBw=;24:LosWjlrdPyv4eSzwxih2lovv7sCYE1LPIsaOAETN3VjRcGN6oVjxLHTlksvsVpVi1fmXlXgh4kFWIFIqhV8en/kpnPkj8EPVjIL2ujw7M5w=;7:wB0gM5fi62bM8swbELVqvzvaEgHQSrMOU3lbF8Lte3XRXnNvP3RgDtPqeRhxE2M4Ttj6uMOn2dZszjRf5pOOoNHiiZDB8u97cWfROLvyvwrh+A1KrZsf3juU26tzzl/W5kwJCNGmtPwAfuga5w3drnjbVk9tICyo9TlNl0wYKbCj5yLt+B3byEHrP76JM3lesL69vMip0qLXo2mzuFAazzV3PLd/VAze6zJLlKH+tQF/8pabRCEQUsXwQNtChkse x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ee78a1be-428a-41ae-2f92-08d58157d144 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MWHSPR01MB344; x-ms-traffictypediagnostic: MWHSPR01MB344: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3231220)(944501244)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:MWHSPR01MB344;BCL:0;PCL:0;RULEID:;SRVR:MWHSPR01MB344; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(346002)(39860400002)(366004)(39380400002)(189003)(199004)(59450400001)(8676002)(5660300001)(5250100002)(2501003)(6506007)(7736002)(36756003)(25786009)(3846002)(6116002)(97736004)(305945005)(2900100001)(76176011)(6436002)(10090500001)(26005)(8936002)(186003)(81166006)(102836004)(81156014)(106356001)(86362001)(10290500003)(3660700001)(2906002)(99286004)(14454004)(86612001)(105586002)(478600001)(4326008)(6486002)(53936002)(107886003)(68736007)(316002)(54906003)(110136005)(6512007)(72206003)(3280700002)(22452003)(2950100002)(1076002)(66066001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHSPR01MB344;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: O3EvylYSQZvou4Fn0+4i8vIs1UY+XcgXEm7lPwWSThYs6fJc5zhWZ0qeCxKqo++vwc0/mLx7NzWcZ4rJk7eyFhw0Z96UQuNIc4MEhm9EQOlN62KsJWc4HSn0gnuKhGh2IQ972fMcYbPlmWaGRBTv3eNP6ox5IXZdjkXhGnGZ8jA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee78a1be-428a-41ae-2f92-08d58157d144 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:31:55.4020 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHSPR01MB344 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adiel Aloni [ Upstream commit e16ea4bb516bc21ea2202f2107718b29218bea59 ] Enforce using PS_MANUAL_POLL in ps hwsim debugfs to trigger a poll, only if PS_ENABLED was set before. This is required due to commit c9491367b759 ("mac80211: always update the PM state of a peer on MGMT / DATA frames") that enforces the ap to check only mgmt/data frames ps bit, and then update station's power save accordingly. When sending only ps-poll (control frame) the ap will not be aware that the station entered power save. Setting ps enable before triggering ps_poll, will send NDP with PM bit enabled first. Signed-off-by: Adiel Aloni Signed-off-by: Luca Coelho Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/mac80211_hwsim.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/m= ac80211_hwsim.c index f877fbc7d7af..8a9164da6c50 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -699,16 +699,21 @@ static int hwsim_fops_ps_write(void *dat, u64 val) val !=3D PS_MANUAL_POLL) return -EINVAL; =20 - old_ps =3D data->ps; - data->ps =3D val; - - local_bh_disable(); if (val =3D=3D PS_MANUAL_POLL) { + if (data->ps !=3D PS_ENABLED) + return -EINVAL; + local_bh_disable(); ieee80211_iterate_active_interfaces_atomic( data->hw, IEEE80211_IFACE_ITER_NORMAL, hwsim_send_ps_poll, data); - data->ps_poll_pending =3D true; - } else if (old_ps =3D=3D PS_DISABLED && val !=3D PS_DISABLED) { + local_bh_enable(); + return 0; + } + old_ps =3D data->ps; + data->ps =3D val; + + local_bh_disable(); + if (old_ps =3D=3D PS_DISABLED && val !=3D PS_DISABLED) { ieee80211_iterate_active_interfaces_atomic( data->hw, IEEE80211_IFACE_ITER_NORMAL, hwsim_send_nullfunc_ps, data); --=20 2.14.1