Received: by 10.213.65.68 with SMTP id h4csp471215imn; Fri, 16 Mar 2018 08:46:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELuJOszxX6CQVpc94/cfZs6MqoFrKBWXtuIIoROvQxTscrVaNVuGE6zHu8Xxq/SEHelgc2/s X-Received: by 2002:a17:902:c24:: with SMTP id 33-v6mr2708704pls.88.1521215168477; Fri, 16 Mar 2018 08:46:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521215168; cv=none; d=google.com; s=arc-20160816; b=HMrgtBhn9RNF0ITUlBCuvwMrIzQqShaFcFzRnLvZ3xV+4DqshIwymZVv9AhmfWKJii 8NoN8nFBIP/6heAtNHy2tNdbRnBmWZkosc4KI/SnSwiksH1LVfElLw3Bw1oHUFAG3s70 Hl/OkBCRVwxpLrMaEoz+kSJed1eW/FeuVshXdi8VpovaTJuwFqUq8tSHtcn3pq7oUEjq T3jZqPXmECk6OwtNpzbX0/Z6QXSyqX2G7JmXrTrO1CMOF/G498dZXhNtQ+XCr1q07xNC jAWeM8J3p8NxUVG+Zny17sLKYk8WKOKpjf/IwhLpdfHJ0se7Zl88QGASHlnzfvv2FPN6 DjCg== 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=++qFeA2L7El+2wOcWzla3jzupk28U+f1UNNU+Xf+a58=; b=SLH1wMKEWesukh8zTNlMdBTGeNnr83hQsUXISN24Qig5boOA47VmKzapbuTPgLo+8C 42wkGdeSQiacmroEIhu8TkIIc1gVJ5X19CwUscJy++9qyUzUMSaL1m/9c0mU4dY+GNUb LBvWTJ2Y5xNSs3NVOf0tcZPRZMgKXWiUKplODEruY9cFN9YtKi8VK0BZudTZ2xqd+bDE qyAaNcqNHO9NybRdEloILTJeTbGRNZH7NJ2+CRMDyW8ZGe8AAiMi0imr+i3qakAckkxK qJkwzVaXVrCdH6Le0WcC1yWnFsv4YRObGRZ/vw//bNHJRsiOIz+RETbEcCWfoRyIy0Sa WVjQ== 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 t11-v6si6330523plr.411.2018.03.16.08.45.54; Fri, 16 Mar 2018 08:46:08 -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 S965533AbeCPPpH (ORCPT + 99 others); Fri, 16 Mar 2018 11:45:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46198 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965496AbeCPPpC (ORCPT ); Fri, 16 Mar 2018 11:45:02 -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 94FAAF1A; Fri, 16 Mar 2018 15:45:01 +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.15 116/128] mac80211_hwsim: enforce PS_MANUAL_POLL to be set after PS_ENABLED Date: Fri, 16 Mar 2018 16:24:17 +0100 Message-Id: <20180316152342.264923312@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@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.15-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 @@ -729,16 +729,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);