Received: by 10.213.65.68 with SMTP id h4csp37898imn; Mon, 19 Mar 2018 18:46:52 -0700 (PDT) X-Google-Smtp-Source: AG47ELtoKVI4CAv1HmaqQcIeArIQ5k4WuaABoZ7W5sr90XxWwsu2FQeQ8crCmKhQTD9s9lvIZIjY X-Received: by 10.99.154.18 with SMTP id o18mr10887830pge.344.1521510411847; Mon, 19 Mar 2018 18:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510411; cv=none; d=google.com; s=arc-20160816; b=ZLnCMzei622ZFXTdd8wpCJXt1v09u3+jdIRBzQHHk4/o5WXXrpk0uDyZy8IkaBep+q 2yihkMi62rYwbMY0v3bNHzWiGIM8mtWtgXCrM2YE/hKZSsxbcHUtdaOCGO1oPpLnRYPS YzzVIW8SxHYZa58aUe2H/6KQh7aDH+7y0W/IjuX1bmbzCm6zr0jbKPc+mVNztdiIabHV 0WaTPvDyy1nEg/03MVzRrzMpg20eu/p7RalQfI1VufEBV83S4amPD6hLImq0E6hwO481 VGDFSikFftf5Q53lkM+5Rma9mERKbuE5VO6JWLGZMRkVOXechHiuJ10iLrwjM2iAi27b 7u8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=DHh0gyOsvzpGPKWhUjk9ipeDVOpT1bNZRQUDYM+zrzw=; b=yYbl/fxE2y64EpCq6byLUjEzm8Jr3kVivonwHTTIhpskKkgYLd8Z3X2fVQrpEHAIPt 0kzXOlFXF5y+mR+LQcFXBws6kHoAP0wl8/BBiCxagM9B2DLPcoWgGWxCLCh9V0Qg8TP1 eWrzsHGpA/ELyKVbE68viOdWhZW/rCNPvedJtWj8RUWk2A8riu4D6ifXOExGEsJ0hz7o 0TBJdkjUiUN89LLgG4VXiRdljar1wYNzX1OJrbSNMv9rgSrlobK0VD6uQU12881u0/K9 URThPOvHAKcRbHO0ubvU027DiOfcqRgcZQjsephCu8vlxQQ4zwNcAKs/Le8cJIB9OcR+ Vo5g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si390327pgc.553.2018.03.19.18.46.38; Mon, 19 Mar 2018 18:46:51 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970118AbeCSTNM (ORCPT + 99 others); Mon, 19 Mar 2018 15:13:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51082 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031645AbeCSS1D (ORCPT ); Mon, 19 Mar 2018 14:27:03 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D7B791266; Mon, 19 Mar 2018 18:27:02 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adiel Aloni , Luca Coelho , Johannes Berg , Sasha Levin Subject: [PATCH 4.9 203/241] mac80211_hwsim: enforce PS_MANUAL_POLL to be set after PS_ENABLED Date: Mon, 19 Mar 2018 19:07:48 +0100 Message-Id: <20180319180759.586466536@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/mac80211_hwsim.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -728,16 +728,21 @@ static int hwsim_fops_ps_write(void *dat val != PS_MANUAL_POLL) return -EINVAL; - old_ps = data->ps; - data->ps = val; - - local_bh_disable(); if (val == PS_MANUAL_POLL) { + if (data->ps != 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 = true; - } else if (old_ps == PS_DISABLED && val != PS_DISABLED) { + local_bh_enable(); + return 0; + } + old_ps = data->ps; + data->ps = val; + + local_bh_disable(); + if (old_ps == PS_DISABLED && val != PS_DISABLED) { ieee80211_iterate_active_interfaces_atomic( data->hw, IEEE80211_IFACE_ITER_NORMAL, hwsim_send_nullfunc_ps, data);