Received: by 10.213.65.68 with SMTP id h4csp498511imn; Fri, 16 Mar 2018 09:34:16 -0700 (PDT) X-Google-Smtp-Source: AG47ELsOObPpSC6NDosWgTMEDmQ0uhPiNNT2TE2CrESm9LXUJjr3+nvMb5CFBTqBH+b/6h8m1ogW X-Received: by 2002:a17:902:7d93:: with SMTP id a19-v6mr2853743plm.160.1521218056749; Fri, 16 Mar 2018 09:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218056; cv=none; d=google.com; s=arc-20160816; b=Jgd0mLzmuzX6Onei/FVVDUE7Adrn40thB0BGypFDs9dJkaBr3Oode2GkbAgzcAOYhJ qTHJq9dJvdb/Juzfrt73yN58SjFJxgdowv7cnLkdDYd3NIzOANrcH67eQxIkkonOfHwv LYmGCzANsi894scNwPeJdE1taOg7iIY1z8TLh5PTmtlq4DNfKjNsjQs00P4a0moG0jHW ls0vghvxAUAup/O8UYfic/TMWYt3jcu1knAnKXRtiFlKhrm4IvLgm41tpNpcjrdZURdY tU8BJ2tgJWv8k9cqnTW01Cyihnv3SQyM583HJPsnjx4uYNy9+ZZx6IhfZL6yWLmVsXuG VR1g== 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=g7rCfQywEByIzB4tgG/CHsFRz4MOYu4bVh6E5mVBkHY=; b=GHSdVqEo/AzR/nJjttKUbNJC57Stpypg29cwqJlsJrrMmp3rR5m/x7Dqk2xRdkPgdY Pri//waxSU/VuM5vFRGzgzyYn89drM8hxbIPGDPiAPjuPZdZSsqmTmC3WvsGRDTxinvs nhyvuNGB0f4LeAmKwrvVfmLnX6aQSwA1IsnDQVmbAmnHOxXuxBcTufPVEkIr0NBLpPGD Os/gNb4aQRf55nVFkMnV+8ZKfp0n52kaEYuj5a27LWamzX2E5guY0RRs5yWKJg6dpRlO dzRdBPPrrKP+pR6NRHJ++sRI2/XhpsF0mMLUU9ZLT1sS24KqyqayFSVAbtls+LRWpNw3 Q24g== 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 f13si5019403pgo.250.2018.03.16.09.34.02; Fri, 16 Mar 2018 09:34:16 -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 S1754532AbeCPPiX (ORCPT + 99 others); Fri, 16 Mar 2018 11:38:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42244 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754501AbeCPPiU (ORCPT ); Fri, 16 Mar 2018 11:38:20 -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 221B8122F; Fri, 16 Mar 2018 15:38:19 +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.14 097/109] mac80211_hwsim: enforce PS_MANUAL_POLL to be set after PS_ENABLED Date: Fri, 16 Mar 2018 16:24:06 +0100 Message-Id: <20180316152335.151840596@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-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 @@ -727,16 +727,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);